From 708cde92cf8dd2904809236ab37e73e3da71f56c Mon Sep 17 00:00:00 2001 From: Heilig Benedek Date: Thu, 25 Jan 2018 14:42:11 +0100 Subject: [PATCH] Don't generate a paint when StartPainting is called inside paint cb --- atom/browser/osr/osr_render_widget_host_view.cc | 5 ++++- atom/browser/osr/osr_render_widget_host_view.h | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/atom/browser/osr/osr_render_widget_host_view.cc b/atom/browser/osr/osr_render_widget_host_view.cc index 8fd17f343556..842cfba09996 100644 --- a/atom/browser/osr/osr_render_widget_host_view.cc +++ b/atom/browser/osr/osr_render_widget_host_view.cc @@ -279,6 +279,7 @@ OffScreenRenderWidgetHostView::OffScreenRenderWidgetHostView( popup_position_(gfx::Rect()), hold_resize_(false), pending_resize_(false), + paint_callback_running_(false), renderer_compositor_frame_sink_(nullptr), background_color_(SkColor()), weak_ptr_factory_(this) { @@ -999,7 +1000,9 @@ void OffScreenRenderWidgetHostView::OnPaint( } damage.Intersect(GetViewBounds()); + paint_callback_running_ = true; callback_.Run(damage, bitmap); + paint_callback_running_ = false; for (size_t i = 0; i < damages.size(); i++) { CopyBitmapTo(bitmap, originals[i], damages[i]); @@ -1147,7 +1150,7 @@ void OffScreenRenderWidgetHostView::SetPainting(bool painting) { painting_ = painting; if (software_output_device_) { - software_output_device_->SetActive(painting_, true); + software_output_device_->SetActive(painting_, !paint_callback_running_); } } diff --git a/atom/browser/osr/osr_render_widget_host_view.h b/atom/browser/osr/osr_render_widget_host_view.h index ed4b160440e6..42d4e7341fef 100644 --- a/atom/browser/osr/osr_render_widget_host_view.h +++ b/atom/browser/osr/osr_render_widget_host_view.h @@ -315,6 +315,8 @@ class OffScreenRenderWidgetHostView bool hold_resize_; bool pending_resize_; + bool paint_callback_running_; + std::unique_ptr root_layer_; std::unique_ptr compositor_; std::unique_ptr delegated_frame_host_;