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

Unified Diff: chrome/browser/extensions/extension_process_manager.h

Issue 9562017: Keep lazy background page alive while there are pending network requests or (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 10 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: chrome/browser/extensions/extension_process_manager.h
diff --git a/chrome/browser/extensions/extension_process_manager.h b/chrome/browser/extensions/extension_process_manager.h
index bbf2109ffaed6da77921a839e61c5abdbfef7788..70a2e28a3b40cb6d7d0d4bc99eb1e2dbbc2034cd 100644
--- a/chrome/browser/extensions/extension_process_manager.h
+++ b/chrome/browser/extensions/extension_process_manager.h
@@ -97,15 +97,15 @@ class ExtensionProcessManager : public content::NotificationObserver {
int IncrementLazyKeepaliveCount(const Extension* extension);
int DecrementLazyKeepaliveCount(const Extension* extension);
- // 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);
- void OnLazyBackgroundPageActive(const std::string& extension_id);
-
- // Handle a response to the ShouldClose message, used for lazy background
+ // Handles a response to the ShouldClose message, used for lazy background
// pages.
void OnShouldCloseAck(const std::string& extension_id, int sequence_id);
+ // Tracks network requests for a given RenderViewHost, used to know
+ // when network activity is idle for lazy background pages.
+ void OnNetworkRequestStarted(RenderViewHost* render_view_host);
+ void OnNetworkRequestDone(RenderViewHost* render_view_host);
+
typedef std::set<ExtensionHost*> ExtensionHostSet;
typedef ExtensionHostSet::const_iterator const_iterator;
const_iterator begin() const { return all_hosts_.begin(); }
@@ -144,14 +144,23 @@ class ExtensionProcessManager : public content::NotificationObserver {
private:
// Contains all extension-related RenderViewHost instances for all extensions.
- typedef std::set<RenderViewHost*> RenderViewHostSet;
- RenderViewHostSet all_extension_views_;
+ // We also keep a cache of the host's view type, because that information
+ // is not accessible at registration/deregistration time.
+ typedef std::map<RenderViewHost*, content::ViewType> ExtensionRenderViews;
Yoyo Zhou 2012/03/02 03:10:46 I think this typename should have "Map".
Matt Perry 2012/03/02 20:25:21 I disagree. I don't like putting container types i
Yoyo Zhou 2012/03/02 20:31:58 I don't think that's a significant cost. As someon
+ ExtensionRenderViews all_extension_views_;
// Close the given |host| iff it's a background page.
void CloseBackgroundHost(ExtensionHost* host);
- // Excludes background page.
- bool HasVisibleViews(const std::string& extension_id);
+ // 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);
+ void OnLazyBackgroundPageActive(const std::string& extension_id);
+
+ // Updates a potentially-registered RenderViewHost once it has been
+ // associated with a WebContents. This allows us to gather information that
+ // was not available when the host was first registered.
+ void UpdateRegisteredRenderView(RenderViewHost* render_view_host);
DISALLOW_COPY_AND_ASSIGN(ExtensionProcessManager);
};

Powered by Google App Engine
This is Rietveld 408576698