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

Unified Diff: chrome/browser/metrics/metrics_service.cc

Issue 25484004: Don't commit prefs::kStabilitySessionEndCompleted change immediately on chromeos (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 2 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
Index: chrome/browser/metrics/metrics_service.cc
diff --git a/chrome/browser/metrics/metrics_service.cc b/chrome/browser/metrics/metrics_service.cc
index 313de569207cbf3824c3368dcc2de80454acfef5..26b81bc96fbe88205de71feb1a9bcbb66e0508b2 100644
--- a/chrome/browser/metrics/metrics_service.cc
+++ b/chrome/browser/metrics/metrics_service.cc
@@ -737,13 +737,11 @@ void MetricsService::HandleIdleSinceLastTransmission(bool in_idle) {
}
void MetricsService::RecordStartOfSessionEnd() {
- LogCleanShutdown();
- RecordBooleanPrefValue(prefs::kStabilitySessionEndCompleted, false);
+ RecordStabilitySessionEndCompleted(false);
}
void MetricsService::RecordCompletedSessionEnd() {
- LogCleanShutdown();
- RecordBooleanPrefValue(prefs::kStabilitySessionEndCompleted, true);
+ RecordStabilitySessionEndCompleted(true);
}
#if defined(OS_ANDROID) || defined(OS_IOS)
@@ -1598,23 +1596,24 @@ void MetricsService::LogRendererHang() {
IncrementPrefValue(prefs::kStabilityRendererHangCount);
}
+void MetricsService::RecordStabilitySessionEndCompleted(bool value) {
+ PrefService* pref = g_browser_process->local_state();
+ DCHECK(pref);
+ // Redundant setting to assure that we always reset this value at shutdown
+ // (and that we don't use some alternate path, and not call
+ // RecordStartOfEndSession/RecordCompletedSessionEnd)
+ clean_shutdown_status_ = CLEANLY_SHUTDOWN;
+ pref->SetBoolean(prefs::kStabilitySessionEndCompleted, value);
+ RecordCurrentState(pref);
+ MarkAppCleanShutdownAndCommit();
jar (doing other things) 2013/10/11 22:55:44 I'm trying to understand what you are doing here,
+}
+
bool MetricsService::UmaMetricsProperlyShutdown() {
CHECK(clean_shutdown_status_ == CLEANLY_SHUTDOWN ||
clean_shutdown_status_ == NEED_TO_SHUTDOWN);
return clean_shutdown_status_ == CLEANLY_SHUTDOWN;
}
-void MetricsService::LogCleanShutdown() {
- // Redundant hack to write pref ASAP.
- MarkAppCleanShutdownAndCommit();
-
- // Redundant setting to assure that we always reset this value at shutdown
- // (and that we don't use some alternate path, and not call LogCleanShutdown).
- clean_shutdown_status_ = CLEANLY_SHUTDOWN;
-
- RecordBooleanPrefValue(prefs::kStabilityExitedCleanly, true);
-}
-
#if defined(OS_CHROMEOS)
void MetricsService::LogChromeOSCrash(const std::string &crash_type) {
if (crash_type == "user")
@@ -1754,16 +1753,6 @@ bool MetricsService::CanLogNotification() {
return !chrome::IsOffTheRecordSessionActive();
}
-void MetricsService::RecordBooleanPrefValue(const char* path, bool value) {
- DCHECK(IsSingleThreaded());
-
- PrefService* pref = g_browser_process->local_state();
- DCHECK(pref);
-
- pref->SetBoolean(path, value);
- RecordCurrentState(pref);
-}
-
void MetricsService::RecordCurrentState(PrefService* pref) {
pref->SetInt64(prefs::kStabilityLastTimestampSec, Time::Now().ToTimeT());
« chrome/browser/metrics/metrics_service.h ('K') | « chrome/browser/metrics/metrics_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698