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

Unified Diff: cc/animation/layer_animation_controller.cc

Issue 13613003: cc: Make animations tick regardless of drawing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: cc/animation/layer_animation_controller.cc
diff --git a/cc/animation/layer_animation_controller.cc b/cc/animation/layer_animation_controller.cc
index a213ba7f76bfaa67350b69fb5a7fd41c7049e63f..67cfc591ef2fa27105ea305e52f5c58609ddc11c 100644
--- a/cc/animation/layer_animation_controller.cc
+++ b/cc/animation/layer_animation_controller.cc
@@ -116,10 +116,7 @@ void LayerAnimationController::PushAnimationUpdatesTo(
PurgeAnimationsMarkedForDeletion();
PushNewAnimationsToImplThread(controller_impl);
- // Remove finished impl side animations only after pushing,
- // and only after the animations are deleted on the main thread
- // this insures we will never push an animation twice.
- RemoveAnimationsCompletedOnMainThread(controller_impl);
+ FinishAnimationsCompletedOnMainThread(controller_impl);
ajuma 2013/04/04 15:28:47 This will also change the way animations that are
PushPropertiesToImplThread(controller_impl);
}
@@ -186,6 +183,13 @@ void LayerAnimationController::UpdateState(AnimationEventsVector* events) {
AccumulatePropertyUpdates(last_tick_time_, events);
+ if (events) {
+ // If we have an |events|, then we have sent a finished event to the main
+ // thread in the |events| list. Then the animation serves no purpose to the
+ // compositor anymore, and should be removed.
+ PurgeAnimationsMarkedForDeletion();
ajuma 2013/04/04 15:28:47 This creates a risk of pushing an animation from t
+ }
+
UpdateActivation(NormalActivation);
}
@@ -317,19 +321,15 @@ struct IsCompleted {
const LayerAnimationController& main_thread_controller_;
};
ajuma 2013/04/04 15:28:47 With the change below, this struct is now unused.
-void LayerAnimationController::RemoveAnimationsCompletedOnMainThread(
+void LayerAnimationController::FinishAnimationsCompletedOnMainThread(
LayerAnimationController* controller_impl) const {
- // Delete all impl thread animations for which there is no corresponding
- // main thread animation. Each iteration,
- // controller->active_animations_.size() is decremented or i is incremented
- // guaranteeing progress towards loop termination.
- ScopedPtrVector<Animation>& animations =
- controller_impl->active_animations_;
- animations.erase(cc::remove_if(&animations,
- animations.begin(),
- animations.end(),
- IsCompleted(*this)),
- animations.end());
+ for (size_t i = 0; i < active_animations_.size(); ++i) {
+ if (active_animations_[i]->is_impl_only())
+ continue;
+ if (!GetAnimation(active_animations_[i]->group(),
+ active_animations_[i]->target_property()))
+ active_animations_[i]->SetRunState(Animation::Finished, 0);
+ }
}
void LayerAnimationController::PushPropertiesToImplThread(

Powered by Google App Engine
This is Rietveld 408576698