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 19 matching lines...) Expand all Loading... |
30 | 30 |
31 #ifndef AnimationTimeline_h | 31 #ifndef AnimationTimeline_h |
32 #define AnimationTimeline_h | 32 #define AnimationTimeline_h |
33 | 33 |
34 #include "bindings/core/v8/ScriptWrappable.h" | 34 #include "bindings/core/v8/ScriptWrappable.h" |
35 #include "core/animation/AnimationEffect.h" | 35 #include "core/animation/AnimationEffect.h" |
36 #include "core/animation/AnimationPlayer.h" | 36 #include "core/animation/AnimationPlayer.h" |
37 #include "core/dom/Element.h" | 37 #include "core/dom/Element.h" |
38 #include "platform/Timer.h" | 38 #include "platform/Timer.h" |
39 #include "platform/heap/Handle.h" | 39 #include "platform/heap/Handle.h" |
| 40 #include "public/platform/WebCompositorAnimationTimeline.h" |
40 #include "wtf/RefCounted.h" | 41 #include "wtf/RefCounted.h" |
41 #include "wtf/RefPtr.h" | 42 #include "wtf/RefPtr.h" |
42 #include "wtf/Vector.h" | 43 #include "wtf/Vector.h" |
43 | 44 |
44 namespace blink { | 45 namespace blink { |
45 | 46 |
46 class Document; | 47 class Document; |
47 class AnimationNode; | 48 class AnimationNode; |
48 | 49 |
49 // 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. |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 double effectiveTime(); | 91 double effectiveTime(); |
91 void pauseAnimationsForTesting(double); | 92 void pauseAnimationsForTesting(double); |
92 | 93 |
93 void setOutdatedAnimationPlayer(AnimationPlayer*); | 94 void setOutdatedAnimationPlayer(AnimationPlayer*); |
94 bool hasOutdatedAnimationPlayer() const; | 95 bool hasOutdatedAnimationPlayer() const; |
95 bool needsAnimationTimingUpdate(); | 96 bool needsAnimationTimingUpdate(); |
96 | 97 |
97 void setPlaybackRate(double); | 98 void setPlaybackRate(double); |
98 double playbackRate() const; | 99 double playbackRate() const; |
99 | 100 |
| 101 WebCompositorAnimationTimeline* compositorTimeline() const { return m_compos
itorTimeline.get(); } |
| 102 |
100 Document* document() { return m_document.get(); } | 103 Document* document() { return m_document.get(); } |
101 #if !ENABLE(OILPAN) | 104 #if !ENABLE(OILPAN) |
102 void detachFromDocument(); | 105 void detachFromDocument(); |
103 #endif | 106 #endif |
104 void wake(); | 107 void wake(); |
105 | 108 |
106 DECLARE_TRACE(); | 109 DECLARE_TRACE(); |
107 | 110 |
108 protected: | 111 protected: |
109 AnimationTimeline(Document*, PassOwnPtrWillBeRawPtr<PlatformTiming>); | 112 AnimationTimeline(Document*, PassOwnPtrWillBeRawPtr<PlatformTiming>); |
110 | 113 |
111 private: | 114 private: |
112 RawPtrWillBeMember<Document> m_document; | 115 RawPtrWillBeMember<Document> m_document; |
113 double m_zeroTime; | 116 double m_zeroTime; |
114 bool m_zeroTimeInitialized; | 117 bool m_zeroTimeInitialized; |
115 // AnimationPlayers which will be updated on the next frame | 118 // AnimationPlayers which will be updated on the next frame |
116 // i.e. current, in effect, or had timing changed | 119 // i.e. current, in effect, or had timing changed |
117 WillBeHeapHashSet<RefPtrWillBeMember<AnimationPlayer>> m_playersNeedingUpdat
e; | 120 WillBeHeapHashSet<RefPtrWillBeMember<AnimationPlayer>> m_playersNeedingUpdat
e; |
118 WillBeHeapHashSet<RawPtrWillBeWeakMember<AnimationPlayer>> m_players; | 121 WillBeHeapHashSet<RawPtrWillBeWeakMember<AnimationPlayer>> m_players; |
119 | 122 |
120 double m_playbackRate; | 123 double m_playbackRate; |
121 | 124 |
122 friend class SMILTimeContainer; | 125 friend class SMILTimeContainer; |
123 static const double s_minimumDelay; | 126 static const double s_minimumDelay; |
124 | 127 |
125 OwnPtrWillBeMember<PlatformTiming> m_timing; | 128 OwnPtrWillBeMember<PlatformTiming> m_timing; |
126 double m_lastCurrentTimeInternal; | 129 double m_lastCurrentTimeInternal; |
127 | 130 |
| 131 OwnPtr<WebCompositorAnimationTimeline> m_compositorTimeline; |
| 132 |
128 class AnimationTimelineTiming final : public PlatformTiming { | 133 class AnimationTimelineTiming final : public PlatformTiming { |
129 public: | 134 public: |
130 AnimationTimelineTiming(AnimationTimeline* timeline) | 135 AnimationTimelineTiming(AnimationTimeline* timeline) |
131 : m_timeline(timeline) | 136 : m_timeline(timeline) |
132 , m_timer(this, &AnimationTimelineTiming::timerFired) | 137 , m_timer(this, &AnimationTimelineTiming::timerFired) |
133 { | 138 { |
134 ASSERT(m_timeline); | 139 ASSERT(m_timeline); |
135 } | 140 } |
136 | 141 |
137 virtual void wakeAfter(double duration) override; | 142 virtual void wakeAfter(double duration) override; |
138 virtual void cancelWake() override; | 143 virtual void cancelWake() override; |
139 virtual void serviceOnNextFrame() override; | 144 virtual void serviceOnNextFrame() override; |
140 | 145 |
141 void timerFired(Timer<AnimationTimelineTiming>*) { m_timeline->wake(); } | 146 void timerFired(Timer<AnimationTimelineTiming>*) { m_timeline->wake(); } |
142 | 147 |
143 DECLARE_VIRTUAL_TRACE(); | 148 DECLARE_VIRTUAL_TRACE(); |
144 | 149 |
145 private: | 150 private: |
146 RawPtrWillBeMember<AnimationTimeline> m_timeline; | 151 RawPtrWillBeMember<AnimationTimeline> m_timeline; |
147 Timer<AnimationTimelineTiming> m_timer; | 152 Timer<AnimationTimelineTiming> m_timer; |
148 }; | 153 }; |
149 | 154 |
150 friend class AnimationAnimationTimelineTest; | 155 friend class AnimationAnimationTimelineTest; |
151 }; | 156 }; |
152 | 157 |
153 } // namespace blink | 158 } // namespace blink |
154 | 159 |
155 #endif | 160 #endif |
OLD | NEW |