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

Unified Diff: net/base/backoff_entry.cc

Issue 1158923005: Use the exact-width integer types defined in <stdint.h> rather than (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Tweak comments. Exclude mime_sniffer*. Rebase. Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: net/base/backoff_entry.cc
diff --git a/net/base/backoff_entry.cc b/net/base/backoff_entry.cc
index 870d6a15631001f696b1abab361d0c3efcf127cc..ac4882c9a28da134281056820efbce97574f0714 100644
--- a/net/base/backoff_entry.cc
+++ b/net/base/backoff_entry.cc
@@ -87,7 +87,7 @@ bool BackoffEntry::CanDiscard() const {
base::TimeTicks now = GetTimeTicksNow();
- int64 unused_since_ms =
+ int64_t unused_since_ms =
(now - exponential_backoff_release_time_).InMilliseconds();
// Release time is further than now, we are managing it.
@@ -135,14 +135,14 @@ base::TimeTicks BackoffEntry::CalculateReleaseTime() const {
// effective_failure_count - 1) * Uniform(1 - jitter_factor, 1]
// Note: if the failure count is too high, |delay_ms| will become infinity
// after the exponential calculation, and then NaN after the jitter is
- // accounted for. Both cases are handled by using CheckedNumeric<int64> to
+ // accounted for. Both cases are handled by using CheckedNumeric<int64_t> to
// perform the conversion to integers.
double delay_ms = policy_->initial_delay_ms;
delay_ms *= pow(policy_->multiply_factor, effective_failure_count - 1);
delay_ms -= base::RandDouble() * policy_->jitter_factor * delay_ms;
// Do overflow checking in microseconds, the internal unit of TimeTicks.
- base::internal::CheckedNumeric<int64> backoff_duration_us = delay_ms + 0.5;
+ base::internal::CheckedNumeric<int64_t> backoff_duration_us = delay_ms + 0.5;
backoff_duration_us *= base::Time::kMicrosecondsPerMillisecond;
base::TimeDelta backoff_duration = base::TimeDelta::FromMicroseconds(
backoff_duration_us.ValueOrDefault(kint64max));
@@ -155,14 +155,14 @@ base::TimeTicks BackoffEntry::CalculateReleaseTime() const {
base::TimeTicks BackoffEntry::BackoffDurationToReleaseTime(
base::TimeDelta backoff_duration) const {
- const int64 kTimeTicksNowUs =
+ const int64_t kTimeTicksNowUs =
(GetTimeTicksNow() - base::TimeTicks()).InMicroseconds();
// Do overflow checking in microseconds, the internal unit of TimeTicks.
- base::internal::CheckedNumeric<int64> calculated_release_time_us =
+ base::internal::CheckedNumeric<int64_t> calculated_release_time_us =
backoff_duration.InMicroseconds();
calculated_release_time_us += kTimeTicksNowUs;
- base::internal::CheckedNumeric<int64> maximum_release_time_us = kint64max;
+ base::internal::CheckedNumeric<int64_t> maximum_release_time_us = kint64max;
if (policy_->maximum_backoff_ms >= 0) {
maximum_release_time_us = policy_->maximum_backoff_ms;
maximum_release_time_us *= base::Time::kMicrosecondsPerMillisecond;
@@ -171,9 +171,9 @@ base::TimeTicks BackoffEntry::BackoffDurationToReleaseTime(
// Decide between maximum release time and calculated release time, accounting
// for overflow with both.
- int64 release_time_us = std::min(
- calculated_release_time_us.ValueOrDefault(kint64max),
- maximum_release_time_us.ValueOrDefault(kint64max));
+ int64_t release_time_us =
+ std::min(calculated_release_time_us.ValueOrDefault(kint64max),
+ maximum_release_time_us.ValueOrDefault(kint64max));
return base::TimeTicks() + base::TimeDelta::FromMicroseconds(release_time_us);
}

Powered by Google App Engine
This is Rietveld 408576698