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

Unified Diff: chrome/browser/extensions/extension_process_manager.cc

Issue 147051: Clean up a few startup and shutdown dependencies which should fix some of the... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 6 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/extensions/extension_process_manager.cc
===================================================================
--- chrome/browser/extensions/extension_process_manager.cc (revision 19016)
+++ chrome/browser/extensions/extension_process_manager.cc (working copy)
@@ -25,19 +25,22 @@
ExtensionProcessManager::ExtensionProcessManager(Profile* profile)
: browsing_instance_(new BrowsingInstance(profile)) {
+ registrar_.Add(this, NotificationType::EXTENSIONS_READY,
+ NotificationService::AllSources());
registrar_.Add(this, NotificationType::EXTENSIONS_LOADED,
NotificationService::AllSources());
registrar_.Add(this, NotificationType::EXTENSION_UNLOADED,
NotificationService::AllSources());
- if (profile->GetExtensionsService())
- CreateBackgroundHosts(this, profile->GetExtensionsService()->extensions());
+ ExtensionsService* service = profile->GetExtensionsService();
+ if (service && service->is_ready())
rafaelw 2009/06/24 23:04:22 Can this test ever return true?
Erik does not do reviews 2009/06/25 16:19:08 Good point. It can't any more. I'll fix this in
+ CreateBackgroundHosts(this, service->extensions());
}
ExtensionProcessManager::~ExtensionProcessManager() {
// Copy all_hosts_ to avoid iterator invalidation issues.
- ExtensionHostSet to_delete(all_hosts_.begin(),
- all_hosts_.end());
+ ExtensionHostSet to_delete(background_hosts_.begin(),
+ background_hosts_.end());
ExtensionHostSet::iterator iter;
for (iter = to_delete.begin(); iter != to_delete.end(); ++iter)
delete *iter;
@@ -85,9 +88,17 @@
const NotificationSource& source,
const NotificationDetails& details) {
switch (type.value) {
+ case NotificationType::EXTENSIONS_READY:
+ CreateBackgroundHosts(this,
+ Source<ExtensionsService>(source).ptr()->extensions());
+ break;
+
case NotificationType::EXTENSIONS_LOADED: {
- const ExtensionList* extensions = Details<ExtensionList>(details).ptr();
- CreateBackgroundHosts(this, extensions);
+ ExtensionsService* service = Source<ExtensionsService>(source).ptr();
+ if (service->is_ready()) {
+ const ExtensionList* extensions = Details<ExtensionList>(details).ptr();
+ CreateBackgroundHosts(this, extensions);
+ }
break;
}

Powered by Google App Engine
This is Rietveld 408576698