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

Unified Diff: chrome/browser/browser_shutdown.cc

Issue 2318373003: Record shutdown type UMA (Closed)
Patch Set: Add description 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..7fb5343f4cf496deee2721f6d281210478d747cc 100644
--- a/chrome/browser/browser_shutdown.cc
+++ b/chrome/browser/browser_shutdown.cc
@@ -170,6 +170,21 @@ bool ShutdownPreThreadsStop() {
if (metrics)
metrics->RecordCompletedSessionEnd();
+ bool restart_last_session = RecordShutdownInfoPrefs();
+
+ prefs->CommitPendingWrite();
+
+#if defined(ENABLE_RLZ)
+ // Cleanup any statics created by RLZ. Must be done before NotificationService
+ // is destroyed.
+ rlz::RLZTracker::CleanupRlz();
+#endif
+
+ return restart_last_session;
+}
+
+bool RecordShutdownInfoPrefs() {
+ PrefService* prefs = g_browser_process->local_state();
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.
@@ -179,22 +194,13 @@ bool ShutdownPreThreadsStop() {
g_shutdown_num_processes_slow);
}
- // Check local state for the restart flag so we can restart the session below.
+ // Check local state for the restart flag so we can restart the session later.
bool restart_last_session = false;
if (prefs->HasPrefPath(prefs::kRestartLastSessionOnShutdown)) {
restart_last_session =
prefs->GetBoolean(prefs::kRestartLastSessionOnShutdown);
prefs->ClearPref(prefs::kRestartLastSessionOnShutdown);
}
-
- prefs->CommitPendingWrite();
-
-#if defined(ENABLE_RLZ)
- // Cleanup any statics created by RLZ. Must be done before NotificationService
- // is destroyed.
- rlz::RLZTracker::CleanupRlz();
-#endif
-
return restart_last_session;
}
@@ -327,6 +333,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