Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1024)

Unified Diff: content/browser/renderer_host/render_widget_host_view_mac.h

Issue 16845005: Don't use a sleep in the browser's main thread to throttle swapbuffers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Resolve against head Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/render_widget_host_view_mac.h
diff --git a/content/browser/renderer_host/render_widget_host_view_mac.h b/content/browser/renderer_host/render_widget_host_view_mac.h
index 7c6b94cbde134fbfac632182eb4c0cfa0ba9dc2b..2ba436a90c53d264cce73fbc6eb40f5b02aea5e1 100644
--- a/content/browser/renderer_host/render_widget_host_view_mac.h
+++ b/content/browser/renderer_host/render_widget_host_view_mac.h
@@ -338,6 +338,10 @@ class RenderWidgetHostViewMac : public RenderWidgetHostViewBase,
// no effect if there are no pending requests.
void AckPendingSwapBuffers();
+ // Ack pending SwapBuffers requests, but no more frequently than the vsync
+ // rate if the renderer is not throttling the swap rate.
+ void ThrottledAckPendingSwapBuffers();
+
// Returns true and stores first rectangle for character range if the
// requested |range| is already cached, otherwise returns false.
// Exposed for testing.
@@ -436,6 +440,9 @@ class RenderWidgetHostViewMac : public RenderWidgetHostViewBase,
friend class RenderWidgetHostView;
friend class RenderWidgetHostViewMacTest;
+ void GetVSyncParameters(
+ base::TimeTicks* timebase, base::TimeDelta* interval);
+
// The view will associate itself with the given widget. The native view must
// be hooked up immediately to the view hierarchy, or else when it is
// deleted it will delete this out from under the caller.
@@ -507,6 +514,15 @@ class RenderWidgetHostViewMac : public RenderWidgetHostViewBase,
// pairs of (route_id, gpu_host_id).
std::list<std::pair<int32, int32> > pending_swap_buffers_acks_;
+ // Factory used to cancel outstanding throttled AckPendingSwapBuffers calls.
+ base::WeakPtrFactory<RenderWidgetHostViewMac>
+ pending_swap_buffers_acks_weak_factory_;
+
+ // The earliest time at which the next swap ack may be sent. Only relevant
+ // when swaps are not being throttled by the renderer (when threaded
+ // compositing is off).
+ base::Time next_swap_ack_time_;
+
// The current composition character range and its bounds.
ui::Range composition_range_;
std::vector<gfx::Rect> composition_bounds_;
« no previous file with comments | « content/browser/renderer_host/render_widget_host_impl.h ('k') | content/browser/renderer_host/render_widget_host_view_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698