summaryrefslogtreecommitdiffstats
path: root/content/browser/browser_plugin/browser_plugin_guest.h
diff options
context:
space:
mode:
authorfsamuel@chromium.org <fsamuel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-08 16:25:08 +0000
committerfsamuel@chromium.org <fsamuel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-08 16:25:08 +0000
commit6a13c9f88bb4b5e8150a040a58fd891b732a7a84 (patch)
tree46e1aa08405df43b46e3ebb076b96a5f4e90f04f /content/browser/browser_plugin/browser_plugin_guest.h
parent4cc66139f28f574f81df4b2d191c8fe752b7f105 (diff)
downloadchromium_src-6a13c9f88bb4b5e8150a040a58fd891b732a7a84.zip
chromium_src-6a13c9f88bb4b5e8150a040a58fd891b732a7a84.tar.gz
chromium_src-6a13c9f88bb4b5e8150a040a58fd891b732a7a84.tar.bz2
Browser Plugin: Update Guest WebContents Visibility on BrowserPlugin Visiblity Change.
BUG=140310 Test=BrowserPluginHostTest.{EmbedderVisiblityChanged, BrowserPluginVisibilityChanged} Review URL: https://chromiumcodereview.appspot.com/11066032 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@160660 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/browser_plugin/browser_plugin_guest.h')
-rw-r--r--content/browser/browser_plugin/browser_plugin_guest.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/content/browser/browser_plugin/browser_plugin_guest.h b/content/browser/browser_plugin/browser_plugin_guest.h
index 985064c1..3c8254f 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);
};