Index: cc/layer_animation_controller.cc |
diff --git a/cc/layer_animation_controller.cc b/cc/layer_animation_controller.cc |
index 8efcc4f93c57db5698b7bbd850ac98dc033f09a6..c2751875bb6ef169914dc752cb17112a32128d23 100644 |
--- a/cc/layer_animation_controller.cc |
+++ b/cc/layer_animation_controller.cc |
@@ -20,6 +20,7 @@ LayerAnimationController::LayerAnimationController(int id) |
, m_id(id) |
, m_registrar(0) |
, m_isActive(false) |
+ , m_orphanWaitStatus(NeverWaitedForLayout) |
{ |
} |
@@ -130,6 +131,8 @@ void LayerAnimationController::animate(double monotonicTime, AnimationEventsVect |
void LayerAnimationController::addAnimation(scoped_ptr<Animation> animation) |
{ |
m_activeAnimations.push_back(animation.Pass()); |
+ if ((m_orphanWaitStatus == NeverWaitedForLayout) && !hasNonOrphanedObserver()) |
+ m_orphanWaitStatus = WaitingForLayout; |
updateActivation(); |
} |
@@ -207,6 +210,19 @@ void LayerAnimationController::removeObserver(LayerAnimationValueObserver* obser |
m_observers.RemoveObserver(observer); |
} |
+bool LayerAnimationController::hasNonOrphanedObserver() |
+{ |
+ if (m_observers.might_have_observers()) { |
+ ObserverListBase<LayerAnimationValueObserver>::Iterator it(m_observers); |
+ LayerAnimationValueObserver* obs; |
+ while ((obs = it.GetNext()) != NULL) { |
+ if (!obs->IsOrphaned()) |
+ return true; |
+ } |
+ } |
+ return false; |
+} |
+ |
void LayerAnimationController::pushNewAnimationsToImplThread(LayerAnimationController* controllerImpl) const |
{ |
// Any new animations owned by the main thread's controller are cloned and adde to the impl thread's controller. |