Chromium Code Reviews| Index: components/metrics/metrics_reporting_scheduler.cc |
| diff --git a/components/metrics/metrics_reporting_scheduler.cc b/components/metrics/metrics_reporting_scheduler.cc |
| index 53c0cc553f26bac20f89bc18339caadd4d01ef60..685098208a9adc2ae1b6ca16e8583bb82c3ac382 100644 |
| --- a/components/metrics/metrics_reporting_scheduler.cc |
| +++ b/components/metrics/metrics_reporting_scheduler.cc |
| @@ -38,6 +38,7 @@ const int kUnsentLogsIntervalSeconds = 15; |
| // Standard interval between log uploads, in seconds. |
| #if defined(OS_ANDROID) || defined(OS_IOS) |
| const int kStandardUploadIntervalSeconds = 5 * 60; // Five minutes. |
| +const int kStandardUploadIntervalCellularSeconds = 15 * 60; // Five minutes. |
| #else |
| const int kStandardUploadIntervalSeconds = 30 * 60; // Thirty minutes. |
| #endif |
| @@ -194,10 +195,31 @@ void MetricsReportingScheduler::BackOffUploadInterval() { |
| base::TimeDelta MetricsReportingScheduler::GetStandardUploadInterval() { |
| #if defined(OS_ANDROID) |
| - return GetUploadIntervalFromExperiment(); |
| + if (IsCellularConnection()) |
| + return TimeDelta::FromSeconds(kStandardUploadIntervalCellularSeconds); |
| + return TimeDelta::FromSeconds(kStandardUploadIntervalSeconds); |
|
Alexei Svitkine (slow)
2015/02/13 21:11:40
Nit: This is the same return as a below. So you ca
gayane -on leave until 09-2017
2015/02/13 22:23:13
Done.
|
| #else |
| return TimeDelta::FromSeconds(kStandardUploadIntervalSeconds); |
| #endif |
| } |
| +void MetricsReportingScheduler::SetNetworkMetricsProvider( |
| + const metrics::NetworkMetricsProvider* network_metrics_provider) { |
| + network_metrics_provider_= network_metrics_provider; |
| +} |
| + |
| +bool MetricsReportingScheduler::IsCellularConnection() { |
| + SystemProfileProto::Network::ConnectionType connection_type = |
| + network_metrics_provider_->GetConnectionType(); |
|
Alexei Svitkine (slow)
2015/02/13 21:11:40
Nit: Since the API allows network_metrics_provider
gayane -on leave until 09-2017
2015/02/13 22:23:13
Done.
|
| + |
| + switch(connection_type) { |
|
Alexei Svitkine (slow)
2015/02/13 21:11:40
Nit: space before (
gayane -on leave until 09-2017
2015/02/13 22:23:13
Done.
|
| + case SystemProfileProto_Network_ConnectionType_CONNECTION_2G: |
| + case SystemProfileProto_Network_ConnectionType_CONNECTION_3G: |
| + case SystemProfileProto_Network_ConnectionType_CONNECTION_4G: |
| + return true; |
| + default: |
| + return false; |
| + } |
| +} |
| + |
| } // namespace metrics |