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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
44 #include "public/platform/WebCompositorAnimationPlayerClient.h" | 44 #include "public/platform/WebCompositorAnimationPlayerClient.h" |
45 #include "wtf/RefPtr.h" | 45 #include "wtf/RefPtr.h" |
46 | 46 |
47 namespace blink { | 47 namespace blink { |
48 | 48 |
49 class AnimationTimeline; | 49 class AnimationTimeline; |
50 class Element; | 50 class Element; |
51 class ExceptionState; | 51 class ExceptionState; |
52 class WebCompositorAnimationPlayer; | 52 class WebCompositorAnimationPlayer; |
53 | 53 |
54 class CORE_EXPORT Animation final | 54 class CORE_EXPORT Animation final : public RefCountedGarbageCollectedEventTarget WithInlineData<Animation>, public ActiveDOMObject, public WebCompositorAnimation Delegate, public WebCompositorAnimationPlayerClient { |
55 : public EventTargetWithInlineData | |
56 , public RefCountedWillBeNoBase<Animation> | |
57 , public ActiveDOMObject | |
58 , public WebCompositorAnimationDelegate | |
59 , public WebCompositorAnimationPlayerClient { | |
60 DEFINE_WRAPPERTYPEINFO(); | 55 DEFINE_WRAPPERTYPEINFO(); |
61 REFCOUNTED_EVENT_TARGET(Animation); | 56 DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(RefCountedGarbageCollected<A nimation>); |
62 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(Animation); | 57 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(Animation); |
58 USING_PRE_FINALIZER(Animation, disposeAnimation); | |
sof
2015/05/30 11:34:04
No need to add a TODO, but eagerly finalizing Anim
peria
2015/06/01 04:43:01
Done.
| |
63 public: | 59 public: |
64 enum AnimationPlayState { | 60 enum AnimationPlayState { |
65 Idle, | 61 Idle, |
66 Pending, | 62 Pending, |
67 Running, | 63 Running, |
68 Paused, | 64 Paused, |
69 Finished | 65 Finished |
70 }; | 66 }; |
71 | 67 |
72 ~Animation(); | 68 ~Animation(); |
73 static PassRefPtrWillBeRawPtr<Animation> create(AnimationEffect*, AnimationT imeline*); | 69 void disposeAnimation(); |
70 static Animation* create(AnimationEffect*, AnimationTimeline*); | |
74 | 71 |
75 // Returns whether the animation is finished. | 72 // Returns whether the animation is finished. |
76 bool update(TimingUpdateReason); | 73 bool update(TimingUpdateReason); |
77 | 74 |
78 // timeToEffectChange returns: | 75 // timeToEffectChange returns: |
79 // infinity - if this animation is no longer in effect | 76 // infinity - if this animation is no longer in effect |
80 // 0 - if this animation requires an update on the next frame | 77 // 0 - if this animation requires an update on the next frame |
81 // n - if this animation requires an update after 'n' units of time | 78 // n - if this animation requires an update after 'n' units of time |
82 double timeToEffectChange(); | 79 double timeToEffectChange(); |
83 | 80 |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
202 void notifyAnimationStarted(double monotonicTime, int group) override; | 199 void notifyAnimationStarted(double monotonicTime, int group) override; |
203 void notifyAnimationFinished(double monotonicTime, int group) override { } | 200 void notifyAnimationFinished(double monotonicTime, int group) override { } |
204 | 201 |
205 AnimationPlayState m_playState; | 202 AnimationPlayState m_playState; |
206 double m_playbackRate; | 203 double m_playbackRate; |
207 double m_startTime; | 204 double m_startTime; |
208 double m_holdTime; | 205 double m_holdTime; |
209 | 206 |
210 unsigned m_sequenceNumber; | 207 unsigned m_sequenceNumber; |
211 | 208 |
212 typedef ScriptPromiseProperty<RawPtrWillBeMember<Animation>, RawPtrWillBeMem ber<Animation>, Member<DOMException>> AnimationPromise; | 209 typedef ScriptPromiseProperty<Member<Animation>, Member<Animation>, Member<D OMException>> AnimationPromise; |
213 PersistentWillBeMember<AnimationPromise> m_finishedPromise; | 210 Member<AnimationPromise> m_finishedPromise; |
214 PersistentWillBeMember<AnimationPromise> m_readyPromise; | 211 Member<AnimationPromise> m_readyPromise; |
215 | 212 |
216 RefPtrWillBeMember<AnimationEffect> m_content; | 213 Member<AnimationEffect> m_content; |
217 RawPtrWillBeMember<AnimationTimeline> m_timeline; | 214 Member<AnimationTimeline> m_timeline; |
218 // Reflects all pausing, including via pauseForTesting(). | 215 // Reflects all pausing, including via pauseForTesting(). |
219 bool m_paused; | 216 bool m_paused; |
220 bool m_held; | 217 bool m_held; |
221 bool m_isPausedForTesting; | 218 bool m_isPausedForTesting; |
222 | 219 |
223 // This indicates timing information relevant to the animation's effect | 220 // This indicates timing information relevant to the animation's effect |
224 // has changed by means other than the ordinary progression of time | 221 // has changed by means other than the ordinary progression of time |
225 bool m_outdated; | 222 bool m_outdated; |
226 | 223 |
227 bool m_finished; | 224 bool m_finished; |
(...skipping 30 matching lines...) Expand all Loading... | |
258 SetCompositorPendingWithSourceChanged, | 255 SetCompositorPendingWithSourceChanged, |
259 DoNotSetCompositorPending, | 256 DoNotSetCompositorPending, |
260 }; | 257 }; |
261 | 258 |
262 class PlayStateUpdateScope { | 259 class PlayStateUpdateScope { |
263 STACK_ALLOCATED(); | 260 STACK_ALLOCATED(); |
264 public: | 261 public: |
265 PlayStateUpdateScope(Animation&, TimingUpdateReason, CompositorPendingCh ange = SetCompositorPending); | 262 PlayStateUpdateScope(Animation&, TimingUpdateReason, CompositorPendingCh ange = SetCompositorPending); |
266 ~PlayStateUpdateScope(); | 263 ~PlayStateUpdateScope(); |
267 private: | 264 private: |
268 RawPtrWillBeMember<Animation> m_animation; | 265 Member<Animation> m_animation; |
269 AnimationPlayState m_initialPlayState; | 266 AnimationPlayState m_initialPlayState; |
270 CompositorPendingChange m_compositorPendingChange; | 267 CompositorPendingChange m_compositorPendingChange; |
271 }; | 268 }; |
272 | 269 |
273 // This mirrors the known compositor state. It is created when a compositor | 270 // This mirrors the known compositor state. It is created when a compositor |
274 // animation is started. Updated once the start time is known and each time | 271 // animation is started. Updated once the start time is known and each time |
275 // modifications are pushed to the compositor. | 272 // modifications are pushed to the compositor. |
276 OwnPtr<CompositorState> m_compositorState; | 273 OwnPtr<CompositorState> m_compositorState; |
277 bool m_compositorPending; | 274 bool m_compositorPending; |
278 int m_compositorGroup; | 275 int m_compositorGroup; |
279 | 276 |
280 OwnPtr<WebCompositorAnimationPlayer> m_compositorPlayer; | 277 OwnPtr<WebCompositorAnimationPlayer> m_compositorPlayer; |
281 | 278 |
282 bool m_currentTimePending; | 279 bool m_currentTimePending; |
283 bool m_stateIsBeingUpdated; | 280 bool m_stateIsBeingUpdated; |
284 }; | 281 }; |
285 | 282 |
286 } // namespace blink | 283 } // namespace blink |
287 | 284 |
288 #endif // Animation_h | 285 #endif // Animation_h |
OLD | NEW |