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

Side by Side Diff: components/metrics/metrics_service.cc

Issue 1036593005: Stop calling CommitPendingWriter() in LogCleanShutdown(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 //------------------------------------------------------------------------------ 5 //------------------------------------------------------------------------------
6 // Description of the life cycle of a instance of MetricsService. 6 // Description of the life cycle of a instance of MetricsService.
7 // 7 //
8 // OVERVIEW 8 // OVERVIEW
9 // 9 //
10 // A MetricsService instance is typically created at application startup. It is 10 // A MetricsService instance is typically created at application startup. It is
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 return NO_RESPONSE; 202 return NO_RESPONSE;
203 case 200: 203 case 200:
204 return SUCCESS; 204 return SUCCESS;
205 case 400: 205 case 400:
206 return BAD_REQUEST; 206 return BAD_REQUEST;
207 default: 207 default:
208 return UNKNOWN_FAILURE; 208 return UNKNOWN_FAILURE;
209 } 209 }
210 } 210 }
211 211
212 #if defined(OS_ANDROID) || defined(OS_IOS)
212 void MarkAppCleanShutdownAndCommit(CleanExitBeacon* clean_exit_beacon, 213 void MarkAppCleanShutdownAndCommit(CleanExitBeacon* clean_exit_beacon,
213 PrefService* local_state) { 214 PrefService* local_state) {
214 clean_exit_beacon->WriteBeaconValue(true); 215 clean_exit_beacon->WriteBeaconValue(true);
215 local_state->SetInteger(prefs::kStabilityExecutionPhase, 216 local_state->SetInteger(prefs::kStabilityExecutionPhase,
216 MetricsService::SHUTDOWN_COMPLETE); 217 MetricsService::SHUTDOWN_COMPLETE);
217 // Start writing right away (write happens on a different thread). 218 // Start writing right away (write happens on a different thread).
218 local_state->CommitPendingWrite(); 219 local_state->CommitPendingWrite();
219 } 220 }
221 #endif // defined(OS_ANDROID) || defined(OS_IOS)
220 222
221 } // namespace 223 } // namespace
222 224
223 225
224 SyntheticTrialGroup::SyntheticTrialGroup(uint32 trial, uint32 group) { 226 SyntheticTrialGroup::SyntheticTrialGroup(uint32 trial, uint32 group) {
225 id.name = trial; 227 id.name = trial;
226 id.group = group; 228 id.group = group;
227 } 229 }
228 230
229 SyntheticTrialGroup::~SyntheticTrialGroup() { 231 SyntheticTrialGroup::~SyntheticTrialGroup() {
(...skipping 851 matching lines...) Expand 10 before | Expand all | Expand 10 after
1081 base::Histogram::kNoFlags, base::Histogram::kUmaTargetedHistogramFlag); 1083 base::Histogram::kNoFlags, base::Histogram::kUmaTargetedHistogramFlag);
1082 } 1084 }
1083 1085
1084 void MetricsService::RecordCurrentStabilityHistograms() { 1086 void MetricsService::RecordCurrentStabilityHistograms() {
1085 DCHECK(log_manager_.current_log()); 1087 DCHECK(log_manager_.current_log());
1086 histogram_snapshot_manager_.PrepareDeltas( 1088 histogram_snapshot_manager_.PrepareDeltas(
1087 base::Histogram::kNoFlags, base::Histogram::kUmaStabilityHistogramFlag); 1089 base::Histogram::kNoFlags, base::Histogram::kUmaStabilityHistogramFlag);
1088 } 1090 }
1089 1091
1090 void MetricsService::LogCleanShutdown() { 1092 void MetricsService::LogCleanShutdown() {
1091 // Redundant hack to write pref ASAP.
1092 MarkAppCleanShutdownAndCommit(&clean_exit_beacon_, local_state_);
1093
1094 // Redundant setting to assure that we always reset this value at shutdown 1093 // Redundant setting to assure that we always reset this value at shutdown
1095 // (and that we don't use some alternate path, and not call LogCleanShutdown). 1094 // (and that we don't use some alternate path, and not call LogCleanShutdown).
1096 clean_shutdown_status_ = CLEANLY_SHUTDOWN; 1095 clean_shutdown_status_ = CLEANLY_SHUTDOWN;
1097 1096
1098 clean_exit_beacon_.WriteBeaconValue(true); 1097 clean_exit_beacon_.WriteBeaconValue(true);
1099 RecordCurrentState(local_state_); 1098 RecordCurrentState(local_state_);
1100 local_state_->SetInteger(prefs::kStabilityExecutionPhase, 1099 local_state_->SetInteger(prefs::kStabilityExecutionPhase,
1101 MetricsService::SHUTDOWN_COMPLETE); 1100 MetricsService::SHUTDOWN_COMPLETE);
1102 } 1101 }
1103 1102
1104 bool MetricsService::ShouldLogEvents() { 1103 bool MetricsService::ShouldLogEvents() {
1105 // We simply don't log events to UMA if there is a single incognito 1104 // We simply don't log events to UMA if there is a single incognito
1106 // session visible. The problem is that we always notify using the orginal 1105 // session visible. The problem is that we always notify using the orginal
1107 // profile in order to simplify notification processing. 1106 // profile in order to simplify notification processing.
1108 return !client_->IsOffTheRecordSessionActive(); 1107 return !client_->IsOffTheRecordSessionActive();
1109 } 1108 }
1110 1109
1111 void MetricsService::RecordBooleanPrefValue(const char* path, bool value) { 1110 void MetricsService::RecordBooleanPrefValue(const char* path, bool value) {
1112 DCHECK(IsSingleThreaded()); 1111 DCHECK(IsSingleThreaded());
1113 local_state_->SetBoolean(path, value); 1112 local_state_->SetBoolean(path, value);
1114 RecordCurrentState(local_state_); 1113 RecordCurrentState(local_state_);
1115 } 1114 }
1116 1115
1117 void MetricsService::RecordCurrentState(PrefService* pref) { 1116 void MetricsService::RecordCurrentState(PrefService* pref) {
1118 pref->SetInt64(prefs::kStabilityLastTimestampSec, 1117 pref->SetInt64(prefs::kStabilityLastTimestampSec,
1119 base::Time::Now().ToTimeT()); 1118 base::Time::Now().ToTimeT());
1120 } 1119 }
1121 1120
1122 } // namespace metrics 1121 } // namespace metrics
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698