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 if (client_->IsUMACellularUploadLogicEnabled() && | 885 bool upload_canceled = false; |
| 886 bool is_cellular_logic = client_->IsUMACellularUploadLogicEnabled(); | |
| 887 if (is_cellular_logic && | |
| 886 !data_use_tracker_->ShouldUploadLogOnCellular( | 888 !data_use_tracker_->ShouldUploadLogOnCellular( |
| 887 log_manager_.staged_log_hash().size())) { | 889 log_manager_.staged_log_hash().size())) { |
| 888 scheduler_->UploadCancelled(); | 890 scheduler_->UploadCancelled(); |
| 891 upload_canceled = true; | |
| 889 } else { | 892 } else { |
| 890 SendStagedLog(); | 893 SendStagedLog(); |
| 891 } | 894 } |
| 895 if (is_cellular_logic) | |
|
Alexei Svitkine (slow)
2016/04/11 16:04:49
Nit: {}
gayane -on leave until 09-2017
2016/04/11 17:42:25
Done.
| |
| 896 UMA_HISTOGRAM_BOOLEAN("UMA.LogUpload.Canceled.CellularConstraint", | |
| 897 upload_canceled); | |
| 892 } | 898 } |
| 893 | 899 |
| 894 bool MetricsService::ProvidersHaveInitialStabilityMetrics() { | 900 bool MetricsService::ProvidersHaveInitialStabilityMetrics() { |
| 895 // Check whether any metrics provider has initial stability metrics. | 901 // Check whether any metrics provider has initial stability metrics. |
| 896 for (MetricsProvider* provider : metrics_providers_) { | 902 for (MetricsProvider* provider : metrics_providers_) { |
| 897 if (provider->HasInitialStabilityMetrics()) | 903 if (provider->HasInitialStabilityMetrics()) |
| 898 return true; | 904 return true; |
| 899 } | 905 } |
| 900 | 906 |
| 901 return false; | 907 return false; |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1183 base::Time::Now().ToTimeT()); | 1189 base::Time::Now().ToTimeT()); |
| 1184 } | 1190 } |
| 1185 | 1191 |
| 1186 void MetricsService::SkipAndDiscardUpload() { | 1192 void MetricsService::SkipAndDiscardUpload() { |
| 1187 log_manager_.DiscardStagedLog(); | 1193 log_manager_.DiscardStagedLog(); |
| 1188 scheduler_->UploadCancelled(); | 1194 scheduler_->UploadCancelled(); |
| 1189 log_upload_in_progress_ = false; | 1195 log_upload_in_progress_ = false; |
| 1190 } | 1196 } |
| 1191 | 1197 |
| 1192 } // namespace metrics | 1198 } // namespace metrics |
| OLD | NEW |