Chromium Code Reviews| 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 864 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 875 // Just tell the scheduler it was uploaded and wait for the next log | 875 // Just tell the scheduler it was uploaded and wait for the next log |
| 876 // interval. | 876 // interval. |
| 877 scheduler_->UploadFinished(true, log_manager_.has_unsent_logs()); | 877 scheduler_->UploadFinished(true, log_manager_.has_unsent_logs()); |
| 878 return; | 878 return; |
| 879 } | 879 } |
| 880 if (!log_manager_.has_staged_log()) | 880 if (!log_manager_.has_staged_log()) |
| 881 log_manager_.StageNextLogForUpload(); | 881 log_manager_.StageNextLogForUpload(); |
| 882 | 882 |
| 883 // Proceed to stage the log for upload if log size satisfies cellular log | 883 // Proceed to stage the log for upload if log size satisfies cellular log |
| 884 // upload constrains. | 884 // upload constrains. |
| 885 bool upload_canceled = false; | |
| 885 if (client_->IsUMACellularUploadLogicEnabled() && | 886 if (client_->IsUMACellularUploadLogicEnabled() && |
| 886 !data_use_tracker_->ShouldUploadLogOnCellular( | 887 !data_use_tracker_->ShouldUploadLogOnCellular( |
| 887 log_manager_.staged_log_hash().size())) { | 888 log_manager_.staged_log_hash().size())) { |
| 888 scheduler_->UploadCancelled(); | 889 scheduler_->UploadCancelled(); |
| 890 upload_canceled = true; | |
| 889 } else { | 891 } else { |
| 890 SendStagedLog(); | 892 SendStagedLog(); |
| 891 } | 893 } |
| 894 UMA_HISTOGRAM_BOOLEAN("UMA.LogUpload.Canceled.CellularConstraint", | |
|
Alexei Svitkine (slow)
2016/04/11 15:09:08
Let's not log this unless IsUMACellularUploadLogic
gayane -on leave until 09-2017
2016/04/11 15:40:46
Done.
| |
| 895 upload_canceled); | |
| 892 } | 896 } |
| 893 | 897 |
| 894 bool MetricsService::ProvidersHaveInitialStabilityMetrics() { | 898 bool MetricsService::ProvidersHaveInitialStabilityMetrics() { |
| 895 // Check whether any metrics provider has initial stability metrics. | 899 // Check whether any metrics provider has initial stability metrics. |
| 896 for (MetricsProvider* provider : metrics_providers_) { | 900 for (MetricsProvider* provider : metrics_providers_) { |
| 897 if (provider->HasInitialStabilityMetrics()) | 901 if (provider->HasInitialStabilityMetrics()) |
| 898 return true; | 902 return true; |
| 899 } | 903 } |
| 900 | 904 |
| 901 return false; | 905 return false; |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1183 base::Time::Now().ToTimeT()); | 1187 base::Time::Now().ToTimeT()); |
| 1184 } | 1188 } |
| 1185 | 1189 |
| 1186 void MetricsService::SkipAndDiscardUpload() { | 1190 void MetricsService::SkipAndDiscardUpload() { |
| 1187 log_manager_.DiscardStagedLog(); | 1191 log_manager_.DiscardStagedLog(); |
| 1188 scheduler_->UploadCancelled(); | 1192 scheduler_->UploadCancelled(); |
| 1189 log_upload_in_progress_ = false; | 1193 log_upload_in_progress_ = false; |
| 1190 } | 1194 } |
| 1191 | 1195 |
| 1192 } // namespace metrics | 1196 } // namespace metrics |
| OLD | NEW |