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

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: Merge to ToT Created 7 years, 9 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 7f52e3d0c9b4303f1977692b4abb42c520033028..5013f90edc0097bafeada42fbba7f3d71f9fdb7f 100644
--- a/chrome/browser/profiles/profile_keyed_base_factory.cc
+++ b/chrome/browser/profiles/profile_keyed_base_factory.cc
@@ -4,9 +4,11 @@
#include "chrome/browser/profiles/profile_keyed_base_factory.h"
+#include "base/command_line.h"
#include "base/prefs/pref_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_dependency_manager.h"
+#include "chrome/browser/profiles/profile_manager.h"
#include "components/user_prefs/pref_registry_syncable.h"
ProfileKeyedBaseFactory::ProfileKeyedBaseFactory(
@@ -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