| 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 1101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1112 | 1112 |
| 1113 void MetricsService::RecordCurrentEnvironment(MetricsLog* log) { | 1113 void MetricsService::RecordCurrentEnvironment(MetricsLog* log) { |
| 1114 std::vector<variations::ActiveGroupId> synthetic_trials; | 1114 std::vector<variations::ActiveGroupId> synthetic_trials; |
| 1115 GetSyntheticFieldTrialsOlderThan(log->creation_time(), &synthetic_trials); | 1115 GetSyntheticFieldTrialsOlderThan(log->creation_time(), &synthetic_trials); |
| 1116 log->RecordEnvironment(metrics_providers_.get(), synthetic_trials, | 1116 log->RecordEnvironment(metrics_providers_.get(), synthetic_trials, |
| 1117 GetInstallDate(), GetMetricsReportingEnabledDate()); | 1117 GetInstallDate(), GetMetricsReportingEnabledDate()); |
| 1118 } | 1118 } |
| 1119 | 1119 |
| 1120 void MetricsService::RecordCurrentHistograms() { | 1120 void MetricsService::RecordCurrentHistograms() { |
| 1121 DCHECK(log_manager_.current_log()); | 1121 DCHECK(log_manager_.current_log()); |
| 1122 |
| 1123 // Merge any data from metrics providers into the global StatisticsRecorder. |
| 1124 for (MetricsProvider* provider : metrics_providers_) |
| 1125 provider->MergeHistogramDeltas(); |
| 1126 |
| 1122 histogram_snapshot_manager_.StartDeltas(); | 1127 histogram_snapshot_manager_.StartDeltas(); |
| 1123 // "true" to the begin() call indicates that StatisticsRecorder should include | 1128 // "true" to the begin() call indicates that StatisticsRecorder should include |
| 1124 // histograms held in persistent storage. | 1129 // histograms held in persistent storage. |
| 1125 histogram_snapshot_manager_.PrepareDeltasWithoutStartFinish( | 1130 histogram_snapshot_manager_.PrepareDeltasWithoutStartFinish( |
| 1126 base::StatisticsRecorder::begin(true), base::StatisticsRecorder::end(), | 1131 base::StatisticsRecorder::begin(true), base::StatisticsRecorder::end(), |
| 1127 base::Histogram::kNoFlags, base::Histogram::kUmaTargetedHistogramFlag); | 1132 base::Histogram::kNoFlags, base::Histogram::kUmaTargetedHistogramFlag); |
| 1128 for (MetricsProvider* provider : metrics_providers_) | 1133 for (MetricsProvider* provider : metrics_providers_) |
| 1129 provider->RecordHistogramSnapshots(&histogram_snapshot_manager_); | 1134 provider->RecordHistogramSnapshots(&histogram_snapshot_manager_); |
| 1130 histogram_snapshot_manager_.FinishDeltas(); | 1135 histogram_snapshot_manager_.FinishDeltas(); |
| 1131 } | 1136 } |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1172 base::Time::Now().ToTimeT()); | 1177 base::Time::Now().ToTimeT()); |
| 1173 } | 1178 } |
| 1174 | 1179 |
| 1175 void MetricsService::SkipAndDiscardUpload() { | 1180 void MetricsService::SkipAndDiscardUpload() { |
| 1176 log_manager_.DiscardStagedLog(); | 1181 log_manager_.DiscardStagedLog(); |
| 1177 scheduler_->UploadCancelled(); | 1182 scheduler_->UploadCancelled(); |
| 1178 log_upload_in_progress_ = false; | 1183 log_upload_in_progress_ = false; |
| 1179 } | 1184 } |
| 1180 | 1185 |
| 1181 } // namespace metrics | 1186 } // namespace metrics |
| OLD | NEW |