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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 142 | 147 |
| 143 bool canStartAnimationOnCompositor(); | 148 bool canStartAnimationOnCompositor(); |
| 144 bool maybeStartAnimationOnCompositor(); | 149 bool maybeStartAnimationOnCompositor(); |
| 145 void cancelAnimationOnCompositor(); | 150 void cancelAnimationOnCompositor(); |
| 146 void restartAnimationOnCompositor(); | 151 void restartAnimationOnCompositor(); |
| 147 void cancelIncompatibleAnimationsOnCompositor(); | 152 void cancelIncompatibleAnimationsOnCompositor(); |
| 148 bool hasActiveAnimationsOnCompositor(); | 153 bool hasActiveAnimationsOnCompositor(); |
| 149 void setCompositorPending(bool sourceChanged = false); | 154 void setCompositorPending(bool sourceChanged = false); |
| 150 void notifyCompositorStartTime(double timelineTime); | 155 void notifyCompositorStartTime(double timelineTime); |
| 151 void notifyStartTime(double timelineTime); | 156 void notifyStartTime(double timelineTime); |
| 157 // WebCompositorAnimationPlayerClient implementation. | |
| 158 WebCompositorAnimationPlayer* compositorPlayer() const override { return m_c ompositorPlayer.get(); } | |
| 159 | |
| 160 void updateCompositorPlayerToElementAttachment(); | |
| 152 | 161 |
| 153 bool affects(const Element&, CSSPropertyID) const; | 162 bool affects(const Element&, CSSPropertyID) const; |
| 154 | 163 |
| 155 void preCommit(int compositorGroup, bool startOnCompositor); | 164 void preCommit(int compositorGroup, bool startOnCompositor); |
| 156 void postCommit(double timelineTime); | 165 void postCommit(double timelineTime); |
| 157 | 166 |
| 158 unsigned sequenceNumber() const { return m_sequenceNumber; } | 167 unsigned sequenceNumber() const { return m_sequenceNumber; } |
| 159 int compositorGroup() const { return m_compositorGroup; } | 168 int compositorGroup() const { return m_compositorGroup; } |
| 160 | 169 |
| 161 static bool hasLowerPriority(const AnimationPlayer* player1, const Animation Player* player2) | 170 static bool hasLowerPriority(const AnimationPlayer* player1, const Animation Player* player2) |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 176 AnimationPlayState calculatePlayState(); | 185 AnimationPlayState calculatePlayState(); |
| 177 double calculateCurrentTime() const; | 186 double calculateCurrentTime() const; |
| 178 | 187 |
| 179 void unpauseInternal(); | 188 void unpauseInternal(); |
| 180 void setPlaybackRateInternal(double); | 189 void setPlaybackRateInternal(double); |
| 181 void updateCurrentTimingState(TimingUpdateReason); | 190 void updateCurrentTimingState(TimingUpdateReason); |
| 182 | 191 |
| 183 void beginUpdatingState(); | 192 void beginUpdatingState(); |
| 184 void endUpdatingState(); | 193 void endUpdatingState(); |
| 185 | 194 |
| 195 void createCompositorPlayer(); | |
| 196 void destroyCompositorPlayer(); | |
| 197 void attachElementToPlayer(); | |
| 198 void detachElementFromPlayer(); | |
| 199 // WebCompositorAnimationDelegate implementation. | |
| 200 void notifyAnimationStarted(double monotonicTime, int group) override; | |
| 201 void notifyAnimationFinished(double monotonicTime, int group) override { } | |
| 202 | |
| 186 AnimationPlayState m_playState; | 203 AnimationPlayState m_playState; |
| 187 double m_playbackRate; | 204 double m_playbackRate; |
| 188 double m_startTime; | 205 double m_startTime; |
| 189 double m_holdTime; | 206 double m_holdTime; |
| 190 | 207 |
| 191 unsigned m_sequenceNumber; | 208 unsigned m_sequenceNumber; |
| 192 | 209 |
| 193 typedef ScriptPromiseProperty<RawPtrWillBeMember<AnimationPlayer>, RawPtrWil lBeMember<AnimationPlayer>, RefPtrWillBeMember<DOMException> > AnimationPlayerPr omise; | 210 typedef ScriptPromiseProperty<RawPtrWillBeMember<AnimationPlayer>, RawPtrWil lBeMember<AnimationPlayer>, RefPtrWillBeMember<DOMException> > AnimationPlayerPr omise; |
| 194 PersistentWillBeMember<AnimationPlayerPromise> m_finishedPromise; | 211 PersistentWillBeMember<AnimationPlayerPromise> m_finishedPromise; |
| 195 PersistentWillBeMember<AnimationPlayerPromise> m_readyPromise; | 212 PersistentWillBeMember<AnimationPlayerPromise> m_readyPromise; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 251 CompositorPendingChange m_compositorPendingChange; | 268 CompositorPendingChange m_compositorPendingChange; |
| 252 }; | 269 }; |
| 253 | 270 |
| 254 // This mirrors the known compositor state. It is created when a compositor | 271 // This mirrors the known compositor state. It is created when a compositor |
| 255 // animation is started. Updated once the start time is known and each time | 272 // animation is started. Updated once the start time is known and each time |
| 256 // modifications are pushed to the compositor. | 273 // modifications are pushed to the compositor. |
| 257 OwnPtr<CompositorState> m_compositorState; | 274 OwnPtr<CompositorState> m_compositorState; |
| 258 bool m_compositorPending; | 275 bool m_compositorPending; |
| 259 int m_compositorGroup; | 276 int m_compositorGroup; |
| 260 | 277 |
| 278 OwnPtr<WebCompositorAnimationPlayer> m_compositorPlayer; | |
| 279 bool m_attachCompositorPlayerToElement; | |
|
dstockwell
2015/03/22 23:07:28
Couldn't we tie this attachment to the lifetime of
| |
| 280 | |
| 261 bool m_currentTimePending; | 281 bool m_currentTimePending; |
| 262 bool m_stateIsBeingUpdated; | 282 bool m_stateIsBeingUpdated; |
| 263 | |
| 264 }; | 283 }; |
| 265 | 284 |
| 266 } // namespace blink | 285 } // namespace blink |
| 267 | 286 |
| 268 #endif // AnimationPlayer_h | 287 #endif // AnimationPlayer_h |
| OLD | NEW |