Index: third_party/WebKit/Source/core/animation/Animation.h |
diff --git a/third_party/WebKit/Source/core/animation/Animation.h b/third_party/WebKit/Source/core/animation/Animation.h |
index e654fe382f6df9c06c3d66dca03e0008098a2652..e1fb0546ac7de054178c868461fa7407dc142007 100644 |
--- a/third_party/WebKit/Source/core/animation/Animation.h |
+++ b/third_party/WebKit/Source/core/animation/Animation.h |
@@ -62,7 +62,6 @@ class CORE_EXPORT Animation final : public EventTargetWithInlineData, |
public CompositorAnimationPlayerClient { |
DEFINE_WRAPPERTYPEINFO(); |
USING_GARBAGE_COLLECTED_MIXIN(Animation); |
- USING_PRE_FINALIZER(Animation, dispose); |
public: |
enum AnimationPlayState { Unset, Idle, Pending, Running, Paused, Finished }; |
@@ -162,7 +161,7 @@ class CORE_EXPORT Animation final : public EventTargetWithInlineData, |
void notifyStartTime(double timelineTime); |
// CompositorAnimationPlayerClient implementation. |
CompositorAnimationPlayer* compositorPlayer() const override { |
- return m_compositorPlayer.get(); |
+ return m_compositorPlayer ? m_compositorPlayer->player() : nullptr; |
} |
bool affects(const Element&, CSSPropertyID) const; |
@@ -300,6 +299,33 @@ class CORE_EXPORT Animation final : public EventTargetWithInlineData, |
CompositorPendingChange m_compositorPendingChange; |
}; |
+ // CompositorAnimationPlayer objects need to eagerly sever |
haraken
2016/12/12 15:33:29
serve
sof
2016/12/12 15:41:22
We're severing the connection.
|
+ // their connection to their Animation delegate; use a separate |
+ // 'holder' on-heap object to accomplish that. |
+ class CompositorAnimationPlayerHolder |
+ : public GarbageCollectedFinalized<CompositorAnimationPlayerHolder> { |
+ USING_PRE_FINALIZER(CompositorAnimationPlayerHolder, dispose); |
+ |
+ public: |
+ static CompositorAnimationPlayerHolder* create(Animation*); |
+ |
+ void detach(); |
+ |
+ DEFINE_INLINE_TRACE() { visitor->trace(m_animation); } |
+ |
+ CompositorAnimationPlayer* player() const { |
+ return m_compositorPlayer.get(); |
+ } |
+ |
+ private: |
+ explicit CompositorAnimationPlayerHolder(Animation*); |
+ |
+ void dispose(); |
+ |
+ std::unique_ptr<CompositorAnimationPlayer> m_compositorPlayer; |
+ Member<Animation> m_animation; |
+ }; |
+ |
// This mirrors the known compositor state. It is created when a compositor |
// animation is started. Updated once the start time is known and each time |
// modifications are pushed to the compositor. |
@@ -307,8 +333,7 @@ class CORE_EXPORT Animation final : public EventTargetWithInlineData, |
bool m_compositorPending; |
int m_compositorGroup; |
- std::unique_ptr<CompositorAnimationPlayer> m_compositorPlayer; |
- bool m_preFinalizerRegistered; |
+ Member<CompositorAnimationPlayerHolder> m_compositorPlayer; |
bool m_currentTimePending; |
bool m_stateIsBeingUpdated; |