Index: cc/trees/layer_tree_host.cc |
diff --git a/cc/trees/layer_tree_host.cc b/cc/trees/layer_tree_host.cc |
index eca231158eead4edd5594d65a59c194be70434b2..b9ad3e535b2c59a72554739335191de98acab3fb 100644 |
--- a/cc/trees/layer_tree_host.cc |
+++ b/cc/trees/layer_tree_host.cc |
@@ -18,6 +18,7 @@ |
#include "base/trace_event/trace_event.h" |
#include "base/trace_event/trace_event_argument.h" |
#include "cc/animation/animation_registrar.h" |
+#include "cc/animation/animation_timeline.h" |
#include "cc/animation/layer_animation_controller.h" |
#include "cc/base/math_util.h" |
#include "cc/debug/devtools_instrumentation.h" |
@@ -295,6 +296,14 @@ void LayerTreeHost::FinishCommitOnImplThread(LayerTreeHostImpl* host_impl) { |
sync_tree->set_source_frame_number(source_frame_number()); |
if (needs_full_tree_sync_) { |
+ scoped_refptr<AnimationTimeline> timeline_impl; |
+ if (animation_timeline_) { |
+ timeline_impl = host_impl->animation_timeline(); |
+ if (!timeline_impl) |
+ timeline_impl = AnimationTimeline::Create(); |
+ } |
+ host_impl->SetAnimationTimeline(timeline_impl); |
+ |
sync_tree->SetRootLayer(TreeSynchronizer::SynchronizeTrees( |
root_layer(), sync_tree->DetachLayerTree(), sync_tree)); |
} |
@@ -368,6 +377,11 @@ void LayerTreeHost::FinishCommitOnImplThread(LayerTreeHostImpl* host_impl) { |
{ |
TRACE_EVENT0("cc", "LayerTreeHost::PushProperties"); |
TreeSynchronizer::PushProperties(root_layer(), sync_tree->root_layer()); |
+ |
+ if (animation_timeline_) { |
+ DCHECK(host_impl->animation_timeline()); |
+ animation_timeline_->PushPropertiesTo(host_impl->animation_timeline()); |
+ } |
} |
micro_benchmark_controller_.ScheduleImplBenchmarks(host_impl); |
@@ -550,6 +564,18 @@ void LayerTreeHost::SetAnimationEvents( |
animation_registrar_->SetAnimationEvents(events.Pass()); |
} |
+void LayerTreeHost::SetAnimationTimeline( |
+ scoped_refptr<AnimationTimeline> timeline) { |
+ if (animation_timeline_.get() == timeline.get()) |
+ return; |
+ |
+ if (animation_timeline_.get()) |
+ animation_timeline_->SetLayerTreeMutatorsClient(nullptr); |
+ animation_timeline_ = timeline; |
+ if (animation_timeline_.get()) |
+ animation_timeline_->SetLayerTreeMutatorsClient(this); |
+} |
+ |
void LayerTreeHost::SetRootLayer(scoped_refptr<Layer> root_layer) { |
if (root_layer_.get() == root_layer.get()) |
return; |
@@ -1289,4 +1315,59 @@ void LayerTreeHost::SendBeginFramesToChildren( |
client_->SendBeginFramesToChildren(args); |
} |
+Layer* LayerTreeHost::LayerById(int id) const { |
+ LayerIdMap::const_iterator iter = layer_id_map_.find(id); |
+ return iter != layer_id_map_.end() ? iter->second : NULL; |
+} |
+ |
+void LayerTreeHost::RegisterLayer(Layer* layer) { |
+ DCHECK(!LayerById(layer->id())); |
+ layer_id_map_[layer->id()] = layer; |
+} |
+ |
+void LayerTreeHost::UnregisterLayer(Layer* layer) { |
+ DCHECK(LayerById(layer->id())); |
+ layer_id_map_.erase(layer->id()); |
+} |
+ |
+AnimationRegistrar* LayerTreeHost::GetAnimationRegistrar() const { |
+ return animation_registrar_.get(); |
+} |
+ |
+bool LayerTreeHost::IsLayerInActiveTree(int layer_id) const { |
+ return true; |
+} |
+ |
+bool LayerTreeHost::IsLayerInPendingTree(int layer_id) const { |
+ return false; |
+} |
+ |
+void LayerTreeHost::SetMutatorsNeedCommit() { |
+ SetNeedsCommit(); |
+} |
+ |
+void LayerTreeHost::SetLayerFilterMutated(int layer_id, |
+ bool active_tree, |
+ const FilterOperations& filters) { |
+ LayerAnimationValueObserver* layer = LayerById(layer_id); |
+ DCHECK(layer); |
+ layer->OnFilterAnimated(filters); |
+} |
+ |
+void LayerTreeHost::SetLayerOpacityMutated(int layer_id, |
+ bool active_tree, |
+ float opacity) { |
+ LayerAnimationValueObserver* layer = LayerById(layer_id); |
+ DCHECK(layer); |
+ layer->OnOpacityAnimated(opacity); |
+} |
+ |
+void LayerTreeHost::SetLayerTransformMutated(int layer_id, |
+ bool active_tree, |
+ const gfx::Transform& transform) { |
+ LayerAnimationValueObserver* layer = LayerById(layer_id); |
+ DCHECK(layer); |
+ layer->OnTransformAnimated(transform); |
+} |
+ |
} // namespace cc |