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

Unified Diff: cc/layer_animation_controller.cc

Issue 11633044: We don't want to tick animation controllers for non-active layers (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Adding the suggested TODO. Created 7 years, 12 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
« no previous file with comments | « cc/layer_animation_controller.h ('k') | cc/layer_animation_value_observer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layer_animation_controller.cc
diff --git a/cc/layer_animation_controller.cc b/cc/layer_animation_controller.cc
index c72df0454a79eb3736fc46bd54bd0deffbed9f4a..f4e0d48a6aacf3c555111020ec0303107431fba1 100644
--- a/cc/layer_animation_controller.cc
+++ b/cc/layer_animation_controller.cc
@@ -103,6 +103,9 @@ void LayerAnimationController::pushAnimationUpdatesTo(LayerAnimationController*
void LayerAnimationController::animate(double monotonicTime, AnimationEventsVector* events)
{
+ if (!hasActiveObserver())
+ return;
+
startAnimationsWaitingForNextTick(monotonicTime, events);
startAnimationsWaitingForStartTime(monotonicTime, events);
startAnimationsWaitingForTargetAvailability(monotonicTime, events);
@@ -457,4 +460,16 @@ void LayerAnimationController::notifyObserversTransformAnimated(const gfx::Trans
OnTransformAnimated(transform));
}
+bool LayerAnimationController::hasActiveObserver()
+{
+ if (m_observers.might_have_observers()) {
+ ObserverListBase<LayerAnimationValueObserver>::Iterator it(m_observers);
+ LayerAnimationValueObserver* obs;
+ while ((obs = it.GetNext()) != NULL)
+ if (obs->IsActive())
+ return true;
+ }
+ return false;
+}
+
} // namespace cc
« no previous file with comments | « cc/layer_animation_controller.h ('k') | cc/layer_animation_value_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698