OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 17 matching lines...) Expand all Loading... |
28 #include "chrome/browser/prefs/pref_service.h" | 28 #include "chrome/browser/prefs/pref_service.h" |
29 #include "chrome/browser/profiles/profile_manager.h" | 29 #include "chrome/browser/profiles/profile_manager.h" |
30 #include "chrome/browser/service/service_process_control.h" | 30 #include "chrome/browser/service/service_process_control.h" |
31 #include "chrome/browser/ui/browser_list.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/browser/plugin_process_host.h" | 37 #include "content/browser/plugin_process_host.h" |
38 #include "content/browser/renderer_host/render_process_host.h" | |
39 #include "content/browser/renderer_host/render_view_host.h" | 38 #include "content/browser/renderer_host/render_view_host.h" |
40 #include "content/browser/renderer_host/render_widget_host.h" | 39 #include "content/browser/renderer_host/render_widget_host.h" |
41 #include "content/public/browser/browser_thread.h" | 40 #include "content/public/browser/browser_thread.h" |
| 41 #include "content/public/browser/render_process_host.h" |
42 #include "ui/base/resource/resource_bundle.h" | 42 #include "ui/base/resource/resource_bundle.h" |
43 | 43 |
44 #if defined(OS_WIN) | 44 #if defined(OS_WIN) |
45 #include "chrome/browser/browser_util_win.h" | 45 #include "chrome/browser/browser_util_win.h" |
46 #include "chrome/browser/first_run/upgrade_util_win.h" | 46 #include "chrome/browser/first_run/upgrade_util_win.h" |
47 #include "chrome/browser/rlz/rlz.h" | 47 #include "chrome/browser/rlz/rlz.h" |
48 #endif | 48 #endif |
49 | 49 |
50 #if defined(OS_CHROMEOS) | 50 #if defined(OS_CHROMEOS) |
51 #include "chrome/browser/chromeos/boot_times_loader.h" | 51 #include "chrome/browser/chromeos/boot_times_loader.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 // since we can't safely count the number of plugin processes from this | 92 // since we can't safely count the number of plugin processes from this |
93 // thread, and we'd really like to avoid anything which might add further | 93 // thread, and we'd really like to avoid anything which might add further |
94 // delays to shutdown time. | 94 // delays to shutdown time. |
95 shutdown_started_ = Time::Now(); | 95 shutdown_started_ = Time::Now(); |
96 | 96 |
97 // Call FastShutdown on all of the RenderProcessHosts. This will be | 97 // Call FastShutdown on all of the RenderProcessHosts. This will be |
98 // a no-op in some cases, so we still need to go through the normal | 98 // a no-op in some cases, so we still need to go through the normal |
99 // shutdown path for the ones that didn't exit here. | 99 // shutdown path for the ones that didn't exit here. |
100 shutdown_num_processes_ = 0; | 100 shutdown_num_processes_ = 0; |
101 shutdown_num_processes_slow_ = 0; | 101 shutdown_num_processes_slow_ = 0; |
102 for (RenderProcessHost::iterator i(RenderProcessHost::AllHostsIterator()); | 102 for (content::RenderProcessHost::iterator i( |
| 103 content::RenderProcessHost::AllHostsIterator()); |
103 !i.IsAtEnd(); i.Advance()) { | 104 !i.IsAtEnd(); i.Advance()) { |
104 ++shutdown_num_processes_; | 105 ++shutdown_num_processes_; |
105 if (!i.GetCurrentValue()->FastShutdownIfPossible()) | 106 if (!i.GetCurrentValue()->FastShutdownIfPossible()) |
106 ++shutdown_num_processes_slow_; | 107 ++shutdown_num_processes_slow_; |
107 } | 108 } |
108 } | 109 } |
109 | 110 |
110 FilePath GetShutdownMsPath() { | 111 FilePath GetShutdownMsPath() { |
111 FilePath shutdown_ms_file; | 112 FilePath shutdown_ms_file; |
112 PathService::Get(chrome::DIR_USER_DATA, &shutdown_ms_file); | 113 PathService::Get(chrome::DIR_USER_DATA, &shutdown_ms_file); |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 | 315 |
315 bool ShuttingDownWithoutClosingBrowsers() { | 316 bool ShuttingDownWithoutClosingBrowsers() { |
316 return g_shutting_down_without_closing_browsers; | 317 return g_shutting_down_without_closing_browsers; |
317 } | 318 } |
318 | 319 |
319 void SetShuttingDownWithoutClosingBrowsers(bool without_close) { | 320 void SetShuttingDownWithoutClosingBrowsers(bool without_close) { |
320 g_shutting_down_without_closing_browsers = without_close; | 321 g_shutting_down_without_closing_browsers = without_close; |
321 } | 322 } |
322 | 323 |
323 } // namespace browser_shutdown | 324 } // namespace browser_shutdown |
OLD | NEW |