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

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: Update new sync tests Created 8 years, 1 month 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_host.cc
diff --git a/chrome/browser/extensions/extension_host.cc b/chrome/browser/extensions/extension_host.cc
index 821859379ae0898d1ead21a9aa3152fe8c69bc59..17092a68662d78cd95af77b551bf0c6ba7696164 100644
--- a/chrome/browser/extensions/extension_host.cc
+++ b/chrome/browser/extensions/extension_host.cc
@@ -22,6 +22,7 @@
#include "chrome/browser/extensions/window_controller.h"
#include "chrome/browser/file_select_helper.h"
#include "chrome/browser/intents/web_intents_util.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"
@@ -137,6 +138,7 @@ ExtensionHost::ExtensionHost(const Extension* extension,
render_view_host_(NULL),
did_stop_loading_(false),
document_element_available_(false),
+ keeping_browser_process_alive_(false),
initial_url_(url),
ALLOW_THIS_IN_INITIALIZER_LIST(
extension_function_dispatcher_(profile_, this)),
@@ -169,6 +171,11 @@ ExtensionHost::~ExtensionHost() {
content::Source<Profile>(profile_),
content::Details<ExtensionHost>(this));
ProcessCreationQueue::GetInstance()->Remove(this);
+
+#if !defined(OS_ANDROID)
+ if (keeping_browser_process_alive_)
+ browser::EndKeepAlive();
+#endif
}
void ExtensionHost::CreateView(Browser* browser) {
@@ -457,6 +464,16 @@ void ExtensionHost::DidCloseJavaScriptDialog() {
pm->DecrementLazyKeepaliveCount(extension());
}
+void ExtensionHost::SetKeepsBrowserProcessAlive() {
+ if (keeping_browser_process_alive_)
+ return;
+
+#if !defined(OS_ANDROID)
+ keeping_browser_process_alive_ = true;
+ browser::StartKeepAlive();
+#endif
+}
+
WebContents* ExtensionHost::OpenURLFromTab(WebContents* source,
const OpenURLParams& params) {
// Whitelist the dispositions we will allow to be opened.

Powered by Google App Engine
This is Rietveld 408576698