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

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

Issue 2261113002: CC Animation: Introduce some dirty flags to optimize PushProperties on commit (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Do not change SetNeedsCommit invalidation, leave it as-is. Created 4 years, 3 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_timeline.cc ('k') | cc/animation/element_animations.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_ELEMENT_ANIMATIONS_H_ 5 #ifndef CC_ANIMATION_ELEMENT_ANIMATIONS_H_
6 #define CC_ANIMATION_ELEMENT_ANIMATIONS_H_ 6 #define CC_ANIMATION_ELEMENT_ANIMATIONS_H_
7 7
8 #include <bitset> 8 #include <bitset>
9 #include <memory> 9 #include <memory>
10 #include <vector> 10 #include <vector>
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 // the removed animation. This is to provide the illusion of synchronicity to 171 // the removed animation. This is to provide the illusion of synchronicity to
172 // JS that simultaneously removes an animation and sets the scroll offset. 172 // JS that simultaneously removes an animation and sets the scroll offset.
173 bool scroll_offset_animation_was_interrupted() const { 173 bool scroll_offset_animation_was_interrupted() const {
174 return scroll_offset_animation_was_interrupted_; 174 return scroll_offset_animation_was_interrupted_;
175 } 175 }
176 176
177 bool needs_to_start_animations_for_testing() { 177 bool needs_to_start_animations_for_testing() {
178 return needs_to_start_animations_; 178 return needs_to_start_animations_;
179 } 179 }
180 180
181 void SetNeedsPushProperties();
182 bool needs_push_properties() const { return needs_push_properties_; }
183
181 private: 184 private:
182 friend class base::RefCounted<ElementAnimations>; 185 friend class base::RefCounted<ElementAnimations>;
183 186
184 ElementAnimations(); 187 ElementAnimations();
185 ~ElementAnimations(); 188 ~ElementAnimations();
186 189
187 // A set of target properties. TargetProperty must be 0-based enum. 190 // A set of target properties. TargetProperty must be 0-based enum.
188 using TargetProperties = 191 using TargetProperties =
189 std::bitset<TargetProperty::LAST_TARGET_PROPERTY + 1>; 192 std::bitset<TargetProperty::LAST_TARGET_PROPERTY + 1>;
190 193
(...skipping 23 matching lines...) Expand all
214 bool notify_pending_elements); 217 bool notify_pending_elements);
215 void NotifyClientTransformAnimated(const gfx::Transform& transform, 218 void NotifyClientTransformAnimated(const gfx::Transform& transform,
216 bool notify_active_elements, 219 bool notify_active_elements,
217 bool notify_pending_elements); 220 bool notify_pending_elements);
218 void NotifyClientFilterAnimated(const FilterOperations& filter, 221 void NotifyClientFilterAnimated(const FilterOperations& filter,
219 bool notify_active_elements, 222 bool notify_active_elements,
220 bool notify_pending_elements); 223 bool notify_pending_elements);
221 void NotifyClientScrollOffsetAnimated(const gfx::ScrollOffset& scroll_offset, 224 void NotifyClientScrollOffsetAnimated(const gfx::ScrollOffset& scroll_offset,
222 bool notify_active_elements, 225 bool notify_active_elements,
223 bool notify_pending_elements); 226 bool notify_pending_elements);
224
225 void NotifyClientAnimationWaitingForDeletion();
226
227 void NotifyClientAnimationChanged( 227 void NotifyClientAnimationChanged(
228 TargetProperty::Type property, 228 TargetProperty::Type property,
229 ElementListType list_type, 229 ElementListType list_type,
230 bool notify_elements_about_potential_animation, 230 bool notify_elements_about_potential_animation,
231 bool notify_elements_about_running_animation); 231 bool notify_elements_about_running_animation);
232 232
233 void UpdateClientAnimationState(TargetProperty::Type property); 233 void UpdateClientAnimationState(TargetProperty::Type property);
234 234
235 void OnFilterAnimated(ElementListType list_type, 235 void OnFilterAnimated(ElementListType list_type,
236 const FilterOperations& filters); 236 const FilterOperations& filters);
237 void OnOpacityAnimated(ElementListType list_type, float opacity); 237 void OnOpacityAnimated(ElementListType list_type, float opacity);
238 void OnTransformAnimated(ElementListType list_type, 238 void OnTransformAnimated(ElementListType list_type,
239 const gfx::Transform& transform); 239 const gfx::Transform& transform);
240 void OnScrollOffsetAnimated(ElementListType list_type, 240 void OnScrollOffsetAnimated(ElementListType list_type,
241 const gfx::ScrollOffset& scroll_offset); 241 const gfx::ScrollOffset& scroll_offset);
242 void OnAnimationWaitingForDeletion();
243 void IsAnimatingChanged(ElementListType list_type, 242 void IsAnimatingChanged(ElementListType list_type,
244 TargetProperty::Type property, 243 TargetProperty::Type property,
245 AnimationChangeType change_type, 244 AnimationChangeType change_type,
246 bool is_animating); 245 bool is_animating);
247 gfx::ScrollOffset ScrollOffsetForAnimation() const; 246 gfx::ScrollOffset ScrollOffsetForAnimation() const;
248 247
249 void NotifyPlayersAnimationStarted(base::TimeTicks monotonic_time, 248 void NotifyPlayersAnimationStarted(base::TimeTicks monotonic_time,
250 TargetProperty::Type target_property, 249 TargetProperty::Type target_property,
251 int group); 250 int group);
252 void NotifyPlayersAnimationFinished(base::TimeTicks monotonic_time, 251 void NotifyPlayersAnimationFinished(base::TimeTicks monotonic_time,
253 TargetProperty::Type target_property, 252 TargetProperty::Type target_property,
254 int group); 253 int group);
255 void NotifyPlayersAnimationAborted(base::TimeTicks monotonic_time, 254 void NotifyPlayersAnimationAborted(base::TimeTicks monotonic_time,
256 TargetProperty::Type target_property, 255 TargetProperty::Type target_property,
257 int group); 256 int group);
257 void NotifyPlayersAnimationWaitingForDeletion();
258 void NotifyPlayersAnimationPropertyUpdate(const AnimationEvent& event); 258 void NotifyPlayersAnimationPropertyUpdate(const AnimationEvent& event);
259 void NotifyPlayersAnimationTakeover(base::TimeTicks monotonic_time, 259 void NotifyPlayersAnimationTakeover(base::TimeTicks monotonic_time,
260 TargetProperty::Type target_property, 260 TargetProperty::Type target_property,
261 double animation_start_time, 261 double animation_start_time,
262 std::unique_ptr<AnimationCurve> curve); 262 std::unique_ptr<AnimationCurve> curve);
263 263
264 std::unique_ptr<PlayersList> players_list_; 264 std::unique_ptr<PlayersList> players_list_;
265 AnimationHost* animation_host_; 265 AnimationHost* animation_host_;
266 ElementId element_id_; 266 ElementId element_id_;
267 std::vector<std::unique_ptr<Animation>> animations_; 267 std::vector<std::unique_ptr<Animation>> animations_;
268 268
269 // This is used to ensure that we don't spam the animation host. 269 // This is used to ensure that we don't spam the animation host.
270 bool is_active_; 270 bool is_active_;
271 271
272 base::TimeTicks last_tick_time_; 272 base::TimeTicks last_tick_time_;
273 273
274 bool has_element_in_active_list_; 274 bool has_element_in_active_list_;
275 bool has_element_in_pending_list_; 275 bool has_element_in_pending_list_;
276 276
277 // Only try to start animations when new animations are added or when the 277 // Only try to start animations when new animations are added or when the
278 // previous attempt at starting animations failed to start all animations. 278 // previous attempt at starting animations failed to start all animations.
279 bool needs_to_start_animations_; 279 bool needs_to_start_animations_;
280 280
281 bool scroll_offset_animation_was_interrupted_; 281 bool scroll_offset_animation_was_interrupted_;
282 282
283 bool needs_push_properties_;
284
283 struct PropertyAnimationState { 285 struct PropertyAnimationState {
284 bool currently_running_for_active_elements = false; 286 bool currently_running_for_active_elements = false;
285 bool currently_running_for_pending_elements = false; 287 bool currently_running_for_pending_elements = false;
286 bool potentially_animating_for_active_elements = false; 288 bool potentially_animating_for_active_elements = false;
287 bool potentially_animating_for_pending_elements = false; 289 bool potentially_animating_for_pending_elements = false;
288 void Clear() { 290 void Clear() {
289 currently_running_for_active_elements = false; 291 currently_running_for_active_elements = false;
290 currently_running_for_pending_elements = false; 292 currently_running_for_pending_elements = false;
291 potentially_animating_for_active_elements = false; 293 potentially_animating_for_active_elements = false;
292 potentially_animating_for_pending_elements = false; 294 potentially_animating_for_pending_elements = false;
293 } 295 }
294 }; 296 };
295 297
296 struct PropertyAnimationState filter_animation_state_; 298 struct PropertyAnimationState filter_animation_state_;
297 struct PropertyAnimationState opacity_animation_state_; 299 struct PropertyAnimationState opacity_animation_state_;
298 struct PropertyAnimationState transform_animation_state_; 300 struct PropertyAnimationState transform_animation_state_;
299 301
300 DISALLOW_COPY_AND_ASSIGN(ElementAnimations); 302 DISALLOW_COPY_AND_ASSIGN(ElementAnimations);
301 }; 303 };
302 304
303 } // namespace cc 305 } // namespace cc
304 306
305 #endif // CC_ANIMATION_ELEMENT_ANIMATIONS_H_ 307 #endif // CC_ANIMATION_ELEMENT_ANIMATIONS_H_
OLDNEW
« no previous file with comments | « cc/animation/animation_timeline.cc ('k') | cc/animation/element_animations.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698