| 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/pref_names.h" | 31 #include "chrome/common/pref_names.h" |
| 32 #include "chrome/common/switch_utils.h" | 32 #include "chrome/common/switch_utils.h" |
| 33 #include "components/metrics/metrics_service.h" | 33 #include "components/metrics/metrics_service.h" |
| 34 #include "components/prefs/pref_registry_simple.h" | 34 #include "components/prefs/pref_registry_simple.h" |
| 35 #include "components/prefs/pref_service.h" | 35 #include "components/prefs/pref_service.h" |
| 36 #include "components/tracing/common/tracing_switches.h" | 36 #include "components/tracing/common/tracing_switches.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/tracing_controller.h" | 39 #include "content/public/browser/tracing_controller.h" |
| 40 #include "printing/features/features.h" | 40 #include "printing/features/features.h" |
| 41 #include "rlz/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 BUILDFLAG(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 BUILDFLAG(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 |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 ProfileMetrics::LogNumberOfProfileSwitches(); | 169 ProfileMetrics::LogNumberOfProfileSwitches(); |
| 169 | 170 |
| 170 metrics::MetricsService* metrics = g_browser_process->metrics_service(); | 171 metrics::MetricsService* metrics = g_browser_process->metrics_service(); |
| 171 if (metrics) | 172 if (metrics) |
| 172 metrics->RecordCompletedSessionEnd(); | 173 metrics->RecordCompletedSessionEnd(); |
| 173 | 174 |
| 174 bool restart_last_session = RecordShutdownInfoPrefs(); | 175 bool restart_last_session = RecordShutdownInfoPrefs(); |
| 175 | 176 |
| 176 prefs->CommitPendingWrite(); | 177 prefs->CommitPendingWrite(); |
| 177 | 178 |
| 178 #if defined(ENABLE_RLZ) | 179 #if BUILDFLAG(ENABLE_RLZ) |
| 179 // Cleanup any statics created by RLZ. Must be done before NotificationService | 180 // Cleanup any statics created by RLZ. Must be done before NotificationService |
| 180 // is destroyed. | 181 // is destroyed. |
| 181 rlz::RLZTracker::CleanupRlz(); | 182 rlz::RLZTracker::CleanupRlz(); |
| 182 #endif | 183 #endif |
| 183 | 184 |
| 184 return restart_last_session; | 185 return restart_last_session; |
| 185 } | 186 } |
| 186 | 187 |
| 187 bool RecordShutdownInfoPrefs() { | 188 bool RecordShutdownInfoPrefs() { |
| 188 PrefService* prefs = g_browser_process->local_state(); | 189 PrefService* prefs = g_browser_process->local_state(); |
| (...skipping 189 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 |