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 21 matching lines...) Expand all Loading... |
32 #define Animation_h | 32 #define Animation_h |
33 | 33 |
34 #include "bindings/core/v8/ScriptPromise.h" | 34 #include "bindings/core/v8/ScriptPromise.h" |
35 #include "bindings/core/v8/ScriptPromiseProperty.h" | 35 #include "bindings/core/v8/ScriptPromiseProperty.h" |
36 #include "core/CSSPropertyNames.h" | 36 #include "core/CSSPropertyNames.h" |
37 #include "core/CoreExport.h" | 37 #include "core/CoreExport.h" |
38 #include "core/animation/AnimationEffect.h" | 38 #include "core/animation/AnimationEffect.h" |
39 #include "core/dom/ActiveDOMObject.h" | 39 #include "core/dom/ActiveDOMObject.h" |
40 #include "core/dom/DOMException.h" | 40 #include "core/dom/DOMException.h" |
41 #include "core/events/EventTarget.h" | 41 #include "core/events/EventTarget.h" |
| 42 #include "platform/animation/CompositorAnimationPlayerClient.h" |
42 #include "platform/heap/Handle.h" | 43 #include "platform/heap/Handle.h" |
43 #include "public/platform/WebCompositorAnimationDelegate.h" | 44 #include "public/platform/WebCompositorAnimationDelegate.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 CompositorAnimationPlayer; |
50 class Element; | 51 class Element; |
51 class ExceptionState; | 52 class ExceptionState; |
52 class WebCompositorAnimationPlayer; | |
53 | 53 |
54 class CORE_EXPORT Animation final | 54 class CORE_EXPORT Animation final |
55 : public RefCountedGarbageCollectedEventTargetWithInlineData<Animation> | 55 : public RefCountedGarbageCollectedEventTargetWithInlineData<Animation> |
56 , public ActiveDOMObject | 56 , public ActiveDOMObject |
57 , public WebCompositorAnimationDelegate | 57 , public WebCompositorAnimationDelegate |
58 , public WebCompositorAnimationPlayerClient { | 58 , public CompositorAnimationPlayerClient { |
59 DEFINE_WRAPPERTYPEINFO(); | 59 DEFINE_WRAPPERTYPEINFO(); |
60 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(Animation); | 60 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(Animation); |
61 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(Animation); | 61 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(Animation); |
62 public: | 62 public: |
63 enum AnimationPlayState { | 63 enum AnimationPlayState { |
64 Idle, | 64 Idle, |
65 Pending, | 65 Pending, |
66 Running, | 66 Running, |
67 Paused, | 67 Paused, |
68 Finished | 68 Finished |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 bool canStartAnimationOnCompositor() const; | 151 bool canStartAnimationOnCompositor() const; |
152 bool isCandidateForAnimationOnCompositor() const; | 152 bool isCandidateForAnimationOnCompositor() const; |
153 bool maybeStartAnimationOnCompositor(); | 153 bool maybeStartAnimationOnCompositor(); |
154 void cancelAnimationOnCompositor(); | 154 void cancelAnimationOnCompositor(); |
155 void restartAnimationOnCompositor(); | 155 void restartAnimationOnCompositor(); |
156 void cancelIncompatibleAnimationsOnCompositor(); | 156 void cancelIncompatibleAnimationsOnCompositor(); |
157 bool hasActiveAnimationsOnCompositor(); | 157 bool hasActiveAnimationsOnCompositor(); |
158 void setCompositorPending(bool effectChanged = false); | 158 void setCompositorPending(bool effectChanged = false); |
159 void notifyCompositorStartTime(double timelineTime); | 159 void notifyCompositorStartTime(double timelineTime); |
160 void notifyStartTime(double timelineTime); | 160 void notifyStartTime(double timelineTime); |
161 // WebCompositorAnimationPlayerClient implementation. | 161 // CompositorAnimationPlayerClient implementation. |
162 WebCompositorAnimationPlayer* compositorPlayer() const override { return m_c
ompositorPlayer.get(); } | 162 CompositorAnimationPlayer* compositorPlayer() const override { return m_comp
ositorPlayer.get(); } |
163 | 163 |
164 bool affects(const Element&, CSSPropertyID) const; | 164 bool affects(const Element&, CSSPropertyID) const; |
165 | 165 |
166 // Returns whether we should continue with the commit for this animation or
wait until next commit. | 166 // Returns whether we should continue with the commit for this animation or
wait until next commit. |
167 bool preCommit(int compositorGroup, bool startOnCompositor); | 167 bool preCommit(int compositorGroup, bool startOnCompositor); |
168 void postCommit(double timelineTime); | 168 void postCommit(double timelineTime); |
169 | 169 |
170 unsigned sequenceNumber() const { return m_sequenceNumber; } | 170 unsigned sequenceNumber() const { return m_sequenceNumber; } |
171 int compositorGroup() const { return m_compositorGroup; } | 171 int compositorGroup() const { return m_compositorGroup; } |
172 | 172 |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 CompositorPendingChange m_compositorPendingChange; | 291 CompositorPendingChange m_compositorPendingChange; |
292 }; | 292 }; |
293 | 293 |
294 // This mirrors the known compositor state. It is created when a compositor | 294 // This mirrors the known compositor state. It is created when a compositor |
295 // animation is started. Updated once the start time is known and each time | 295 // animation is started. Updated once the start time is known and each time |
296 // modifications are pushed to the compositor. | 296 // modifications are pushed to the compositor. |
297 OwnPtr<CompositorState> m_compositorState; | 297 OwnPtr<CompositorState> m_compositorState; |
298 bool m_compositorPending; | 298 bool m_compositorPending; |
299 int m_compositorGroup; | 299 int m_compositorGroup; |
300 | 300 |
301 OwnPtr<WebCompositorAnimationPlayer> m_compositorPlayer; | 301 OwnPtr<CompositorAnimationPlayer> m_compositorPlayer; |
302 | 302 |
303 bool m_currentTimePending; | 303 bool m_currentTimePending; |
304 bool m_stateIsBeingUpdated; | 304 bool m_stateIsBeingUpdated; |
305 }; | 305 }; |
306 | 306 |
307 } // namespace blink | 307 } // namespace blink |
308 | 308 |
309 #endif // Animation_h | 309 #endif // Animation_h |
OLD | NEW |