| Index: components/keyed_service/core/refcounted_keyed_service_factory.cc
|
| diff --git a/components/keyed_service/core/refcounted_keyed_service_factory.cc b/components/keyed_service/core/refcounted_keyed_service_factory.cc
|
| index d33340b2d530fe7fdc5c25570e7e7160d0286529..1a7ab86290fc83475228b63d0be782d6a8e5c511 100644
|
| --- a/components/keyed_service/core/refcounted_keyed_service_factory.cc
|
| +++ b/components/keyed_service/core/refcounted_keyed_service_factory.cc
|
| @@ -26,6 +26,7 @@ void RefcountedKeyedServiceFactory::SetTestingFactory(
|
| // 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
|
| // destruction.
|
| + context = GetUnderlyingContext(context);
|
| bool add_context = ArePreferencesSetOn(context);
|
|
|
| // We have to go through the shutdown and destroy mechanisms because there
|
| @@ -45,6 +46,7 @@ RefcountedKeyedServiceFactory::SetTestingFactoryAndUse(
|
| base::SupportsUserData* context,
|
| TestingFactoryFunction testing_factory) {
|
| DCHECK(testing_factory);
|
| + context = GetUnderlyingContext(context);
|
| SetTestingFactory(context, testing_factory);
|
| return GetServiceForContext(context, true);
|
| }
|
| @@ -53,6 +55,7 @@ scoped_refptr<RefcountedKeyedService>
|
| RefcountedKeyedServiceFactory::GetServiceForContext(
|
| base::SupportsUserData* context,
|
| bool create) {
|
| + context = GetUnderlyingContext(context);
|
| context = GetContextToUse(context);
|
| if (!context)
|
| return nullptr;
|
| @@ -89,12 +92,14 @@ RefcountedKeyedServiceFactory::GetServiceForContext(
|
| void RefcountedKeyedServiceFactory::Associate(
|
| base::SupportsUserData* context,
|
| const scoped_refptr<RefcountedKeyedService>& service) {
|
| + context = GetUnderlyingContext(context);
|
| DCHECK(!ContainsKey(mapping_, context));
|
| mapping_.insert(std::make_pair(context, service));
|
| }
|
|
|
| void RefcountedKeyedServiceFactory::ContextShutdown(
|
| base::SupportsUserData* context) {
|
| + context = GetUnderlyingContext(context);
|
| const auto& it = mapping_.find(context);
|
| if (it != mapping_.end() && it->second.get())
|
| it->second->ShutdownOnUIThread();
|
| @@ -102,6 +107,7 @@ void RefcountedKeyedServiceFactory::ContextShutdown(
|
|
|
| void RefcountedKeyedServiceFactory::ContextDestroyed(
|
| base::SupportsUserData* context) {
|
| + context = GetUnderlyingContext(context);
|
| // We "merely" drop our reference to the service. Hopefully this will cause
|
| // the service to be destroyed. If not, oh well.
|
| mapping_.erase(context);
|
| @@ -117,15 +123,18 @@ void RefcountedKeyedServiceFactory::ContextDestroyed(
|
|
|
| void RefcountedKeyedServiceFactory::SetEmptyTestingFactory(
|
| base::SupportsUserData* context) {
|
| + context = GetUnderlyingContext(context);
|
| SetTestingFactory(context, nullptr);
|
| }
|
|
|
| bool RefcountedKeyedServiceFactory::HasTestingFactory(
|
| base::SupportsUserData* context) {
|
| + context = GetUnderlyingContext(context);
|
| return testing_factories_.find(context) != testing_factories_.end();
|
| }
|
|
|
| void RefcountedKeyedServiceFactory::CreateServiceNow(
|
| base::SupportsUserData* context) {
|
| + context = GetUnderlyingContext(context);
|
| GetServiceForContext(context, true);
|
| }
|
|
|