Chromium Code Reviews| 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> { |
|
sof
2015/05/30 11:34:04
Unusual abstract interface, it also deriving from
| |
| 56 | |
| 57 public: | 56 public: |
| 58 // Calls AnimationTimeline's wake() method after duration seconds. | 57 // Calls AnimationTimeline's wake() method after duration seconds. |
| 59 virtual void wakeAfter(double duration) = 0; | 58 virtual void wakeAfter(double duration) = 0; |
| 60 virtual void cancelWake() = 0; | 59 virtual void cancelWake() = 0; |
| 61 virtual void serviceOnNextFrame() = 0; | 60 virtual void serviceOnNextFrame() = 0; |
| 62 virtual ~PlatformTiming() { } | 61 virtual ~PlatformTiming() { } |
| 63 DEFINE_INLINE_VIRTUAL_TRACE() { } | 62 DEFINE_INLINE_VIRTUAL_TRACE() { } |
| 64 }; | 63 }; |
| 65 | 64 |
| 66 static PassRefPtrWillBeRawPtr<AnimationTimeline> create(Document*, PassOwnPt rWillBeRawPtr<PlatformTiming> = nullptr); | 65 static AnimationTimeline* create(Document*, PlatformTiming* = nullptr); |
| 67 ~AnimationTimeline(); | 66 ~AnimationTimeline(); |
| 68 | 67 |
| 69 void serviceAnimations(TimingUpdateReason); | 68 void serviceAnimations(TimingUpdateReason); |
| 70 void scheduleNextService(); | 69 void scheduleNextService(); |
| 71 | 70 |
| 72 Animation* play(AnimationEffect*); | 71 Animation* play(AnimationEffect*); |
| 73 WillBeHeapVector<RefPtrWillBeMember<Animation>> getAnimations(); | 72 HeapVector<Member<Animation>> getAnimations(); |
| 74 | 73 |
| 75 void animationAttached(Animation&); | 74 void animationAttached(Animation&); |
| 76 #if !ENABLE(OILPAN) | 75 #if !ENABLE(OILPAN) |
| 77 void animationDestroyed(Animation* animation) | 76 void animationDestroyed(Animation* animation) |
| 78 { | 77 { |
| 79 ASSERT(m_animations.contains(animation)); | 78 ASSERT(m_animations.contains(animation)); |
| 80 m_animations.remove(animation); | 79 m_animations.remove(animation); |
| 81 } | 80 } |
| 82 #endif | 81 #endif |
| 83 | 82 |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 103 | 102 |
| 104 Document* document() { return m_document.get(); } | 103 Document* document() { return m_document.get(); } |
| 105 #if !ENABLE(OILPAN) | 104 #if !ENABLE(OILPAN) |
| 106 void detachFromDocument(); | 105 void detachFromDocument(); |
| 107 #endif | 106 #endif |
| 108 void wake(); | 107 void wake(); |
| 109 | 108 |
| 110 DECLARE_TRACE(); | 109 DECLARE_TRACE(); |
| 111 | 110 |
| 112 protected: | 111 protected: |
| 113 AnimationTimeline(Document*, PassOwnPtrWillBeRawPtr<PlatformTiming>); | 112 AnimationTimeline(Document*, PlatformTiming*); |
| 114 | 113 |
| 115 private: | 114 private: |
| 116 RawPtrWillBeMember<Document> m_document; | 115 RawPtrWillBeMember<Document> m_document; |
| 117 double m_zeroTime; | 116 double m_zeroTime; |
| 118 bool m_zeroTimeInitialized; | 117 bool m_zeroTimeInitialized; |
| 119 // Animations which will be updated on the next frame | 118 // Animations which will be updated on the next frame |
| 120 // i.e. current, in effect, or had timing changed | 119 // i.e. current, in effect, or had timing changed |
| 121 WillBeHeapHashSet<RefPtrWillBeMember<Animation>> m_animationsNeedingUpdate; | 120 HeapHashSet<Member<Animation>> m_animationsNeedingUpdate; |
| 122 WillBeHeapHashSet<RawPtrWillBeWeakMember<Animation>> m_animations; | 121 HeapHashSet<WeakMember<Animation>> m_animations; |
| 123 | 122 |
| 124 double m_playbackRate; | 123 double m_playbackRate; |
| 125 | 124 |
| 126 friend class SMILTimeContainer; | 125 friend class SMILTimeContainer; |
| 127 static const double s_minimumDelay; | 126 static const double s_minimumDelay; |
| 128 | 127 |
| 129 OwnPtrWillBeMember<PlatformTiming> m_timing; | 128 Member<PlatformTiming> m_timing; |
| 130 double m_lastCurrentTimeInternal; | 129 double m_lastCurrentTimeInternal; |
| 131 | 130 |
| 132 OwnPtr<WebCompositorAnimationTimeline> m_compositorTimeline; | 131 OwnPtr<WebCompositorAnimationTimeline> m_compositorTimeline; |
| 133 | 132 |
| 134 class AnimationTimelineTiming final : public PlatformTiming { | 133 class AnimationTimelineTiming final : public PlatformTiming { |
| 135 public: | 134 public: |
| 136 AnimationTimelineTiming(AnimationTimeline* timeline) | 135 AnimationTimelineTiming(AnimationTimeline* timeline) |
| 137 : m_timeline(timeline) | 136 : m_timeline(timeline) |
| 138 , m_timer(this, &AnimationTimelineTiming::timerFired) | 137 , m_timer(this, &AnimationTimelineTiming::timerFired) |
| 139 { | 138 { |
| 140 ASSERT(m_timeline); | 139 ASSERT(m_timeline); |
| 141 } | 140 } |
| 142 | 141 |
| 143 virtual void wakeAfter(double duration) override; | 142 virtual void wakeAfter(double duration) override; |
| 144 virtual void cancelWake() override; | 143 virtual void cancelWake() override; |
| 145 virtual void serviceOnNextFrame() override; | 144 virtual void serviceOnNextFrame() override; |
| 146 | 145 |
| 147 void timerFired(Timer<AnimationTimelineTiming>*) { m_timeline->wake(); } | 146 void timerFired(Timer<AnimationTimelineTiming>*) { m_timeline->wake(); } |
| 148 | 147 |
| 149 DECLARE_VIRTUAL_TRACE(); | 148 DECLARE_VIRTUAL_TRACE(); |
| 150 | 149 |
| 151 private: | 150 private: |
| 152 RawPtrWillBeMember<AnimationTimeline> m_timeline; | 151 Member<AnimationTimeline> m_timeline; |
| 153 Timer<AnimationTimelineTiming> m_timer; | 152 Timer<AnimationTimelineTiming> m_timer; |
| 154 }; | 153 }; |
| 155 | 154 |
| 156 friend class AnimationAnimationTimelineTest; | 155 friend class AnimationAnimationTimelineTest; |
| 157 }; | 156 }; |
| 158 | 157 |
| 159 } // namespace blink | 158 } // namespace blink |
| 160 | 159 |
| 161 #endif | 160 #endif |
| OLD | NEW |