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

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

Issue 11572036: Do not load extension system in the Profile import process. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: rollback to patchset 10 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
Index: chrome/browser/extensions/extension_service.cc
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc
index 0a3c1bd9f78f75a8350e9a7e3fcd7181beb6bf58..14ad31a75eac7750d56b1d7e583a637dbc78c84f 100644
--- a/chrome/browser/extensions/extension_service.cc
+++ b/chrome/browser/extensions/extension_service.cc
@@ -412,11 +412,9 @@ ExtensionService::ExtensionService(Profile* profile,
app_notification_manager_->Init();
if (extensions_enabled_) {
- if (!command_line->HasSwitch(switches::kImport) &&
- !command_line->HasSwitch(switches::kImportFromFile)) {
- extensions::ExternalProviderImpl::CreateExternalProviders(
- this, profile_, &external_extension_providers_);
- }
+ CHECK(!ProfileManager::IsImportProcess(*command_line));
+ extensions::ExternalProviderImpl::CreateExternalProviders(
+ this, profile_, &external_extension_providers_);
}
// Set this as the ExtensionService for extension sorting to ensure it
@@ -504,6 +502,8 @@ void ExtensionService::RegisterForImportFinished() {
}
void ExtensionService::InitAfterImport() {
+ component_loader_->BulkLoadDeferred();
+
CheckForExternalUpdates();
GarbageCollectExtensions();
@@ -591,10 +591,29 @@ void ExtensionService::Init() {
DCHECK(!ready_); // Can't redo init.
DCHECK_EQ(extensions_.size(), 0u);
+ CHECK(!ProfileManager::IsImportProcess(*CommandLine::ForCurrentProcess()));
+
// TODO(mek): It might be cleaner to do the FinishDelayedInstallInfo stuff
// here instead of in installedloader.
- component_loader_->LoadAll();
- extensions::InstalledLoader(this).LoadAllExtensions();
+ if (g_browser_process->profile_manager() &&
+ g_browser_process->profile_manager()->will_import()) {
+
+ // Defer component extensions with background pages, since they may conflict
+ // with the import process.
+ component_loader_->BulkLoadDeferBackgroundPages();
+ extensions::InstalledLoader(this).LoadAllExtensions();
+ RegisterForImportFinished();
+ } else {
+ component_loader_->BulkLoadAll();
+ extensions::InstalledLoader(this).LoadAllExtensions();
+
+ // TODO(erikkay) this should probably be deferred to a future point
+ // rather than running immediately at startup.
+ CheckForExternalUpdates();
+
+ // TODO(erikkay) this should probably be deferred as well.
+ GarbageCollectExtensions();
+ }
// The Sideload Wipeout effort takes place during load (see above), so once
// that is done the flag can be set so that we don't have to check again.
@@ -603,26 +622,6 @@ void ExtensionService::Init() {
wipeout_is_active_ = false; // Wipeout is only on during load.
}
- // If we are running in the import process, don't bother initializing the
- // extension service since this can interfere with the main browser process
- // that is already running an extension service for this profile.
- // TODO(aa): can we start up even less of ExtensionService?
- // http://crbug.com/107636
- if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kImport) &&
- !CommandLine::ForCurrentProcess()->HasSwitch(switches::kImportFromFile)) {
- if (g_browser_process->profile_manager() &&
- g_browser_process->profile_manager()->will_import()) {
- RegisterForImportFinished();
- } else {
- // TODO(erikkay) this should probably be deferred to a future point
- // rather than running immediately at startup.
- CheckForExternalUpdates();
-
- // TODO(erikkay) this should probably be deferred as well.
- GarbageCollectExtensions();
- }
- }
-
if (extension_prefs_->NeedsStorageGarbageCollection()) {
GarbageCollectIsolatedStorage();
extension_prefs_->SetNeedsStorageGarbageCollection(false);
@@ -2015,7 +2014,7 @@ void ExtensionService::UnloadAllExtensions() {
void ExtensionService::ReloadExtensions() {
UnloadAllExtensions();
- component_loader_->LoadAll();
+ component_loader_->BulkLoadAll();
extensions::InstalledLoader(this).LoadAllExtensions();
}
« no previous file with comments | « chrome/browser/extensions/component_loader_unittest.cc ('k') | chrome/browser/extensions/extension_system.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698