Index: cc/layer_tree_host.cc |
diff --git a/cc/layer_tree_host.cc b/cc/layer_tree_host.cc |
index d834164d80e1eea77f66df49b4371272649f5371..f810e067976e273b8918843eb9f1c0bb5923d095 100644 |
--- a/cc/layer_tree_host.cc |
+++ b/cc/layer_tree_host.cc |
@@ -89,8 +89,9 @@ LayerTreeHost::LayerTreeHost(LayerTreeHostClient* client, const LayerTreeSetting |
, m_backgroundColor(SK_ColorWHITE) |
, m_hasTransparentBackground(false) |
, m_partialTextureUpdateRequests(0) |
- , m_animationRegistrar(AnimationRegistrar::create()) |
{ |
+ if (m_settings.acceleratedAnimationEnabled) |
+ m_animationRegistrar = AnimationRegistrar::create(); |
numLayerTreeInstances++; |
} |
@@ -830,9 +831,16 @@ void LayerTreeHost::animateLayers(base::TimeTicks monotonicTime, base::Time wall |
double monotonicTimeInSeconds = (monotonicTime - base::TimeTicks()).InSecondsF(); |
+ scoped_ptr<AnimationEventsVector> events(make_scoped_ptr(new AnimationEventsVector)); |
AnimationRegistrar::AnimationControllerMap copy = m_animationRegistrar->active_animation_controllers(); |
for (AnimationRegistrar::AnimationControllerMap::iterator iter = copy.begin(); iter != copy.end(); ++iter) |
- (*iter).second->animate(monotonicTimeInSeconds, 0); |
+ if ((*iter).second->hasNonOrphanedObserver()) |
+ (*iter).second->animate(monotonicTimeInSeconds, 0); |
+ else |
+ (*iter).second->animate(monotonicTimeInSeconds, events.get()); |
+ |
+ if (!events->empty()) |
+ setAnimationEvents(events.Pass(), wallClockTime); |
} |
void LayerTreeHost::setAnimationEventsRecursive(const AnimationEventsVector& events, Layer* layer, base::Time wallClockTime) |