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

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

Issue 1148333002: cc: Make re-added animations get pushed to the compositor thread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 | « no previous file | cc/animation/layer_animation_controller_unittest.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 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
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
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
OLDNEW
« no previous file with comments | « no previous file | cc/animation/layer_animation_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698