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

Unified Diff: content/browser/browser_plugin/browser_plugin_guest.h

Issue 11066032: Browser Plugin: Update Guest WebContents Visibility on BrowserPlugin Visiblity Change. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed creis@'s comments Created 8 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/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);
};

Powered by Google App Engine
This is Rietveld 408576698