| OLD | NEW |
| 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" |
| (...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 577 void LayerAnimationController::PushNewAnimationsToImplThread( | 577 void LayerAnimationController::PushNewAnimationsToImplThread( |
| 578 LayerAnimationController* controller_impl) const { | 578 LayerAnimationController* controller_impl) const { |
| 579 // Any new animations owned by the main thread's controller are cloned and | 579 // Any new animations owned by the main thread's controller are cloned and |
| 580 // add to the impl thread's controller. | 580 // add to the impl thread's controller. |
| 581 for (size_t i = 0; i < animations_.size(); ++i) { | 581 for (size_t i = 0; i < animations_.size(); ++i) { |
| 582 // If the animation is already running on the impl thread, there is no | 582 // If the animation is already running on the impl thread, there is no |
| 583 // need to copy it over. | 583 // need to copy it over. |
| 584 if (controller_impl->GetAnimationById(animations_[i]->id())) | 584 if (controller_impl->GetAnimationById(animations_[i]->id())) |
| 585 continue; | 585 continue; |
| 586 | 586 |
| 587 // If the animation is not running on the impl thread, it does not | |
| 588 // necessarily mean that it needs to be copied over and started; it may | |
| 589 // have already finished. In this case, the impl thread animation will | |
| 590 // have already notified that it has started and the main thread animation | |
| 591 // will no longer need | |
| 592 // a synchronized start time. | |
| 593 if (!animations_[i]->needs_synchronized_start_time()) | |
| 594 continue; | |
| 595 | |
| 596 // Scroll animations always start at the current scroll offset. | 587 // Scroll animations always start at the current scroll offset. |
| 597 if (animations_[i]->target_property() == Animation::SCROLL_OFFSET) { | 588 if (animations_[i]->target_property() == Animation::SCROLL_OFFSET) { |
| 598 gfx::ScrollOffset current_scroll_offset; | 589 gfx::ScrollOffset current_scroll_offset; |
| 599 if (controller_impl->value_provider_) { | 590 if (controller_impl->value_provider_) { |
| 600 current_scroll_offset = | 591 current_scroll_offset = |
| 601 controller_impl->value_provider_->ScrollOffsetForAnimation(); | 592 controller_impl->value_provider_->ScrollOffsetForAnimation(); |
| 602 } else { | 593 } else { |
| 603 // The owning layer isn't yet in the active tree, so the main thread | 594 // The owning layer isn't yet in the active tree, so the main thread |
| 604 // scroll offset will be up-to-date. | 595 // scroll offset will be up-to-date. |
| 605 current_scroll_offset = value_provider_->ScrollOffsetForAnimation(); | 596 current_scroll_offset = value_provider_->ScrollOffsetForAnimation(); |
| (...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1068 &value_observers_); | 1059 &value_observers_); |
| 1069 LayerAnimationValueObserver* obs; | 1060 LayerAnimationValueObserver* obs; |
| 1070 while ((obs = it.GetNext()) != nullptr) | 1061 while ((obs = it.GetNext()) != nullptr) |
| 1071 if (obs->IsActive()) | 1062 if (obs->IsActive()) |
| 1072 return true; | 1063 return true; |
| 1073 } | 1064 } |
| 1074 return false; | 1065 return false; |
| 1075 } | 1066 } |
| 1076 | 1067 |
| 1077 } // namespace cc | 1068 } // namespace cc |
| OLD | NEW |