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

Unified Diff: chrome/browser/lifetime/application_lifetime.cc

Issue 1839453002: Move use of ShutdownWatcherHelper after early return (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: moar Created 4 years, 9 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 | « PRESUBMIT.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/lifetime/application_lifetime.cc
diff --git a/chrome/browser/lifetime/application_lifetime.cc b/chrome/browser/lifetime/application_lifetime.cc
index c734162d2c165249ccac25dfe06a3408ecb0e49a..8bd06e9b4f849582328e480af9eaeb6a9b5fc656 100644
--- a/chrome/browser/lifetime/application_lifetime.cc
+++ b/chrome/browser/lifetime/application_lifetime.cc
@@ -247,12 +247,6 @@ void SessionEnding() {
// disk as we can as soon as we can, and where we must kill the
// process within a hang timeout to avoid user prompts.
- // Start watching for hang during shutdown, and crash it if takes too long.
- // We disarm when |shutdown_watcher| object is destroyed, which is when we
- // exit this function.
- ShutdownWatcherHelper shutdown_watcher;
- shutdown_watcher.Arm(base::TimeDelta::FromSeconds(90));
-
// EndSession is invoked once per frame. Only do something the first time.
static bool already_ended = false;
// We may get called in the middle of shutdown, e.g. http://crbug.com/70852
@@ -261,6 +255,17 @@ void SessionEnding() {
return;
already_ended = true;
+ // ~ShutdownWatcherHelper uses IO (it joins a thread). We'll only trigger that
+ // if Terminate() fails, which leaves us in a weird state, or the OS is going
+ // to kill us soon. Either way we don't care about that here.
+ base::ThreadRestrictions::ScopedAllowIO allow_io;
+
+ // Start watching for hang during shutdown, and crash it if takes too long.
+ // We disarm when |shutdown_watcher| object is destroyed, which is when we
+ // exit this function.
+ ShutdownWatcherHelper shutdown_watcher;
+ shutdown_watcher.Arm(base::TimeDelta::FromSeconds(90));
+
browser_shutdown::OnShutdownStarting(browser_shutdown::END_SESSION);
content::NotificationService::current()->Notify(
« no previous file with comments | « PRESUBMIT.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698