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

Unified Diff: components/keyed_service/content/browser_context_keyed_base_factory.cc

Issue 654753010: Refactor (Refcounted)BrowserContextKeyedServiceFactory (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments Created 6 years, 2 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: components/keyed_service/content/browser_context_keyed_base_factory.cc
diff --git a/components/keyed_service/content/browser_context_keyed_base_factory.cc b/components/keyed_service/content/browser_context_keyed_base_factory.cc
index f2f09b41adcf2f59f6a695330223d8ed0d8f3ff3..726c8efec551aeda44ccc6ca7131bc755e14526e 100644
--- a/components/keyed_service/content/browser_context_keyed_base_factory.cc
+++ b/components/keyed_service/content/browser_context_keyed_base_factory.cc
@@ -56,31 +56,6 @@ void BrowserContextKeyedBaseFactory::BrowserContextDestroyed(
user_prefs::PrefRegistrySyncable*
BrowserContextKeyedBaseFactory::GetAssociatedPrefRegistry(
base::SupportsUserData* context) const {
- // Safe timing for pref registration is hard. Previously, we made
- // BrowserContext responsible for all pref registration on every service
- // that used BrowserContext. Now we don't and there are timing issues.
- //
- // With normal contexts, prefs can simply be registered at
- // BrowserContextDependencyManager::RegisterProfilePrefsForServices time.
- // With incognito contexts, we just never register since incognito contexts
- // share the same pref services with their parent contexts.
- //
- // TestingBrowserContexts throw a wrench into the mix, in that some tests will
- // swap out the PrefService after we've registered user prefs on the original
- // PrefService. Test code that does this is responsible for either manually
- // invoking RegisterProfilePrefs() on the appropriate
- // BrowserContextKeyedServiceFactory associated with the prefs they need,
- // or they can use SetTestingFactory() and create a service (since service
- // creation with a factory method causes registration to happen at
- // TestingProfile creation time).
- //
- // Now that services are responsible for declaring their preferences, we have
- // to enforce a uniquenes check here because some tests create one context and
- // multiple services of the same type attached to that context (serially, not
- // parallel) and we don't want to register multiple times on the same context.
- // This is the purpose of RegisterProfilePrefsIfNecessary() which could be
- // replaced directly by RegisterProfilePrefs() if this method is ever phased
- // out.
PrefService* prefs = user_prefs::UserPrefs::Get(
static_cast<content::BrowserContext*>(context));
user_prefs::PrefRegistrySyncable* registry =

Powered by Google App Engine
This is Rietveld 408576698