Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Side by Side Diff: chrome/browser/browser_shutdown.cc

Issue 844193005: Add UMA metrics for profile switching. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/files/file_path.h" 12 #include "base/files/file_path.h"
13 #include "base/files/file_util.h" 13 #include "base/files/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/prefs/pref_registry_simple.h" 16 #include "base/prefs/pref_registry_simple.h"
17 #include "base/prefs/pref_service.h" 17 #include "base/prefs/pref_service.h"
18 #include "base/strings/string_number_conversions.h" 18 #include "base/strings/string_number_conversions.h"
19 #include "base/strings/stringprintf.h" 19 #include "base/strings/stringprintf.h"
20 #include "base/threading/thread.h" 20 #include "base/threading/thread.h"
21 #include "base/time/time.h" 21 #include "base/time/time.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/lifetime/application_lifetime.h" 25 #include "chrome/browser/lifetime/application_lifetime.h"
26 #include "chrome/browser/profiles/profile_manager.h" 26 #include "chrome/browser/profiles/profile_manager.h"
27 #include "chrome/browser/profiles/profile_metrics.h"
27 #include "chrome/common/chrome_paths.h" 28 #include "chrome/common/chrome_paths.h"
28 #include "chrome/common/chrome_switches.h" 29 #include "chrome/common/chrome_switches.h"
29 #include "chrome/common/crash_keys.h" 30 #include "chrome/common/crash_keys.h"
30 #include "chrome/common/pref_names.h" 31 #include "chrome/common/pref_names.h"
31 #include "chrome/common/switch_utils.h" 32 #include "chrome/common/switch_utils.h"
32 #include "components/metrics/metrics_service.h" 33 #include "components/metrics/metrics_service.h"
33 #include "content/public/browser/browser_thread.h" 34 #include "content/public/browser/browser_thread.h"
34 #include "content/public/browser/render_process_host.h" 35 #include "content/public/browser/render_process_host.h"
35 36
36 #if defined(OS_WIN) 37 #if defined(OS_WIN)
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 #if defined(ENABLE_PRINT_PREVIEW) 147 #if defined(ENABLE_PRINT_PREVIEW)
147 // Shutdown the IPC channel to the service processes. 148 // Shutdown the IPC channel to the service processes.
148 ServiceProcessControl::GetInstance()->Disconnect(); 149 ServiceProcessControl::GetInstance()->Disconnect();
149 #endif // ENABLE_PRINT_PREVIEW 150 #endif // ENABLE_PRINT_PREVIEW
150 151
151 // WARNING: During logoff/shutdown (WM_ENDSESSION) we may not have enough 152 // WARNING: During logoff/shutdown (WM_ENDSESSION) we may not have enough
152 // time to get here. If you have something that *must* happen on end session, 153 // time to get here. If you have something that *must* happen on end session,
153 // consider putting it in BrowserProcessImpl::EndSession. 154 // consider putting it in BrowserProcessImpl::EndSession.
154 PrefService* prefs = g_browser_process->local_state(); 155 PrefService* prefs = g_browser_process->local_state();
155 156
157 //Log the amount of times the user switched profiles during this session
Mike Lerman 2015/01/21 20:58:02 nit: space after // and before Log nit: end senten
anthonyvd 2015/01/23 16:01:30 Done.
158 ProfileMetrics::LogNumberOfSwitches();
159
156 metrics::MetricsService* metrics = g_browser_process->metrics_service(); 160 metrics::MetricsService* metrics = g_browser_process->metrics_service();
157 if (metrics) 161 if (metrics)
158 metrics->RecordCompletedSessionEnd(); 162 metrics->RecordCompletedSessionEnd();
159 163
160 if (shutdown_type_ > NOT_VALID && shutdown_num_processes_ > 0) { 164 if (shutdown_type_ > NOT_VALID && shutdown_num_processes_ > 0) {
161 // Record the shutdown info so that we can put it into a histogram at next 165 // Record the shutdown info so that we can put it into a histogram at next
162 // startup. 166 // startup.
163 prefs->SetInteger(prefs::kShutdownType, shutdown_type_); 167 prefs->SetInteger(prefs::kShutdownType, shutdown_type_);
164 prefs->SetInteger(prefs::kShutdownNumProcesses, shutdown_num_processes_); 168 prefs->SetInteger(prefs::kShutdownNumProcesses, shutdown_num_processes_);
165 prefs->SetInteger(prefs::kShutdownNumProcessesSlow, 169 prefs->SetInteger(prefs::kShutdownNumProcessesSlow,
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 338
335 void SetTryingToQuit(bool quitting) { 339 void SetTryingToQuit(bool quitting) {
336 g_trying_to_quit = quitting; 340 g_trying_to_quit = quitting;
337 } 341 }
338 342
339 bool IsTryingToQuit() { 343 bool IsTryingToQuit() {
340 return g_trying_to_quit; 344 return g_trying_to_quit;
341 } 345 }
342 346
343 } // namespace browser_shutdown 347 } // namespace browser_shutdown
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/profiles/profile_metrics.h » ('j') | chrome/browser/profiles/profile_metrics.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698