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(); } | |
| 152 | 159 |
| 153 bool affects(const Element&, CSSPropertyID) const; | 160 bool affects(const Element&, CSSPropertyID) const; |
| 154 | 161 |
| 155 void preCommit(int compositorGroup, bool startOnCompositor); | 162 void preCommit(int compositorGroup, bool startOnCompositor); |
| 156 void postCommit(double timelineTime); | 163 void postCommit(double timelineTime); |
| 157 | 164 |
| 158 unsigned sequenceNumber() const { return m_sequenceNumber; } | 165 unsigned sequenceNumber() const { return m_sequenceNumber; } |
| 159 int compositorGroup() const { return m_compositorGroup; } | 166 int compositorGroup() const { return m_compositorGroup; } |
| 160 | 167 |
| 161 static bool hasLowerPriority(const AnimationPlayer* player1, const Animation Player* player2) | 168 static bool hasLowerPriority(const AnimationPlayer* player1, const Animation Player* player2) |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 176 AnimationPlayState calculatePlayState(); | 183 AnimationPlayState calculatePlayState(); |
| 177 double calculateCurrentTime() const; | 184 double calculateCurrentTime() const; |
| 178 | 185 |
| 179 void unpauseInternal(); | 186 void unpauseInternal(); |
| 180 void setPlaybackRateInternal(double); | 187 void setPlaybackRateInternal(double); |
| 181 void updateCurrentTimingState(TimingUpdateReason); | 188 void updateCurrentTimingState(TimingUpdateReason); |
| 182 | 189 |
| 183 void beginUpdatingState(); | 190 void beginUpdatingState(); |
| 184 void endUpdatingState(); | 191 void endUpdatingState(); |
| 185 | 192 |
| 193 void createCompositorPlayer(); | |
| 194 void destroyCompositorPlayer(); | |
| 195 // WebCompositorAnimationDelegate implementation. | |
| 196 void notifyAnimationStarted(double monotonicTime, int group) override; | |
| 197 void notifyAnimationFinished(double monotonicTime, int group) override { } | |
|
dstockwell
2015/03/16 00:11:27
We should just not add this.
loyso (OOO)
2015/03/18 06:59:43
I didn't want to change WebCompositorAnimationDele
dstockwell
2015/03/18 07:17:18
Ahh, I see. Are you planning to keep WebCompositor
loyso (OOO)
2015/03/19 02:32:24
It's a part of old system. After the migration we
| |
| 198 | |
| 186 AnimationPlayState m_playState; | 199 AnimationPlayState m_playState; |
| 187 double m_playbackRate; | 200 double m_playbackRate; |
| 188 double m_startTime; | 201 double m_startTime; |
| 189 double m_holdTime; | 202 double m_holdTime; |
| 190 | 203 |
| 191 unsigned m_sequenceNumber; | 204 unsigned m_sequenceNumber; |
| 192 | 205 |
| 193 typedef ScriptPromiseProperty<RawPtrWillBeMember<AnimationPlayer>, RawPtrWil lBeMember<AnimationPlayer>, RefPtrWillBeMember<DOMException> > AnimationPlayerPr omise; | 206 typedef ScriptPromiseProperty<RawPtrWillBeMember<AnimationPlayer>, RawPtrWil lBeMember<AnimationPlayer>, RefPtrWillBeMember<DOMException> > AnimationPlayerPr omise; |
| 194 PersistentWillBeMember<AnimationPlayerPromise> m_finishedPromise; | 207 PersistentWillBeMember<AnimationPlayerPromise> m_finishedPromise; |
| 195 PersistentWillBeMember<AnimationPlayerPromise> m_readyPromise; | 208 PersistentWillBeMember<AnimationPlayerPromise> m_readyPromise; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 251 CompositorPendingChange m_compositorPendingChange; | 264 CompositorPendingChange m_compositorPendingChange; |
| 252 }; | 265 }; |
| 253 | 266 |
| 254 // This mirrors the known compositor state. It is created when a compositor | 267 // 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 | 268 // animation is started. Updated once the start time is known and each time |
| 256 // modifications are pushed to the compositor. | 269 // modifications are pushed to the compositor. |
| 257 OwnPtr<CompositorState> m_compositorState; | 270 OwnPtr<CompositorState> m_compositorState; |
| 258 bool m_compositorPending; | 271 bool m_compositorPending; |
| 259 int m_compositorGroup; | 272 int m_compositorGroup; |
| 260 | 273 |
| 274 OwnPtr<WebCompositorAnimationPlayer> m_compositorPlayer; | |
| 275 | |
| 261 bool m_currentTimePending; | 276 bool m_currentTimePending; |
| 262 bool m_stateIsBeingUpdated; | 277 bool m_stateIsBeingUpdated; |
| 263 | 278 |
| 264 }; | 279 }; |
| 265 | 280 |
| 266 } // namespace blink | 281 } // namespace blink |
| 267 | 282 |
| 268 #endif // AnimationPlayer_h | 283 #endif // AnimationPlayer_h |
| OLD | NEW |