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

Unified Diff: cc/animation/layer_animation_controller.cc

Issue 73343002: De-activate LayerAnimationControllers when all animations are WaitingForDeletion (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix TickAnimationWhileBackgrounded flake Created 7 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 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 acc16d3116423495f328adb52ceba01741277792..d75134336587a08e546f0356de973442bd5c38d4 100644
--- a/cc/animation/layer_animation_controller.cc
+++ b/cc/animation/layer_animation_controller.cc
@@ -720,11 +720,19 @@ void LayerAnimationController::TickAnimations(double monotonic_time) {
void LayerAnimationController::UpdateActivation(UpdateActivationType type) {
bool force = type == ForceActivation;
if (registrar_) {
- if (!active_animations_.empty() && (!is_active_ || force))
+ bool was_active = is_active_;
+ is_active_ = false;
+ for (size_t i = 0; i < active_animations_.size(); ++i) {
+ if (active_animations_[i]->run_state() != Animation::WaitingForDeletion) {
+ is_active_ = true;
+ break;
+ }
+ }
+
+ if (is_active_ && (!was_active || force))
registrar_->DidActivateAnimationController(this);
- else if (active_animations_.empty() && (is_active_ || force))
+ else if (!is_active_ && (was_active || force))
registrar_->DidDeactivateAnimationController(this);
- is_active_ = !active_animations_.empty();
}
}
« no previous file with comments | « no previous file | cc/animation/layer_animation_controller_unittest.cc » ('j') | cc/trees/layer_tree_host_unittest_animation.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698