Index: components/keyed_service/core/dependency_manager.cc |
diff --git a/components/keyed_service/core/dependency_manager.cc b/components/keyed_service/core/dependency_manager.cc |
index 7eea3cdc330791c233a99d4a8a694788c53a5bd3..59cc867f6d2bfd521f3604b0aaa88d36987ef7c2 100644 |
--- a/components/keyed_service/core/dependency_manager.cc |
+++ b/components/keyed_service/core/dependency_manager.cc |
@@ -34,7 +34,7 @@ void DependencyManager::AddEdge(KeyedServiceBaseFactory* depended, |
} |
void DependencyManager::RegisterPrefsForServices( |
- const base::SupportsUserData* context, |
+ base::SupportsUserData* context, |
user_prefs::PrefRegistrySyncable* pref_registry) { |
std::vector<DependencyNode*> construction_order; |
if (!dependency_graph_.GetConstructionOrder(&construction_order)) { |
@@ -44,7 +44,8 @@ void DependencyManager::RegisterPrefsForServices( |
for (const auto& dependency_node : construction_order) { |
KeyedServiceBaseFactory* factory = |
static_cast<KeyedServiceBaseFactory*>(dependency_node); |
- factory->RegisterPrefsIfNecessaryForContext(context, pref_registry); |
+ base::SupportsUserData* typed_context = factory->GetTypedContext(context); |
+ factory->RegisterPrefsIfNecessaryForContext(typed_context, pref_registry); |
} |
} |
@@ -66,11 +67,12 @@ void DependencyManager::CreateContextServices(base::SupportsUserData* context, |
for (const auto& dependency_node : construction_order) { |
KeyedServiceBaseFactory* factory = |
static_cast<KeyedServiceBaseFactory*>(dependency_node); |
+ base::SupportsUserData* typed_context = factory->GetTypedContext(context); |
if (is_testing_context && factory->ServiceIsNULLWhileTesting() && |
- !factory->HasTestingFactory(context)) { |
- factory->SetEmptyTestingFactory(context); |
+ !factory->HasTestingFactory(typed_context)) { |
+ factory->SetEmptyTestingFactory(typed_context); |
} else if (factory->ServiceIsCreatedWithContext()) { |
- factory->CreateServiceNow(context); |
+ factory->CreateServiceNow(typed_context); |
} |
} |
} |
@@ -89,7 +91,8 @@ void DependencyManager::DestroyContextServices( |
for (const auto& dependency_node : destruction_order) { |
KeyedServiceBaseFactory* factory = |
static_cast<KeyedServiceBaseFactory*>(dependency_node); |
- factory->ContextShutdown(context); |
+ base::SupportsUserData* typed_context = factory->GetTypedContext(context); |
+ factory->ContextShutdown(typed_context); |
} |
#ifndef NDEBUG |
@@ -100,13 +103,14 @@ void DependencyManager::DestroyContextServices( |
for (const auto& dependency_node : destruction_order) { |
KeyedServiceBaseFactory* factory = |
static_cast<KeyedServiceBaseFactory*>(dependency_node); |
- factory->ContextDestroyed(context); |
+ base::SupportsUserData* typed_context = factory->GetTypedContext(context); |
+ factory->ContextDestroyed(typed_context); |
} |
} |
#ifndef NDEBUG |
void DependencyManager::AssertContextWasntDestroyed( |
- const base::SupportsUserData* context) { |
+ base::SupportsUserData* context) { |
if (dead_context_pointers_.find(context) != dead_context_pointers_.end()) { |
NOTREACHED() << "Attempted to access a context that was ShutDown(). " |
<< "This is most likely a heap smasher in progress. After " |
@@ -116,7 +120,7 @@ void DependencyManager::AssertContextWasntDestroyed( |
} |
void DependencyManager::MarkContextLiveForTesting( |
- const base::SupportsUserData* context) { |
+ base::SupportsUserData* context) { |
dead_context_pointers_.erase(context); |
} |