diff options
author | hashimoto <hashimoto@chromium.org> | 2014-11-03 23:35:18 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-11-04 07:35:41 +0000 |
commit | 5bca2278b8ecb8ae3b933807d3cb9a207616127c (patch) | |
tree | d7c1e73a0978aff828eb1f381538566b979da885 /extensions/browser/process_manager.h | |
parent | f8c206026c760982bfda3ccbe000f0d1bde124ce (diff) | |
download | chromium_src-5bca2278b8ecb8ae3b933807d3cb9a207616127c.zip chromium_src-5bca2278b8ecb8ae3b933807d3cb9a207616127c.tar.gz chromium_src-5bca2278b8ecb8ae3b933807d3cb9a207616127c.tar.bz2 |
Add a way to kill apps without killing windows
This change allows apps to remember the app state when handling onSuspend event.
Add a new method ProcessManager::ReleaseLazyKeepaliveCountForView to decrement the lazy keepalive count without killing AppWindow.
Rename ProcessManager::IncrementLazyKeepaliveCountForView to AcquireLazyKeepaliveCountForView.
Close remaining views in CloseLazyBackgroundPageNow().
Before this change, things happen in this order:
1. All AppWindows are destroyed
2. Keepalive count becomes 0
3. chrome.runtime.onSuspend is invoked
4. The background page is unloaded.
After this change:
1. All AppWindows have released keepalive. (by explicitly releasing it or being destroyed)
2. Keepalive count becomes 0
3. chrome.runtime.onSuspend is invoked
4. Remaining AppWindows are destroyed
5. The background page is unloaded.
BUG=416999
Review URL: https://codereview.chromium.org/689833005
Cr-Commit-Position: refs/heads/master@{#302584}
Diffstat (limited to 'extensions/browser/process_manager.h')
-rw-r--r-- | extensions/browser/process_manager.h | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/extensions/browser/process_manager.h b/extensions/browser/process_manager.h index ba923d2..5dcc7f1 100644 --- a/extensions/browser/process_manager.h +++ b/extensions/browser/process_manager.h @@ -77,6 +77,16 @@ class ProcessManager : public KeyedService, // apps, not hosted apps. virtual content::SiteInstance* GetSiteInstanceForURL(const GURL& url); + // If the view isn't keeping the lazy background page alive, increments the + // keepalive count to do so. + void AcquireLazyKeepaliveCountForView( + content::RenderViewHost* render_view_host); + + // If the view is keeping the lazy background page alive, decrements the + // keepalive count to stop doing it. + void ReleaseLazyKeepaliveCountForView( + content::RenderViewHost* render_view_host); + // Unregisters a RenderViewHost as hosting any extension. void UnregisterRenderViewHost(content::RenderViewHost* render_view_host); @@ -102,9 +112,6 @@ class ProcessManager : public KeyedService, 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. @@ -210,10 +217,11 @@ class ProcessManager : public KeyedService, // Extra information we keep for each extension's background page. struct BackgroundPageData; + struct ExtensionRenderViewData; typedef std::string ExtensionId; typedef std::map<ExtensionId, BackgroundPageData> BackgroundPageDataMap; - typedef std::map<content::RenderViewHost*, - extensions::ViewType> ExtensionRenderViews; + typedef std::map<content::RenderViewHost*, ExtensionRenderViewData> + ExtensionRenderViews; // Load all background pages once the profile data is ready and the pages // should be loaded. |