Chromium Code Reviews| 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. |