Commit ca219edc authored by Fredrik Söderquist's avatar Fredrik Söderquist Committed by Commit Bot

Remove |SMILTimeContainer::active_sandwiches_|

We no longer have a need for it - SMILAnimationSandwich::IsEmpty()
will never return true in the loop in UpdateIntervals().

Tidy up the loops to use the Values() proxy.

Bug: 998526
Change-Id: Ic7ebda4aece0989692293f3407c7f17c804495a3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1796667
Commit-Queue: Fredrik Söderquist <fs@opera.com>
Reviewed-by: default avatarPhilip Rogers <pdr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#695954}
parent 63353c9c
...@@ -461,23 +461,15 @@ void SMILTimeContainer::RemoveUnusedKeys() { ...@@ -461,23 +461,15 @@ void SMILTimeContainer::RemoveUnusedKeys() {
} }
void SMILTimeContainer::UpdateIntervals(SMILTime document_time) { void SMILTimeContainer::UpdateIntervals(SMILTime document_time) {
// This Shrink should free up the memory from the previous
// run in this loop. Otherwise it won't do anything.
DCHECK(document_time.IsFinite()); DCHECK(document_time.IsFinite());
DCHECK(document_time >= 0.0); DCHECK(document_time >= 0.0);
do { do {
intervals_dirty_ = false; intervals_dirty_ = false;
active_sandwiches_.Shrink(0);
for (auto& entry : scheduled_animations_) {
auto* sandwich = entry.value.Get();
sandwich->UpdateTiming(document_time.Value());
if (!sandwich->IsEmpty()) { for (auto& sandwich : scheduled_animations_.Values())
active_sandwiches_.push_back(sandwich); sandwich->UpdateTiming(document_time.Value());
}
}
for (auto& sandwich : active_sandwiches_) for (auto& sandwich : scheduled_animations_.Values())
sandwich->UpdateSyncBases(document_time.Value()); sandwich->UpdateSyncBases(document_time.Value());
} while (intervals_dirty_); } while (intervals_dirty_);
} }
...@@ -502,7 +494,6 @@ void SMILTimeContainer::UpdateAnimationTimings(double presentation_time) { ...@@ -502,7 +494,6 @@ void SMILTimeContainer::UpdateAnimationTimings(double presentation_time) {
if (intervals_dirty_) if (intervals_dirty_)
UpdateIntervals(latest_update_time_); UpdateIntervals(latest_update_time_);
active_sandwiches_.ReserveCapacity(scheduled_animations_.size());
while (latest_update_time_ < presentation_time) { while (latest_update_time_ < presentation_time) {
const SMILTime interesting_time = NextInterestingTime(latest_update_time_); const SMILTime interesting_time = NextInterestingTime(latest_update_time_);
latest_update_time_ = latest_update_time_ =
...@@ -517,12 +508,11 @@ void SMILTimeContainer::ApplyAnimationValues(double elapsed) { ...@@ -517,12 +508,11 @@ void SMILTimeContainer::ApplyAnimationValues(double elapsed) {
prevent_scheduled_animations_changes_ = true; prevent_scheduled_animations_changes_ = true;
#endif #endif
HeapVector<Member<SVGSMILElement>> animations_to_apply; HeapVector<Member<SVGSMILElement>> animations_to_apply;
for (auto& sandwich : active_sandwiches_) { for (auto& sandwich : scheduled_animations_.Values()) {
sandwich->UpdateActiveAnimationStack(elapsed); sandwich->UpdateActiveAnimationStack(elapsed);
if (SVGSMILElement* animation = sandwich->ApplyAnimationValues()) if (SVGSMILElement* animation = sandwich->ApplyAnimationValues())
animations_to_apply.push_back(animation); animations_to_apply.push_back(animation);
} }
active_sandwiches_.Shrink(0);
if (animations_to_apply.IsEmpty()) { if (animations_to_apply.IsEmpty()) {
#if DCHECK_IS_ON() #if DCHECK_IS_ON()
...@@ -568,7 +558,6 @@ void SMILTimeContainer::AdvanceFrameForTesting() { ...@@ -568,7 +558,6 @@ void SMILTimeContainer::AdvanceFrameForTesting() {
void SMILTimeContainer::Trace(blink::Visitor* visitor) { void SMILTimeContainer::Trace(blink::Visitor* visitor) {
visitor->Trace(scheduled_animations_); visitor->Trace(scheduled_animations_);
visitor->Trace(owner_svg_element_); visitor->Trace(owner_svg_element_);
visitor->Trace(active_sandwiches_);
} }
} // namespace blink } // namespace blink
...@@ -147,7 +147,6 @@ class SMILTimeContainer final ...@@ -147,7 +147,6 @@ class SMILTimeContainer final
TaskRunnerTimer<SMILTimeContainer> animation_policy_once_timer_; TaskRunnerTimer<SMILTimeContainer> animation_policy_once_timer_;
AnimationsMap scheduled_animations_; AnimationsMap scheduled_animations_;
HeapVector<Member<SMILAnimationSandwich>> active_sandwiches_;
Member<SVGSVGElement> owner_svg_element_; Member<SVGSVGElement> owner_svg_element_;
......
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