Commit b937ddab authored by Edvard Thörnros's avatar Edvard Thörnros Committed by Commit Bot

Refactor SMILAnimationSandwich::GetNextFireTime

This should in theory give performance increases,
and has made the code easier to read by moving all
GetNextFireTime related computations into the relevant
method. This resulted in that one member could be removed.

This was purely a refactor commit and no breaking changes
should have taken place here.

Bug: 981522
Change-Id: Iba72d8ca48e1aaff1ae271033e9d57650ddc1eda
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1710578
Auto-Submit: Edvard Thörnros <edvardt@opera.com>
Commit-Queue: Stephen Chenney <schenney@chromium.org>
Reviewed-by: default avatarStephen Chenney <schenney@chromium.org>
Cr-Commit-Position: refs/heads/master@{#679944}
parent 5413d4da
......@@ -31,8 +31,7 @@
namespace blink {
SMILAnimationSandwich::SMILAnimationSandwich()
: earliest_fire_time_(SMILTime::Unresolved()) {}
SMILAnimationSandwich::SMILAnimationSandwich() {}
void SMILAnimationSandwich::Schedule(SVGSMILElement* animation) {
DCHECK(!sandwich_.Contains(animation));
......@@ -70,15 +69,19 @@ void SMILAnimationSandwich::UpdateTiming(double elapsed, bool seek_to_time) {
} else {
animation->ClearAnimatedType();
}
SMILTime next_fire_time = animation->NextProgressTime();
if (next_fire_time.IsFinite())
earliest_fire_time_ = std::min(next_fire_time, earliest_fire_time_);
}
}
SMILTime SMILAnimationSandwich::GetNextFireTime() {
return earliest_fire_time_;
SMILTime earliest_fire_time = SMILTime::Unresolved();
for (const auto& it_animation : sandwich_) {
SVGSMILElement* animation = it_animation.Get();
SMILTime next_fire_time = animation->NextProgressTime();
if (next_fire_time.IsFinite())
earliest_fire_time = std::min(next_fire_time, earliest_fire_time);
}
return earliest_fire_time;
}
void SMILAnimationSandwich::SendEvents(double elapsed, bool seek_to_time) {
......@@ -106,12 +109,6 @@ void SMILAnimationSandwich::SendEvents(double elapsed, bool seek_to_time) {
scheduled->ClearAnimatedType();
it = active_.erase(it);
}
for (auto& animation : active_) {
SMILTime next_fire_time = animation->NextProgressTime();
if (next_fire_time.IsFinite())
earliest_fire_time_ = std::min(next_fire_time, earliest_fire_time_);
}
}
SVGSMILElement* SMILAnimationSandwich::ApplyAnimationValues() {
......
......@@ -76,7 +76,6 @@ class SMILAnimationSandwich : public GarbageCollected<SMILAnimationSandwich> {
// The list stored here is always sorted.
ScheduledVector sandwich_;
ScheduledVector active_;
SMILTime earliest_fire_time_;
};
} // namespace blink
......
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