| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 class AnimationEffect; | 48 class AnimationEffect; |
| 49 | 49 |
| 50 // AnimationTimeline is constructed and owned by Document, and tied to its lifec
ycle. | 50 // AnimationTimeline is constructed and owned by Document, and tied to its lifec
ycle. |
| 51 class CORE_EXPORT AnimationTimeline : public GarbageCollectedFinalized<Animation
Timeline>, public ScriptWrappable { | 51 class CORE_EXPORT AnimationTimeline : public GarbageCollectedFinalized<Animation
Timeline>, public ScriptWrappable { |
| 52 DEFINE_WRAPPERTYPEINFO(); | 52 DEFINE_WRAPPERTYPEINFO(); |
| 53 public: | 53 public: |
| 54 class PlatformTiming : public GarbageCollectedFinalized<PlatformTiming> { | 54 class PlatformTiming : public GarbageCollectedFinalized<PlatformTiming> { |
| 55 public: | 55 public: |
| 56 // Calls AnimationTimeline's wake() method after duration seconds. | 56 // Calls AnimationTimeline's wake() method after duration seconds. |
| 57 virtual void wakeAfter(double duration) = 0; | 57 virtual void wakeAfter(double duration) = 0; |
| 58 virtual void cancelWake() = 0; | |
| 59 virtual void serviceOnNextFrame() = 0; | 58 virtual void serviceOnNextFrame() = 0; |
| 60 virtual ~PlatformTiming() { } | 59 virtual ~PlatformTiming() { } |
| 61 DEFINE_INLINE_VIRTUAL_TRACE() { } | 60 DEFINE_INLINE_VIRTUAL_TRACE() { } |
| 62 }; | 61 }; |
| 63 | 62 |
| 64 static AnimationTimeline* create(Document*, PlatformTiming* = nullptr); | 63 static AnimationTimeline* create(Document*, PlatformTiming* = nullptr); |
| 65 ~AnimationTimeline(); | 64 ~AnimationTimeline(); |
| 66 | 65 |
| 67 void serviceAnimations(TimingUpdateReason); | 66 void serviceAnimations(TimingUpdateReason); |
| 68 void scheduleNextService(); | 67 void scheduleNextService(); |
| 69 | 68 |
| 70 Animation* play(AnimationEffect*); | 69 Animation* play(AnimationEffect*); |
| 71 HeapVector<Member<Animation>> getAnimations(); | 70 HeapVector<Member<Animation>> getAnimations(); |
| 72 | 71 |
| 73 void animationAttached(Animation&); | 72 void animationAttached(Animation&); |
| 74 | 73 |
| 74 bool isActive(); |
| 75 bool hasPendingUpdates() const { return !m_animationsNeedingUpdate.isEmpty()
; } | 75 bool hasPendingUpdates() const { return !m_animationsNeedingUpdate.isEmpty()
; } |
| 76 double zeroTime(); | 76 double zeroTime(); |
| 77 double currentTime(bool& isNull); | 77 double currentTime(bool& isNull); |
| 78 double currentTime(); | 78 double currentTime(); |
| 79 double currentTimeInternal(bool& isNull); | 79 double currentTimeInternal(bool& isNull); |
| 80 double currentTimeInternal(); | 80 double currentTimeInternal(); |
| 81 void setCurrentTime(double); | 81 void setCurrentTime(double); |
| 82 void setCurrentTimeInternal(double); | 82 void setCurrentTimeInternal(double); |
| 83 double effectiveTime(); | 83 double effectiveTime(); |
| 84 void pauseAnimationsForTesting(double); | 84 void pauseAnimationsForTesting(double); |
| 85 | 85 |
| 86 void setAllCompositorPending(bool sourceChanged = false); | 86 void setAllCompositorPending(bool sourceChanged = false); |
| 87 void setOutdatedAnimation(Animation*); | 87 void setOutdatedAnimation(Animation*); |
| 88 void clearOutdatedAnimation(Animation*); | 88 void clearOutdatedAnimation(Animation*); |
| 89 bool hasOutdatedAnimation() const { return m_outdatedAnimationCount > 0; } | 89 bool hasOutdatedAnimation() const { return m_outdatedAnimationCount > 0; } |
| 90 bool needsAnimationTimingUpdate(); | 90 bool needsAnimationTimingUpdate(); |
| 91 | 91 |
| 92 void setPlaybackRate(double); | 92 void setPlaybackRate(double); |
| 93 double playbackRate() const; | 93 double playbackRate() const; |
| 94 | 94 |
| 95 WebCompositorAnimationTimeline* compositorTimeline() const { return m_compos
itorTimeline.get(); } | 95 WebCompositorAnimationTimeline* compositorTimeline() const { return m_compos
itorTimeline.get(); } |
| 96 | 96 |
| 97 Document* document() { return m_document.get(); } | 97 Document* document() { return m_document.get(); } |
| 98 #if !ENABLE(OILPAN) | 98 #if !ENABLE(OILPAN) |
| 99 void detachFromDocument(); | 99 void detachFromDocument(); |
| 100 #endif | 100 #endif |
| 101 void wake(); | 101 void wake(); |
| 102 void resetForTesting(); |
| 102 | 103 |
| 103 DECLARE_TRACE(); | 104 DECLARE_TRACE(); |
| 104 | 105 |
| 105 protected: | 106 protected: |
| 106 AnimationTimeline(Document*, PlatformTiming*); | 107 AnimationTimeline(Document*, PlatformTiming*); |
| 107 | 108 |
| 108 private: | 109 private: |
| 109 RawPtrWillBeMember<Document> m_document; | 110 RawPtrWillBeMember<Document> m_document; |
| 110 double m_zeroTime; | 111 double m_zeroTime; |
| 111 bool m_zeroTimeInitialized; | 112 bool m_zeroTimeInitialized; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 128 class AnimationTimelineTiming final : public PlatformTiming { | 129 class AnimationTimelineTiming final : public PlatformTiming { |
| 129 public: | 130 public: |
| 130 AnimationTimelineTiming(AnimationTimeline* timeline) | 131 AnimationTimelineTiming(AnimationTimeline* timeline) |
| 131 : m_timeline(timeline) | 132 : m_timeline(timeline) |
| 132 , m_timer(this, &AnimationTimelineTiming::timerFired) | 133 , m_timer(this, &AnimationTimelineTiming::timerFired) |
| 133 { | 134 { |
| 134 ASSERT(m_timeline); | 135 ASSERT(m_timeline); |
| 135 } | 136 } |
| 136 | 137 |
| 137 void wakeAfter(double duration) override; | 138 void wakeAfter(double duration) override; |
| 138 void cancelWake() override; | |
| 139 void serviceOnNextFrame() override; | 139 void serviceOnNextFrame() override; |
| 140 | 140 |
| 141 void timerFired(Timer<AnimationTimelineTiming>*) { m_timeline->wake(); } | 141 void timerFired(Timer<AnimationTimelineTiming>*) { m_timeline->wake(); } |
| 142 | 142 |
| 143 DECLARE_VIRTUAL_TRACE(); | 143 DECLARE_VIRTUAL_TRACE(); |
| 144 | 144 |
| 145 private: | 145 private: |
| 146 Member<AnimationTimeline> m_timeline; | 146 Member<AnimationTimeline> m_timeline; |
| 147 Timer<AnimationTimelineTiming> m_timer; | 147 Timer<AnimationTimelineTiming> m_timer; |
| 148 }; | 148 }; |
| 149 | 149 |
| 150 friend class AnimationAnimationTimelineTest; | 150 friend class AnimationAnimationTimelineTest; |
| 151 }; | 151 }; |
| 152 | 152 |
| 153 } // namespace blink | 153 } // namespace blink |
| 154 | 154 |
| 155 #endif | 155 #endif |
| OLD | NEW |