summaryrefslogtreecommitdiffstats
path: root/extensions/browser/process_manager.h
diff options
context:
space:
mode:
authorscheib@chromium.org <scheib@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-03 01:25:32 +0000
committerscheib@chromium.org <scheib@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-03 01:25:32 +0000
commit38877015653d92a3937c8516b77c6b88181fc3d9 (patch)
tree805dad84377e8a7c8c3e92ba1573c8ebf1aae175 /extensions/browser/process_manager.h
parenta316ad7a2e6baefb32be587e2cd701930a092dad (diff)
downloadchromium_src-38877015653d92a3937c8516b77c6b88181fc3d9.zip
chromium_src-38877015653d92a3937c8516b77c6b88181fc3d9.tar.gz
chromium_src-38877015653d92a3937c8516b77c6b88181fc3d9.tar.bz2
Add KeepaliveImpulse to extension process manager.
Impulses are an efficient way to handle certain types of activity from extensions. E.g. the work in progress to keep NaCl plugins in background pages alive. An Increment / Decrement approach would require extensive and fragile instrumentation of all APIs. Impulses can be sent upon any api activity and act as an implicit increment with a timed out decrement. See design doc: https://docs.google.com/a/chromium.org/document/d/1mI0lS1rfAf-BAGLmWAEcWy37Xq9dOvgfMx8OqeUMXts/edit# BUG=298339 Review URL: https://codereview.chromium.org/60613004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@238261 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'extensions/browser/process_manager.h')
-rw-r--r--extensions/browser/process_manager.h16
1 files changed, 14 insertions, 2 deletions
diff --git a/extensions/browser/process_manager.h b/extensions/browser/process_manager.h
index 669ebe7..379c364 100644
--- a/extensions/browser/process_manager.h
+++ b/extensions/browser/process_manager.h
@@ -86,12 +86,17 @@ class ProcessManager : public content::NotificationObserver {
// When this reaches 0, we will begin the process of shutting down the page.
// "Things" include pending events, resource loads, and API calls.
int GetLazyKeepaliveCount(const Extension* extension);
- int IncrementLazyKeepaliveCount(const Extension* extension);
- int DecrementLazyKeepaliveCount(const Extension* extension);
+ void IncrementLazyKeepaliveCount(const Extension* extension);
+ void DecrementLazyKeepaliveCount(const Extension* extension);
void IncrementLazyKeepaliveCountForView(
content::RenderViewHost* render_view_host);
+ // Keeps a background page alive. Unlike IncrementLazyKeepaliveCount, these
+ // impulses will only keep the page alive for a limited amount of time unless
+ // called regularly.
+ void KeepaliveImpulse(const Extension* extension);
+
// Handles a response to the ShouldSuspend message, used for lazy background
// pages.
void OnShouldSuspendAck(const std::string& extension_id, int sequence_id);
@@ -164,6 +169,13 @@ class ProcessManager : public content::NotificationObserver {
// Close the given |host| iff it's a background page.
void CloseBackgroundHost(ExtensionHost* host);
+ // Internal implementation of DecrementLazyKeepaliveCount with an
+ // |extension_id| known to have a lazy background page.
+ void DecrementLazyKeepaliveCount(const std::string& extension_id);
+
+ // Checks if keepalive impulses have occured, and adjusts keep alive count.
+ void OnKeepaliveImpulseCheck();
+
// These are called when the extension transitions between idle and active.
// They control the process of closing the background page when idle.
void OnLazyBackgroundPageIdle(const std::string& extension_id,