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

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: Test 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
Index: chrome/browser/extensions/extension_host.cc
diff --git a/chrome/browser/extensions/extension_host.cc b/chrome/browser/extensions/extension_host.cc
index c1bd02b08a191a1aac8fc33b2b20c2d909d2ed61..bd37ca140183b80b887240054d34b941615b7d4a 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"
@@ -141,6 +142,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)),
@@ -173,6 +175,9 @@ ExtensionHost::~ExtensionHost() {
content::Source<Profile>(profile_),
content::Details<ExtensionHost>(this));
ProcessCreationQueue::GetInstance()->Remove(this);
+
+ if (keeping_browser_process_alive_)
+ browser::EndKeepAlive();
}
void ExtensionHost::CreateView(Browser* browser) {
@@ -469,6 +474,14 @@ void ExtensionHost::DidCloseJavaScriptDialog() {
pm->DecrementLazyKeepaliveCount(extension());
}
+void ExtensionHost::KeepBrowserProcessAlive() {
Aaron Boodman 2012/10/31 07:31:22 Nit: I think SetKeepsBrowserProcessAlive() would b
benwells 2012/10/31 08:08:22 Done.
+ if (keeping_browser_process_alive_)
+ return;
+
+ keeping_browser_process_alive_ = true;
+ browser::StartKeepAlive();
+}
+
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