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 21 matching lines...) Expand all Loading... | |
| 32 #define AnimationPlayer_h | 32 #define AnimationPlayer_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/animation/AnimationNode.h" | 37 #include "core/animation/AnimationNode.h" |
| 38 #include "core/dom/ActiveDOMObject.h" | 38 #include "core/dom/ActiveDOMObject.h" |
| 39 #include "core/dom/DOMException.h" | 39 #include "core/dom/DOMException.h" |
| 40 #include "core/events/EventTarget.h" | 40 #include "core/events/EventTarget.h" |
| 41 #include "platform/heap/Handle.h" | 41 #include "platform/heap/Handle.h" |
| 42 #include "public/platform/WebCompositorAnimationDelegate.h" | |
| 43 #include "public/platform/WebCompositorAnimationPlayerClient.h" | |
| 42 #include "wtf/RefPtr.h" | 44 #include "wtf/RefPtr.h" |
| 43 | 45 |
| 44 namespace blink { | 46 namespace blink { |
| 45 | 47 |
| 46 class AnimationTimeline; | 48 class AnimationTimeline; |
| 47 class Element; | 49 class Element; |
| 48 class ExceptionState; | 50 class ExceptionState; |
| 51 class WebCompositorAnimationPlayer; | |
| 49 | 52 |
| 50 class AnimationPlayer final | 53 class AnimationPlayer final |
| 51 : public EventTargetWithInlineData | 54 : public EventTargetWithInlineData, |
| 52 , public RefCountedWillBeNoBase<AnimationPlayer> | 55 public RefCountedWillBeNoBase<AnimationPlayer>, |
| 53 , public ActiveDOMObject { | 56 public ActiveDOMObject, |
| 57 public WebCompositorAnimationDelegate, | |
| 58 public WebCompositorAnimationPlayerClient { | |
| 54 DEFINE_WRAPPERTYPEINFO(); | 59 DEFINE_WRAPPERTYPEINFO(); |
| 55 REFCOUNTED_EVENT_TARGET(AnimationPlayer); | 60 REFCOUNTED_EVENT_TARGET(AnimationPlayer); |
| 56 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(AnimationPlayer); | 61 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(AnimationPlayer); |
| 57 public: | 62 public: |
| 58 enum AnimationPlayState { | 63 enum AnimationPlayState { |
| 59 Idle, | 64 Idle, |
| 60 Pending, | 65 Pending, |
| 61 Running, | 66 Running, |
| 62 Paused, | 67 Paused, |
| 63 Finished | 68 Finished |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 143 bool maybeStartAnimationOnCompositor(); | 148 bool maybeStartAnimationOnCompositor(); |
| 144 void cancelAnimationOnCompositor(); | 149 void cancelAnimationOnCompositor(); |
| 145 void cancelIncompatibleAnimationsOnCompositor(); | 150 void cancelIncompatibleAnimationsOnCompositor(); |
| 146 bool hasActiveAnimationsOnCompositor(); | 151 bool hasActiveAnimationsOnCompositor(); |
| 147 void setCompositorPending(bool sourceChanged = false); | 152 void setCompositorPending(bool sourceChanged = false); |
| 148 void notifyCompositorStartTime(double timelineTime); | 153 void notifyCompositorStartTime(double timelineTime); |
| 149 void notifyStartTime(double timelineTime); | 154 void notifyStartTime(double timelineTime); |
| 150 | 155 |
| 151 bool affects(const Element&, CSSPropertyID) const; | 156 bool affects(const Element&, CSSPropertyID) const; |
| 152 | 157 |
| 158 // WebCompositorAnimationDelegate implementation. | |
| 159 void notifyAnimationStarted(double monotonicTime, int group) override; | |
| 160 void notifyAnimationFinished(double monotonicTime, int group) override; | |
|
dstockwell
2015/02/26 00:07:12
Is this just for consistency? Do we need it?
loyso (OOO)
2015/02/26 03:24:57
That's already existing interface with pure abstra
| |
| 161 | |
| 162 void createCompositorPlayer(); | |
|
dstockwell
2015/02/26 00:07:12
These should probably not be public.
loyso (OOO)
2015/02/26 03:24:57
Sure! This is a side-effect of the draft version.
| |
| 163 void destroyCompositorPlayer(); | |
| 164 // WebCompositorAnimationPlayerClient implementation. | |
| 165 WebCompositorAnimationPlayer* compositorPlayer() const override { return m_c ompositorPlayer.get(); } | |
| 166 | |
| 153 void preCommit(int compositorGroup, bool startOnCompositor); | 167 void preCommit(int compositorGroup, bool startOnCompositor); |
| 154 void postCommit(double timelineTime); | 168 void postCommit(double timelineTime); |
| 155 | 169 |
| 156 unsigned sequenceNumber() const { return m_sequenceNumber; } | 170 unsigned sequenceNumber() const { return m_sequenceNumber; } |
| 157 int compositorGroup() const { return m_compositorGroup; } | 171 int compositorGroup() const { return m_compositorGroup; } |
| 158 | 172 |
| 159 static bool hasLowerPriority(const AnimationPlayer* player1, const Animation Player* player2) | 173 static bool hasLowerPriority(const AnimationPlayer* player1, const Animation Player* player2) |
| 160 { | 174 { |
| 161 return player1->sequenceNumber() < player2->sequenceNumber(); | 175 return player1->sequenceNumber() < player2->sequenceNumber(); |
| 162 } | 176 } |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 255 CompositorPendingChange m_compositorPendingChange; | 269 CompositorPendingChange m_compositorPendingChange; |
| 256 }; | 270 }; |
| 257 | 271 |
| 258 // This mirrors the known compositor state. It is created when a compositor | 272 // This mirrors the known compositor state. It is created when a compositor |
| 259 // animation is started. Updated once the start time is known and each time | 273 // animation is started. Updated once the start time is known and each time |
| 260 // modifications are pushed to the compositor. | 274 // modifications are pushed to the compositor. |
| 261 OwnPtr<CompositorState> m_compositorState; | 275 OwnPtr<CompositorState> m_compositorState; |
| 262 bool m_compositorPending; | 276 bool m_compositorPending; |
| 263 int m_compositorGroup; | 277 int m_compositorGroup; |
| 264 | 278 |
| 279 OwnPtr<WebCompositorAnimationPlayer> m_compositorPlayer; | |
| 280 | |
| 265 bool m_currentTimePending; | 281 bool m_currentTimePending; |
| 266 bool m_stateIsBeingUpdated; | 282 bool m_stateIsBeingUpdated; |
| 267 | 283 |
| 268 }; | 284 }; |
| 269 | 285 |
| 270 } // namespace blink | 286 } // namespace blink |
| 271 | 287 |
| 272 #endif // AnimationPlayer_h | 288 #endif // AnimationPlayer_h |
| OLD | NEW |