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

Unified Diff: chrome/browser/browser_shutdown.cc

Issue 2318373003: Record shutdown type UMA (Closed)
Patch Set: Address comments Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/browser_shutdown.h ('k') | chrome/browser/lifetime/application_lifetime.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/browser_shutdown.cc
diff --git a/chrome/browser/browser_shutdown.cc b/chrome/browser/browser_shutdown.cc
index 4af6c31b616b2c4205cb17d72e21bb679a6d0baf..7e7b39f185243acc8dceea75338581cc03aeb6b9 100644
--- a/chrome/browser/browser_shutdown.cc
+++ b/chrome/browser/browser_shutdown.cc
@@ -170,14 +170,7 @@ bool ShutdownPreThreadsStop() {
if (metrics)
metrics->RecordCompletedSessionEnd();
- if (g_shutdown_type > NOT_VALID && g_shutdown_num_processes > 0) {
- // Record the shutdown info so that we can put it into a histogram at next
- // startup.
- prefs->SetInteger(prefs::kShutdownType, g_shutdown_type);
- prefs->SetInteger(prefs::kShutdownNumProcesses, g_shutdown_num_processes);
- prefs->SetInteger(prefs::kShutdownNumProcessesSlow,
- g_shutdown_num_processes_slow);
- }
+ RecordShutdownInfoPrefs();
// Check local state for the restart flag so we can restart the session below.
bool restart_last_session = false;
@@ -198,6 +191,18 @@ bool ShutdownPreThreadsStop() {
return restart_last_session;
}
+void RecordShutdownInfoPrefs() {
+ if (g_shutdown_type > NOT_VALID && g_shutdown_num_processes > 0) {
+ PrefService* prefs = g_browser_process->local_state();
+ // Record the shutdown info so that we can put it into a histogram at next
+ // startup.
+ prefs->SetInteger(prefs::kShutdownType, g_shutdown_type);
+ prefs->SetInteger(prefs::kShutdownNumProcesses, g_shutdown_num_processes);
+ prefs->SetInteger(prefs::kShutdownNumProcessesSlow,
+ g_shutdown_num_processes_slow);
+ }
+}
+
void ShutdownPostThreadsStop(int shutdown_flags) {
delete g_browser_process;
g_browser_process = NULL;
@@ -327,6 +332,8 @@ void ReadLastShutdownInfo() {
prefs->SetInteger(prefs::kShutdownNumProcesses, 0);
prefs->SetInteger(prefs::kShutdownNumProcessesSlow, 0);
+ UMA_HISTOGRAM_ENUMERATION("Shutdown.ShutdownType", type, kNumShutdownTypes);
+
// Read and delete the file on the file thread.
BrowserThread::PostTask(
BrowserThread::FILE, FROM_HERE,
« no previous file with comments | « chrome/browser/browser_shutdown.h ('k') | chrome/browser/lifetime/application_lifetime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698