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_path.h" | 12 #include "base/file_path.h" |
13 #include "base/file_util.h" | 13 #include "base/file_util.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/process_util.h" | 16 #include "base/process_util.h" |
17 #include "base/string_number_conversions.h" | 17 #include "base/string_number_conversions.h" |
18 #include "base/stringprintf.h" | 18 #include "base/stringprintf.h" |
19 #include "base/threading/thread.h" | 19 #include "base/threading/thread.h" |
20 #include "base/threading/thread_restrictions.h" | 20 #include "base/threading/thread_restrictions.h" |
21 #include "base/time.h" | 21 #include "base/time.h" |
22 #include "build/build_config.h" | 22 #include "build/build_config.h" |
23 #include "chrome/browser/about_flags.h" | 23 #include "chrome/browser/about_flags.h" |
24 #include "chrome/browser/browser_process.h" | 24 #include "chrome/browser/browser_process.h" |
25 #include "chrome/browser/first_run/upgrade_util.h" | 25 #include "chrome/browser/first_run/upgrade_util.h" |
26 #include "chrome/browser/jankometer.h" | 26 #include "chrome/browser/jankometer.h" |
| 27 #include "chrome/browser/lifetime/application_lifetime.h" |
27 #include "chrome/browser/metrics/metrics_service.h" | 28 #include "chrome/browser/metrics/metrics_service.h" |
28 #include "chrome/browser/prefs/pref_service.h" | 29 #include "chrome/browser/prefs/pref_service.h" |
29 #include "chrome/browser/profiles/profile_manager.h" | 30 #include "chrome/browser/profiles/profile_manager.h" |
30 #include "chrome/browser/service/service_process_control.h" | 31 #include "chrome/browser/service/service_process_control.h" |
31 #include "chrome/browser/ui/browser_list.h" | |
32 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" | 32 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" |
33 #include "chrome/common/chrome_paths.h" | 33 #include "chrome/common/chrome_paths.h" |
34 #include "chrome/common/chrome_switches.h" | 34 #include "chrome/common/chrome_switches.h" |
35 #include "chrome/common/pref_names.h" | 35 #include "chrome/common/pref_names.h" |
36 #include "chrome/common/switch_utils.h" | 36 #include "chrome/common/switch_utils.h" |
37 #include "content/public/browser/browser_thread.h" | 37 #include "content/public/browser/browser_thread.h" |
38 #include "content/public/browser/render_process_host.h" | 38 #include "content/public/browser/render_process_host.h" |
39 #include "content/public/browser/render_view_host.h" | 39 #include "content/public/browser/render_view_host.h" |
40 #include "ui/base/resource/resource_bundle.h" | 40 #include "ui/base/resource/resource_bundle.h" |
41 | 41 |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 // We can't use prefs since all services are shutdown at this point. | 232 // We can't use prefs since all services are shutdown at this point. |
233 TimeDelta shutdown_delta = Time::Now() - *shutdown_started_; | 233 TimeDelta shutdown_delta = Time::Now() - *shutdown_started_; |
234 std::string shutdown_ms = | 234 std::string shutdown_ms = |
235 base::Int64ToString(shutdown_delta.InMilliseconds()); | 235 base::Int64ToString(shutdown_delta.InMilliseconds()); |
236 int len = static_cast<int>(shutdown_ms.length()) + 1; | 236 int len = static_cast<int>(shutdown_ms.length()) + 1; |
237 FilePath shutdown_ms_file = GetShutdownMsPath(); | 237 FilePath shutdown_ms_file = GetShutdownMsPath(); |
238 file_util::WriteFile(shutdown_ms_file, shutdown_ms.c_str(), len); | 238 file_util::WriteFile(shutdown_ms_file, shutdown_ms.c_str(), len); |
239 } | 239 } |
240 | 240 |
241 #if defined(OS_CHROMEOS) | 241 #if defined(OS_CHROMEOS) |
242 BrowserList::NotifyAndTerminate(false); | 242 browser::NotifyAndTerminate(false); |
243 #endif | 243 #endif |
244 | 244 |
245 ChromeURLDataManager::DeleteDataSources(); | 245 ChromeURLDataManager::DeleteDataSources(); |
246 } | 246 } |
247 | 247 |
248 void ReadLastShutdownFile( | 248 void ReadLastShutdownFile( |
249 ShutdownType type, | 249 ShutdownType type, |
250 int num_procs, | 250 int num_procs, |
251 int num_procs_slow) { | 251 int num_procs_slow) { |
252 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 252 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 | 317 |
318 bool ShuttingDownWithoutClosingBrowsers() { | 318 bool ShuttingDownWithoutClosingBrowsers() { |
319 return g_shutting_down_without_closing_browsers; | 319 return g_shutting_down_without_closing_browsers; |
320 } | 320 } |
321 | 321 |
322 void SetShuttingDownWithoutClosingBrowsers(bool without_close) { | 322 void SetShuttingDownWithoutClosingBrowsers(bool without_close) { |
323 g_shutting_down_without_closing_browsers = without_close; | 323 g_shutting_down_without_closing_browsers = without_close; |
324 } | 324 } |
325 | 325 |
326 } // namespace browser_shutdown | 326 } // namespace browser_shutdown |
OLD | NEW |