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

Unified Diff: chrome/browser/profiles/profile_keyed_service_factory.cc

Issue 6813116: Revert 81277 - Profile shouldn't own DesktopNotificationService.DesktopNotificationService is now... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 8 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: chrome/browser/profiles/profile_keyed_service_factory.cc
===================================================================
--- chrome/browser/profiles/profile_keyed_service_factory.cc (revision 81278)
+++ chrome/browser/profiles/profile_keyed_service_factory.cc (working copy)
@@ -13,7 +13,7 @@
ProfileKeyedServiceFactory::ProfileKeyedServiceFactory(
ProfileDependencyManager* manager)
- : dependency_manager_(manager), factory_(NULL) {
+ : dependency_manager_(manager) {
dependency_manager_->AddComponent(this);
}
@@ -35,22 +35,12 @@
}
}
- ProfileKeyedService* service;
-
std::map<Profile*, ProfileKeyedService*>::iterator it =
mapping_.find(profile);
- if (it != mapping_.end()) {
- service = it->second;
- if (service || !factory_)
- return service;
+ if (it != mapping_.end())
+ return it->second;
- // service is NULL but we have a mock factory function
- mapping_.erase(it);
- service = factory_(profile);
- } else {
- service = BuildServiceInstanceFor(profile);
- }
-
+ ProfileKeyedService* service = BuildServiceInstanceFor(profile);
Associate(profile, service);
return service;
}
@@ -76,7 +66,7 @@
void ProfileKeyedServiceFactory::ProfileShutdown(Profile* profile) {
std::map<Profile*, ProfileKeyedService*>::iterator it =
mapping_.find(profile);
- if (it != mapping_.end() && it->second)
+ if (it != mapping_.end())
it->second->Shutdown();
}
« no previous file with comments | « chrome/browser/profiles/profile_keyed_service_factory.h ('k') | chrome/browser/sync/glue/theme_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698