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

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

Issue 864003002: cc: Make LayerAnimationController keep state for clearing scroll delta (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address review comments Created 5 years, 11 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 | « no previous file | cc/animation/layer_animation_controller.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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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_LAYER_ANIMATION_CONTROLLER_H_ 5 #ifndef CC_ANIMATION_LAYER_ANIMATION_CONTROLLER_H_
6 #define CC_ANIMATION_LAYER_ANIMATION_CONTROLLER_H_ 6 #define CC_ANIMATION_LAYER_ANIMATION_CONTROLLER_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/containers/hash_tables.h" 9 #include "base/containers/hash_tables.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 132
133 bool HasOnlyTranslationTransforms() const; 133 bool HasOnlyTranslationTransforms() const;
134 134
135 bool AnimationsPreserveAxisAlignment() const; 135 bool AnimationsPreserveAxisAlignment() const;
136 136
137 // Sets |max_scale| to the maximum scale along any dimension at any 137 // Sets |max_scale| to the maximum scale along any dimension at any
138 // destination in active animations. Returns false if the maximum scale cannot 138 // destination in active animations. Returns false if the maximum scale cannot
139 // be computed. 139 // be computed.
140 bool MaximumTargetScale(float* max_scale) const; 140 bool MaximumTargetScale(float* max_scale) const;
141 141
142 // When a scroll animation is removed on the main thread, its compositor
143 // thread counterpart continues producing scroll deltas until activation.
144 // These scroll deltas need to be cleared at activation, so that the active
145 // layer's scroll offset matches the offset provided by the main thread
146 // rather than a combination of this offset and scroll deltas produced by
147 // the removed animation. This is to provide the illusion of synchronicity to
148 // JS that simultaneously removes an animation and sets the scroll offset.
149 bool scroll_offset_animation_was_interrupted() const {
150 return scroll_offset_animation_was_interrupted_;
151 }
152
142 bool needs_to_start_animations_for_testing() { 153 bool needs_to_start_animations_for_testing() {
143 return needs_to_start_animations_; 154 return needs_to_start_animations_;
144 } 155 }
145 156
146 protected: 157 protected:
147 friend class base::RefCounted<LayerAnimationController>; 158 friend class base::RefCounted<LayerAnimationController>;
148 159
149 explicit LayerAnimationController(int id); 160 explicit LayerAnimationController(int id);
150 virtual ~LayerAnimationController(); 161 virtual ~LayerAnimationController();
151 162
152 private: 163 private:
153 typedef base::hash_set<int> TargetProperties; 164 typedef base::hash_set<int> TargetProperties;
154 165
155 void PushNewAnimationsToImplThread( 166 void PushNewAnimationsToImplThread(
156 LayerAnimationController* controller_impl) const; 167 LayerAnimationController* controller_impl) const;
157 void RemoveAnimationsCompletedOnMainThread( 168 void RemoveAnimationsCompletedOnMainThread(
158 LayerAnimationController* controller_impl) const; 169 LayerAnimationController* controller_impl) const;
159 void PushPropertiesToImplThread( 170 void PushPropertiesToImplThread(LayerAnimationController* controller_impl);
160 LayerAnimationController* controller_impl) const;
161 171
162 void StartAnimations(base::TimeTicks monotonic_time); 172 void StartAnimations(base::TimeTicks monotonic_time);
163 void PromoteStartedAnimations(base::TimeTicks monotonic_time, 173 void PromoteStartedAnimations(base::TimeTicks monotonic_time,
164 AnimationEventsVector* events); 174 AnimationEventsVector* events);
165 void MarkFinishedAnimations(base::TimeTicks monotonic_time); 175 void MarkFinishedAnimations(base::TimeTicks monotonic_time);
166 void MarkAnimationsForDeletion(base::TimeTicks monotonic_time, 176 void MarkAnimationsForDeletion(base::TimeTicks monotonic_time,
167 AnimationEventsVector* events); 177 AnimationEventsVector* events);
168 void PurgeAnimationsMarkedForDeletion(); 178 void PurgeAnimationsMarkedForDeletion();
169 179
170 void TickAnimations(base::TimeTicks monotonic_time); 180 void TickAnimations(base::TimeTicks monotonic_time);
(...skipping 13 matching lines...) Expand all
184 void NotifyObserversFilterAnimated(const FilterOperations& filter, 194 void NotifyObserversFilterAnimated(const FilterOperations& filter,
185 bool notify_active_observers, 195 bool notify_active_observers,
186 bool notify_pending_observers); 196 bool notify_pending_observers);
187 void NotifyObserversScrollOffsetAnimated( 197 void NotifyObserversScrollOffsetAnimated(
188 const gfx::ScrollOffset& scroll_offset, 198 const gfx::ScrollOffset& scroll_offset,
189 bool notify_active_observers, 199 bool notify_active_observers,
190 bool notify_pending_observers); 200 bool notify_pending_observers);
191 201
192 void NotifyObserversAnimationWaitingForDeletion(); 202 void NotifyObserversAnimationWaitingForDeletion();
193 203
194 void NotifyObserversScrollOffsetAnimationRemoved();
195
196 bool HasValueObserver(); 204 bool HasValueObserver();
197 bool HasActiveValueObserver(); 205 bool HasActiveValueObserver();
198 206
199 AnimationRegistrar* registrar_; 207 AnimationRegistrar* registrar_;
200 int id_; 208 int id_;
201 ScopedPtrVector<Animation> animations_; 209 ScopedPtrVector<Animation> animations_;
202 210
203 // This is used to ensure that we don't spam the registrar. 211 // This is used to ensure that we don't spam the registrar.
204 bool is_active_; 212 bool is_active_;
205 213
206 base::TimeTicks last_tick_time_; 214 base::TimeTicks last_tick_time_;
207 215
208 ObserverList<LayerAnimationValueObserver> value_observers_; 216 ObserverList<LayerAnimationValueObserver> value_observers_;
209 ObserverList<LayerAnimationEventObserver> event_observers_; 217 ObserverList<LayerAnimationEventObserver> event_observers_;
210 218
211 LayerAnimationValueProvider* value_provider_; 219 LayerAnimationValueProvider* value_provider_;
212 220
213 AnimationDelegate* layer_animation_delegate_; 221 AnimationDelegate* layer_animation_delegate_;
214 222
215 // Only try to start animations when new animations are added or when the 223 // Only try to start animations when new animations are added or when the
216 // previous attempt at starting animations failed to start all animations. 224 // previous attempt at starting animations failed to start all animations.
217 bool needs_to_start_animations_; 225 bool needs_to_start_animations_;
218 226
227 bool scroll_offset_animation_was_interrupted_;
228
219 DISALLOW_COPY_AND_ASSIGN(LayerAnimationController); 229 DISALLOW_COPY_AND_ASSIGN(LayerAnimationController);
220 }; 230 };
221 231
222 } // namespace cc 232 } // namespace cc
223 233
224 #endif // CC_ANIMATION_LAYER_ANIMATION_CONTROLLER_H_ 234 #endif // CC_ANIMATION_LAYER_ANIMATION_CONTROLLER_H_
OLDNEW
« no previous file with comments | « no previous file | cc/animation/layer_animation_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698