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

Unified Diff: extensions/browser/process_manager.h

Issue 60613004: Add KeepaliveImpulse to extension process manager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: tapted comments addressed Created 7 years 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: extensions/browser/process_manager.h
diff --git a/extensions/browser/process_manager.h b/extensions/browser/process_manager.h
index 669ebe78557e4bfb6d71e252a367e54179ad2977..379c3648d527cd2e14e199abe4c12de960dea0ff 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,

Powered by Google App Engine
This is Rietveld 408576698