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/domain_reliability/scheduler.h" | 5 #include "components/domain_reliability/scheduler.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/metrics/field_trial.h" | 9 #include "base/metrics/field_trial.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
11 #include "components/domain_reliability/config.h" | 11 #include "components/domain_reliability/config.h" |
12 #include "components/domain_reliability/util.h" | 12 #include "components/domain_reliability/util.h" |
13 | 13 |
14 namespace { | 14 namespace { |
15 | 15 |
16 const unsigned kInvalidCollectorIndex = -1; | 16 const unsigned kInvalidCollectorIndex = static_cast<unsigned>(-1); |
17 | 17 |
18 const unsigned kDefaultMinimumUploadDelaySec = 60; | 18 const unsigned kDefaultMinimumUploadDelaySec = 60; |
19 const unsigned kDefaultMaximumUploadDelaySec = 300; | 19 const unsigned kDefaultMaximumUploadDelaySec = 300; |
20 const unsigned kDefaultUploadRetryIntervalSec = 60; | 20 const unsigned kDefaultUploadRetryIntervalSec = 60; |
21 | 21 |
22 const char* kMinimumUploadDelayFieldTrialName = "DomRel-MinimumUploadDelay"; | 22 const char* kMinimumUploadDelayFieldTrialName = "DomRel-MinimumUploadDelay"; |
23 const char* kMaximumUploadDelayFieldTrialName = "DomRel-MaximumUploadDelay"; | 23 const char* kMaximumUploadDelayFieldTrialName = "DomRel-MaximumUploadDelay"; |
24 const char* kUploadRetryIntervalFieldTrialName = "DomRel-UploadRetryInterval"; | 24 const char* kUploadRetryIntervalFieldTrialName = "DomRel-UploadRetryInterval"; |
25 | 25 |
26 unsigned GetUnsignedFieldTrialValueOrDefault(std::string field_trial_name, | 26 unsigned GetUnsignedFieldTrialValueOrDefault(std::string field_trial_name, |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 return base::TimeDelta::FromSeconds(0); | 203 return base::TimeDelta::FromSeconds(0); |
204 else { | 204 else { |
205 // Don't back off more than 64x the original delay. | 205 // Don't back off more than 64x the original delay. |
206 if (failures > 7) | 206 if (failures > 7) |
207 failures = 7; | 207 failures = 7; |
208 return params_.upload_retry_interval * (1 << (failures - 1)); | 208 return params_.upload_retry_interval * (1 << (failures - 1)); |
209 } | 209 } |
210 } | 210 } |
211 | 211 |
212 } // namespace domain_reliability | 212 } // namespace domain_reliability |
OLD | NEW |