Commit 75bae800 authored by Peter Kasting's avatar Peter Kasting Committed by Commit Bot

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

Bug: 1104532
Change-Id: Icc7244ef277171fbc37f1fc3ca89837a629aa01b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2354628
Auto-Submit: Peter Kasting <pkasting@chromium.org>
Commit-Queue: Mike Pinkerton <pinkerton@chromium.org>
Reviewed-by: default avatarMike Pinkerton <pinkerton@chromium.org>
Cr-Commit-Position: refs/heads/master@{#798124}
parent 0fabf596
......@@ -435,7 +435,7 @@ void AccessibilityFocusRingController::AnimateFocusRings(
return;
}
double fraction = delta.InSecondsF() / transition_time.InSecondsF();
double fraction = delta / transition_time;
// Ease-in effect.
fraction = pow(fraction, 0.3);
......@@ -474,12 +474,10 @@ void AccessibilityFocusRingController::ComputeOpacity(
}
float opacity;
if (start_delta < fade_in_time) {
opacity = start_delta.InSecondsF() / fade_in_time.InSecondsF();
} else {
opacity = 1.0 - (change_delta.InSecondsF() /
(fade_in_time + fade_out_time).InSecondsF());
}
if (start_delta < fade_in_time)
opacity = start_delta / fade_in_time;
else
opacity = 1.0 - (change_delta / (fade_in_time + fade_out_time));
// Layer::SetOpacity will throw an error if we're not within 0...1.
opacity = base::ClampToRange(opacity, 0.0f, 1.0f);
......
......@@ -37,8 +37,7 @@ bool IsTimeDeltaWithinJitter(const base::TimeDelta& base_time_delta,
base::TimeDelta difference =
(jittered_time_delta - base_time_delta).magnitude();
double percentage_of_base =
difference.InMillisecondsF() / base_time_delta.InMillisecondsF();
double percentage_of_base = difference / base_time_delta;
return percentage_of_base < max_jitter_ratio;
}
......
......@@ -322,9 +322,8 @@ double MessageQuotaChecker::DecayingRateAverage::GetDecayedRateAverage(
// - |when| is beyond the end of the current sampling interval.
const int64_t sampling_interval = ToSamplingInterval(when);
double age_in_sampling_intervals =
(when - FromSamplingInterval(events_sampling_interval_))
.InMicrosecondsF() /
kSamplingInterval.InMicrosecondsF();
(when - FromSamplingInterval(events_sampling_interval_)) /
kSamplingInterval;
DCHECK_LE(0.0, age_in_sampling_intervals);
if (when == FromSamplingInterval(events_sampling_interval_)) {
DCHECK_EQ(0.0, age_in_sampling_intervals);
......
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