New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes buffer size in offscreen mode #6713
Conversation
@@ -379,6 +379,13 @@ OffScreenRenderWidgetHostView::~OffScreenRenderWidgetHostView() { | |||
#if defined(OS_MACOSX) | |||
DestroyPlatformWidget(); | |||
#endif | |||
|
|||
if (copy_frame_generator_.get()) | |||
copy_frame_generator_.reset(NULL); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use nullptr instead
@@ -1345,11 +1345,19 @@ bool WebContents::IsOffScreen() const { | |||
|
|||
void WebContents::OnPaint(const gfx::Rect& dirty_rect, | |||
const gfx::Size& bitmap_size, | |||
const int pixel_size, | |||
void* bitmap_pixels) { | |||
v8::MaybeLocal<v8::Object> buffer = node::Buffer::New( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Calling node::Buffer::New
means the data is transferred to Node to manage, so once the returned data
is garbage collected the bitmap_pixels
would be deleted, while it is still being managed by someone class. I think we should do node::Buffer::Copy
here.
fixed buffer size calculation (we actually send the whole image, not just the dirty part) removed the unnecessary resets and const now we use Copy instead of New
7c55be7
to
1b0af6f
Compare
Thanks! |
This PR fixes the buffer size issue in the
'paint'
event in offscreen mode. #6704Also resets some properties in
OffScreenRenderWidgetHostView
's destructor.