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" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 bool g_trying_to_quit = false; | 63 bool g_trying_to_quit = false; |
64 | 64 |
65 // Whether the browser should quit without closing browsers. | 65 // Whether the browser should quit without closing browsers. |
66 bool g_shutting_down_without_closing_browsers = false; | 66 bool g_shutting_down_without_closing_browsers = false; |
67 | 67 |
68 Time* shutdown_started_ = NULL; | 68 Time* shutdown_started_ = NULL; |
69 ShutdownType shutdown_type_ = NOT_VALID; | 69 ShutdownType shutdown_type_ = NOT_VALID; |
70 int shutdown_num_processes_; | 70 int shutdown_num_processes_; |
71 int shutdown_num_processes_slow_; | 71 int shutdown_num_processes_slow_; |
72 | 72 |
73 bool delete_resources_on_shutdown = true; | |
74 | |
75 const char kShutdownMsFile[] = "chrome_shutdown_ms.txt"; | 73 const char kShutdownMsFile[] = "chrome_shutdown_ms.txt"; |
76 | 74 |
77 void RegisterPrefs(PrefService* local_state) { | 75 void RegisterPrefs(PrefService* local_state) { |
78 local_state->RegisterIntegerPref(prefs::kShutdownType, NOT_VALID); | 76 local_state->RegisterIntegerPref(prefs::kShutdownType, NOT_VALID); |
79 local_state->RegisterIntegerPref(prefs::kShutdownNumProcesses, 0); | 77 local_state->RegisterIntegerPref(prefs::kShutdownNumProcesses, 0); |
80 local_state->RegisterIntegerPref(prefs::kShutdownNumProcessesSlow, 0); | 78 local_state->RegisterIntegerPref(prefs::kShutdownNumProcessesSlow, 0); |
81 } | 79 } |
82 | 80 |
83 ShutdownType GetShutdownType() { | 81 ShutdownType GetShutdownType() { |
84 return shutdown_type_; | 82 return shutdown_type_; |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 ProfileManager::NukeDeletedProfilesFromDisk(); | 171 ProfileManager::NukeDeletedProfilesFromDisk(); |
174 | 172 |
175 #if defined(OS_CHROMEOS) | 173 #if defined(OS_CHROMEOS) |
176 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("BrowserDeleted", | 174 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("BrowserDeleted", |
177 true); | 175 true); |
178 #endif | 176 #endif |
179 | 177 |
180 // Uninstall Jank-O-Meter here after the IO thread is no longer running. | 178 // Uninstall Jank-O-Meter here after the IO thread is no longer running. |
181 UninstallJankometer(); | 179 UninstallJankometer(); |
182 | 180 |
183 if (delete_resources_on_shutdown) | |
184 ResourceBundle::CleanupSharedInstance(); | |
185 | |
186 #if defined(OS_WIN) | 181 #if defined(OS_WIN) |
187 if (!browser_util::IsBrowserAlreadyRunning() && | 182 if (!browser_util::IsBrowserAlreadyRunning() && |
188 shutdown_type_ != browser_shutdown::END_SESSION) { | 183 shutdown_type_ != browser_shutdown::END_SESSION) { |
189 upgrade_util::SwapNewChromeExeIfPresent(); | 184 upgrade_util::SwapNewChromeExeIfPresent(); |
190 } | 185 } |
191 #endif | 186 #endif |
192 | 187 |
193 if (restart_last_session) { | 188 if (restart_last_session) { |
194 #if !defined(OS_CHROMEOS) | 189 #if !defined(OS_CHROMEOS) |
195 // Make sure to relaunch the browser with the original command line plus | 190 // Make sure to relaunch the browser with the original command line plus |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 | 307 |
313 bool ShuttingDownWithoutClosingBrowsers() { | 308 bool ShuttingDownWithoutClosingBrowsers() { |
314 return g_shutting_down_without_closing_browsers; | 309 return g_shutting_down_without_closing_browsers; |
315 } | 310 } |
316 | 311 |
317 void SetShuttingDownWithoutClosingBrowsers(bool without_close) { | 312 void SetShuttingDownWithoutClosingBrowsers(bool without_close) { |
318 g_shutting_down_without_closing_browsers = without_close; | 313 g_shutting_down_without_closing_browsers = without_close; |
319 } | 314 } |
320 | 315 |
321 } // namespace browser_shutdown | 316 } // namespace browser_shutdown |
OLD | NEW |