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

Unified Diff: components/metrics/metrics_service.cc

Issue 2428413005: Revise system profile prefs clearing (Closed)
Patch Set: Created 4 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
« components/metrics/metrics_log.h ('K') | « components/metrics/metrics_log.cc ('k') | no next file » | 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 2acc9cb0b88cbec1f0538b42147f7c800af98958..ac1ae4d39fffb13414190154db3501cb2ff749da 100644
--- a/components/metrics/metrics_service.cc
+++ b/components/metrics/metrics_service.cc
@@ -584,11 +584,11 @@ void MetricsService::InitializeMetricsState() {
clean_exit_beacon_.WriteBeaconValue(true);
}
- bool has_initial_stability_log = false;
- bool providers_have_initial_stability_metrics =
+ bool is_initial_stability_log_required =
Alexei Svitkine (slow) 2016/10/20 16:47:26 Nit: const
manzagop (departed) 2016/10/20 18:38:37 Done.
+ !clean_exit_beacon_.exited_cleanly() ||
ProvidersHaveInitialStabilityMetrics();
- if (!clean_exit_beacon_.exited_cleanly() ||
- providers_have_initial_stability_metrics) {
+ bool has_initial_stability_log = false;
+ if (is_initial_stability_log_required) {
// TODO(rtenneti): On windows, consider saving/getting execution_phase from
// the registry.
int execution_phase =
@@ -606,17 +606,24 @@ void MetricsService::InitializeMetricsState() {
}
}
- // If no initial stability log was generated and there was a version upgrade,
- // clear the stability stats from the previous version (so that they don't get
+ // If the version changed, but no initial stability log was generated, clear
+ // the stability stats from the previous version (so that they don't get
// attributed to the current version). This could otherwise happen due to a
// number of different edge cases, such as if the last version crashed before
// it could save off a system profile or if UMA reporting is disabled (which
// normally results in stats being accumulated).
- if (!has_initial_stability_log && version_changed) {
+ if (version_changed && !has_initial_stability_log) {
ClearSavedStabilityMetrics();
IncrementPrefValue(prefs::kStabilityDiscardCount);
}
+ // If the version changed, the system profile is obsolete and needs to be
+ // cleared.
Alexei Svitkine (slow) 2016/10/20 16:47:26 I think I do agree with this logic, but the commen
manzagop (departed) 2016/10/20 18:38:37 Done.
+ if (version_changed) {
+ local_state->ClearPref(prefs::kStabilitySavedSystemProfile);
+ local_state->ClearPref(prefs::kStabilitySavedSystemProfileHash);
+ }
+
// Update session ID.
++session_id_;
local_state_->SetInteger(prefs::kMetricsSessionID, session_id_);
« components/metrics/metrics_log.h ('K') | « components/metrics/metrics_log.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698