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

Unified Diff: chrome/browser/tab_contents/background_contents.cc

Issue 2866034: Refactor shutdown code to allow win/linux to run after last browser closes. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Uploaded patch that resolves merge issue Created 10 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
« no previous file with comments | « chrome/browser/profile_manager.cc ('k') | chrome/common/chrome_switches.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/tab_contents/background_contents.cc
diff --git a/chrome/browser/tab_contents/background_contents.cc b/chrome/browser/tab_contents/background_contents.cc
index 2e65d9d63668d71791ce8fdfd5424bdcf56d73b6..f8c466dec4b83b06e8e7ba324f17ff044623c311 100644
--- a/chrome/browser/tab_contents/background_contents.cc
+++ b/chrome/browser/tab_contents/background_contents.cc
@@ -34,8 +34,13 @@ BackgroundContents::BackgroundContents(SiteInstance* site_instance,
session_storage_namespace_id);
render_view_host_->AllowScriptToClose(true);
+ // Close ourselves when the application is shutting down.
+ registrar_.Add(this, NotificationType::APP_TERMINATING,
+ NotificationService::AllSources());
+
// Register for our parent profile to shutdown, so we can shut ourselves down
- // as well.
+ // as well (should only be called for OTR profiles, as we should receive
+ // APP_TERMINATING before non-OTR profiles are destroyed).
registrar_.Add(this, NotificationType::PROFILE_DESTROYED,
Source<Profile>(profile));
}
@@ -51,7 +56,8 @@ void BackgroundContents::Observe(NotificationType type,
// TODO(rafaelw): Implement pagegroup ref-counting so that non-persistent
// background pages are closed when the last referencing frame is closed.
switch (type.value) {
- case NotificationType::PROFILE_DESTROYED: {
+ case NotificationType::PROFILE_DESTROYED:
+ case NotificationType::APP_TERMINATING: {
delete this;
break;
}
« no previous file with comments | « chrome/browser/profile_manager.cc ('k') | chrome/common/chrome_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698