Don't generate a paint when StartPainting is called inside paint cb

This commit is contained in:
Heilig Benedek 2018-01-25 14:42:11 +01:00
parent 17d85318c3
commit 708cde92cf
2 changed files with 6 additions and 1 deletions

View file

@ -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_);
}
}

View file

@ -315,6 +315,8 @@ class OffScreenRenderWidgetHostView
bool hold_resize_;
bool pending_resize_;
bool paint_callback_running_;
std::unique_ptr<ui::Layer> root_layer_;
std::unique_ptr<ui::Compositor> compositor_;
std::unique_ptr<content::DelegatedFrameHost> delegated_frame_host_;