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

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

Issue 684343002: Mac: Use Mavericks occlusion APIs for power savings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Retry upload Created 6 years, 2 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 33663b1ea106feda3094bed877d8a43079fa9dad..d3e68a068ad0fd478e272fbaf9b2158411b1a8ff 100644
--- a/content/browser/renderer_host/render_widget_host_view_mac.h
+++ b/content/browser/renderer_host/render_widget_host_view_mac.h
@@ -377,11 +377,42 @@ class CONTENT_EXPORT RenderWidgetHostViewMac
// The background CoreAnimation layer which is hosted by |cocoa_view_|.
base::scoped_nsobject<CALayer> background_layer_;
+ // The state of |delegated_frame_host_| and |browser_compositor_view_| to
+ // manage being visible, hidden, or occluded.
+ enum BrowserCompositorViewState {
+ // Effects:
+ // - |browser_compositor_view_| exists and |delegated_frame_host_| is
+ // visible.
+ // Happens when:
+ // - |render_widet_host_| is in the visible state (this includes when
+ // the tab isn't visible, but tab capture is enabled).
+ BrowserCompositorActive,
+ // Effects:
+ // - |browser_compositor_view_| exists, but |delegated_frame_host_| has
+ // been hidden.
+ // Happens when:
+ // - The |render_widget_host_| is hidden, but |cocoa_view_| is still in the
+ // NSWindow hierarchy.
+ // - This happens when |cocoa_view_| is occluded by another window. The
Andre 2014/10/30 03:19:26 Occlusion also happens when the window is minimize
ccameron 2014/10/30 19:23:33 Done.
+ // |browser_compositor_view_| and its CALayers are kept around so that we
+ // will have content to show when we are un-occluded.
+ BrowserCompositorSuspended,
+ // Effects:
+ // - |browser_compositor_view_| has been destroyed and
+ // |delegated_frame_host_| has been hidden. This is for situations where
miu 2014/10/30 18:33:44 s/This is for situations where//
ccameron 2014/10/30 19:23:33 Done.
+ // Happens when:
+ // - The |render_widget_host_| is hidden or dead, and |cocoa_view_| is not
+ // attached to a NSWindow.
+ // - This happens for backgrounded tabs.
+ BrowserCompositorDestroyed,
+ };
Avi (use Gerrit) 2014/10/30 19:32:52 I love these comments.
+ BrowserCompositorViewState browser_compositor_state_;
+
// Delegated frame management and compositior.
scoped_ptr<DelegatedFrameHost> delegated_frame_host_;
scoped_ptr<ui::Layer> root_layer_;
- // Container for the NSView drawn by the browser compositor.
+ // Container for the CALayer tree drawn by the browser compositor.
scoped_ptr<BrowserCompositorViewMac> browser_compositor_view_;
// Placeholder that is allocated while browser_compositor_view_ is NULL,
@@ -429,6 +460,10 @@ class CONTENT_EXPORT RenderWidgetHostViewMac
void BrowserCompositorViewFrameSwapped(
const std::vector<ui::LatencyInfo>& latency_info) override;
+ // Transition from being in the Suspended state to being in the Destroyed
+ // state, if appropriate (see BrowserCompositorViewState for details).
+ void DestroySuspendedBrowserCompositorViewIfNeeded();
+
private:
friend class RenderWidgetHostViewMacTest;
@@ -443,7 +478,10 @@ class CONTENT_EXPORT RenderWidgetHostViewMac
// ensure no dangling references.
void ShutdownBrowserCompositor();
+ // The state of the the browser compositor and delegated frame host. See
+ // BrowserCompositorViewState for details.
void EnsureBrowserCompositorView();
+ void SuspendBrowserCompositorView();
void DestroyBrowserCompositorView();
// IPC message handlers.

Powered by Google App Engine
This is Rietveld 408576698