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

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

Issue 7672009: Lazy creating of background pages --enable-lazy-background-pages) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move implementation to ExtensionEventRouter and store pending events in a queue Created 9 years, 4 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_process_manager.cc
diff --git a/chrome/browser/extensions/extension_process_manager.cc b/chrome/browser/extensions/extension_process_manager.cc
index f64624c2588ff844e10f21e1eb4623c78bb0b87d..8090581a3b3a2cd909bd7f8f1a0904f2cc16a30d 100644
--- a/chrome/browser/extensions/extension_process_manager.cc
+++ b/chrome/browser/extensions/extension_process_manager.cc
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "base/command_line.h"
#include "chrome/browser/extensions/extension_process_manager.h"
#include "chrome/browser/ui/browser_window.h"
@@ -14,6 +15,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/common/chrome_notification_types.h"
+#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/url_constants.h"
#include "content/browser/site_instance.h"
@@ -55,10 +57,12 @@ class IncognitoExtensionProcessManager : public ExtensionProcessManager {
ExtensionProcessManager* original_manager_;
};
-static void CreateBackgroundHost(
+static void MaybeCreateBackgroundHost(
Aaron Boodman 2011/08/18 19:25:55 Sorry to nitpick the but "Maybe" functions always
Tessa MacDuff 2011/08/23 18:18:42 Done. I also moved the switch check up out of the
ExtensionProcessManager* manager, const Extension* extension) {
- // Start the process for the master page, if it exists.
- if (extension->background_url().is_valid())
+ // Start the process for the master page, if it exists and we're not lazy.
+ if (extension->background_url().is_valid() &&
+ !CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableLazyBackgroundPages))
manager->CreateBackgroundHost(extension, extension->background_url());
}
@@ -66,7 +70,7 @@ static void CreateBackgroundHosts(
ExtensionProcessManager* manager, const ExtensionList* extensions) {
for (ExtensionList::const_iterator extension = extensions->begin();
extension != extensions->end(); ++extension) {
- CreateBackgroundHost(manager, *extension);
+ MaybeCreateBackgroundHost(manager, *extension);
}
}
@@ -298,7 +302,7 @@ void ExtensionProcessManager::Observe(int type,
Source<Profile>(source).ptr()->GetExtensionService();
if (service->is_ready()) {
const Extension* extension = Details<const Extension>(details).ptr();
- ::CreateBackgroundHost(this, extension);
+ ::MaybeCreateBackgroundHost(this, extension);
}
break;
}

Powered by Google App Engine
This is Rietveld 408576698