| 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 #include "components/metrics/metrics_reporting_scheduler.h" | 5 #include "components/metrics/metrics_reporting_scheduler.h" |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 | 9 |
| 10 using base::TimeDelta; | 10 using base::TimeDelta; |
| 11 | 11 |
| 12 namespace metrics { |
| 13 |
| 12 namespace { | 14 namespace { |
| 13 | 15 |
| 14 // The delay, in seconds, after startup before sending the first log message. | 16 // The delay, in seconds, after startup before sending the first log message. |
| 15 #if defined(OS_ANDROID) || defined(OS_IOS) | 17 #if defined(OS_ANDROID) || defined(OS_IOS) |
| 16 // Sessions are more likely to be short on a mobile device, so handle the | 18 // Sessions are more likely to be short on a mobile device, so handle the |
| 17 // initial log quickly. | 19 // initial log quickly. |
| 18 const int kInitialUploadIntervalSeconds = 15; | 20 const int kInitialUploadIntervalSeconds = 15; |
| 19 #else | 21 #else |
| 20 const int kInitialUploadIntervalSeconds = 60; | 22 const int kInitialUploadIntervalSeconds = 60; |
| 21 #endif | 23 #endif |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 upload_interval_ = TimeDelta::FromMicroseconds( | 153 upload_interval_ = TimeDelta::FromMicroseconds( |
| 152 static_cast<int64>(kBackoffMultiplier * | 154 static_cast<int64>(kBackoffMultiplier * |
| 153 upload_interval_.InMicroseconds())); | 155 upload_interval_.InMicroseconds())); |
| 154 | 156 |
| 155 TimeDelta max_interval = kMaxBackoffMultiplier * | 157 TimeDelta max_interval = kMaxBackoffMultiplier * |
| 156 TimeDelta::FromSeconds(kStandardUploadIntervalSeconds); | 158 TimeDelta::FromSeconds(kStandardUploadIntervalSeconds); |
| 157 if (upload_interval_ > max_interval || upload_interval_.InSeconds() < 0) { | 159 if (upload_interval_ > max_interval || upload_interval_.InSeconds() < 0) { |
| 158 upload_interval_ = max_interval; | 160 upload_interval_ = max_interval; |
| 159 } | 161 } |
| 160 } | 162 } |
| 163 |
| 164 } // namespace metrics |
| OLD | NEW |