| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 #include "wtf/RefCounted.h" | 42 #include "wtf/RefCounted.h" |
| 43 #include "wtf/RefPtr.h" | 43 #include "wtf/RefPtr.h" |
| 44 #include "wtf/Vector.h" | 44 #include "wtf/Vector.h" |
| 45 | 45 |
| 46 namespace blink { | 46 namespace blink { |
| 47 | 47 |
| 48 class Document; | 48 class Document; |
| 49 class AnimationEffect; | 49 class AnimationEffect; |
| 50 | 50 |
| 51 // AnimationTimeline is constructed and owned by Document, and tied to its lifec
ycle. | 51 // AnimationTimeline is constructed and owned by Document, and tied to its lifec
ycle. |
| 52 class CORE_EXPORT AnimationTimeline : public RefCountedWillBeGarbageCollectedFin
alized<AnimationTimeline>, public ScriptWrappable { | 52 class CORE_EXPORT AnimationTimeline : public GarbageCollectedFinalized<Animation
Timeline>, public ScriptWrappable { |
| 53 DEFINE_WRAPPERTYPEINFO(); | 53 DEFINE_WRAPPERTYPEINFO(); |
| 54 public: | 54 public: |
| 55 class PlatformTiming : public NoBaseWillBeGarbageCollectedFinalized<Platform
Timing> { | 55 class PlatformTiming : public GarbageCollectedFinalized<PlatformTiming> { |
| 56 | 56 |
| 57 public: | 57 public: |
| 58 // Calls AnimationTimeline's wake() method after duration seconds. | 58 // Calls AnimationTimeline's wake() method after duration seconds. |
| 59 virtual void wakeAfter(double duration) = 0; | 59 virtual void wakeAfter(double duration) = 0; |
| 60 virtual void cancelWake() = 0; | 60 virtual void cancelWake() = 0; |
| 61 virtual void serviceOnNextFrame() = 0; | 61 virtual void serviceOnNextFrame() = 0; |
| 62 virtual ~PlatformTiming() { } | 62 virtual ~PlatformTiming() { } |
| 63 DEFINE_INLINE_VIRTUAL_TRACE() { } | 63 DEFINE_INLINE_VIRTUAL_TRACE() { } |
| 64 }; | 64 }; |
| 65 | 65 |
| 66 static PassRefPtrWillBeRawPtr<AnimationTimeline> create(Document*, PassOwnPt
rWillBeRawPtr<PlatformTiming> = nullptr); | 66 static AnimationTimeline* create(Document*, PlatformTiming* = nullptr); |
| 67 ~AnimationTimeline(); | 67 ~AnimationTimeline(); |
| 68 | 68 |
| 69 void serviceAnimations(TimingUpdateReason); | 69 void serviceAnimations(TimingUpdateReason); |
| 70 void scheduleNextService(); | 70 void scheduleNextService(); |
| 71 | 71 |
| 72 Animation* play(AnimationEffect*); | 72 Animation* play(AnimationEffect*); |
| 73 WillBeHeapVector<RefPtrWillBeMember<Animation>> getAnimations(); | 73 WillBeHeapVector<RefPtrWillBeMember<Animation>> getAnimations(); |
| 74 | 74 |
| 75 void animationAttached(Animation&); | 75 void animationAttached(Animation&); |
| 76 #if !ENABLE(OILPAN) | 76 #if !ENABLE(OILPAN) |
| (...skipping 23 matching lines...) Expand all Loading... |
| 100 double playbackRate() const; | 100 double playbackRate() const; |
| 101 | 101 |
| 102 WebCompositorAnimationTimeline* compositorTimeline() const { return m_compos
itorTimeline.get(); } | 102 WebCompositorAnimationTimeline* compositorTimeline() const { return m_compos
itorTimeline.get(); } |
| 103 | 103 |
| 104 Document* document() { return m_document.get(); } | 104 Document* document() { return m_document.get(); } |
| 105 #if !ENABLE(OILPAN) | 105 #if !ENABLE(OILPAN) |
| 106 void detachFromDocument(); | 106 void detachFromDocument(); |
| 107 #endif | 107 #endif |
| 108 void wake(); | 108 void wake(); |
| 109 | 109 |
| 110 PlatformTiming* timing() { return m_timing.get(); } |
| 111 |
| 110 DECLARE_TRACE(); | 112 DECLARE_TRACE(); |
| 111 | 113 |
| 112 protected: | 114 protected: |
| 113 AnimationTimeline(Document*, PassOwnPtrWillBeRawPtr<PlatformTiming>); | 115 AnimationTimeline(Document*, PlatformTiming*); |
| 114 | 116 |
| 115 private: | 117 private: |
| 116 RawPtrWillBeMember<Document> m_document; | 118 RawPtrWillBeMember<Document> m_document; |
| 117 double m_zeroTime; | 119 double m_zeroTime; |
| 118 bool m_zeroTimeInitialized; | 120 bool m_zeroTimeInitialized; |
| 119 // Animations which will be updated on the next frame | 121 // Animations which will be updated on the next frame |
| 120 // i.e. current, in effect, or had timing changed | 122 // i.e. current, in effect, or had timing changed |
| 121 WillBeHeapHashSet<RefPtrWillBeMember<Animation>> m_animationsNeedingUpdate; | 123 WillBeHeapHashSet<RefPtrWillBeMember<Animation>> m_animationsNeedingUpdate; |
| 122 WillBeHeapHashSet<RawPtrWillBeWeakMember<Animation>> m_animations; | 124 WillBeHeapHashSet<RawPtrWillBeWeakMember<Animation>> m_animations; |
| 123 | 125 |
| 124 double m_playbackRate; | 126 double m_playbackRate; |
| 125 | 127 |
| 126 friend class SMILTimeContainer; | 128 friend class SMILTimeContainer; |
| 127 static const double s_minimumDelay; | 129 static const double s_minimumDelay; |
| 128 | 130 |
| 129 OwnPtrWillBeMember<PlatformTiming> m_timing; | 131 Member<PlatformTiming> m_timing; |
| 130 double m_lastCurrentTimeInternal; | 132 double m_lastCurrentTimeInternal; |
| 131 | 133 |
| 132 OwnPtr<WebCompositorAnimationTimeline> m_compositorTimeline; | 134 OwnPtr<WebCompositorAnimationTimeline> m_compositorTimeline; |
| 133 | 135 |
| 134 class AnimationTimelineTiming final : public PlatformTiming { | 136 class AnimationTimelineTiming final : public PlatformTiming { |
| 135 public: | 137 public: |
| 136 AnimationTimelineTiming(AnimationTimeline* timeline) | 138 AnimationTimelineTiming(AnimationTimeline* timeline) |
| 137 : m_timeline(timeline) | 139 : m_timeline(timeline) |
| 138 , m_timer(this, &AnimationTimelineTiming::timerFired) | 140 , m_timer(this, &AnimationTimelineTiming::timerFired) |
| 139 { | 141 { |
| 140 ASSERT(m_timeline); | 142 ASSERT(m_timeline); |
| 141 } | 143 } |
| 142 | 144 |
| 143 virtual void wakeAfter(double duration) override; | 145 virtual void wakeAfter(double duration) override; |
| 144 virtual void cancelWake() override; | 146 virtual void cancelWake() override; |
| 145 virtual void serviceOnNextFrame() override; | 147 virtual void serviceOnNextFrame() override; |
| 146 | 148 |
| 147 void timerFired(Timer<AnimationTimelineTiming>*) { m_timeline->wake(); } | 149 void timerFired(Timer<AnimationTimelineTiming>*) { m_timeline->wake(); } |
| 148 | 150 |
| 149 DECLARE_VIRTUAL_TRACE(); | 151 DECLARE_VIRTUAL_TRACE(); |
| 150 | 152 |
| 151 private: | 153 private: |
| 152 RawPtrWillBeMember<AnimationTimeline> m_timeline; | 154 Member<AnimationTimeline> m_timeline; |
| 153 Timer<AnimationTimelineTiming> m_timer; | 155 Timer<AnimationTimelineTiming> m_timer; |
| 154 }; | 156 }; |
| 155 | 157 |
| 156 friend class AnimationAnimationTimelineTest; | 158 friend class AnimationAnimationTimelineTest; |
| 157 }; | 159 }; |
| 158 | 160 |
| 159 } // namespace blink | 161 } // namespace blink |
| 160 | 162 |
| 161 #endif | 163 #endif |
| OLD | NEW |