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

Side by Side Diff: cc/animation/animation_player.h

Issue 2966793002: NOT FOR REVIEW - convert to cc animation
Patch Set: switch to transform operations Created 3 years, 5 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
« no previous file with comments | « cc/animation/animation_observer.h ('k') | cc/animation/animation_player.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CC_ANIMATION_ANIMATION_PLAYER_H_ 5 #ifndef CC_ANIMATION_ANIMATION_PLAYER_H_
6 #define CC_ANIMATION_ANIMATION_PLAYER_H_ 6 #define CC_ANIMATION_ANIMATION_PLAYER_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/observer_list.h"
12 #include "base/time/time.h" 13 #include "base/time/time.h"
13 #include "cc/animation/animation.h" 14 #include "cc/animation/animation.h"
14 #include "cc/animation/animation_curve.h" 15 #include "cc/animation/animation_curve.h"
15 #include "cc/animation/animation_export.h" 16 #include "cc/animation/animation_export.h"
16 #include "cc/animation/element_animations.h" 17 #include "cc/animation/element_animations.h"
17 #include "cc/trees/element_id.h" 18 #include "cc/trees/element_id.h"
18 19
19 namespace cc { 20 namespace cc {
20 21
21 class AnimationDelegate; 22 class AnimationDelegate;
22 class AnimationEvents; 23 class AnimationEvents;
23 class AnimationHost; 24 class AnimationHost;
25 class AnimationObserver;
24 class AnimationTimeline; 26 class AnimationTimeline;
25 struct AnimationEvent; 27 struct AnimationEvent;
26 struct PropertyAnimationState; 28 struct PropertyAnimationState;
27 29
28 // An AnimationPlayer owns all animations to be run on particular CC Layer. 30 // An AnimationPlayer owns all animations to be run on particular CC Layer.
29 // Multiple AnimationPlayers can be attached to one layer. In this case, 31 // Multiple AnimationPlayers can be attached to one layer. In this case,
30 // they share common ElementAnimations so the 32 // they share common ElementAnimations so the
31 // ElementAnimations-to-Layer relationship is 1:1. 33 // ElementAnimations-to-Layer relationship is 1:1.
32 // For now, the blink logic is responsible for handling of conflicting 34 // For now, the blink logic is responsible for handling of conflicting
33 // same-property animations. 35 // same-property animations.
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 // thread counterpart continues producing scroll deltas until activation. 165 // thread counterpart continues producing scroll deltas until activation.
164 // These scroll deltas need to be cleared at activation, so that the active 166 // These scroll deltas need to be cleared at activation, so that the active
165 // element's scroll offset matches the offset provided by the main thread 167 // element's scroll offset matches the offset provided by the main thread
166 // rather than a combination of this offset and scroll deltas produced by 168 // rather than a combination of this offset and scroll deltas produced by
167 // the removed animation. This is to provide the illusion of synchronicity to 169 // the removed animation. This is to provide the illusion of synchronicity to
168 // JS that simultaneously removes an animation and sets the scroll offset. 170 // JS that simultaneously removes an animation and sets the scroll offset.
169 bool scroll_offset_animation_was_interrupted() const { 171 bool scroll_offset_animation_was_interrupted() const {
170 return scroll_offset_animation_was_interrupted_; 172 return scroll_offset_animation_was_interrupted_;
171 } 173 }
172 174
175 // This controls the list of entities who are informed of updates as
176 // animations are ticked.
177 void AddObserver(AnimationObserver* observer);
178 void RemoveObserver(AnimationObserver* observer);
179
173 private: 180 private:
174 friend class base::RefCounted<AnimationPlayer>; 181 friend class base::RefCounted<AnimationPlayer>;
175 182
176 explicit AnimationPlayer(int id); 183 explicit AnimationPlayer(int id);
177 ~AnimationPlayer(); 184 ~AnimationPlayer();
178 185
179 void SetNeedsCommit(); 186 void SetNeedsCommit();
180 187
181 void RegisterPlayer(); 188 void RegisterPlayer();
182 void UnregisterPlayer(); 189 void UnregisterPlayer();
(...skipping 28 matching lines...) Expand all
211 218
212 // Only try to start animations when new animations are added or when the 219 // Only try to start animations when new animations are added or when the
213 // previous attempt at starting animations failed to start all animations. 220 // previous attempt at starting animations failed to start all animations.
214 bool needs_to_start_animations_; 221 bool needs_to_start_animations_;
215 222
216 // This is used to ensure that we don't spam the animation host. 223 // This is used to ensure that we don't spam the animation host.
217 bool is_ticking_; 224 bool is_ticking_;
218 225
219 bool scroll_offset_animation_was_interrupted_; 226 bool scroll_offset_animation_was_interrupted_;
220 227
228 base::ObserverList<AnimationObserver> observers_;
229
221 DISALLOW_COPY_AND_ASSIGN(AnimationPlayer); 230 DISALLOW_COPY_AND_ASSIGN(AnimationPlayer);
222 }; 231 };
223 232
224 } // namespace cc 233 } // namespace cc
225 234
226 #endif // CC_ANIMATION_ANIMATION_PLAYER_H_ 235 #endif // CC_ANIMATION_ANIMATION_PLAYER_H_
OLDNEW
« no previous file with comments | « cc/animation/animation_observer.h ('k') | cc/animation/animation_player.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698