summaryrefslogtreecommitdiff
path: root/chromium/components/browser_context_keyed_service
diff options
context:
space:
mode:
authorAndras Becsi <andras.becsi@digia.com>2014-03-18 13:16:26 +0100
committerFrederik Gladhorn <frederik.gladhorn@digia.com>2014-03-20 15:55:39 +0100
commit3f0f86b0caed75241fa71c95a5d73bc0164348c5 (patch)
tree92b9fb00f2e9e90b0be2262093876d4f43b6cd13 /chromium/components/browser_context_keyed_service
parente90d7c4b152c56919d963987e2503f9909a666d2 (diff)
downloadqtwebengine-chromium-3f0f86b0caed75241fa71c95a5d73bc0164348c5.tar.gz
Update to new stable branch 1750
This also includes an updated ninja and chromium dependencies needed on Windows. Change-Id: Icd597d80ed3fa4425933c9f1334c3c2e31291c42 Reviewed-by: Zoltan Arvai <zarvai@inf.u-szeged.hu> Reviewed-by: Zeno Albisser <zeno.albisser@digia.com>
Diffstat (limited to 'chromium/components/browser_context_keyed_service')
-rw-r--r--chromium/components/browser_context_keyed_service/DEPS1
-rw-r--r--chromium/components/browser_context_keyed_service/OWNERS1
-rw-r--r--chromium/components/browser_context_keyed_service/browser_context_dependency_manager.cc36
-rw-r--r--chromium/components/browser_context_keyed_service/browser_context_dependency_manager.h23
-rw-r--r--chromium/components/browser_context_keyed_service/browser_context_keyed_base_factory.cc38
-rw-r--r--chromium/components/browser_context_keyed_service/browser_context_keyed_base_factory.h30
-rw-r--r--chromium/components/browser_context_keyed_service/browser_context_keyed_service_factory.cc35
-rw-r--r--chromium/components/browser_context_keyed_service/browser_context_keyed_service_factory.h20
-rw-r--r--chromium/components/browser_context_keyed_service/refcounted_browser_context_keyed_service_factory.cc20
-rw-r--r--chromium/components/browser_context_keyed_service/refcounted_browser_context_keyed_service_factory.h15
10 files changed, 130 insertions, 89 deletions
diff --git a/chromium/components/browser_context_keyed_service/DEPS b/chromium/components/browser_context_keyed_service/DEPS
index 1c35d9ca694..3a3074d047f 100644
--- a/chromium/components/browser_context_keyed_service/DEPS
+++ b/chromium/components/browser_context_keyed_service/DEPS
@@ -1,3 +1,4 @@
include_rules = [
+ "+components/user_prefs",
"+content/public/browser",
]
diff --git a/chromium/components/browser_context_keyed_service/OWNERS b/chromium/components/browser_context_keyed_service/OWNERS
index 0a6b6d0a421..1ee3703a024 100644
--- a/chromium/components/browser_context_keyed_service/OWNERS
+++ b/chromium/components/browser_context_keyed_service/OWNERS
@@ -1,4 +1,3 @@
erg@chromium.org
-mirandac@chromium.org
phajdan.jr@chromium.org
rlp@chromium.org
diff --git a/chromium/components/browser_context_keyed_service/browser_context_dependency_manager.cc b/chromium/components/browser_context_keyed_service/browser_context_dependency_manager.cc
index 66134233c76..913c92b8085 100644
--- a/chromium/components/browser_context_keyed_service/browser_context_dependency_manager.cc
+++ b/chromium/components/browser_context_keyed_service/browser_context_dependency_manager.cc
@@ -39,21 +39,35 @@ void BrowserContextDependencyManager::AddEdge(
dependency_graph_.AddEdge(depended, dependee);
}
+void BrowserContextDependencyManager::RegisterProfilePrefsForServices(
+ const content::BrowserContext* context,
+ user_prefs::PrefRegistrySyncable* pref_registry) {
+ std::vector<DependencyNode*> construction_order;
+ if (!dependency_graph_.GetConstructionOrder(&construction_order)) {
+ NOTREACHED();
+ }
+
+ for (std::vector<DependencyNode*>::const_iterator it =
+ construction_order.begin(); it != construction_order.end(); ++it) {
+ BrowserContextKeyedBaseFactory* factory =
+ static_cast<BrowserContextKeyedBaseFactory*>(*it);
+ factory->RegisterProfilePrefsIfNecessaryForContext(context, pref_registry);
+ }
+}
+
void BrowserContextDependencyManager::CreateBrowserContextServices(
content::BrowserContext* context) {
- DoCreateBrowserContextServices(context, false, false);
+ DoCreateBrowserContextServices(context, false);
}
void BrowserContextDependencyManager::CreateBrowserContextServicesForTest(
- content::BrowserContext* context,
- bool force_register_prefs) {
- DoCreateBrowserContextServices(context, true, force_register_prefs);
+ content::BrowserContext* context) {
+ DoCreateBrowserContextServices(context, true);
}
void BrowserContextDependencyManager::DoCreateBrowserContextServices(
content::BrowserContext* context,
- bool is_testing_context,
- bool force_register_prefs) {
+ bool is_testing_context) {
TRACE_EVENT0("browser",
"BrowserContextDependencyManager::DoCreateBrowserContextServices")
#ifndef NDEBUG
@@ -76,16 +90,6 @@ void BrowserContextDependencyManager::DoCreateBrowserContextServices(
for (size_t i = 0; i < construction_order.size(); i++) {
BrowserContextKeyedBaseFactory* factory =
static_cast<BrowserContextKeyedBaseFactory*>(construction_order[i]);
-
- if (!context->IsOffTheRecord() || force_register_prefs) {
- // We only register preferences on normal contexts because the incognito
- // context shares the pref service with the normal one. Always register
- // for standalone testing contexts (testing contexts that don't have an
- // "original" profile set) as otherwise the preferences won't be
- // registered.
- factory->RegisterUserPrefsOnBrowserContext(context);
- }
-
if (is_testing_context && factory->ServiceIsNULLWhileTesting()) {
factory->SetEmptyTestingFactory(context);
} else if (factory->ServiceIsCreatedWithBrowserContext()) {
diff --git a/chromium/components/browser_context_keyed_service/browser_context_dependency_manager.h b/chromium/components/browser_context_keyed_service/browser_context_dependency_manager.h
index 5482aaa9283..6b2ba2620c5 100644
--- a/chromium/components/browser_context_keyed_service/browser_context_dependency_manager.h
+++ b/chromium/components/browser_context_keyed_service/browser_context_dependency_manager.h
@@ -19,6 +19,10 @@ namespace content {
class BrowserContext;
}
+namespace user_prefs {
+class PrefRegistrySyncable;
+}
+
// A singleton that listens for context destruction notifications and
// rebroadcasts them to each BrowserContextKeyedBaseFactory in a safe order
// based on the stated dependencies by each service.
@@ -33,6 +37,14 @@ class BROWSER_CONTEXT_KEYED_SERVICE_EXPORT BrowserContextDependencyManager {
void AddEdge(BrowserContextKeyedBaseFactory* depended,
BrowserContextKeyedBaseFactory* dependee);
+ // Registers profile-specific preferences for all services via |registry|.
+ // |context| should be the BrowserContext containing |registry| and is used as
+ // a key to prevent multiple registrations on the same BrowserContext in
+ // tests.
+ void RegisterProfilePrefsForServices(
+ const content::BrowserContext* context,
+ user_prefs::PrefRegistrySyncable* registry);
+
// Called by each BrowserContext to alert us of its creation. Several services
// want to be started when a context is created. If you want your
// BrowserContextKeyedService to be started with the BrowserContext, override
@@ -44,12 +56,8 @@ class BROWSER_CONTEXT_KEYED_SERVICE_EXPORT BrowserContextDependencyManager {
// Similar to CreateBrowserContextServices(), except this is used for creating
// test BrowserContexts - these contexts will not create services for any
// BrowserContextKeyedBaseFactories that return true from
- // ServiceIsNULLWhileTesting(). Callers can pass |force_register_prefs| as
- // true to have preferences registered even for incognito profiles - this
- // allows tests to specify a standalone incognito profile without an
- // associated normal profile.
- void CreateBrowserContextServicesForTest(content::BrowserContext* context,
- bool force_register_prefs);
+ // ServiceIsNULLWhileTesting().
+ void CreateBrowserContextServicesForTest(content::BrowserContext* context);
// Called by each BrowserContext to alert us that we should destroy services
// associated with it.
@@ -70,8 +78,7 @@ class BROWSER_CONTEXT_KEYED_SERVICE_EXPORT BrowserContextDependencyManager {
// Helper function used by CreateBrowserContextServices[ForTest].
void DoCreateBrowserContextServices(content::BrowserContext* context,
- bool is_testing_context,
- bool force_register_prefs);
+ bool is_testing_context);
BrowserContextDependencyManager();
virtual ~BrowserContextDependencyManager();
diff --git a/chromium/components/browser_context_keyed_service/browser_context_keyed_base_factory.cc b/chromium/components/browser_context_keyed_service/browser_context_keyed_base_factory.cc
index cc3f487d188..a4f62ed7bdb 100644
--- a/chromium/components/browser_context_keyed_service/browser_context_keyed_base_factory.cc
+++ b/chromium/components/browser_context_keyed_service/browser_context_keyed_base_factory.cc
@@ -29,6 +29,17 @@ void BrowserContextKeyedBaseFactory::DependsOn(
dependency_manager_->AddEdge(rhs, this);
}
+void BrowserContextKeyedBaseFactory::RegisterProfilePrefsIfNecessaryForContext(
+ const content::BrowserContext* context,
+ user_prefs::PrefRegistrySyncable* registry) {
+ std::set<const content::BrowserContext*>::iterator it =
+ registered_preferences_.find(context);
+ if (it == registered_preferences_.end()) {
+ RegisterProfilePrefs(registry);
+ registered_preferences_.insert(context);
+ }
+}
+
content::BrowserContext* BrowserContextKeyedBaseFactory::GetBrowserContextToUse(
content::BrowserContext* context) const {
DCHECK(CalledOnValidThread());
@@ -44,14 +55,14 @@ content::BrowserContext* BrowserContextKeyedBaseFactory::GetBrowserContextToUse(
return context;
}
-void BrowserContextKeyedBaseFactory::RegisterUserPrefsOnBrowserContext(
+void BrowserContextKeyedBaseFactory::RegisterUserPrefsOnBrowserContextForTest(
content::BrowserContext* context) {
// 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::CreateBrowserContextServices time.
+ // BrowserContextDependencyManager::RegisterProfilePrefsForServices time.
// With incognito contexts, we just never register since incognito contexts
// share the same pref services with their parent contexts.
//
@@ -61,24 +72,21 @@ void BrowserContextKeyedBaseFactory::RegisterUserPrefsOnBrowserContext(
// 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 service
- // creation time).
+ // 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.
-
- std::set<content::BrowserContext*>::iterator it =
- registered_preferences_.find(context);
- if (it == registered_preferences_.end()) {
- PrefService* prefs = user_prefs::UserPrefs::Get(context);
- user_prefs::PrefRegistrySyncable* registry =
- static_cast<user_prefs::PrefRegistrySyncable*>(
- prefs->DeprecatedGetPrefRegistry());
- RegisterProfilePrefs(registry);
- registered_preferences_.insert(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(context);
+ user_prefs::PrefRegistrySyncable* registry =
+ static_cast<user_prefs::PrefRegistrySyncable*>(
+ prefs->DeprecatedGetPrefRegistry());
+ RegisterProfilePrefsIfNecessaryForContext(context, registry);
}
bool
diff --git a/chromium/components/browser_context_keyed_service/browser_context_keyed_base_factory.h b/chromium/components/browser_context_keyed_service/browser_context_keyed_base_factory.h
index 1c937d3edeb..36f28299948 100644
--- a/chromium/components/browser_context_keyed_service/browser_context_keyed_base_factory.h
+++ b/chromium/components/browser_context_keyed_service/browser_context_keyed_base_factory.h
@@ -38,8 +38,12 @@ BrowserContextKeyedBaseFactory
// Registers preferences used in this service on the pref service of
// |context|. This is the public interface and is safe to be called multiple
// times because testing code can have multiple services of the same type
- // attached to a single |context|.
- void RegisterUserPrefsOnBrowserContext(content::BrowserContext* context);
+ // attached to a single |context|. Only test code is allowed to call this
+ // method.
+ // TODO(gab): This method can be removed entirely when
+ // PrefService::DeprecatedGetPrefRegistry() is phased out.
+ void RegisterUserPrefsOnBrowserContextForTest(
+ content::BrowserContext* context);
#ifndef NDEBUG
// Returns our name. We don't keep track of this in release mode.
@@ -55,18 +59,20 @@ BrowserContextKeyedBaseFactory
// created by factories.
void DependsOn(BrowserContextKeyedBaseFactory* rhs);
+ // Calls RegisterProfilePrefs() after doing house keeping required to work
+ // alongside RegisterUserPrefsOnBrowserContextForTest().
+ // TODO(gab): This method can be replaced by RegisterProfilePrefs() directly
+ // once RegisterUserPrefsOnBrowserContextForTest() is phased out.
+ void RegisterProfilePrefsIfNecessaryForContext(
+ const content::BrowserContext* context,
+ user_prefs::PrefRegistrySyncable* registry);
+
// Interface for people building a concrete FooServiceFactory: --------------
// Finds which browser context (if any) to use.
virtual content::BrowserContext* GetBrowserContextToUse(
content::BrowserContext* context) const;
- // Register any user preferences on this service. This is called during
- // CreateBrowserContextService() since preferences are registered on a per
- // BrowserContext basis.
- virtual void RegisterProfilePrefs(
- user_prefs::PrefRegistrySyncable* registry) {}
-
// By default, we create instances of a service lazily and wait until
// GetForBrowserContext() is called on our subclass. Some services need to be
// created as soon as the BrowserContext has been brought up.
@@ -109,6 +115,12 @@ BrowserContextKeyedBaseFactory
friend class BrowserContextDependencyManager;
friend class BrowserContextDependencyManagerUnittests;
+ // Registers any user preferences on this service. This is called by
+ // RegisterProfilePrefsIfNecessary() and should be overriden by any service
+ // that wants to register profile-specific preferences.
+ virtual void RegisterProfilePrefs(
+ user_prefs::PrefRegistrySyncable* registry) {}
+
// These two methods are for tight integration with the
// BrowserContextDependencyManager.
@@ -127,7 +139,7 @@ BrowserContextKeyedBaseFactory
BrowserContextDependencyManager* dependency_manager_;
// BrowserContexts that have this service's preferences registered on them.
- std::set<content::BrowserContext*> registered_preferences_;
+ std::set<const content::BrowserContext*> registered_preferences_;
#if !defined(NDEBUG)
// A static string passed in to our constructor. Should be unique across all
diff --git a/chromium/components/browser_context_keyed_service/browser_context_keyed_service_factory.cc b/chromium/components/browser_context_keyed_service/browser_context_keyed_service_factory.cc
index 619318ef584..8f2bc729f06 100644
--- a/chromium/components/browser_context_keyed_service/browser_context_keyed_service_factory.cc
+++ b/chromium/components/browser_context_keyed_service/browser_context_keyed_service_factory.cc
@@ -13,7 +13,7 @@
#include "content/public/browser/browser_context.h"
void BrowserContextKeyedServiceFactory::SetTestingFactory(
- content::BrowserContext* context, FactoryFunction factory) {
+ content::BrowserContext* context, TestingFactoryFunction testing_factory) {
// Destroying the context may cause us to lose data about whether |context|
// has our preferences registered on it (since the context object itself
// isn't dead). See if we need to readd it once we've gone through normal
@@ -29,15 +29,15 @@ void BrowserContextKeyedServiceFactory::SetTestingFactory(
if (add_context)
MarkPreferencesSetOn(context);
- factories_[context] = factory;
+ testing_factories_[context] = testing_factory;
}
BrowserContextKeyedService*
BrowserContextKeyedServiceFactory::SetTestingFactoryAndUse(
content::BrowserContext* context,
- FactoryFunction factory) {
- DCHECK(factory);
- SetTestingFactory(context, factory);
+ TestingFactoryFunction testing_factory) {
+ DCHECK(testing_factory);
+ SetTestingFactory(context, testing_factory);
return GetServiceForBrowserContext(context, true);
}
@@ -72,12 +72,12 @@ BrowserContextKeyedServiceFactory::GetServiceForBrowserContext(
// Check to see if we have a per-BrowserContext testing factory that we should
// use instead of default behavior.
BrowserContextKeyedService* service = NULL;
- BrowserContextOverriddenFunctions::const_iterator jt =
- factories_.find(context);
- if (jt != factories_.end()) {
+ BrowserContextOverriddenTestingFunctions::const_iterator jt =
+ testing_factories_.find(context);
+ if (jt != testing_factories_.end()) {
if (jt->second) {
if (!context->IsOffTheRecord())
- RegisterUserPrefsOnBrowserContext(context);
+ RegisterUserPrefsOnBrowserContextForTest(context);
service = jt->second(context);
}
} else {
@@ -95,6 +95,15 @@ void BrowserContextKeyedServiceFactory::Associate(
mapping_.insert(std::make_pair(context, service));
}
+void BrowserContextKeyedServiceFactory::Disassociate(
+ content::BrowserContext* context) {
+ BrowserContextKeyedServices::iterator it = mapping_.find(context);
+ if (it != mapping_.end()) {
+ delete it->second;
+ mapping_.erase(it);
+ }
+}
+
void BrowserContextKeyedServiceFactory::BrowserContextShutdown(
content::BrowserContext* context) {
BrowserContextKeyedServices::iterator it = mapping_.find(context);
@@ -104,17 +113,13 @@ void BrowserContextKeyedServiceFactory::BrowserContextShutdown(
void BrowserContextKeyedServiceFactory::BrowserContextDestroyed(
content::BrowserContext* context) {
- BrowserContextKeyedServices::iterator it = mapping_.find(context);
- if (it != mapping_.end()) {
- delete it->second;
- mapping_.erase(it);
- }
+ Disassociate(context);
// For unit tests, we also remove the factory function both so we don't
// maintain a big map of dead pointers, but also since we may have a second
// object that lives at the same address (see other comments about unit tests
// in this file).
- factories_.erase(context);
+ testing_factories_.erase(context);
BrowserContextKeyedBaseFactory::BrowserContextDestroyed(context);
}
diff --git a/chromium/components/browser_context_keyed_service/browser_context_keyed_service_factory.h b/chromium/components/browser_context_keyed_service/browser_context_keyed_service_factory.h
index 2775e4cc45b..f97144d1085 100644
--- a/chromium/components/browser_context_keyed_service/browser_context_keyed_service_factory.h
+++ b/chromium/components/browser_context_keyed_service/browser_context_keyed_service_factory.h
@@ -30,21 +30,21 @@ class BROWSER_CONTEXT_KEYED_SERVICE_EXPORT BrowserContextKeyedServiceFactory
// for a given BrowserContext. This is used primarily for testing, where
// we want to feed a specific mock into the BCKSF system.
typedef BrowserContextKeyedService*
- (*FactoryFunction)(content::BrowserContext* context);
+ (*TestingFactoryFunction)(content::BrowserContext* context);
// Associates |factory| with |context| so that |factory| is used to create
// the BrowserContextKeyedService when requested. |factory| can be NULL
// to signal that BrowserContextKeyedService should be NULL. Multiple calls to
// SetTestingFactory() are allowed; previous services will be shut down.
void SetTestingFactory(content::BrowserContext* context,
- FactoryFunction factory);
+ TestingFactoryFunction factory);
// Associates |factory| with |context| and immediately returns the created
// BrowserContextKeyedService. Since the factory will be used immediately,
// it may not be NULL.
BrowserContextKeyedService* SetTestingFactoryAndUse(
content::BrowserContext* context,
- FactoryFunction factory);
+ TestingFactoryFunction factory);
protected:
// BrowserContextKeyedServiceFactories must communicate with a
@@ -75,6 +75,9 @@ class BROWSER_CONTEXT_KEYED_SERVICE_EXPORT BrowserContextKeyedServiceFactory
void Associate(content::BrowserContext* context,
BrowserContextKeyedService* service);
+ // Removes the mapping from |context| to a service.
+ void Disassociate(content::BrowserContext* context);
+
// All subclasses of BrowserContextKeyedServiceFactory must return a
// BrowserContextKeyedService instead of just a BrowserContextKeyedBase.
virtual BrowserContextKeyedService* BuildServiceInstanceFor(
@@ -107,14 +110,15 @@ class BROWSER_CONTEXT_KEYED_SERVICE_EXPORT BrowserContextKeyedServiceFactory
typedef std::map<content::BrowserContext*, BrowserContextKeyedService*>
BrowserContextKeyedServices;
- typedef std::map<content::BrowserContext*, FactoryFunction>
- BrowserContextOverriddenFunctions;
+ typedef std::map<content::BrowserContext*, TestingFactoryFunction>
+ BrowserContextOverriddenTestingFunctions;
// The mapping between a BrowserContext and its service.
- std::map<content::BrowserContext*, BrowserContextKeyedService*> mapping_;
+ BrowserContextKeyedServices mapping_;
- // The mapping between a BrowserContext and its overridden FactoryFunction.
- std::map<content::BrowserContext*, FactoryFunction> factories_;
+ // The mapping between a BrowserContext and its overridden
+ // TestingFactoryFunction.
+ BrowserContextOverriddenTestingFunctions testing_factories_;
DISALLOW_COPY_AND_ASSIGN(BrowserContextKeyedServiceFactory);
};
diff --git a/chromium/components/browser_context_keyed_service/refcounted_browser_context_keyed_service_factory.cc b/chromium/components/browser_context_keyed_service/refcounted_browser_context_keyed_service_factory.cc
index 060ddc1eb1d..947e1faa2ad 100644
--- a/chromium/components/browser_context_keyed_service/refcounted_browser_context_keyed_service_factory.cc
+++ b/chromium/components/browser_context_keyed_service/refcounted_browser_context_keyed_service_factory.cc
@@ -12,7 +12,7 @@
void RefcountedBrowserContextKeyedServiceFactory::SetTestingFactory(
content::BrowserContext* context,
- FactoryFunction factory) {
+ TestingFactoryFunction testing_factory) {
// Destroying the context may cause us to lose data about whether |context|
// has our preferences registered on it (since the context object itself
// isn't dead). See if we need to readd it once we've gone through normal
@@ -28,15 +28,15 @@ void RefcountedBrowserContextKeyedServiceFactory::SetTestingFactory(
if (add_context)
MarkPreferencesSetOn(context);
- factories_[context] = factory;
+ testing_factories_[context] = testing_factory;
}
scoped_refptr<RefcountedBrowserContextKeyedService>
RefcountedBrowserContextKeyedServiceFactory::SetTestingFactoryAndUse(
content::BrowserContext* context,
- FactoryFunction factory) {
- DCHECK(factory);
- SetTestingFactory(context, factory);
+ TestingFactoryFunction testing_factory) {
+ DCHECK(testing_factory);
+ SetTestingFactory(context, testing_factory);
return GetServiceForBrowserContext(context, true);
}
@@ -74,12 +74,12 @@ RefcountedBrowserContextKeyedServiceFactory::GetServiceForBrowserContext(
// Check to see if we have a per-BrowserContext testing factory that we should
// use instead of default behavior.
scoped_refptr<RefcountedBrowserContextKeyedService> service;
- BrowserContextOverriddenFunctions::const_iterator jt =
- factories_.find(context);
- if (jt != factories_.end()) {
+ BrowserContextOverriddenTestingFunctions::const_iterator jt =
+ testing_factories_.find(context);
+ if (jt != testing_factories_.end()) {
if (jt->second) {
if (!context->IsOffTheRecord())
- RegisterUserPrefsOnBrowserContext(context);
+ RegisterUserPrefsOnBrowserContextForTest(context);
service = jt->second(context);
}
} else {
@@ -114,7 +114,7 @@ void RefcountedBrowserContextKeyedServiceFactory::BrowserContextDestroyed(
// maintain a big map of dead pointers, but also since we may have a second
// object that lives at the same address (see other comments about unit tests
// in this file).
- factories_.erase(context);
+ testing_factories_.erase(context);
BrowserContextKeyedBaseFactory::BrowserContextDestroyed(context);
}
diff --git a/chromium/components/browser_context_keyed_service/refcounted_browser_context_keyed_service_factory.h b/chromium/components/browser_context_keyed_service/refcounted_browser_context_keyed_service_factory.h
index 34eff157e90..27ac467cafd 100644
--- a/chromium/components/browser_context_keyed_service/refcounted_browser_context_keyed_service_factory.h
+++ b/chromium/components/browser_context_keyed_service/refcounted_browser_context_keyed_service_factory.h
@@ -35,21 +35,21 @@ RefcountedBrowserContextKeyedServiceFactory
// a given BrowserContext. This is used primarily for testing, where we want
// to feed a specific mock into the BCKSF system.
typedef scoped_refptr<RefcountedBrowserContextKeyedService>
- (*FactoryFunction)(content::BrowserContext* context);
+ (*TestingFactoryFunction)(content::BrowserContext* context);
// Associates |factory| with |context| so that |factory| is used to create
// the BrowserContextKeyedService when requested. |factory| can be NULL
// to signal that BrowserContextKeyedService should be NULL. Multiple calls to
// SetTestingFactory() are allowed; previous services will be shut down.
void SetTestingFactory(content::BrowserContext* context,
- FactoryFunction factory);
+ TestingFactoryFunction factory);
// Associates |factory| with |context| and immediately returns the created
// BrowserContextKeyedService. Since the factory will be used immediately,
// it may not be NULL.
scoped_refptr<RefcountedBrowserContextKeyedService> SetTestingFactoryAndUse(
content::BrowserContext* context,
- FactoryFunction factory);
+ TestingFactoryFunction factory);
protected:
RefcountedBrowserContextKeyedServiceFactory(
@@ -85,14 +85,15 @@ RefcountedBrowserContextKeyedServiceFactory
typedef std::map<content::BrowserContext*,
scoped_refptr<RefcountedBrowserContextKeyedService> >
RefCountedStorage;
- typedef std::map<content::BrowserContext*,
- FactoryFunction> BrowserContextOverriddenFunctions;
+ typedef std::map<content::BrowserContext*, TestingFactoryFunction>
+ BrowserContextOverriddenTestingFunctions;
// The mapping between a BrowserContext and its refcounted service.
RefCountedStorage mapping_;
- // The mapping between a BrowserContext and its overridden FactoryFunction.
- BrowserContextOverriddenFunctions factories_;
+ // The mapping between a BrowserContext and its overridden
+ // TestingFactoryFunction.
+ BrowserContextOverriddenTestingFunctions testing_factories_;
DISALLOW_COPY_AND_ASSIGN(RefcountedBrowserContextKeyedServiceFactory);
};