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

Unified Diff: chrome/browser/extensions/extension_host.cc

Issue 11117011: Keep browser process alive while there are platform apps with background pages running. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extension_host.cc
diff --git a/chrome/browser/extensions/extension_host.cc b/chrome/browser/extensions/extension_host.cc
index d370c268c555b51ae652538ac323cac0c26de36b..76ef390241c620232ecce971c78a3cd66a546794 100644
--- a/chrome/browser/extensions/extension_host.cc
+++ b/chrome/browser/extensions/extension_host.cc
@@ -21,6 +21,7 @@
#include "chrome/browser/extensions/extension_tab_util.h"
#include "chrome/browser/extensions/window_controller.h"
#include "chrome/browser/file_select_helper.h"
+#include "chrome/browser/lifetime/application_lifetime.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/app_modal_dialogs/javascript_dialog_creator.h"
#include "chrome/browser/ui/browser.h"
@@ -154,6 +155,13 @@ ExtensionHost::ExtensionHost(const Extension* extension,
// be the same extension that this points to.
registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED,
content::Source<Profile>(profile_));
+
+ // Keep the browser process alive while platform apps have active background
+ // pages.
+ if (extension_->is_platform_app() &&
+ extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE) {
benwells 2012/10/12 05:33:38 I don't like putting the is_platform_app check her
Aaron Boodman 2012/10/12 17:58:30 What about if ExtensionHost supported this feature
+ browser::StartKeepAlive();
+ }
}
ExtensionHost::~ExtensionHost() {
@@ -167,6 +175,11 @@ ExtensionHost::~ExtensionHost() {
content::Source<Profile>(profile_),
content::Details<ExtensionHost>(this));
ProcessCreationQueue::GetInstance()->Remove(this);
+
+ if (extension_->is_platform_app() &&
+ extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE) {
+ browser::EndKeepAlive();
+ }
}
void ExtensionHost::CreateView(Browser* browser) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698