Chromium Code Reviews| Index: cc/animation/layer_animation_controller.cc |
| diff --git a/cc/animation/layer_animation_controller.cc b/cc/animation/layer_animation_controller.cc |
| index 4e85592303ea3007915d1f577edfe667a2f0277d..ff07a02ec31e22ef853172b211bd0352606ff783 100644 |
| --- a/cc/animation/layer_animation_controller.cc |
| +++ b/cc/animation/layer_animation_controller.cc |
| @@ -602,6 +602,7 @@ void LayerAnimationController::StartAnimations(base::TimeTicks monotonic_time) { |
| // First collect running properties affecting each type of observer. |
| TargetProperties blocked_properties_for_active_observers; |
| TargetProperties blocked_properties_for_pending_observers; |
| + AnimationMap waitingfor_target_animations_; |
|
vivekg
2014/07/21 12:39:32
nit: waitingfor_target_animations_ => animations_w
shreyas.g
2014/07/21 13:00:37
Done.
|
| for (size_t i = 0; i < animations_.size(); ++i) { |
| if (animations_[i]->run_state() == Animation::Starting || |
| animations_[i]->run_state() == Animation::Running) { |
| @@ -613,22 +614,25 @@ void LayerAnimationController::StartAnimations(base::TimeTicks monotonic_time) { |
| blocked_properties_for_pending_observers.insert( |
| animations_[i]->target_property()); |
| } |
| + } else if (animations_[i]->run_state() == |
| + Animation::WaitingForTargetAvailability) { |
| + waitingfor_target_animations_[i] = animations_[i]; |
| } |
| } |
| - for (size_t i = 0; i < animations_.size(); ++i) { |
| - if (animations_[i]->run_state() == |
| - Animation::WaitingForTargetAvailability) { |
| + for (AnimationMap::const_iterator iter = |
| + waitingfor_target_animations_.begin(); |
| + iter != waitingfor_target_animations_.end(); |
| + ++iter) { |
| // Collect all properties for animations with the same group id (they |
| // should all also be in the list of animations). |
| TargetProperties enqueued_properties; |
| - bool affects_active_observers = |
| - animations_[i]->affects_active_observers(); |
| + bool affects_active_observers = iter->second->affects_active_observers(); |
| bool affects_pending_observers = |
| - animations_[i]->affects_pending_observers(); |
| - enqueued_properties.insert(animations_[i]->target_property()); |
| - for (size_t j = i + 1; j < animations_.size(); ++j) { |
| - if (animations_[i]->group() == animations_[j]->group()) { |
| + iter->second->affects_pending_observers(); |
| + enqueued_properties.insert(iter->second->target_property()); |
| + for (size_t j = iter->first + 1; j < animations_.size(); ++j) { |
| + if (iter->second->group() == animations_[j]->group()) { |
| enqueued_properties.insert(animations_[j]->target_property()); |
| affects_active_observers |= |
| animations_[j]->affects_active_observers(); |
| @@ -657,16 +661,15 @@ void LayerAnimationController::StartAnimations(base::TimeTicks monotonic_time) { |
| // If the intersection is null, then we are free to start the animations |
| // in the group. |
| if (null_intersection) { |
| - animations_[i]->SetRunState(Animation::Starting, monotonic_time); |
| - for (size_t j = i + 1; j < animations_.size(); ++j) { |
| - if (animations_[i]->group() == animations_[j]->group()) { |
| + iter->second->SetRunState(Animation::Starting, monotonic_time); |
| + for (size_t j = iter->first + 1; j < animations_.size(); ++j) { |
| + if (iter->second->group() == animations_[j]->group()) { |
| animations_[j]->SetRunState(Animation::Starting, monotonic_time); |
| } |
| } |
| } else { |
| needs_to_start_animations_ = true; |
| } |
| - } |
| } |
| } |