OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/lifetime/application_lifetime.h" | 5 #include "chrome/browser/lifetime/application_lifetime.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #if defined(OS_WIN) | 9 #if defined(OS_WIN) |
10 #include <windows.h> | 10 #include <windows.h> |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 base::ThreadRestrictions::ScopedAllowIO allow_io; | 300 base::ThreadRestrictions::ScopedAllowIO allow_io; |
301 | 301 |
302 // Start watching for hang during shutdown, and crash it if takes too long. | 302 // Start watching for hang during shutdown, and crash it if takes too long. |
303 // We disarm when |shutdown_watcher| object is destroyed, which is when we | 303 // We disarm when |shutdown_watcher| object is destroyed, which is when we |
304 // exit this function. | 304 // exit this function. |
305 ShutdownWatcherHelper shutdown_watcher; | 305 ShutdownWatcherHelper shutdown_watcher; |
306 shutdown_watcher.Arm(base::TimeDelta::FromSeconds(90)); | 306 shutdown_watcher.Arm(base::TimeDelta::FromSeconds(90)); |
307 | 307 |
308 browser_shutdown::OnShutdownStarting(browser_shutdown::END_SESSION); | 308 browser_shutdown::OnShutdownStarting(browser_shutdown::END_SESSION); |
309 | 309 |
| 310 // In a clean shutdown, browser_shutdown::OnShutdownStarting sets |
| 311 // g_shutdown_type, and browser_shutdown::ShutdownPreThreadsStop calls |
| 312 // RecordShutdownInfoPrefs to update the pref with the value. However, here |
| 313 // the process is going to exit without calling ShutdownPreThreadsStop. |
| 314 // Instead, here we call RecordShutdownInfoPrefs to record the shutdown info. |
| 315 browser_shutdown::RecordShutdownInfoPrefs(); |
| 316 |
310 content::NotificationService::current()->Notify( | 317 content::NotificationService::current()->Notify( |
311 chrome::NOTIFICATION_CLOSE_ALL_BROWSERS_REQUEST, | 318 chrome::NOTIFICATION_CLOSE_ALL_BROWSERS_REQUEST, |
312 content::NotificationService::AllSources(), | 319 content::NotificationService::AllSources(), |
313 content::NotificationService::NoDetails()); | 320 content::NotificationService::NoDetails()); |
314 | 321 |
315 // Write important data first. | 322 // Write important data first. |
316 g_browser_process->EndSession(); | 323 g_browser_process->EndSession(); |
317 | 324 |
318 #if defined(OS_WIN) | 325 #if defined(OS_WIN) |
319 base::win::SetShouldCrashOnProcessDetach(false); | 326 base::win::SetShouldCrashOnProcessDetach(false); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 void OnAppExiting() { | 397 void OnAppExiting() { |
391 static bool notified = false; | 398 static bool notified = false; |
392 if (notified) | 399 if (notified) |
393 return; | 400 return; |
394 notified = true; | 401 notified = true; |
395 HandleAppExitingForPlatform(); | 402 HandleAppExitingForPlatform(); |
396 } | 403 } |
397 #endif // !defined(OS_ANDROID) | 404 #endif // !defined(OS_ANDROID) |
398 | 405 |
399 } // namespace chrome | 406 } // namespace chrome |
OLD | NEW |