Index: cc/layer_tree_host.cc |
diff --git a/cc/layer_tree_host.cc b/cc/layer_tree_host.cc |
index 44833e72ec30c0458846626996c9dc5d533ce00a..6062aae6c520c63a40aa608c062aa6babe17a1e4 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++; |
} |
@@ -867,9 +868,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) |