| 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 896 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 907 SendStagedLog(); | 907 SendStagedLog(); |
| 908 } | 908 } |
| 909 if (is_cellular_logic) { | 909 if (is_cellular_logic) { |
| 910 UMA_HISTOGRAM_BOOLEAN("UMA.LogUpload.Canceled.CellularConstraint", | 910 UMA_HISTOGRAM_BOOLEAN("UMA.LogUpload.Canceled.CellularConstraint", |
| 911 upload_canceled); | 911 upload_canceled); |
| 912 } | 912 } |
| 913 } | 913 } |
| 914 | 914 |
| 915 bool MetricsService::ProvidersHaveInitialStabilityMetrics() { | 915 bool MetricsService::ProvidersHaveInitialStabilityMetrics() { |
| 916 // Check whether any metrics provider has initial stability metrics. | 916 // Check whether any metrics provider has initial stability metrics. |
| 917 for (MetricsProvider* provider : metrics_providers_) { | 917 // All providers are queried (rather than stopping after the first "true" |
| 918 if (provider->HasInitialStabilityMetrics()) | 918 // response) in case they do any kind of setup work in preparation for |
| 919 return true; | 919 // the later call to RecordInitialHistogramSnapshots(). |
| 920 } | 920 bool has_stability_metrics = false; |
| 921 for (MetricsProvider* provider : metrics_providers_) |
| 922 has_stability_metrics |= provider->HasInitialStabilityMetrics(); |
| 921 | 923 |
| 922 return false; | 924 return has_stability_metrics; |
| 923 } | 925 } |
| 924 | 926 |
| 925 bool MetricsService::PrepareInitialStabilityLog( | 927 bool MetricsService::PrepareInitialStabilityLog( |
| 926 const std::string& prefs_previous_version) { | 928 const std::string& prefs_previous_version) { |
| 927 DCHECK_EQ(INITIALIZED, state_); | 929 DCHECK_EQ(INITIALIZED, state_); |
| 928 | 930 |
| 929 std::unique_ptr<MetricsLog> initial_stability_log( | 931 std::unique_ptr<MetricsLog> initial_stability_log( |
| 930 CreateLog(MetricsLog::INITIAL_STABILITY_LOG)); | 932 CreateLog(MetricsLog::INITIAL_STABILITY_LOG)); |
| 931 | 933 |
| 932 // Do not call NotifyOnDidCreateMetricsLog here because the stability | 934 // Do not call NotifyOnDidCreateMetricsLog here because the stability |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1226 base::Time::Now().ToTimeT()); | 1228 base::Time::Now().ToTimeT()); |
| 1227 } | 1229 } |
| 1228 | 1230 |
| 1229 void MetricsService::SkipAndDiscardUpload() { | 1231 void MetricsService::SkipAndDiscardUpload() { |
| 1230 log_manager_.DiscardStagedLog(); | 1232 log_manager_.DiscardStagedLog(); |
| 1231 scheduler_->UploadCancelled(); | 1233 scheduler_->UploadCancelled(); |
| 1232 log_upload_in_progress_ = false; | 1234 log_upload_in_progress_ = false; |
| 1233 } | 1235 } |
| 1234 | 1236 |
| 1235 } // namespace metrics | 1237 } // namespace metrics |
| OLD | NEW |