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

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

Issue 316103004: Mac ÜC: Enable GPU back-pressure from the browser to the renderer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@dip
Patch Set: Simplify Created 6 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 5380fa73d24e74e1e84aef066d42a5f8a0905c10..181784138bb9a7defcdf01ac1dfa009623742ccc 100644
--- a/content/browser/renderer_host/render_widget_host_view_mac.h
+++ b/content/browser/renderer_host/render_widget_host_view_mac.h
@@ -16,6 +16,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/time/time.h"
+#include "content/browser/compositor/browser_compositor_view_mac.h"
#include "content/browser/compositor/delegated_frame_host.h"
#include "content/browser/renderer_host/compositing_iosurface_layer_mac.h"
#include "content/browser/renderer_host/display_link_mac.h"
@@ -213,6 +214,7 @@ class CONTENT_EXPORT RenderWidgetHostViewMac
public DelegatedFrameHostClient,
public IPC::Sender,
public SoftwareFrameManagerClient,
+ public BrowserCompositorViewMacClient,
public CompositingIOSurfaceLayerClient {
public:
// The view will associate itself with the given widget. The native view must
@@ -343,6 +345,9 @@ class CONTENT_EXPORT RenderWidgetHostViewMac
virtual SkBitmap::Config PreferredReadbackFormat() OVERRIDE;
+ // BrowserCompositorViewMacHelper implementation.
+ virtual void BrowserCompositorDidDrawFrame() OVERRIDE;
+
// CompositingIOSurfaceLayerClient implementation.
virtual void AcceleratedLayerDidDrawFrame(bool succeeded) OVERRIDE;
@@ -448,6 +453,12 @@ class CONTENT_EXPORT RenderWidgetHostViewMac
scoped_ptr<DelegatedFrameHost> delegated_frame_host_;
scoped_ptr<ui::Layer> root_layer_;
+ // This lock is taken when the browser compositor produces a frame, and is
+ // released when that frame is displayed. It is by this mechanism that the
+ // browser compositor can exert GPU backpressure on the renderer compositor.
+ scoped_refptr<ui::CompositorLock> browser_compositor_lock_;
+ bool browser_compositor_damaged_during_lock_;
+
// This holds the current software compositing framebuffer, if any.
scoped_ptr<SoftwareFrameManager> software_frame_manager_;
@@ -518,6 +529,8 @@ class CONTENT_EXPORT RenderWidgetHostViewMac
virtual RenderWidgetHostImpl* GetHost() OVERRIDE;
virtual void SchedulePaintInRect(
const gfx::Rect& damage_rect_in_dip) OVERRIDE;
+ virtual void DelegatedCompositorDidSwapBuffers() OVERRIDE;
+ virtual void DelegatedCompositorAbortedSwapBuffers() OVERRIDE;
virtual bool IsVisible() OVERRIDE;
virtual scoped_ptr<ResizeLock> CreateResizeLock(
bool defer_compositor_lock) OVERRIDE;
@@ -590,6 +603,12 @@ class CONTENT_EXPORT RenderWidgetHostViewMac
// Send updated vsync parameters to the renderer.
void SendVSyncParametersToRenderer();
+ // Release the browser compositor lock, and request another frame from the
+ // browser compositor. Because this can be requested from inside compositor
+ // calbacks, post it as task instead of calling it directly.
+ void PostReleaseBrowserCompositorLock();
+ void ReleaseBrowserCompositorLock();
+
// The associated view. This is weak and is inserted into the view hierarchy
// to own this RenderWidgetHostViewMac object. Set to nil at the start of the
// destructor.

Powered by Google App Engine
This is Rietveld 408576698