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

Unified Diff: components/metrics/metrics_service.cc

Issue 2528033003: MetricsService: ensure in-memory/pref execution phase are in sync (Closed)
Patch Set: Add metric owner Created 4 years, 1 month 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 | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/metrics/metrics_service.cc
diff --git a/components/metrics/metrics_service.cc b/components/metrics/metrics_service.cc
index 5c9448987ab9b42348f2ed6a8b0743936542dacb..82380f59d271db15be58baf0bbe78325d7ca8308 100644
--- a/components/metrics/metrics_service.cc
+++ b/components/metrics/metrics_service.cc
@@ -222,6 +222,7 @@ ResponseStatus ResponseCodeToStatus(int response_code) {
void MarkAppCleanShutdownAndCommit(CleanExitBeacon* clean_exit_beacon,
PrefService* local_state) {
clean_exit_beacon->WriteBeaconValue(true);
+ // Note: the in-memory MetricsService::execution_phase_ is not updated.
local_state->SetInteger(prefs::kStabilityExecutionPhase,
MetricsService::SHUTDOWN_COMPLETE);
// Start writing right away (write happens on a different thread).
@@ -480,6 +481,8 @@ void MetricsService::OnAppEnterBackground() {
void MetricsService::OnAppEnterForeground() {
clean_exit_beacon_.WriteBeaconValue(false);
+ // Restore the execution phase stored in prefs.
Alexei Svitkine (slow) 2016/11/24 21:20:20 Nit: Mention MarkAppCleanShutdownAndCommit() here.
manzagop (departed) 2016/11/24 22:40:42 Done.
+ local_state_->SetInteger(prefs::kStabilityExecutionPhase, execution_phase_);
StartSchedulerIfNecessary();
}
#else
@@ -521,8 +524,7 @@ void MetricsService::ClearSavedStabilityMetrics() {
local_state_->SetInteger(prefs::kStabilityCrashCount, 0);
local_state_->SetInteger(prefs::kStabilityDebuggerPresent, 0);
local_state_->SetInteger(prefs::kStabilityDebuggerNotPresent, 0);
- local_state_->SetInteger(prefs::kStabilityExecutionPhase,
- UNINITIALIZED_PHASE);
+ local_state_->SetInteger(prefs::kStabilityExecutionPhase, execution_phase_);
Alexei Svitkine (slow) 2016/11/24 21:20:20 I'm not sure this makes sense. Maybe better to jus
manzagop (departed) 2016/11/24 22:40:42 Done. The value needs to be preserved up to when
local_state_->SetInteger(prefs::kStabilityIncompleteSessionEndCount, 0);
local_state_->SetInteger(prefs::kStabilityLaunchCount, 0);
local_state_->SetBoolean(prefs::kStabilitySessionEndCompleted, true);
@@ -1211,8 +1213,7 @@ void MetricsService::LogCleanShutdown() {
client_->OnLogCleanShutdown();
clean_exit_beacon_.WriteBeaconValue(true);
RecordCurrentState(local_state_);
- local_state_->SetInteger(prefs::kStabilityExecutionPhase,
- MetricsService::SHUTDOWN_COMPLETE);
+ SetExecutionPhase(MetricsService::SHUTDOWN_COMPLETE, local_state_);
}
void MetricsService::RecordBooleanPrefValue(const char* path, bool value) {
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698