diff options
author | ccameron@chromium.org <ccameron@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-21 19:02:06 +0000 |
---|---|---|
committer | ccameron@chromium.org <ccameron@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-21 19:02:06 +0000 |
commit | 27db31bd98b971da50f2c8145972a8d97b5f8082 (patch) | |
tree | 709c6fce500ab6cc90255e044e50b78f28244a03 | |
parent | c0d17b97c623d0108d09d60171e8204e714f3c22 (diff) | |
download | chromium_src-27db31bd98b971da50f2c8145972a8d97b5f8082.zip chromium_src-27db31bd98b971da50f2c8145972a8d97b5f8082.tar.gz chromium_src-27db31bd98b971da50f2c8145972a8d97b5f8082.tar.bz2 |
Merge 262431 "[Mac] Don't pause for pending resize in overlay vi..."
> [Mac] Don't pause for pending resize in overlay views.
>
> BUG=352020
>
> Review URL: https://codereview.chromium.org/223913002
TBR=dgozman@chromium.org
Review URL: https://codereview.chromium.org/245503004
git-svn-id: svn://svn.chromium.org/chrome/branches/1916/src@265036 0039d316-1c4b-4281-b951-d872f2087c98
3 files changed, 30 insertions, 11 deletions
diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc index a882acc..e2fd3f9 100644 --- a/content/browser/renderer_host/render_widget_host_impl.cc +++ b/content/browser/renderer_host/render_widget_host_impl.cc @@ -792,16 +792,23 @@ void RenderWidgetHostImpl::PauseForPendingResizeOrRepaints() { TRACE_EVENT0("browser", "RenderWidgetHostImpl::PauseForPendingResizeOrRepaints"); + if (!CanPauseForPendingResizeOrRepaints()) + return; + + // Waiting for a backing store will do the wait for us. + ignore_result(GetBackingStore(true)); +} + +bool RenderWidgetHostImpl::CanPauseForPendingResizeOrRepaints() { // Do not pause if the view is hidden. if (is_hidden()) - return; + return false; // Do not pause if there is not a paint or resize already coming. if (!repaint_ack_pending_ && !resize_ack_pending_ && !view_being_painted_) - return; + return false; - // Waiting for a backing store will do the wait for us. - ignore_result(GetBackingStore(true)); + return true; } bool RenderWidgetHostImpl::TryGetBackingStore(const gfx::Size& desired_size, diff --git a/content/browser/renderer_host/render_widget_host_impl.h b/content/browser/renderer_host/render_widget_host_impl.h index a20a5ff..6b79e24 100644 --- a/content/browser/renderer_host/render_widget_host_impl.h +++ b/content/browser/renderer_host/render_widget_host_impl.h @@ -249,6 +249,9 @@ class CONTENT_EXPORT RenderWidgetHostImpl : virtual public RenderWidgetHost, // size, then also pump through a new resize message if there is time. void PauseForPendingResizeOrRepaints(); + // Whether pausing may be useful. + bool CanPauseForPendingResizeOrRepaints(); + // Check for the existance of a BackingStore of the given |desired_size| and // return it if it exists. If the BackingStore is GPU, true is returned and // |*backing_store| is set to NULL. diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm index 256f231..d5c7c28 100644 --- a/content/browser/renderer_host/render_widget_host_view_mac.mm +++ b/content/browser/renderer_host/render_widget_host_view_mac.mm @@ -1590,15 +1590,15 @@ void RenderWidgetHostViewMac::DestroyCompositingStateOnError() { void RenderWidgetHostViewMac::SetOverlayView( RenderWidgetHostViewMac* overlay, const gfx::Point& offset) { - if (use_core_animation_) - return; - if (overlay_view_) overlay_view_->underlay_view_.reset(); overlay_view_ = overlay->overlay_view_weak_factory_.GetWeakPtr(); - overlay_view_offset_ = offset; overlay_view_->underlay_view_ = overlay_view_weak_factory_.GetWeakPtr(); + if (use_core_animation_) + return; + + overlay_view_offset_ = offset; overlay_view_->underlay_view_has_drawn_ = false; [cocoa_view_ setNeedsDisplay:YES]; @@ -1606,13 +1606,13 @@ void RenderWidgetHostViewMac::SetOverlayView( } void RenderWidgetHostViewMac::RemoveOverlayView() { - if (use_core_animation_) - return; - if (overlay_view_) { overlay_view_->underlay_view_.reset(); overlay_view_.reset(); } + if (use_core_animation_) + return; + [cocoa_view_ setNeedsDisplay:YES]; [[cocoa_view_ window] disableScreenUpdatesUntilFlush]; } @@ -2221,6 +2221,15 @@ void RenderWidgetHostViewMac::PauseForPendingResizeOrRepaintsAndDraw() { if (!render_widget_host_ || render_widget_host_->is_hidden()) return; + // Pausing for the overlay view prevents the underlay from receiving + // frames. This may lead to large delays, causing overlaps. If both + // overlay and underlay resize at the same time, let them both to have + // some time waiting. See crbug.com/352020. + if (underlay_view_ && + !underlay_view_->render_widget_host_-> + CanPauseForPendingResizeOrRepaints()) + return; + // Ensure that all frames are acked before waiting for a frame to come in. // Note that we will draw a frame at the end of this function, so it is safe // to ack a never-drawn frame here. |