Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(288)

Side by Side Diff: components/domain_reliability/scheduler.cc

Issue 1546143002: Switch to standard integer types in components/, part 1 of 4. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <stdint.h>
8
7 #include <algorithm> 9 #include <algorithm>
8 10
9 #include "base/metrics/field_trial.h" 11 #include "base/metrics/field_trial.h"
10 #include "base/strings/string_number_conversions.h" 12 #include "base/strings/string_number_conversions.h"
11 #include "base/values.h" 13 #include "base/values.h"
12 #include "components/domain_reliability/config.h" 14 #include "components/domain_reliability/config.h"
13 #include "components/domain_reliability/util.h" 15 #include "components/domain_reliability/util.h"
14 #include "net/base/backoff_entry.h" 16 #include "net/base/backoff_entry.h"
15 17
16 namespace { 18 namespace {
17 19
18 const unsigned kInvalidCollectorIndex = static_cast<unsigned>(-1); 20 const unsigned kInvalidCollectorIndex = static_cast<unsigned>(-1);
19 21
20 const unsigned kDefaultMinimumUploadDelaySec = 60; 22 const unsigned kDefaultMinimumUploadDelaySec = 60;
21 const unsigned kDefaultMaximumUploadDelaySec = 300; 23 const unsigned kDefaultMaximumUploadDelaySec = 300;
22 const unsigned kDefaultUploadRetryIntervalSec = 60; 24 const unsigned kDefaultUploadRetryIntervalSec = 60;
23 25
24 const char* kMinimumUploadDelayFieldTrialName = "DomRel-MinimumUploadDelay"; 26 const char* kMinimumUploadDelayFieldTrialName = "DomRel-MinimumUploadDelay";
25 const char* kMaximumUploadDelayFieldTrialName = "DomRel-MaximumUploadDelay"; 27 const char* kMaximumUploadDelayFieldTrialName = "DomRel-MaximumUploadDelay";
26 const char* kUploadRetryIntervalFieldTrialName = "DomRel-UploadRetryInterval"; 28 const char* kUploadRetryIntervalFieldTrialName = "DomRel-UploadRetryInterval";
27 29
28 // Fixed elements of backoff policy 30 // Fixed elements of backoff policy
29 const double kMultiplyFactor = 2.0; 31 const double kMultiplyFactor = 2.0;
30 const double kJitterFactor = 0.1; 32 const double kJitterFactor = 0.1;
31 const int64 kMaximumBackoffMs = 60 * 1000 * 1000; 33 const int64_t kMaximumBackoffMs = 60 * 1000 * 1000;
32 34
33 unsigned GetUnsignedFieldTrialValueOrDefault(std::string field_trial_name, 35 unsigned GetUnsignedFieldTrialValueOrDefault(std::string field_trial_name,
34 unsigned default_value) { 36 unsigned default_value) {
35 if (!base::FieldTrialList::TrialExists(field_trial_name)) 37 if (!base::FieldTrialList::TrialExists(field_trial_name))
36 return default_value; 38 return default_value;
37 39
38 std::string group_name = base::FieldTrialList::FindFullName(field_trial_name); 40 std::string group_name = base::FieldTrialList::FindFullName(field_trial_name);
39 unsigned value; 41 unsigned value;
40 if (!base::StringToUint(group_name, &value)) { 42 if (!base::StringToUint(group_name, &value)) {
41 LOG(ERROR) << "Expected unsigned integer for field trial " 43 LOG(ERROR) << "Expected unsigned integer for field trial "
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 min_index = i; 261 min_index = i;
260 } 262 }
261 } 263 }
262 264
263 DCHECK_NE(kInvalidCollectorIndex, min_index); 265 DCHECK_NE(kInvalidCollectorIndex, min_index);
264 *upload_time_out = min_time; 266 *upload_time_out = min_time;
265 *collector_index_out = min_index; 267 *collector_index_out = min_index;
266 } 268 }
267 269
268 } // namespace domain_reliability 270 } // namespace domain_reliability
OLDNEW
« no previous file with comments | « components/domain_reliability/scheduler.h ('k') | components/domain_reliability/scheduler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698