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( ...@@ -435,7 +435,7 @@ void AccessibilityFocusRingController::AnimateFocusRings(
return; return;
} }
double fraction = delta.InSecondsF() / transition_time.InSecondsF(); double fraction = delta / transition_time;
// Ease-in effect. // Ease-in effect.
fraction = pow(fraction, 0.3); fraction = pow(fraction, 0.3);
...@@ -474,12 +474,10 @@ void AccessibilityFocusRingController::ComputeOpacity( ...@@ -474,12 +474,10 @@ void AccessibilityFocusRingController::ComputeOpacity(
} }
float opacity; float opacity;
if (start_delta < fade_in_time) { if (start_delta < fade_in_time)
opacity = start_delta.InSecondsF() / fade_in_time.InSecondsF(); opacity = start_delta / fade_in_time;
} else { else
opacity = 1.0 - (change_delta.InSecondsF() / opacity = 1.0 - (change_delta / (fade_in_time + fade_out_time));
(fade_in_time + fade_out_time).InSecondsF());
}
// Layer::SetOpacity will throw an error if we're not within 0...1. // Layer::SetOpacity will throw an error if we're not within 0...1.
opacity = base::ClampToRange(opacity, 0.0f, 1.0f); opacity = base::ClampToRange(opacity, 0.0f, 1.0f);
......
...@@ -37,8 +37,7 @@ bool IsTimeDeltaWithinJitter(const base::TimeDelta& base_time_delta, ...@@ -37,8 +37,7 @@ bool IsTimeDeltaWithinJitter(const base::TimeDelta& base_time_delta,
base::TimeDelta difference = base::TimeDelta difference =
(jittered_time_delta - base_time_delta).magnitude(); (jittered_time_delta - base_time_delta).magnitude();
double percentage_of_base = double percentage_of_base = difference / base_time_delta;
difference.InMillisecondsF() / base_time_delta.InMillisecondsF();
return percentage_of_base < max_jitter_ratio; return percentage_of_base < max_jitter_ratio;
} }
......
...@@ -322,9 +322,8 @@ double MessageQuotaChecker::DecayingRateAverage::GetDecayedRateAverage( ...@@ -322,9 +322,8 @@ double MessageQuotaChecker::DecayingRateAverage::GetDecayedRateAverage(
// - |when| is beyond the end of the current sampling interval. // - |when| is beyond the end of the current sampling interval.
const int64_t sampling_interval = ToSamplingInterval(when); const int64_t sampling_interval = ToSamplingInterval(when);
double age_in_sampling_intervals = double age_in_sampling_intervals =
(when - FromSamplingInterval(events_sampling_interval_)) (when - FromSamplingInterval(events_sampling_interval_)) /
.InMicrosecondsF() / kSamplingInterval;
kSamplingInterval.InMicrosecondsF();
DCHECK_LE(0.0, age_in_sampling_intervals); DCHECK_LE(0.0, age_in_sampling_intervals);
if (when == FromSamplingInterval(events_sampling_interval_)) { if (when == FromSamplingInterval(events_sampling_interval_)) {
DCHECK_EQ(0.0, age_in_sampling_intervals); 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