Chromium Code Reviews| Index: content/browser/browser_plugin/browser_plugin_guest.h |
| diff --git a/content/browser/browser_plugin/browser_plugin_guest.h b/content/browser/browser_plugin/browser_plugin_guest.h |
| index 35dee2533cda515ebfed3c09df7be56a71d580b2..6d5b0e530c8d6f90814a1475fdc60a8495d82015 100644 |
| --- a/content/browser/browser_plugin/browser_plugin_guest.h |
| +++ b/content/browser/browser_plugin/browser_plugin_guest.h |
| @@ -81,6 +81,8 @@ class CONTENT_EXPORT BrowserPluginGuest : public WebContentsDelegate, |
| embedder_render_process_host_ = render_process_host; |
| } |
| + bool visible() const { return visible_; } |
| + |
| // WebContentsObserver implementation. |
| virtual void DidStartProvisionalLoadForFrame( |
| int64 frame_id, |
| @@ -133,6 +135,23 @@ class CONTENT_EXPORT BrowserPluginGuest : public WebContentsDelegate, |
| // accepting touch events. |
| void SetIsAcceptingTouchEvents(bool accept); |
| + // The guest WebContents' is visible if both its embedder is visible and |
| + // the browser plugin element is visible. If either one is not then the |
| + // WebContents is marked as hidden. A hidden WebContents will consume |
| + // fewer GPU and CPU resources. |
| + // |
| + // When the guest WebContents is hidden, it will lower the priority of the |
| + // process (see RenderProcessHostImpl::WidgetHidden). |
|
Charlie Reis
2012/10/05 16:23:58
Technically, when every WebContents in a RenderPro
Fady Samuel
2012/10/08 14:24:56
Done.
|
| + // |
| + // It will also send a message to the guest renderer process to cleanup |
|
Charlie Reis
2012/10/05 16:23:58
nit: extra space
Fady Samuel
2012/10/08 14:24:56
Done.
|
| + // resources such as dropping back buffers and adjusting memory limits (if in |
| + // compositing mode, see CCLayerTreeHost::setVisible). |
| + // |
| + // Additionally it will slow down Javascript execution and garbage collection. |
| + // See RenderThreadImpl::IdleHandler (executed when hidden) and |
| + // RenderThreadImpl::IdleHandlerInForegroundTab (executed when visible). |
| + void SetVisibility(bool embedder_visible, bool visible); |
| + |
| // Exposes the protected web_contents() from WebContentsObserver. |
| WebContents* GetWebContents(); |
| @@ -200,6 +219,7 @@ class CONTENT_EXPORT BrowserPluginGuest : public WebContentsDelegate, |
| IDMap<RenderViewHost> pending_updates_; |
| int pending_update_counter_; |
| base::TimeDelta guest_hang_timeout_; |
| + bool visible_; |
| DISALLOW_COPY_AND_ASSIGN(BrowserPluginGuest); |
| }; |