Skip to content

Commit

Permalink
[ScrollTimeline] Unconditionally detach compositor timeline during Do…
Browse files Browse the repository at this point in the history
…cument::Shutdown()

Previously during the shutdown process the compositor timeline may not
be detached if it still has animation attached to it. Rather, it should
be detached unconditionally.

This patch moves the condition check to the call sites to make sure that
the timeline cannot be detached if it still has animation attached.

Bug: None
Change-Id: I0e9b02493ffab9521211a0723557dafa19917f00
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2167517
Reviewed-by: David Bokan <bokan@chromium.org>
Reviewed-by: Majid Valipour <majidvp@chromium.org>
Commit-Queue: Yi Gu <yigu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#763463}
  • Loading branch information
yi-gu authored and Commit Bot committed Apr 28, 2020
1 parent baddec7 commit 91082e6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
4 changes: 3 additions & 1 deletion third_party/blink/renderer/core/animation/animation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2011,8 +2011,10 @@ void Animation::DetachCompositorTimeline() {

compositor_timeline->AnimationDestroyed(*this);

if (compositor_timeline->GetAnimationTimeline()->IsScrollTimeline())
if (compositor_timeline->GetAnimationTimeline()->IsScrollTimeline() &&
!compositor_timeline->GetAnimationTimeline()->HasAnimation()) {
document_->DetachCompositorTimeline(compositor_timeline);
}
}

void Animation::UpdateCompositorScrollTimeline() {
Expand Down
8 changes: 2 additions & 6 deletions third_party/blink/renderer/core/dom/document.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2975,12 +2975,8 @@ void Document::DetachCompositorTimeline(
!GetSettings()->GetAcceleratedCompositingEnabled())
return;

// This requires detaching all animations from timeline first before detaching
// timeline.
if (timeline->GetAnimationTimeline()->IsScrollTimeline() &&
timeline->GetAnimationTimeline()->HasAnimation())
return;

// During Document::Shutdown() the timeline needs to be unconditionally
// detached.
GetPage()->GetChromeClient().DetachCompositorAnimationTimeline(timeline,
GetFrame());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,8 @@ void WorkletAnimation::DestroyCompositorAnimation() {

if (compositor_animation_) {
if (compositor_timeline &&
compositor_timeline->GetAnimationTimeline()->IsScrollTimeline()) {
compositor_timeline->GetAnimationTimeline()->IsScrollTimeline() &&
!compositor_timeline->GetAnimationTimeline()->HasAnimation()) {
document_->DetachCompositorTimeline(compositor_timeline);
}

Expand Down

0 comments on commit 91082e6

Please sign in to comment.