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 void updateCompositedLayersAttachments(); |
| 103 |
100 Document* document() { return m_document.get(); } | 104 Document* document() { return m_document.get(); } |
101 #if !ENABLE(OILPAN) | 105 #if !ENABLE(OILPAN) |
102 void detachFromDocument(); | 106 void detachFromDocument(); |
103 #endif | 107 #endif |
104 void wake(); | 108 void wake(); |
105 | 109 |
106 DECLARE_TRACE(); | 110 DECLARE_TRACE(); |
107 | 111 |
108 protected: | 112 protected: |
109 AnimationTimeline(Document*, PassOwnPtrWillBeRawPtr<PlatformTiming>); | 113 AnimationTimeline(Document*, PassOwnPtrWillBeRawPtr<PlatformTiming>); |
110 | 114 |
111 private: | 115 private: |
112 RawPtrWillBeMember<Document> m_document; | 116 RawPtrWillBeMember<Document> m_document; |
113 double m_zeroTime; | 117 double m_zeroTime; |
114 bool m_zeroTimeInitialized; | 118 bool m_zeroTimeInitialized; |
115 // AnimationPlayers which will be updated on the next frame | 119 // AnimationPlayers which will be updated on the next frame |
116 // i.e. current, in effect, or had timing changed | 120 // i.e. current, in effect, or had timing changed |
117 WillBeHeapHashSet<RefPtrWillBeMember<AnimationPlayer>> m_playersNeedingUpdat
e; | 121 WillBeHeapHashSet<RefPtrWillBeMember<AnimationPlayer>> m_playersNeedingUpdat
e; |
118 WillBeHeapHashSet<RawPtrWillBeWeakMember<AnimationPlayer>> m_players; | 122 WillBeHeapHashSet<RawPtrWillBeWeakMember<AnimationPlayer>> m_players; |
119 | 123 |
120 double m_playbackRate; | 124 double m_playbackRate; |
121 | 125 |
122 friend class SMILTimeContainer; | 126 friend class SMILTimeContainer; |
123 static const double s_minimumDelay; | 127 static const double s_minimumDelay; |
124 | 128 |
125 OwnPtrWillBeMember<PlatformTiming> m_timing; | 129 OwnPtrWillBeMember<PlatformTiming> m_timing; |
126 double m_lastCurrentTimeInternal; | 130 double m_lastCurrentTimeInternal; |
127 | 131 |
| 132 OwnPtr<WebCompositorAnimationTimeline> m_compositorTimeline; |
| 133 |
128 class AnimationTimelineTiming final : public PlatformTiming { | 134 class AnimationTimelineTiming final : public PlatformTiming { |
129 public: | 135 public: |
130 AnimationTimelineTiming(AnimationTimeline* timeline) | 136 AnimationTimelineTiming(AnimationTimeline* timeline) |
131 : m_timeline(timeline) | 137 : m_timeline(timeline) |
132 , m_timer(this, &AnimationTimelineTiming::timerFired) | 138 , m_timer(this, &AnimationTimelineTiming::timerFired) |
133 { | 139 { |
134 ASSERT(m_timeline); | 140 ASSERT(m_timeline); |
135 } | 141 } |
136 | 142 |
137 virtual void wakeAfter(double duration) override; | 143 virtual void wakeAfter(double duration) override; |
138 virtual void cancelWake() override; | 144 virtual void cancelWake() override; |
139 virtual void serviceOnNextFrame() override; | 145 virtual void serviceOnNextFrame() override; |
140 | 146 |
141 void timerFired(Timer<AnimationTimelineTiming>*) { m_timeline->wake(); } | 147 void timerFired(Timer<AnimationTimelineTiming>*) { m_timeline->wake(); } |
142 | 148 |
143 DECLARE_VIRTUAL_TRACE(); | 149 DECLARE_VIRTUAL_TRACE(); |
144 | 150 |
145 private: | 151 private: |
146 RawPtrWillBeMember<AnimationTimeline> m_timeline; | 152 RawPtrWillBeMember<AnimationTimeline> m_timeline; |
147 Timer<AnimationTimelineTiming> m_timer; | 153 Timer<AnimationTimelineTiming> m_timer; |
148 }; | 154 }; |
149 | 155 |
150 friend class AnimationAnimationTimelineTest; | 156 friend class AnimationAnimationTimelineTest; |
151 }; | 157 }; |
152 | 158 |
153 } // namespace blink | 159 } // namespace blink |
154 | 160 |
155 #endif | 161 #endif |
OLD | NEW |