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

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

Issue 415933003: Remove chrome::NOTIFICATION_PROFILE_DESTROYED usage from src/extensions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cleanup Created 6 years, 5 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/chrome_process_manager_delegate.cc
diff --git a/chrome/browser/extensions/chrome_process_manager_delegate.cc b/chrome/browser/extensions/chrome_process_manager_delegate.cc
index 12e0c161d669aad0f829cb830bcb271590cc6249..50dc2841c7768b598b3980f1a936aaf7f4ca221d 100644
--- a/chrome/browser/extensions/chrome_process_manager_delegate.cc
+++ b/chrome/browser/extensions/chrome_process_manager_delegate.cc
@@ -30,8 +30,9 @@ ChromeProcessManagerDelegate::ChromeProcessManagerDelegate() {
registrar_.Add(this,
chrome::NOTIFICATION_PROFILE_CREATED,
content::NotificationService::AllSources());
- // TODO(jamescook): Move observation of NOTIFICATION_PROFILE_DESTROYED here.
- // http://crbug.com/392658
+ registrar_.Add(this,
+ chrome::NOTIFICATION_PROFILE_DESTROYED,
+ content::NotificationService::AllSources());
}
ChromeProcessManagerDelegate::~ChromeProcessManagerDelegate() {
@@ -85,7 +86,11 @@ void ChromeProcessManagerDelegate::Observe(
OnProfileCreated(profile);
break;
}
-
+ case chrome::NOTIFICATION_PROFILE_DESTROYED: {
+ Profile* profile = content::Source<Profile>(source).ptr();
+ OnProfileDestroyed(profile);
+ break;
+ }
default:
NOTREACHED();
}
@@ -140,4 +145,24 @@ void ChromeProcessManagerDelegate::OnProfileCreated(Profile* profile) {
manager->MaybeCreateStartupBackgroundHosts();
}
+void ChromeProcessManagerDelegate::OnProfileDestroyed(Profile* profile) {
+ // Close background hosts when the last profile is closed so that they
+ // have time to shutdown various objects on different threads. The
+ // ProfileManager destructor is called too late in the shutdown sequence.
+ // http://crbug.com/15708
+ ProcessManager* manager = ExtensionSystem::Get(profile)->process_manager();
+ if (manager)
+ manager->CloseBackgroundHosts();
+
+ // If this profile owns an incognito profile then close the incognito
James Cook 2014/07/24 18:27:54 This mimics the behavior of the existing code (spe
Yoyo Zhou 2014/07/24 20:25:01 From the CL that added this, I wrote (which happe
James Cook 2014/07/24 21:02:35 Done.
+ // background hosts as well. http://crbug.com/138843
+ if (!profile->IsOffTheRecord() && profile->HasOffTheRecordProfile()) {
+ ProcessManager* incognito_manager =
+ ExtensionSystem::Get(profile->GetOffTheRecordProfile())
+ ->process_manager();
+ if (incognito_manager)
+ incognito_manager->CloseBackgroundHosts();
+ }
+}
+
} // namespace extensions

Powered by Google App Engine
This is Rietveld 408576698