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

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

Issue 2357533002: CC Animation: Use std::bitset to update animation state. (Closed)
Patch Set: Clean it up. 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
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 <memory> 8 #include <memory>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 return scroll_offset_animation_was_interrupted_; 174 return scroll_offset_animation_was_interrupted_;
175 } 175 }
176 void SetScrollOffsetAnimationWasInterrupted(); 176 void SetScrollOffsetAnimationWasInterrupted();
177 177
178 // TODO(loyso): Erase it, use AnimationPlayer's one. 178 // TODO(loyso): Erase it, use AnimationPlayer's one.
179 bool needs_to_start_animations_for_testing() const; 179 bool needs_to_start_animations_for_testing() const;
180 180
181 void SetNeedsPushProperties(); 181 void SetNeedsPushProperties();
182 bool needs_push_properties() const { return needs_push_properties_; } 182 bool needs_push_properties() const { return needs_push_properties_; }
183 183
184 // TODO(loyso): Rework UpdateClientAnimationState to use bitset.
185 void UpdateClientAnimationState(TargetProperty::Type target_property); 184 void UpdateClientAnimationState(TargetProperty::Type target_property);
186 void UpdateClientAnimationState(bool transform, bool opacity, bool filter); 185 void UpdateClientAnimationState(TargetProperties target_properties);
187 void SetNeedsUpdateImplClientState(bool transform, bool opacity, bool filter); 186 void SetNeedsUpdateImplClientState(TargetProperties target_properties);
188 187
189 void UpdateActivationNormal(); 188 void UpdateActivationNormal();
190 189
191 void NotifyClientOpacityAnimated(float opacity, 190 void NotifyClientOpacityAnimated(float opacity,
192 bool notify_active_elements, 191 bool notify_active_elements,
193 bool notify_pending_elements); 192 bool notify_pending_elements);
194 void NotifyClientTransformAnimated(const gfx::Transform& transform, 193 void NotifyClientTransformAnimated(const gfx::Transform& transform,
195 bool notify_active_elements, 194 bool notify_active_elements,
196 bool notify_pending_elements); 195 bool notify_pending_elements);
197 void NotifyClientFilterAnimated(const FilterOperations& filter, 196 void NotifyClientFilterAnimated(const FilterOperations& filter,
198 bool notify_active_elements, 197 bool notify_active_elements,
199 bool notify_pending_elements); 198 bool notify_pending_elements);
200 void NotifyClientScrollOffsetAnimated(const gfx::ScrollOffset& scroll_offset, 199 void NotifyClientScrollOffsetAnimated(const gfx::ScrollOffset& scroll_offset,
201 bool notify_active_elements, 200 bool notify_active_elements,
202 bool notify_pending_elements); 201 bool notify_pending_elements);
203 gfx::ScrollOffset ScrollOffsetForAnimation() const; 202 gfx::ScrollOffset ScrollOffsetForAnimation() const;
204 203
205 private: 204 private:
206 friend class base::RefCounted<ElementAnimations>; 205 friend class base::RefCounted<ElementAnimations>;
207 206
208 ElementAnimations(); 207 ElementAnimations();
209 ~ElementAnimations(); 208 ~ElementAnimations();
210 209
211 enum class ActivationType { NORMAL, FORCE }; 210 enum class ActivationType { NORMAL, FORCE };
212 void UpdateActivation(ActivationType type); 211 void UpdateActivation(ActivationType type);
213 212
214 void UpdateClientAnimationStateInternal(TargetProperty::Type property); 213 void UpdateClientAnimationStateInternal(TargetProperties properties);
215
216 void NotifyClientAnimationChanged(
217 TargetProperty::Type property,
218 ElementListType list_type,
219 bool notify_elements_about_potential_animation,
220 bool notify_elements_about_running_animation);
221 214
222 void OnFilterAnimated(ElementListType list_type, 215 void OnFilterAnimated(ElementListType list_type,
223 const FilterOperations& filters); 216 const FilterOperations& filters);
224 void OnOpacityAnimated(ElementListType list_type, float opacity); 217 void OnOpacityAnimated(ElementListType list_type, float opacity);
225 void OnTransformAnimated(ElementListType list_type, 218 void OnTransformAnimated(ElementListType list_type,
226 const gfx::Transform& transform); 219 const gfx::Transform& transform);
227 void OnScrollOffsetAnimated(ElementListType list_type, 220 void OnScrollOffsetAnimated(ElementListType list_type,
228 const gfx::ScrollOffset& scroll_offset); 221 const gfx::ScrollOffset& scroll_offset);
229 void IsAnimatingChanged(ElementListType list_type,
230 TargetProperty::Type property,
231 AnimationChangeType change_type,
232 bool is_animating);
233 222
234 void ClearNeedsUpdateImplClientState(); 223 static TargetProperties GetPropertiesMaskForAnimationState();
235 224
236 PlayersList players_list_; 225 PlayersList players_list_;
237 AnimationHost* animation_host_; 226 AnimationHost* animation_host_;
238 ElementId element_id_; 227 ElementId element_id_;
239 228
240 // This is used to ensure that we don't spam the animation host. 229 // This is used to ensure that we don't spam the animation host.
241 bool is_active_; 230 bool is_active_;
242 231
243 base::TimeTicks last_tick_time_; 232 base::TimeTicks last_tick_time_;
244 233
245 bool has_element_in_active_list_; 234 bool has_element_in_active_list_;
246 bool has_element_in_pending_list_; 235 bool has_element_in_pending_list_;
247 236
248 bool scroll_offset_animation_was_interrupted_; 237 bool scroll_offset_animation_was_interrupted_;
249 238
250 bool needs_push_properties_; 239 bool needs_push_properties_;
251 240
252 PropertyAnimationState filter_animation_state_; 241 PropertyAnimationState active_state_;
253 PropertyAnimationState opacity_animation_state_; 242 PropertyAnimationState pending_state_;
254 PropertyAnimationState transform_animation_state_;
255 243
256 bool needs_update_impl_client_state_transform_ : 1; 244 TargetProperties needs_update_impl_client_state_properties_;
257 bool needs_update_impl_client_state_opacity_ : 1;
258 bool needs_update_impl_client_state_filter_ : 1;
259 245
260 DISALLOW_COPY_AND_ASSIGN(ElementAnimations); 246 DISALLOW_COPY_AND_ASSIGN(ElementAnimations);
261 }; 247 };
262 248
263 } // namespace cc 249 } // namespace cc
264 250
265 #endif // CC_ANIMATION_ELEMENT_ANIMATIONS_H_ 251 #endif // CC_ANIMATION_ELEMENT_ANIMATIONS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698