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/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/file_path.h" | 11 #include "base/file_path.h" |
12 #include "base/file_util.h" | 12 #include "base/file_util.h" |
13 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
14 #include "base/path_service.h" | 14 #include "base/path_service.h" |
15 #include "base/process_util.h" | 15 #include "base/process_util.h" |
16 #include "base/stringprintf.h" | 16 #include "base/stringprintf.h" |
17 #include "base/string_number_conversions.h" | 17 #include "base/string_number_conversions.h" |
18 #include "base/threading/thread.h" | 18 #include "base/threading/thread.h" |
19 #include "base/threading/thread_restrictions.h" | 19 #include "base/threading/thread_restrictions.h" |
20 #include "base/time.h" | 20 #include "base/time.h" |
21 #include "build/build_config.h" | 21 #include "build/build_config.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" | 25 #include "chrome/browser/jankometer.h" |
26 #include "chrome/browser/metrics/metrics_service.h" | 26 #include "chrome/browser/metrics/metrics_service.h" |
27 #include "chrome/browser/plugin_updater.h" | |
28 #include "chrome/browser/prefs/pref_service.h" | 27 #include "chrome/browser/prefs/pref_service.h" |
29 #include "chrome/browser/profiles/profile_manager.h" | 28 #include "chrome/browser/profiles/profile_manager.h" |
30 #include "chrome/browser/service/service_process_control.h" | 29 #include "chrome/browser/service/service_process_control.h" |
31 #include "chrome/browser/ui/browser_list.h" | 30 #include "chrome/browser/ui/browser_list.h" |
32 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" | 31 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" |
33 #include "chrome/common/chrome_paths.h" | 32 #include "chrome/common/chrome_paths.h" |
34 #include "chrome/common/chrome_switches.h" | 33 #include "chrome/common/chrome_switches.h" |
35 #include "chrome/common/pref_names.h" | 34 #include "chrome/common/pref_names.h" |
36 #include "chrome/common/switch_utils.h" | 35 #include "chrome/common/switch_utils.h" |
37 #include "content/browser/browser_thread.h" | 36 #include "content/browser/browser_thread.h" |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 | 138 |
140 // WARNING: During logoff/shutdown (WM_ENDSESSION) we may not have enough | 139 // WARNING: During logoff/shutdown (WM_ENDSESSION) we may not have enough |
141 // time to get here. If you have something that *must* happen on end session, | 140 // time to get here. If you have something that *must* happen on end session, |
142 // consider putting it in BrowserProcessImpl::EndSession. | 141 // consider putting it in BrowserProcessImpl::EndSession. |
143 PrefService* prefs = g_browser_process->local_state(); | 142 PrefService* prefs = g_browser_process->local_state(); |
144 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 143 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
145 PrefService* user_prefs = profile_manager->GetDefaultProfile()->GetPrefs(); | 144 PrefService* user_prefs = profile_manager->GetDefaultProfile()->GetPrefs(); |
146 | 145 |
147 chrome_browser_net::SavePredictorStateForNextStartupAndTrim(user_prefs); | 146 chrome_browser_net::SavePredictorStateForNextStartupAndTrim(user_prefs); |
148 | 147 |
149 PluginUpdater::GetInstance()->Shutdown(); | |
150 | |
151 MetricsService* metrics = g_browser_process->metrics_service(); | 148 MetricsService* metrics = g_browser_process->metrics_service(); |
152 if (metrics) | 149 if (metrics) |
153 metrics->RecordCompletedSessionEnd(); | 150 metrics->RecordCompletedSessionEnd(); |
154 | 151 |
155 if (shutdown_type_ > NOT_VALID && shutdown_num_processes_ > 0) { | 152 if (shutdown_type_ > NOT_VALID && shutdown_num_processes_ > 0) { |
156 // Record the shutdown info so that we can put it into a histogram at next | 153 // Record the shutdown info so that we can put it into a histogram at next |
157 // startup. | 154 // startup. |
158 prefs->SetInteger(prefs::kShutdownType, shutdown_type_); | 155 prefs->SetInteger(prefs::kShutdownType, shutdown_type_); |
159 prefs->SetInteger(prefs::kShutdownNumProcesses, shutdown_num_processes_); | 156 prefs->SetInteger(prefs::kShutdownNumProcesses, shutdown_num_processes_); |
160 prefs->SetInteger(prefs::kShutdownNumProcessesSlow, | 157 prefs->SetInteger(prefs::kShutdownNumProcessesSlow, |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 | 323 |
327 bool ShuttingDownWithoutClosingBrowsers() { | 324 bool ShuttingDownWithoutClosingBrowsers() { |
328 #if defined(USE_X11) | 325 #if defined(USE_X11) |
329 if (GetShutdownType() == browser_shutdown::END_SESSION) | 326 if (GetShutdownType() == browser_shutdown::END_SESSION) |
330 return true; | 327 return true; |
331 #endif | 328 #endif |
332 return false; | 329 return false; |
333 } | 330 } |
334 | 331 |
335 } // namespace browser_shutdown | 332 } // namespace browser_shutdown |
OLD | NEW |