Skip to content
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

Merged
merged 4 commits into from Aug 4, 2016

Conversation

gerhardberger
Copy link
Contributor

This PR fixes the buffer size issue in the 'paint' event in offscreen mode. #6704

Also resets some properties in OffScreenRenderWidgetHostView's destructor.

@@ -379,6 +379,13 @@ OffScreenRenderWidgetHostView::~OffScreenRenderWidgetHostView() {
#if defined(OS_MACOSX)
DestroyPlatformWidget();
#endif

if (copy_frame_generator_.get())
copy_frame_generator_.reset(NULL);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use nullptr instead

@gerhardberger gerhardberger mentioned this pull request Aug 3, 2016
5 tasks
@@ -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(
Copy link
Member

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
@zcbenz
Copy link
Member

zcbenz commented Aug 4, 2016

Thanks!

@zcbenz zcbenz merged commit 32d9382 into electron:master Aug 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants