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 updates the | |
312 // pref with the value. However, here the process is going to exit without | |
313 // calling ShutdownPreThreadsStop. | |
314 // Instead, here we update the pref to record the shutdown info. | |
315 g_browser_process->local_state()->SetInteger(prefs::kShutdownType, | |
sky
2016/09/09 15:40:56
There is a bunch of other stuff ShutdownPreThreads
hashimoto
2016/09/12 05:10:19
Added a new function RecordShutdownInfoPrefs to br
| |
316 browser_shutdown::END_SESSION); | |
317 | |
310 content::NotificationService::current()->Notify( | 318 content::NotificationService::current()->Notify( |
311 chrome::NOTIFICATION_CLOSE_ALL_BROWSERS_REQUEST, | 319 chrome::NOTIFICATION_CLOSE_ALL_BROWSERS_REQUEST, |
312 content::NotificationService::AllSources(), | 320 content::NotificationService::AllSources(), |
313 content::NotificationService::NoDetails()); | 321 content::NotificationService::NoDetails()); |
314 | 322 |
315 // Write important data first. | 323 // Write important data first. |
316 g_browser_process->EndSession(); | 324 g_browser_process->EndSession(); |
317 | 325 |
318 #if defined(OS_WIN) | 326 #if defined(OS_WIN) |
319 base::win::SetShouldCrashOnProcessDetach(false); | 327 base::win::SetShouldCrashOnProcessDetach(false); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
390 void OnAppExiting() { | 398 void OnAppExiting() { |
391 static bool notified = false; | 399 static bool notified = false; |
392 if (notified) | 400 if (notified) |
393 return; | 401 return; |
394 notified = true; | 402 notified = true; |
395 HandleAppExitingForPlatform(); | 403 HandleAppExitingForPlatform(); |
396 } | 404 } |
397 #endif // !defined(OS_ANDROID) | 405 #endif // !defined(OS_ANDROID) |
398 | 406 |
399 } // namespace chrome | 407 } // namespace chrome |
OLD | NEW |