Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Side by Side Diff: Source/core/animation/AnimationPlayer.h

Issue 946323002: Animations: Introduce compositor AnimationPlayer and AnimationTimeline. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rename. Create cc::AnimationPlayer on PreCommit if needed. Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 138
134 // Pausing via this method is not reflected in the value returned by 139 // Pausing via this method is not reflected in the value returned by
135 // paused() and must never overlap with pausing via pause(). 140 // paused() and must never overlap with pausing via pause().
136 void pauseForTesting(double pauseTime); 141 void pauseForTesting(double pauseTime);
137 // This should only be used for CSS 142 // This should only be used for CSS
138 void unpause(); 143 void unpause();
139 144
140 void setOutdated(); 145 void setOutdated();
141 bool outdated() { return m_outdated; } 146 bool outdated() { return m_outdated; }
142 147
143 bool canStartAnimationOnCompositor(); 148 bool canStartAnimationOnCompositor() const;
149 bool isCandidateForAnimationOnCompositor() const;
144 bool maybeStartAnimationOnCompositor(); 150 bool maybeStartAnimationOnCompositor();
145 void cancelAnimationOnCompositor(); 151 void cancelAnimationOnCompositor();
146 void restartAnimationOnCompositor(); 152 void restartAnimationOnCompositor();
147 void cancelIncompatibleAnimationsOnCompositor(); 153 void cancelIncompatibleAnimationsOnCompositor();
148 bool hasActiveAnimationsOnCompositor(); 154 bool hasActiveAnimationsOnCompositor();
149 void setCompositorPending(bool sourceChanged = false); 155 void setCompositorPending(bool sourceChanged = false);
150 void notifyCompositorStartTime(double timelineTime); 156 void notifyCompositorStartTime(double timelineTime);
151 void notifyStartTime(double timelineTime); 157 void notifyStartTime(double timelineTime);
158 // WebCompositorAnimationPlayerClient implementation.
159 WebCompositorAnimationPlayer* compositorPlayer() const override { return m_c ompositorPlayer.get(); }
160
161 void updateCompositedLayersAttachment();
152 162
153 bool affects(const Element&, CSSPropertyID) const; 163 bool affects(const Element&, CSSPropertyID) const;
154 164
155 void preCommit(int compositorGroup, bool startOnCompositor); 165 void preCommit(int compositorGroup, bool startOnCompositor);
156 void postCommit(double timelineTime); 166 void postCommit(double timelineTime);
157 167
158 unsigned sequenceNumber() const { return m_sequenceNumber; } 168 unsigned sequenceNumber() const { return m_sequenceNumber; }
159 int compositorGroup() const { return m_compositorGroup; } 169 int compositorGroup() const { return m_compositorGroup; }
160 170
161 static bool hasLowerPriority(const AnimationPlayer* player1, const Animation Player* player2) 171 static bool hasLowerPriority(const AnimationPlayer* player1, const Animation Player* player2)
(...skipping 14 matching lines...) Expand all
176 AnimationPlayState calculatePlayState(); 186 AnimationPlayState calculatePlayState();
177 double calculateCurrentTime() const; 187 double calculateCurrentTime() const;
178 188
179 void unpauseInternal(); 189 void unpauseInternal();
180 void setPlaybackRateInternal(double); 190 void setPlaybackRateInternal(double);
181 void updateCurrentTimingState(TimingUpdateReason); 191 void updateCurrentTimingState(TimingUpdateReason);
182 192
183 void beginUpdatingState(); 193 void beginUpdatingState();
184 void endUpdatingState(); 194 void endUpdatingState();
185 195
196 void createCompositorPlayer();
197 void destroyCompositorPlayer();
198 void attachCompositorTimeline();
199 void detachCompositorTimeline();
200 void attachCompositedLayers();
201 void detachCompositedLayers();
202 // WebCompositorAnimationDelegate implementation.
203 void notifyAnimationStarted(double monotonicTime, int group) override;
204 void notifyAnimationFinished(double monotonicTime, int group) override { }
205
186 AnimationPlayState m_playState; 206 AnimationPlayState m_playState;
187 double m_playbackRate; 207 double m_playbackRate;
188 double m_startTime; 208 double m_startTime;
189 double m_holdTime; 209 double m_holdTime;
190 210
191 unsigned m_sequenceNumber; 211 unsigned m_sequenceNumber;
192 212
193 typedef ScriptPromiseProperty<RawPtrWillBeMember<AnimationPlayer>, RawPtrWil lBeMember<AnimationPlayer>, RefPtrWillBeMember<DOMException> > AnimationPlayerPr omise; 213 typedef ScriptPromiseProperty<RawPtrWillBeMember<AnimationPlayer>, RawPtrWil lBeMember<AnimationPlayer>, RefPtrWillBeMember<DOMException> > AnimationPlayerPr omise;
194 PersistentWillBeMember<AnimationPlayerPromise> m_finishedPromise; 214 PersistentWillBeMember<AnimationPlayerPromise> m_finishedPromise;
195 PersistentWillBeMember<AnimationPlayerPromise> m_readyPromise; 215 PersistentWillBeMember<AnimationPlayerPromise> m_readyPromise;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 CompositorPendingChange m_compositorPendingChange; 271 CompositorPendingChange m_compositorPendingChange;
252 }; 272 };
253 273
254 // This mirrors the known compositor state. It is created when a compositor 274 // 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 275 // animation is started. Updated once the start time is known and each time
256 // modifications are pushed to the compositor. 276 // modifications are pushed to the compositor.
257 OwnPtr<CompositorState> m_compositorState; 277 OwnPtr<CompositorState> m_compositorState;
258 bool m_compositorPending; 278 bool m_compositorPending;
259 int m_compositorGroup; 279 int m_compositorGroup;
260 280
281 OwnPtr<WebCompositorAnimationPlayer> m_compositorPlayer;
282 bool m_attachCompositedLayers;
283
261 bool m_currentTimePending; 284 bool m_currentTimePending;
262 bool m_stateIsBeingUpdated; 285 bool m_stateIsBeingUpdated;
263
264 }; 286 };
265 287
266 } // namespace blink 288 } // namespace blink
267 289
268 #endif // AnimationPlayer_h 290 #endif // AnimationPlayer_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698