Commit 684e7542 authored by Peter Kasting's avatar Peter Kasting Committed by Commit Bot

Use TimeDelta::operator/() more, net/ edition.

Bug: 1104532
Change-Id: I0578584a42e7557b0baa23519cebcbe96a3729ef
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2353346
Auto-Submit: Peter Kasting <pkasting@chromium.org>
Reviewed-by: default avatarZhongyi Shi <zhongyi@chromium.org>
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#798980}
parent 568b6e3b
...@@ -278,10 +278,9 @@ bool ThroughputAnalyzer::IsHangingWindow(int64_t bits_received, ...@@ -278,10 +278,9 @@ bool ThroughputAnalyzer::IsHangingWindow(int64_t bits_received,
// Scale the |duration| to one HTTP RTT, and compute the number of bits that // Scale the |duration| to one HTTP RTT, and compute the number of bits that
// would be received over a duration of one HTTP RTT. // would be received over a duration of one HTTP RTT.
size_t bits_received_over_one_http_rtt = size_t bits_received_over_one_http_rtt =
bits_received * (network_quality_estimator_->GetHttpRTT() bits_received * (network_quality_estimator_->GetHttpRTT().value_or(
.value_or(base::TimeDelta::FromSeconds(10)) base::TimeDelta::FromSeconds(10)) /
.InMillisecondsF() / duration);
duration.InMillisecondsF());
// If |is_hanging| is true, it implies that less than // If |is_hanging| is true, it implies that less than
// kCwndSizeKilobytes were received over a period of 1 HTTP RTT. For a network // kCwndSizeKilobytes were received over a period of 1 HTTP RTT. For a network
......
...@@ -660,10 +660,10 @@ TEST(URLRequestThrottlerSimulation, PerceivedDowntimeRatio) { ...@@ -660,10 +660,10 @@ TEST(URLRequestThrottlerSimulation, PerceivedDowntimeRatio) {
Stats stats; Stats stats;
void PrintTrialDescription() { void PrintTrialDescription() {
double duration_minutes = const double duration_minutes =
static_cast<double>(duration.InSeconds()) / 60.0; duration / base::TimeDelta::FromMinutes(1);
double interval_minutes = const double interval_minutes =
static_cast<double>(average_client_interval.InSeconds()) / 60.0; average_client_interval / base::TimeDelta::FromMinutes(1);
VerboseOut("Trial with %.2f min downtime, avg. interval %.2f min.\n", VerboseOut("Trial with %.2f min downtime, avg. interval %.2f min.\n",
duration_minutes, interval_minutes); duration_minutes, interval_minutes);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment