[go: nahoru, domu]

Reland "Remove tracking of which animating elements exist."

Avoids crashes due to animating non-existent property nodes through
defensive checks, while still keeping a DCHECK to be aware of the
underlying issues.

Subsequently, https://chromium-review.googlesource.com/c/chromium/src/+/3408198
will provide more insight into the stacks leading to these
animations on non-existent property nodes.

Original change (patchset 1) description:
> Remove tracking of which animating elements exist.
>
> Prior to property trees, composited animations were created before their
> corresponding layers existed. However, the blink lifecycle now ensures
> that composited animations are created in sync with their property tree
> nodes such that they always exist in the tree. Removing this code saves
> time and will unlock further simplifications of the code.
>
> The ui animation infrastructure eagerly creates layers before their
> animations so it doesn't have this issue and the LayerAnimator class
> ensures that animations are cleaned up on Layer removal.
>
> Bug: 900241
> Change-Id: If854cf67ba8bd21e727e42475d26ce1a846a7674
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3200347
> Reviewed-by: David Baron <dbaron@chromium.org>
> Reviewed-by: Philip Rogers <pdr@chromium.org>
> Commit-Queue: Robert Flack <flackr@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#975833}

Bug: 900241
Change-Id: Ie66d10d9d68c752090db85557b451c83f3573750
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3530228
Reviewed-by: David Baron <dbaron@chromium.org>
Reviewed-by: Chris Harrelson <chrishtr@chromium.org>
Commit-Queue: Robert Flack <flackr@chromium.org>
Cr-Commit-Position: refs/heads/main@{#981959}
diff --git a/cc/animation/animation_timeline.cc b/cc/animation/animation_timeline.cc
index ac3a92e..e4ce1186 100644
--- a/cc/animation/animation_timeline.cc
+++ b/cc/animation/animation_timeline.cc
@@ -154,8 +154,8 @@
 void AnimationTimeline::EraseAnimation(scoped_refptr<Animation> animation) {
   if (animation->element_animations())
     animation->DetachElement();
-  animation->SetAnimationTimeline(nullptr);
   animation->SetAnimationHost(nullptr);
+  animation->SetAnimationTimeline(nullptr);
 }
 
 void AnimationTimeline::PushPropertiesToImplThread(