| 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/browser_shutdown.h" | 5 #include "chrome/browser/browser_shutdown.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/file_util.h" | 12 #include "base/file_util.h" |
| 13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
| 14 #include "base/metrics/histogram.h" | 14 #include "base/metrics/histogram.h" |
| 15 #include "base/path_service.h" | 15 #include "base/path_service.h" |
| 16 #include "base/prefs/pref_registry_simple.h" | 16 #include "base/prefs/pref_registry_simple.h" |
| 17 #include "base/prefs/pref_service.h" | 17 #include "base/prefs/pref_service.h" |
| 18 #include "base/strings/string_number_conversions.h" | 18 #include "base/strings/string_number_conversions.h" |
| 19 #include "base/strings/stringprintf.h" | 19 #include "base/strings/stringprintf.h" |
| 20 #include "base/threading/thread.h" | 20 #include "base/threading/thread.h" |
| 21 #include "base/time/time.h" | 21 #include "base/time/time.h" |
| 22 #include "chrome/browser/about_flags.h" | 22 #include "chrome/browser/about_flags.h" |
| 23 #include "chrome/browser/browser_process.h" | 23 #include "chrome/browser/browser_process.h" |
| 24 #include "chrome/browser/first_run/upgrade_util.h" | 24 #include "chrome/browser/first_run/upgrade_util.h" |
| 25 #include "chrome/browser/jankometer.h" | |
| 26 #include "chrome/browser/lifetime/application_lifetime.h" | 25 #include "chrome/browser/lifetime/application_lifetime.h" |
| 27 #include "chrome/browser/profiles/profile_manager.h" | 26 #include "chrome/browser/profiles/profile_manager.h" |
| 28 #include "chrome/browser/service_process/service_process_control.h" | 27 #include "chrome/browser/service_process/service_process_control.h" |
| 29 #include "chrome/common/chrome_paths.h" | 28 #include "chrome/common/chrome_paths.h" |
| 30 #include "chrome/common/chrome_switches.h" | 29 #include "chrome/common/chrome_switches.h" |
| 31 #include "chrome/common/crash_keys.h" | 30 #include "chrome/common/crash_keys.h" |
| 32 #include "chrome/common/pref_names.h" | 31 #include "chrome/common/pref_names.h" |
| 33 #include "chrome/common/switch_utils.h" | 32 #include "chrome/common/switch_utils.h" |
| 34 #include "components/metrics/metrics_service.h" | 33 #include "components/metrics/metrics_service.h" |
| 35 #include "content/public/browser/browser_thread.h" | 34 #include "content/public/browser/browser_thread.h" |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 #if defined(ENABLE_RLZ) | 184 #if defined(ENABLE_RLZ) |
| 186 // Cleanup any statics created by RLZ. Must be done before NotificationService | 185 // Cleanup any statics created by RLZ. Must be done before NotificationService |
| 187 // is destroyed. | 186 // is destroyed. |
| 188 RLZTracker::CleanupRlz(); | 187 RLZTracker::CleanupRlz(); |
| 189 #endif | 188 #endif |
| 190 | 189 |
| 191 return restart_last_session; | 190 return restart_last_session; |
| 192 } | 191 } |
| 193 | 192 |
| 194 void ShutdownPostThreadsStop(bool restart_last_session) { | 193 void ShutdownPostThreadsStop(bool restart_last_session) { |
| 195 // The jank'o'meter requires that the browser process has been destroyed | |
| 196 // before calling UninstallJankometer(). | |
| 197 delete g_browser_process; | 194 delete g_browser_process; |
| 198 g_browser_process = NULL; | 195 g_browser_process = NULL; |
| 199 | 196 |
| 200 // crbug.com/95079 - This needs to happen after the browser process object | 197 // crbug.com/95079 - This needs to happen after the browser process object |
| 201 // goes away. | 198 // goes away. |
| 202 ProfileManager::NukeDeletedProfilesFromDisk(); | 199 ProfileManager::NukeDeletedProfilesFromDisk(); |
| 203 | 200 |
| 204 #if defined(OS_CHROMEOS) | 201 #if defined(OS_CHROMEOS) |
| 205 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("BrowserDeleted", | 202 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("BrowserDeleted", |
| 206 true); | 203 true); |
| 207 #endif | 204 #endif |
| 208 | 205 |
| 209 // Uninstall Jank-O-Meter here after the IO thread is no longer running. | |
| 210 UninstallJankometer(); | |
| 211 | |
| 212 #if defined(OS_WIN) | 206 #if defined(OS_WIN) |
| 213 if (!browser_util::IsBrowserAlreadyRunning() && | 207 if (!browser_util::IsBrowserAlreadyRunning() && |
| 214 shutdown_type_ != browser_shutdown::END_SESSION) { | 208 shutdown_type_ != browser_shutdown::END_SESSION) { |
| 215 upgrade_util::SwapNewChromeExeIfPresent(); | 209 upgrade_util::SwapNewChromeExeIfPresent(); |
| 216 } | 210 } |
| 217 #endif | 211 #endif |
| 218 | 212 |
| 219 if (restart_last_session) { | 213 if (restart_last_session) { |
| 220 #if !defined(OS_CHROMEOS) | 214 #if !defined(OS_CHROMEOS) |
| 221 // Make sure to relaunch the browser with the original command line plus | 215 // Make sure to relaunch the browser with the original command line plus |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 | 327 |
| 334 void SetTryingToQuit(bool quitting) { | 328 void SetTryingToQuit(bool quitting) { |
| 335 g_trying_to_quit = quitting; | 329 g_trying_to_quit = quitting; |
| 336 } | 330 } |
| 337 | 331 |
| 338 bool IsTryingToQuit() { | 332 bool IsTryingToQuit() { |
| 339 return g_trying_to_quit; | 333 return g_trying_to_quit; |
| 340 } | 334 } |
| 341 | 335 |
| 342 } // namespace browser_shutdown | 336 } // namespace browser_shutdown |
| OLD | NEW |