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

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: Fixed nits 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 985064c1dec1f995c9946b02357386b31f5beb0a..3c8254fa1d3e396818ff939dda40ed133e27d069 100644
--- a/content/browser/browser_plugin/browser_plugin_guest.h
+++ b/content/browser/browser_plugin/browser_plugin_guest.h
@@ -84,6 +84,8 @@ class CONTENT_EXPORT BrowserPluginGuest : public NotificationObserver,
embedder_render_process_host_ = render_process_host;
}
+ bool visible() const { return visible_; }
+
// NotificationObserver implementation.
virtual void Observe(int type,
const NotificationSource& source,
@@ -141,6 +143,23 @@ class CONTENT_EXPORT BrowserPluginGuest : public NotificationObserver,
// 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 every WebContents in a RenderProcessHost is hidden, it will lower
+ // the priority of the process (see RenderProcessHostImpl::WidgetHidden).
+ //
+ // It will also send a message to the guest renderer process to cleanup
+ // 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();
@@ -214,6 +233,7 @@ class CONTENT_EXPORT BrowserPluginGuest : public NotificationObserver,
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