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

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

Issue 1437413002: cc: Remove ScopedPtrVector and cc::remove_if. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: just the vector Created 5 years, 1 month 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 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 #include "cc/animation/layer_animation_controller.h" 5 #include "cc/animation/layer_animation_controller.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "cc/animation/animation.h" 10 #include "cc/animation/animation.h"
11 #include "cc/animation/animation_delegate.h" 11 #include "cc/animation/animation_delegate.h"
12 #include "cc/animation/animation_registrar.h" 12 #include "cc/animation/animation_registrar.h"
13 #include "cc/animation/keyframed_animation_curve.h" 13 #include "cc/animation/keyframed_animation_curve.h"
14 #include "cc/animation/layer_animation_value_observer.h" 14 #include "cc/animation/layer_animation_value_observer.h"
15 #include "cc/animation/layer_animation_value_provider.h" 15 #include "cc/animation/layer_animation_value_provider.h"
16 #include "cc/animation/scroll_offset_animation_curve.h" 16 #include "cc/animation/scroll_offset_animation_curve.h"
17 #include "cc/base/scoped_ptr_algorithm.h"
18 #include "cc/output/filter_operations.h" 17 #include "cc/output/filter_operations.h"
19 #include "ui/gfx/geometry/box_f.h" 18 #include "ui/gfx/geometry/box_f.h"
20 #include "ui/gfx/transform.h" 19 #include "ui/gfx/transform.h"
21 20
22 namespace cc { 21 namespace cc {
23 22
24 LayerAnimationController::LayerAnimationController(int id) 23 LayerAnimationController::LayerAnimationController(int id)
25 : registrar_(0), 24 : registrar_(0),
26 id_(id), 25 id_(id),
27 is_active_(false), 26 is_active_(false),
(...skipping 18 matching lines...) Expand all
46 base::TimeDelta time_offset) { 45 base::TimeDelta time_offset) {
47 for (size_t i = 0; i < animations_.size(); ++i) { 46 for (size_t i = 0; i < animations_.size(); ++i) {
48 if (animations_[i]->id() == animation_id) { 47 if (animations_[i]->id() == animation_id) {
49 animations_[i]->SetRunState(Animation::PAUSED, 48 animations_[i]->SetRunState(Animation::PAUSED,
50 time_offset + animations_[i]->start_time() + 49 time_offset + animations_[i]->start_time() +
51 animations_[i]->time_offset()); 50 animations_[i]->time_offset());
52 } 51 }
53 } 52 }
54 } 53 }
55 54
56 struct HasAnimationId {
57 explicit HasAnimationId(int id) : id_(id) {}
58 bool operator()(Animation* animation) const {
59 return animation->id() == id_;
60 }
61
62 private:
63 int id_;
64 };
65
66 void LayerAnimationController::UpdatePotentiallyAnimatingTransform() { 55 void LayerAnimationController::UpdatePotentiallyAnimatingTransform() {
67 bool was_potentially_animating_transform_for_active_observers = 56 bool was_potentially_animating_transform_for_active_observers =
68 potentially_animating_transform_for_active_observers_; 57 potentially_animating_transform_for_active_observers_;
69 bool was_potentially_animating_transform_for_pending_observers = 58 bool was_potentially_animating_transform_for_pending_observers =
70 potentially_animating_transform_for_pending_observers_; 59 potentially_animating_transform_for_pending_observers_;
71 60
72 potentially_animating_transform_for_active_observers_ = false; 61 potentially_animating_transform_for_active_observers_ = false;
73 potentially_animating_transform_for_pending_observers_ = false; 62 potentially_animating_transform_for_pending_observers_ = false;
74 63
75 for (Animation* animation : animations_) { 64 for (const scoped_ptr<Animation>& animation : animations_) {
danakj 2015/11/17 01:12:16 I'd like this to be an auto& and I wrote as much t
vmpstr 2015/11/17 23:26:23 Done.
76 if (!animation->is_finished() && 65 if (!animation->is_finished() &&
77 animation->target_property() == Animation::TRANSFORM) { 66 animation->target_property() == Animation::TRANSFORM) {
78 potentially_animating_transform_for_active_observers_ |= 67 potentially_animating_transform_for_active_observers_ |=
79 animation->affects_active_observers(); 68 animation->affects_active_observers();
80 potentially_animating_transform_for_pending_observers_ |= 69 potentially_animating_transform_for_pending_observers_ |=
81 animation->affects_pending_observers(); 70 animation->affects_pending_observers();
82 } 71 }
83 } 72 }
84 73
85 bool changed_for_active_observers = 74 bool changed_for_active_observers =
86 was_potentially_animating_transform_for_active_observers != 75 was_potentially_animating_transform_for_active_observers !=
87 potentially_animating_transform_for_active_observers_; 76 potentially_animating_transform_for_active_observers_;
88 bool changed_for_pending_observers = 77 bool changed_for_pending_observers =
89 was_potentially_animating_transform_for_pending_observers != 78 was_potentially_animating_transform_for_pending_observers !=
90 potentially_animating_transform_for_pending_observers_; 79 potentially_animating_transform_for_pending_observers_;
91 80
92 if (!changed_for_active_observers && !changed_for_pending_observers) 81 if (!changed_for_active_observers && !changed_for_pending_observers)
93 return; 82 return;
94 83
95 NotifyObserversTransformIsPotentiallyAnimatingChanged( 84 NotifyObserversTransformIsPotentiallyAnimatingChanged(
96 changed_for_active_observers, changed_for_pending_observers); 85 changed_for_active_observers, changed_for_pending_observers);
97 } 86 }
98 87
99 void LayerAnimationController::RemoveAnimation(int animation_id) { 88 void LayerAnimationController::RemoveAnimation(int animation_id) {
100 bool removed_transform_animation = false; 89 bool removed_transform_animation = false;
101 auto animations_to_remove = 90 auto animations_to_remove = std::stable_partition(
danakj 2015/11/17 01:12:16 Can you leave a comment saying you used this inste
vmpstr 2015/11/17 23:26:23 Done.
102 animations_.remove_if(HasAnimationId(animation_id)); 91 animations_.begin(), animations_.end(),
92 [animation_id](const scoped_ptr<Animation>& animation) {
93 return animation->id() != animation_id;
94 });
103 for (auto it = animations_to_remove; it != animations_.end(); ++it) { 95 for (auto it = animations_to_remove; it != animations_.end(); ++it) {
104 if ((*it)->target_property() == Animation::SCROLL_OFFSET) { 96 if ((*it)->target_property() == Animation::SCROLL_OFFSET) {
105 scroll_offset_animation_was_interrupted_ = true; 97 scroll_offset_animation_was_interrupted_ = true;
106 } else if ((*it)->target_property() == Animation::TRANSFORM && 98 } else if ((*it)->target_property() == Animation::TRANSFORM &&
107 !(*it)->is_finished()) { 99 !(*it)->is_finished()) {
108 removed_transform_animation = true; 100 removed_transform_animation = true;
109 } 101 }
110 } 102 }
111 103
112 animations_.erase(animations_to_remove, animations_.end()); 104 animations_.erase(animations_to_remove, animations_.end());
113 UpdateActivation(NORMAL_ACTIVATION); 105 UpdateActivation(NORMAL_ACTIVATION);
114 if (removed_transform_animation) 106 if (removed_transform_animation)
115 UpdatePotentiallyAnimatingTransform(); 107 UpdatePotentiallyAnimatingTransform();
116 } 108 }
117 109
118 struct HasAnimationIdAndProperty {
119 HasAnimationIdAndProperty(int id, Animation::TargetProperty target_property)
120 : id_(id), target_property_(target_property) {}
121 bool operator()(Animation* animation) const {
122 return animation->id() == id_ &&
123 animation->target_property() == target_property_;
124 }
125
126 private:
127 int id_;
128 Animation::TargetProperty target_property_;
129 };
130
131 void LayerAnimationController::RemoveAnimation( 110 void LayerAnimationController::RemoveAnimation(
132 int animation_id, 111 int animation_id,
133 Animation::TargetProperty target_property) { 112 Animation::TargetProperty target_property) {
134 bool removed_transform_animation = false; 113 bool removed_transform_animation = false;
135 auto animations_to_remove = animations_.remove_if( 114 auto animations_to_remove = std::stable_partition(
danakj 2015/11/17 01:12:16 ditto comment
vmpstr 2015/11/17 23:26:23 Done.
136 HasAnimationIdAndProperty(animation_id, target_property)); 115 animations_.begin(), animations_.end(),
116 [animation_id, target_property](const scoped_ptr<Animation>& animation) {
danakj 2015/11/17 01:12:16 in general i find it easier to read these types of
vmpstr 2015/11/17 23:26:23 Yeah I think that's very reasonable. Let me know o
117 return animation->id() != animation_id ||
118 animation->target_property() != target_property;
119 });
137 if (animations_to_remove == animations_.end()) 120 if (animations_to_remove == animations_.end())
138 return; 121 return;
139 122
140 if (target_property == Animation::SCROLL_OFFSET) 123 if (target_property == Animation::SCROLL_OFFSET)
141 scroll_offset_animation_was_interrupted_ = true; 124 scroll_offset_animation_was_interrupted_ = true;
142 else if (target_property == Animation::TRANSFORM && 125 else if (target_property == Animation::TRANSFORM &&
143 !(*animations_to_remove)->is_finished()) 126 !(*animations_to_remove)->is_finished())
vmpstr 2015/11/17 23:26:23 This _looks_ like there can only be one of such an
144 removed_transform_animation = true; 127 removed_transform_animation = true;
145 128
146 animations_.erase(animations_to_remove, animations_.end()); 129 animations_.erase(animations_to_remove, animations_.end());
147 UpdateActivation(NORMAL_ACTIVATION); 130 UpdateActivation(NORMAL_ACTIVATION);
148 if (removed_transform_animation) 131 if (removed_transform_animation)
149 UpdatePotentiallyAnimatingTransform(); 132 UpdatePotentiallyAnimatingTransform();
150 } 133 }
151 134
152 void LayerAnimationController::AbortAnimations( 135 void LayerAnimationController::AbortAnimations(
153 Animation::TargetProperty target_property) { 136 Animation::TargetProperty target_property) {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 last_tick_time_ = monotonic_time; 178 last_tick_time_ = monotonic_time;
196 } 179 }
197 180
198 void LayerAnimationController::AccumulatePropertyUpdates( 181 void LayerAnimationController::AccumulatePropertyUpdates(
199 base::TimeTicks monotonic_time, 182 base::TimeTicks monotonic_time,
200 AnimationEventsVector* events) { 183 AnimationEventsVector* events) {
201 if (!events) 184 if (!events)
202 return; 185 return;
203 186
204 for (size_t i = 0; i < animations_.size(); ++i) { 187 for (size_t i = 0; i < animations_.size(); ++i) {
205 Animation* animation = animations_[i]; 188 Animation* animation = animations_[i].get();
206 if (!animation->is_impl_only()) 189 if (!animation->is_impl_only())
207 continue; 190 continue;
208 191
209 if (!animation->InEffect(monotonic_time)) 192 if (!animation->InEffect(monotonic_time))
210 continue; 193 continue;
211 194
212 base::TimeDelta trimmed = 195 base::TimeDelta trimmed =
213 animation->TrimTimeToCurrentIteration(monotonic_time); 196 animation->TrimTimeToCurrentIteration(monotonic_time);
214 switch (animation->target_property()) { 197 switch (animation->target_property()) {
215 case Animation::OPACITY: { 198 case Animation::OPACITY: {
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 if (needs_to_start_animations_ && start_ready_animations) { 264 if (needs_to_start_animations_ && start_ready_animations) {
282 StartAnimations(last_tick_time_); 265 StartAnimations(last_tick_time_);
283 PromoteStartedAnimations(last_tick_time_, events); 266 PromoteStartedAnimations(last_tick_time_, events);
284 } 267 }
285 268
286 AccumulatePropertyUpdates(last_tick_time_, events); 269 AccumulatePropertyUpdates(last_tick_time_, events);
287 270
288 UpdateActivation(NORMAL_ACTIVATION); 271 UpdateActivation(NORMAL_ACTIVATION);
289 } 272 }
290 273
291 struct AffectsNoObservers {
292 bool operator()(Animation* animation) const {
293 return !animation->affects_active_observers() &&
294 !animation->affects_pending_observers();
295 }
296 };
297
298 void LayerAnimationController::ActivateAnimations() { 274 void LayerAnimationController::ActivateAnimations() {
299 bool changed_transform_animation = false; 275 bool changed_transform_animation = false;
300 for (size_t i = 0; i < animations_.size(); ++i) { 276 for (size_t i = 0; i < animations_.size(); ++i) {
301 if (animations_[i]->affects_active_observers() != 277 if (animations_[i]->affects_active_observers() !=
302 animations_[i]->affects_pending_observers() && 278 animations_[i]->affects_pending_observers() &&
303 animations_[i]->target_property() == Animation::TRANSFORM) 279 animations_[i]->target_property() == Animation::TRANSFORM)
304 changed_transform_animation = true; 280 changed_transform_animation = true;
305 animations_[i]->set_affects_active_observers( 281 animations_[i]->set_affects_active_observers(
306 animations_[i]->affects_pending_observers()); 282 animations_[i]->affects_pending_observers());
307 } 283 }
308 animations_.erase(cc::remove_if(&animations_, 284 animations_.erase(
309 animations_.begin(), 285 std::remove_if(animations_.begin(), animations_.end(),
310 animations_.end(), 286 [](const scoped_ptr<Animation>& animation) {
311 AffectsNoObservers()), 287 return !animation->affects_active_observers() &&
danakj 2015/11/17 01:12:16 kinda like having a lambda here too, similar to co
vmpstr 2015/11/17 23:26:23 Done.
312 animations_.end()); 288 !animation->affects_pending_observers();
289 }),
290 animations_.end());
313 scroll_offset_animation_was_interrupted_ = false; 291 scroll_offset_animation_was_interrupted_ = false;
314 UpdateActivation(NORMAL_ACTIVATION); 292 UpdateActivation(NORMAL_ACTIVATION);
315 if (changed_transform_animation) 293 if (changed_transform_animation)
316 UpdatePotentiallyAnimatingTransform(); 294 UpdatePotentiallyAnimatingTransform();
317 } 295 }
318 296
319 void LayerAnimationController::AddAnimation(scoped_ptr<Animation> animation) { 297 void LayerAnimationController::AddAnimation(scoped_ptr<Animation> animation) {
320 bool added_transform_animation = 298 bool added_transform_animation =
321 animation->target_property() == Animation::TRANSFORM; 299 animation->target_property() == Animation::TRANSFORM;
322 animations_.push_back(animation.Pass()); 300 animations_.push_back(animation.Pass());
323 needs_to_start_animations_ = true; 301 needs_to_start_animations_ = true;
324 UpdateActivation(NORMAL_ACTIVATION); 302 UpdateActivation(NORMAL_ACTIVATION);
325 if (added_transform_animation) 303 if (added_transform_animation)
326 UpdatePotentiallyAnimatingTransform(); 304 UpdatePotentiallyAnimatingTransform();
327 } 305 }
328 306
329 Animation* LayerAnimationController::GetAnimation( 307 Animation* LayerAnimationController::GetAnimation(
330 Animation::TargetProperty target_property) const { 308 Animation::TargetProperty target_property) const {
331 for (size_t i = 0; i < animations_.size(); ++i) { 309 for (size_t i = 0; i < animations_.size(); ++i) {
332 size_t index = animations_.size() - i - 1; 310 size_t index = animations_.size() - i - 1;
333 if (animations_[index]->target_property() == target_property) 311 if (animations_[index]->target_property() == target_property)
334 return animations_[index]; 312 return animations_[index].get();
335 } 313 }
336 return 0; 314 return nullptr;
337 } 315 }
338 316
339 Animation* LayerAnimationController::GetAnimationById(int animation_id) const { 317 Animation* LayerAnimationController::GetAnimationById(int animation_id) const {
340 for (size_t i = 0; i < animations_.size(); ++i) 318 for (size_t i = 0; i < animations_.size(); ++i)
341 if (animations_[i]->id() == animation_id) 319 if (animations_[i]->id() == animation_id)
342 return animations_[i]; 320 return animations_[i].get();
343 return nullptr; 321 return nullptr;
344 } 322 }
345 323
346 bool LayerAnimationController::HasActiveAnimation() const { 324 bool LayerAnimationController::HasActiveAnimation() const {
347 for (size_t i = 0; i < animations_.size(); ++i) { 325 for (size_t i = 0; i < animations_.size(); ++i) {
348 if (!animations_[i]->is_finished()) 326 if (!animations_[i]->is_finished())
349 return true; 327 return true;
350 } 328 }
351 return false; 329 return false;
352 } 330 }
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
730 static bool IsCompleted( 708 static bool IsCompleted(
731 Animation* animation, 709 Animation* animation,
732 const LayerAnimationController* main_thread_controller) { 710 const LayerAnimationController* main_thread_controller) {
733 if (animation->is_impl_only()) { 711 if (animation->is_impl_only()) {
734 return (animation->run_state() == Animation::WAITING_FOR_DELETION); 712 return (animation->run_state() == Animation::WAITING_FOR_DELETION);
735 } else { 713 } else {
736 return !main_thread_controller->GetAnimationById(animation->id()); 714 return !main_thread_controller->GetAnimationById(animation->id());
737 } 715 }
738 } 716 }
739 717
740 static bool AffectsActiveOnlyAndIsWaitingForDeletion(Animation* animation) {
741 return animation->run_state() == Animation::WAITING_FOR_DELETION &&
742 !animation->affects_pending_observers();
743 }
744
745 void LayerAnimationController::RemoveAnimationsCompletedOnMainThread( 718 void LayerAnimationController::RemoveAnimationsCompletedOnMainThread(
746 LayerAnimationController* controller_impl) const { 719 LayerAnimationController* controller_impl) const {
747 bool removed_transform_animation = false; 720 bool removed_transform_animation = false;
748 // Animations removed on the main thread should no longer affect pending 721 // Animations removed on the main thread should no longer affect pending
749 // observers, and should stop affecting active observers after the next call 722 // observers, and should stop affecting active observers after the next call
750 // to ActivateAnimations. If already WAITING_FOR_DELETION, they can be removed 723 // to ActivateAnimations. If already WAITING_FOR_DELETION, they can be removed
751 // immediately. 724 // immediately.
752 ScopedPtrVector<Animation>& animations = controller_impl->animations_; 725 std::vector<scoped_ptr<Animation>>& animations = controller_impl->animations_;
danakj 2015/11/17 01:12:16 that's a lot of templatefu. consider auto&? do we
vmpstr 2015/11/17 23:26:23 Done.
753 for (size_t i = 0; i < animations.size(); ++i) { 726 for (size_t i = 0; i < animations.size(); ++i) {
754 if (IsCompleted(animations[i], this)) { 727 if (IsCompleted(animations[i].get(), this)) {
755 animations[i]->set_affects_pending_observers(false); 728 animations[i]->set_affects_pending_observers(false);
756 if (animations[i]->target_property() == Animation::TRANSFORM) 729 if (animations[i]->target_property() == Animation::TRANSFORM)
757 removed_transform_animation = true; 730 removed_transform_animation = true;
758 } 731 }
759 } 732 }
760 animations.erase(cc::remove_if(&animations, 733 animations.erase(std::remove_if(
761 animations.begin(), 734 animations.begin(), animations.end(),
762 animations.end(), 735 [](const scoped_ptr<Animation>& animation) {
763 AffectsActiveOnlyAndIsWaitingForDeletion), 736 return animation->run_state() == Animation::WAITING_FOR_DELETION &&
764 animations.end()); 737 !animation->affects_pending_observers();
738 }));
ericrk 2015/11/16 19:20:52 missing animations.end()?
vmpstr 2015/11/17 23:26:23 Done.
765 739
766 if (removed_transform_animation) 740 if (removed_transform_animation)
767 controller_impl->UpdatePotentiallyAnimatingTransform(); 741 controller_impl->UpdatePotentiallyAnimatingTransform();
768 } 742 }
769 743
770 void LayerAnimationController::PushPropertiesToImplThread( 744 void LayerAnimationController::PushPropertiesToImplThread(
771 LayerAnimationController* controller_impl) { 745 LayerAnimationController* controller_impl) {
772 for (size_t i = 0; i < animations_.size(); ++i) { 746 for (size_t i = 0; i < animations_.size(); ++i) {
773 Animation* current_impl = 747 Animation* current_impl =
774 controller_impl->GetAnimationById(animations_[i]->id()); 748 controller_impl->GetAnimationById(animations_[i]->id());
(...skipping 28 matching lines...) Expand all
803 } else if (animations_[i]->run_state() == 777 } else if (animations_[i]->run_state() ==
804 Animation::WAITING_FOR_TARGET_AVAILABILITY) { 778 Animation::WAITING_FOR_TARGET_AVAILABILITY) {
805 animations_waiting_for_target.push_back(i); 779 animations_waiting_for_target.push_back(i);
806 } 780 }
807 } 781 }
808 782
809 for (size_t i = 0; i < animations_waiting_for_target.size(); ++i) { 783 for (size_t i = 0; i < animations_waiting_for_target.size(); ++i) {
810 // Collect all properties for animations with the same group id (they 784 // Collect all properties for animations with the same group id (they
811 // should all also be in the list of animations). 785 // should all also be in the list of animations).
812 size_t animation_index = animations_waiting_for_target[i]; 786 size_t animation_index = animations_waiting_for_target[i];
813 Animation* animation_waiting_for_target = animations_[animation_index]; 787 Animation* animation_waiting_for_target =
788 animations_[animation_index].get();
814 // Check for the run state again even though the animation was waiting 789 // Check for the run state again even though the animation was waiting
815 // for target because it might have changed the run state while handling 790 // for target because it might have changed the run state while handling
816 // previous animation in this loop (if they belong to same group). 791 // previous animation in this loop (if they belong to same group).
817 if (animation_waiting_for_target->run_state() == 792 if (animation_waiting_for_target->run_state() ==
818 Animation::WAITING_FOR_TARGET_AVAILABILITY) { 793 Animation::WAITING_FOR_TARGET_AVAILABILITY) {
819 TargetProperties enqueued_properties; 794 TargetProperties enqueued_properties;
820 bool affects_active_observers = 795 bool affects_active_observers =
821 animation_waiting_for_target->affects_active_observers(); 796 animation_waiting_for_target->affects_active_observers();
822 bool affects_pending_observers = 797 bool affects_pending_observers =
823 animation_waiting_for_target->affects_pending_observers(); 798 animation_waiting_for_target->affects_pending_observers();
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
1002 animations_[animation_index]->SetRunState( 977 animations_[animation_index]->SetRunState(
1003 Animation::WAITING_FOR_DELETION, monotonic_time); 978 Animation::WAITING_FOR_DELETION, monotonic_time);
1004 } 979 }
1005 marked_animations_for_deletions = true; 980 marked_animations_for_deletions = true;
1006 } 981 }
1007 } 982 }
1008 if (marked_animations_for_deletions) 983 if (marked_animations_for_deletions)
1009 NotifyObserversAnimationWaitingForDeletion(); 984 NotifyObserversAnimationWaitingForDeletion();
1010 } 985 }
1011 986
1012 static bool IsWaitingForDeletion(Animation* animation) {
1013 return animation->run_state() == Animation::WAITING_FOR_DELETION;
1014 }
1015
1016 void LayerAnimationController::PurgeAnimationsMarkedForDeletion() { 987 void LayerAnimationController::PurgeAnimationsMarkedForDeletion() {
1017 animations_.erase(cc::remove_if(&animations_, 988 animations_.erase(std::remove_if(animations_.begin(), animations_.end(),
1018 animations_.begin(), 989 [](const scoped_ptr<Animation>& animation) {
1019 animations_.end(), 990 return animation->run_state() ==
1020 IsWaitingForDeletion), 991 Animation::WAITING_FOR_DELETION;
992 }),
1021 animations_.end()); 993 animations_.end());
1022 } 994 }
1023 995
1024 void LayerAnimationController::TickAnimations(base::TimeTicks monotonic_time) { 996 void LayerAnimationController::TickAnimations(base::TimeTicks monotonic_time) {
1025 for (size_t i = 0; i < animations_.size(); ++i) { 997 for (size_t i = 0; i < animations_.size(); ++i) {
1026 if (animations_[i]->run_state() == Animation::STARTING || 998 if (animations_[i]->run_state() == Animation::STARTING ||
1027 animations_[i]->run_state() == Animation::RUNNING || 999 animations_[i]->run_state() == Animation::RUNNING ||
1028 animations_[i]->run_state() == Animation::PAUSED) { 1000 animations_[i]->run_state() == Animation::PAUSED) {
1029 if (!animations_[i]->InEffect(monotonic_time)) 1001 if (!animations_[i]->InEffect(monotonic_time))
1030 continue; 1002 continue;
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
1217 &value_observers_); 1189 &value_observers_);
1218 LayerAnimationValueObserver* obs; 1190 LayerAnimationValueObserver* obs;
1219 while ((obs = it.GetNext()) != nullptr) 1191 while ((obs = it.GetNext()) != nullptr)
1220 if (obs->IsActive()) 1192 if (obs->IsActive())
1221 return true; 1193 return true;
1222 } 1194 }
1223 return false; 1195 return false;
1224 } 1196 }
1225 1197
1226 } // namespace cc 1198 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698