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

Unified Diff: chrome/browser/profiles/profile_keyed_base_factory.cc

Issue 12330073: Disable ProfileKeyedServices on import process by default. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase to ToT Created 7 years, 10 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/profiles/profile_keyed_base_factory.cc
diff --git a/chrome/browser/profiles/profile_keyed_base_factory.cc b/chrome/browser/profiles/profile_keyed_base_factory.cc
index 8277f87372db1f76c06c7662041a777658c8b8fb..a9ea56036f50f12c10cde34a67a62ff9eac7bd96 100644
--- a/chrome/browser/profiles/profile_keyed_base_factory.cc
+++ b/chrome/browser/profiles/profile_keyed_base_factory.cc
@@ -4,10 +4,12 @@
#include "chrome/browser/profiles/profile_keyed_base_factory.h"
+#include "base/command_line.h"
#include "base/prefs/pref_service.h"
#include "chrome/browser/prefs/pref_registry_syncable.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_dependency_manager.h"
+#include "chrome/browser/profiles/profile_manager.h"
ProfileKeyedBaseFactory::ProfileKeyedBaseFactory(
const char* name, ProfileDependencyManager* manager)
@@ -49,6 +51,14 @@ Profile* ProfileKeyedBaseFactory::GetProfileToUse(Profile* profile) {
}
}
+ // If this is the import process, most services are not created to avoid
+ // conflicts with non-shareable resources used by the same service running in
+ // the browser process.
+ if (ProfileManager::IsImportProcess(*CommandLine::ForCurrentProcess()) &&
+ ServiceIsNULLOnImportProcess()) {
+ return NULL;
+ }
+
return profile;
}
@@ -102,6 +112,10 @@ bool ProfileKeyedBaseFactory::ServiceIsNULLWhileTesting() const {
return false;
}
+bool ProfileKeyedBaseFactory::ServiceIsNULLOnImportProcess() const {
+ return true;
+}
+
void ProfileKeyedBaseFactory::ProfileDestroyed(Profile* profile) {
// While object destruction can be customized in ways where the object is
// only dereferenced, this still must run on the UI thread.

Powered by Google App Engine
This is Rietveld 408576698