Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Side by Side Diff: third_party/WebKit/Source/platform/animation/CompositorAnimationPlayer.cpp

Issue 1747283004: Blink Compositor Animations: Reset delegate in CC on Blink player deletion. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Replace DCHECK with detach action. Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "platform/animation/CompositorAnimationPlayer.h" 5 #include "platform/animation/CompositorAnimationPlayer.h"
6 6
7 #include "cc/animation/animation_id_provider.h" 7 #include "cc/animation/animation_id_provider.h"
8 #include "cc/animation/animation_timeline.h"
8 #include "platform/animation/CompositorAnimation.h" 9 #include "platform/animation/CompositorAnimation.h"
9 #include "platform/animation/CompositorAnimationDelegate.h" 10 #include "platform/animation/CompositorAnimationDelegate.h"
10 #include "public/platform/WebLayer.h" 11 #include "public/platform/WebLayer.h"
11 12
12 namespace blink { 13 namespace blink {
13 14
14 CompositorAnimationPlayer::CompositorAnimationPlayer() 15 CompositorAnimationPlayer::CompositorAnimationPlayer()
15 : m_animationPlayer(cc::AnimationPlayer::Create(cc::AnimationIdProvider::Nex tPlayerId())) 16 : m_animationPlayer(cc::AnimationPlayer::Create(cc::AnimationIdProvider::Nex tPlayerId()))
16 , m_delegate() 17 , m_delegate()
17 { 18 {
18 } 19 }
19 20
20 CompositorAnimationPlayer::~CompositorAnimationPlayer() 21 CompositorAnimationPlayer::~CompositorAnimationPlayer()
21 { 22 {
23 setAnimationDelegate(nullptr);
24 // Detach player from timeline, otherwise it stays there (leaks) until
25 // compositor shutdown.
26 if (m_animationPlayer->animation_timeline())
27 m_animationPlayer->animation_timeline()->DetachPlayer(m_animationPlayer) ;
22 } 28 }
23 29
24 cc::AnimationPlayer* CompositorAnimationPlayer::animationPlayer() const 30 cc::AnimationPlayer* CompositorAnimationPlayer::animationPlayer() const
25 { 31 {
26 return m_animationPlayer.get(); 32 return m_animationPlayer.get();
27 } 33 }
28 34
29 void CompositorAnimationPlayer::setAnimationDelegate(CompositorAnimationDelegate * delegate) 35 void CompositorAnimationPlayer::setAnimationDelegate(CompositorAnimationDelegate * delegate)
30 { 36 {
31 m_delegate = delegate; 37 m_delegate = delegate;
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 { 109 {
104 if (m_delegate) { 110 if (m_delegate) {
105 m_delegate->notifyAnimationTakeover( 111 m_delegate->notifyAnimationTakeover(
106 (monotonicTime - base::TimeTicks()).InSecondsF(), 112 (monotonicTime - base::TimeTicks()).InSecondsF(),
107 animationStartTime, 113 animationStartTime,
108 std::move(curve)); 114 std::move(curve));
109 } 115 }
110 } 116 }
111 117
112 } // namespace blink 118 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698