Commit 4938505d authored by George Steel's avatar George Steel Committed by Commit Bot

Restrict transform animation checks to only those in-play

Currently UpdateBoxSizeAndCheckTransformAxisAlignment loops over all
animations in ElementAnimations, including otherwise-unreachable ones
which have not been garbage collected yet, which can cause the function
to loop over and test/update many completed animations unnecessarily,
hurting performance. Add a fast check to exclude animations no longer
current or in effect.

Bug: 1142176, 1142666
Change-Id: I3f489fa022df173d9dc20b198c0894dabb7bfdc1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2500604Reviewed-by: default avatarKevin Ellis <kevers@chromium.org>
Commit-Queue: George Steel <gtsteel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#821218}
parent 9c108b62
...@@ -142,6 +142,8 @@ bool ElementAnimations::UpdateBoxSizeAndCheckTransformAxisAlignment( ...@@ -142,6 +142,8 @@ bool ElementAnimations::UpdateBoxSizeAndCheckTransformAxisAlignment(
for (auto& entry : animations_) { for (auto& entry : animations_) {
Animation& animation = *entry.key; Animation& animation = *entry.key;
if (auto* effect = DynamicTo<KeyframeEffect>(animation.effect())) { if (auto* effect = DynamicTo<KeyframeEffect>(animation.effect())) {
if (!effect->IsCurrent() && !effect->IsInEffect())
continue;
if (!effect->UpdateBoxSizeAndCheckTransformAxisAlignment(box_size)) if (!effect->UpdateBoxSizeAndCheckTransformAxisAlignment(box_size))
preserves_axis_alignment = false; preserves_axis_alignment = false;
} }
......
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