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

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: And another test Created 8 years 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 | « chrome/browser/extensions/extension_host.h ('k') | chrome/browser/extensions/platform_app_browsertest.cc » ('j') | 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 f46e8880abe6bb7c7781cc32bf6ea2d4e1009b2a..f72319a0bcf6d41b886a2380c12183127c54bd30 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) {
@@ -460,6 +467,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.
« no previous file with comments | « chrome/browser/extensions/extension_host.h ('k') | chrome/browser/extensions/platform_app_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698