| Index: components/keyed_service/core/keyed_service_factory.cc
|
| diff --git a/components/keyed_service/core/keyed_service_factory.cc b/components/keyed_service/core/keyed_service_factory.cc
|
| index 1417bab80a39e88278147bd333e60854f13f5890..efc61f904e7b8bc1631e97fff4038afd499c9f1f 100644
|
| --- a/components/keyed_service/core/keyed_service_factory.cc
|
| +++ b/components/keyed_service/core/keyed_service_factory.cc
|
| @@ -77,7 +77,7 @@ KeyedService* KeyedServiceFactory::GetServiceForContext(
|
| // Create new object.
|
| // Check to see if we have a per-context testing factory that we should use
|
| // instead of default behavior.
|
| - KeyedService* service = nullptr;
|
| + scoped_ptr<KeyedService> service;
|
| const auto& jt = testing_factories_.find(context);
|
| if (jt != testing_factories_.end()) {
|
| if (jt->second) {
|
| @@ -89,14 +89,14 @@ KeyedService* KeyedServiceFactory::GetServiceForContext(
|
| service = BuildServiceInstanceFor(context);
|
| }
|
|
|
| - Associate(context, service);
|
| - return service;
|
| + Associate(context, service.Pass());
|
| + return mapping_[context];
|
| }
|
|
|
| void KeyedServiceFactory::Associate(base::SupportsUserData* context,
|
| - KeyedService* service) {
|
| + scoped_ptr<KeyedService> service) {
|
| DCHECK(!ContainsKey(mapping_, context));
|
| - mapping_.insert(std::make_pair(context, service));
|
| + mapping_.insert(std::make_pair(context, service.release()));
|
| }
|
|
|
| void KeyedServiceFactory::Disassociate(base::SupportsUserData* context) {
|
|
|