| 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 <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 #include "chrome/common/crash_keys.h" | 31 #include "chrome/common/crash_keys.h" |
| 32 #include "chrome/common/pref_names.h" | 32 #include "chrome/common/pref_names.h" |
| 33 #include "chrome/common/switch_utils.h" | 33 #include "chrome/common/switch_utils.h" |
| 34 #include "components/metrics/metrics_service.h" | 34 #include "components/metrics/metrics_service.h" |
| 35 #include "components/prefs/pref_registry_simple.h" | 35 #include "components/prefs/pref_registry_simple.h" |
| 36 #include "components/prefs/pref_service.h" | 36 #include "components/prefs/pref_service.h" |
| 37 #include "components/tracing/common/tracing_switches.h" | 37 #include "components/tracing/common/tracing_switches.h" |
| 38 #include "content/public/browser/browser_thread.h" | 38 #include "content/public/browser/browser_thread.h" |
| 39 #include "content/public/browser/render_process_host.h" | 39 #include "content/public/browser/render_process_host.h" |
| 40 #include "content/public/browser/tracing_controller.h" | 40 #include "content/public/browser/tracing_controller.h" |
| 41 #include "printing/features/features.h" |
| 41 | 42 |
| 42 #if defined(OS_WIN) | 43 #if defined(OS_WIN) |
| 43 #include "chrome/browser/first_run/upgrade_util_win.h" | 44 #include "chrome/browser/first_run/upgrade_util_win.h" |
| 44 #include "chrome/browser/win/browser_util.h" | 45 #include "chrome/browser/win/browser_util.h" |
| 45 #endif | 46 #endif |
| 46 | 47 |
| 47 #if !defined(OS_ANDROID) && !defined(OS_CHROMEOS) | 48 #if !defined(OS_ANDROID) && !defined(OS_CHROMEOS) |
| 48 #include "chrome/browser/first_run/upgrade_util.h" | 49 #include "chrome/browser/first_run/upgrade_util.h" |
| 49 #endif | 50 #endif |
| 50 | 51 |
| 51 #if BUILDFLAG(ENABLE_BACKGROUND) | 52 #if BUILDFLAG(ENABLE_BACKGROUND) |
| 52 #include "chrome/browser/background/background_mode_manager.h" | 53 #include "chrome/browser/background/background_mode_manager.h" |
| 53 #endif | 54 #endif |
| 54 | 55 |
| 55 #if defined(ENABLE_RLZ) | 56 #if defined(ENABLE_RLZ) |
| 56 #include "components/rlz/rlz_tracker.h" | 57 #include "components/rlz/rlz_tracker.h" |
| 57 #endif | 58 #endif |
| 58 | 59 |
| 59 #if defined(OS_CHROMEOS) | 60 #if defined(OS_CHROMEOS) |
| 60 #include "chrome/browser/chromeos/boot_times_recorder.h" | 61 #include "chrome/browser/chromeos/boot_times_recorder.h" |
| 61 #endif | 62 #endif |
| 62 | 63 |
| 63 #if defined(ENABLE_PRINT_PREVIEW) | 64 #if BUILDFLAG(ENABLE_PRINT_PREVIEW) |
| 64 #include "chrome/browser/service_process/service_process_control.h" | 65 #include "chrome/browser/service_process/service_process_control.h" |
| 65 #endif | 66 #endif |
| 66 | 67 |
| 67 using base::Time; | 68 using base::Time; |
| 68 using base::TimeDelta; | 69 using base::TimeDelta; |
| 69 using content::BrowserThread; | 70 using content::BrowserThread; |
| 70 | 71 |
| 71 namespace browser_shutdown { | 72 namespace browser_shutdown { |
| 72 namespace { | 73 namespace { |
| 73 | 74 |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 PathService::Get(chrome::DIR_USER_DATA, &shutdown_ms_file); | 148 PathService::Get(chrome::DIR_USER_DATA, &shutdown_ms_file); |
| 148 return shutdown_ms_file.AppendASCII(kShutdownMsFile); | 149 return shutdown_ms_file.AppendASCII(kShutdownMsFile); |
| 149 } | 150 } |
| 150 | 151 |
| 151 #if !defined(OS_ANDROID) | 152 #if !defined(OS_ANDROID) |
| 152 bool ShutdownPreThreadsStop() { | 153 bool ShutdownPreThreadsStop() { |
| 153 #if defined(OS_CHROMEOS) | 154 #if defined(OS_CHROMEOS) |
| 154 chromeos::BootTimesRecorder::Get()->AddLogoutTimeMarker( | 155 chromeos::BootTimesRecorder::Get()->AddLogoutTimeMarker( |
| 155 "BrowserShutdownStarted", false); | 156 "BrowserShutdownStarted", false); |
| 156 #endif | 157 #endif |
| 157 #if defined(ENABLE_PRINT_PREVIEW) | 158 #if BUILDFLAG(ENABLE_PRINT_PREVIEW) |
| 158 // Shutdown the IPC channel to the service processes. | 159 // Shutdown the IPC channel to the service processes. |
| 159 ServiceProcessControl::GetInstance()->Disconnect(); | 160 ServiceProcessControl::GetInstance()->Disconnect(); |
| 160 #endif // ENABLE_PRINT_PREVIEW | 161 #endif // ENABLE_PRINT_PREVIEW |
| 161 | 162 |
| 162 // WARNING: During logoff/shutdown (WM_ENDSESSION) we may not have enough | 163 // WARNING: During logoff/shutdown (WM_ENDSESSION) we may not have enough |
| 163 // time to get here. If you have something that *must* happen on end session, | 164 // time to get here. If you have something that *must* happen on end session, |
| 164 // consider putting it in BrowserProcessImpl::EndSession. | 165 // consider putting it in BrowserProcessImpl::EndSession. |
| 165 PrefService* prefs = g_browser_process->local_state(); | 166 PrefService* prefs = g_browser_process->local_state(); |
| 166 | 167 |
| 167 // Log the amount of times the user switched profiles during this session. | 168 // Log the amount of times the user switched profiles during this session. |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 base::trace_event::TraceConfig trace_config( | 379 base::trace_event::TraceConfig trace_config( |
| 379 command_line.GetSwitchValueASCII(switches::kTraceShutdown), ""); | 380 command_line.GetSwitchValueASCII(switches::kTraceShutdown), ""); |
| 380 content::TracingController::GetInstance()->StartTracing( | 381 content::TracingController::GetInstance()->StartTracing( |
| 381 trace_config, | 382 trace_config, |
| 382 content::TracingController::StartTracingDoneCallback()); | 383 content::TracingController::StartTracingDoneCallback()); |
| 383 } | 384 } |
| 384 TRACE_EVENT0("shutdown", "StartShutdownTracing"); | 385 TRACE_EVENT0("shutdown", "StartShutdownTracing"); |
| 385 } | 386 } |
| 386 | 387 |
| 387 } // namespace browser_shutdown | 388 } // namespace browser_shutdown |
| OLD | NEW |