| OLD | NEW |
| 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 1190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1201 base::StatisticsRecorder::begin(true), base::StatisticsRecorder::end(), | 1201 base::StatisticsRecorder::begin(true), base::StatisticsRecorder::end(), |
| 1202 base::Histogram::kNoFlags, base::Histogram::kUmaStabilityHistogramFlag); | 1202 base::Histogram::kNoFlags, base::Histogram::kUmaStabilityHistogramFlag); |
| 1203 for (MetricsProvider* provider : metrics_providers_) | 1203 for (MetricsProvider* provider : metrics_providers_) |
| 1204 provider->RecordInitialHistogramSnapshots(&histogram_snapshot_manager_); | 1204 provider->RecordInitialHistogramSnapshots(&histogram_snapshot_manager_); |
| 1205 } | 1205 } |
| 1206 | 1206 |
| 1207 void MetricsService::LogCleanShutdown() { | 1207 void MetricsService::LogCleanShutdown() { |
| 1208 // Redundant setting to assure that we always reset this value at shutdown | 1208 // Redundant setting to assure that we always reset this value at shutdown |
| 1209 // (and that we don't use some alternate path, and not call LogCleanShutdown). | 1209 // (and that we don't use some alternate path, and not call LogCleanShutdown). |
| 1210 clean_shutdown_status_ = CLEANLY_SHUTDOWN; | 1210 clean_shutdown_status_ = CLEANLY_SHUTDOWN; |
| 1211 | 1211 client_->OnLogCleanShutdown(); |
| 1212 clean_exit_beacon_.WriteBeaconValue(true); | 1212 clean_exit_beacon_.WriteBeaconValue(true); |
| 1213 RecordCurrentState(local_state_); | 1213 RecordCurrentState(local_state_); |
| 1214 local_state_->SetInteger(prefs::kStabilityExecutionPhase, | 1214 local_state_->SetInteger(prefs::kStabilityExecutionPhase, |
| 1215 MetricsService::SHUTDOWN_COMPLETE); | 1215 MetricsService::SHUTDOWN_COMPLETE); |
| 1216 } | 1216 } |
| 1217 | 1217 |
| 1218 void MetricsService::RecordBooleanPrefValue(const char* path, bool value) { | 1218 void MetricsService::RecordBooleanPrefValue(const char* path, bool value) { |
| 1219 DCHECK(IsSingleThreaded()); | 1219 DCHECK(IsSingleThreaded()); |
| 1220 local_state_->SetBoolean(path, value); | 1220 local_state_->SetBoolean(path, value); |
| 1221 RecordCurrentState(local_state_); | 1221 RecordCurrentState(local_state_); |
| 1222 } | 1222 } |
| 1223 | 1223 |
| 1224 void MetricsService::RecordCurrentState(PrefService* pref) { | 1224 void MetricsService::RecordCurrentState(PrefService* pref) { |
| 1225 pref->SetInt64(prefs::kStabilityLastTimestampSec, | 1225 pref->SetInt64(prefs::kStabilityLastTimestampSec, |
| 1226 base::Time::Now().ToTimeT()); | 1226 base::Time::Now().ToTimeT()); |
| 1227 } | 1227 } |
| 1228 | 1228 |
| 1229 void MetricsService::SkipAndDiscardUpload() { | 1229 void MetricsService::SkipAndDiscardUpload() { |
| 1230 log_manager_.DiscardStagedLog(); | 1230 log_manager_.DiscardStagedLog(); |
| 1231 scheduler_->UploadCancelled(); | 1231 scheduler_->UploadCancelled(); |
| 1232 log_upload_in_progress_ = false; | 1232 log_upload_in_progress_ = false; |
| 1233 } | 1233 } |
| 1234 | 1234 |
| 1235 } // namespace metrics | 1235 } // namespace metrics |
| OLD | NEW |