summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/extension_process_manager.h
diff options
context:
space:
mode:
authormpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-06 01:30:18 +0000
committermpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-06 01:30:18 +0000
commit6baff0b5ce43b24522f0af48e664d925088c7f3d (patch)
treecbc2fb3e5c15f211cb6c9f87d716bf7e6f0f283f /chrome/browser/extensions/extension_process_manager.h
parentb030a477851cdd4207d791b7b4083c57893b1a46 (diff)
downloadchromium_src-6baff0b5ce43b24522f0af48e664d925088c7f3d.zip
chromium_src-6baff0b5ce43b24522f0af48e664d925088c7f3d.tar.gz
chromium_src-6baff0b5ce43b24522f0af48e664d925088c7f3d.tar.bz2
Keep lazy background page alive while there are pending network requests or
visible extension views. BUG=81752 TEST=no Review URL: https://chromiumcodereview.appspot.com/9562017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@125061 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/extension_process_manager.h')
-rw-r--r--chrome/browser/extensions/extension_process_manager.h29
1 files changed, 19 insertions, 10 deletions
diff --git a/chrome/browser/extensions/extension_process_manager.h b/chrome/browser/extensions/extension_process_manager.h
index bbf2109..70a2e28 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;
+ 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);
};