summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authorccameron@chromium.org <ccameron@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-27 06:17:59 +0000
committerccameron@chromium.org <ccameron@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-27 06:17:59 +0000
commit529e057259e452cdc9df22a55ed2b3b621d2ec60 (patch)
tree7c705b11dd151df63174c72225bb6686d7d92588 /content
parent86fae911599420ce2dcea87fed0e3b373c684408 (diff)
downloadchromium_src-529e057259e452cdc9df22a55ed2b3b621d2ec60.zip
chromium_src-529e057259e452cdc9df22a55ed2b3b621d2ec60.tar.gz
chromium_src-529e057259e452cdc9df22a55ed2b3b621d2ec60.tar.bz2
Fix software compositor responsiveness
Force new frames to be drawn before acknowledging them. This ensures that the renderer will not produce another frame before the old frame has finished drawing. For fast animations on high resolution displays, the new frame can immediately demand to be drawn right after the old frame, giving no time to process input events. This was done by the (now defunct) legacy software path in DidUpdateBackingStore. This updates software compositor to do the same. BUG=347274 Review URL: https://codereview.chromium.org/182203002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@253738 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/browser/renderer_host/render_widget_host_view_mac.mm21
1 files changed, 17 insertions, 4 deletions
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 0107a67..66e4c3c 100644
--- a/content/browser/renderer_host/render_widget_host_view_mac.mm
+++ b/content/browser/renderer_host/render_widget_host_view_mac.mm
@@ -1804,18 +1804,31 @@ void RenderWidgetHostViewMac::OnSwapCompositorFrame(
return;
}
+ // Add latency info to report when the frame finishes drawing.
+ AddPendingLatencyInfo(frame->metadata.latency_info);
+ GotSoftwareFrame();
+
+ // Draw the contents of the frame immediately. It is critical that this
+ // happen before the frame be acked, otherwise the new frame will likely be
+ // ready before the drawing is complete, thrashing the browser main thread.
+ if (use_core_animation_) {
+ [software_layer_ setNeedsDisplay];
+ if (!about_to_validate_and_paint_)
+ [software_layer_ displayIfNeeded];
+ } else {
+ [cocoa_view_ setNeedsDisplay:YES];
+ if (!about_to_validate_and_paint_)
+ [cocoa_view_ displayIfNeeded];
+ }
+
cc::CompositorFrameAck ack;
RenderWidgetHostImpl::SendSwapCompositorFrameAck(
render_widget_host_->GetRoutingID(),
software_frame_manager_->GetCurrentFrameOutputSurfaceId(),
render_widget_host_->GetProcess()->GetID(),
ack);
- AddPendingLatencyInfo(frame->metadata.latency_info);
software_frame_manager_->SwapToNewFrameComplete(
!render_widget_host_->is_hidden());
-
- GotSoftwareFrame();
- [cocoa_view_ setNeedsDisplay:YES];
}
void RenderWidgetHostViewMac::OnAcceleratedCompositingStateChange() {