Index: cc/trees/layer_tree_host_impl.cc |
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc |
index 23cc0dbb10cc58005733286e59c8865ea2054917..78c2f23c8662be02f59d5dc3a9e2caac70be5aa9 100644 |
--- a/cc/trees/layer_tree_host_impl.cc |
+++ b/cc/trees/layer_tree_host_impl.cc |
@@ -220,7 +220,6 @@ LayerTreeHostImpl::LayerTreeHostImpl( |
device_scale_factor_(1.f), |
resourceless_software_draw_(false), |
begin_impl_frame_interval_(BeginFrameArgs::DefaultInterval()), |
- animation_registrar_(AnimationRegistrar::Create()), |
rendering_stats_instrumentation_(rendering_stats_instrumentation), |
micro_benchmark_controller_(this), |
shared_bitmap_manager_(shared_bitmap_manager), |
@@ -233,12 +232,16 @@ LayerTreeHostImpl::LayerTreeHostImpl( |
if (settings.use_compositor_animation_timelines) { |
animation_host_ = AnimationHost::Create(true); |
animation_host_->SetLayerTreeMutatorsClient(this); |
+ animation_host_->SetSupportsScrollAnimations( |
+ proxy_->SupportsImplScrolling()); |
+ } else { |
+ animation_registrar_ = AnimationRegistrar::Create(); |
+ animation_registrar_->set_supports_scroll_animations( |
+ proxy_->SupportsImplScrolling()); |
} |
DCHECK(proxy_->IsImplThread()); |
DidVisibilityChange(this, visible_); |
- animation_registrar_->set_supports_scroll_animations( |
- proxy_->SupportsImplScrolling()); |
SetDebugState(settings.initial_debug_state); |
@@ -282,6 +285,12 @@ LayerTreeHostImpl::~LayerTreeHostImpl() { |
recycle_tree_ = nullptr; |
pending_tree_ = nullptr; |
active_tree_ = nullptr; |
+ |
+ if (animation_host_) { |
+ animation_host_->ClearTimelines(); |
+ animation_host_->SetLayerTreeMutatorsClient(nullptr); |
+ } |
+ |
DestroyTileManager(); |
} |
@@ -1539,7 +1548,9 @@ void LayerTreeHostImpl::DrawLayers(FrameData* frame, |
if (draw_mode == DRAW_MODE_RESOURCELESS_SOFTWARE) { |
bool disable_picture_quad_image_filtering = |
- IsActivelyScrolling() || animation_registrar_->needs_animate_layers(); |
+ IsActivelyScrolling() || |
+ (animation_host_ ? animation_host_->NeedsAnimateLayers() |
+ : animation_registrar_->needs_animate_layers()); |
scoped_ptr<SoftwareRenderer> temp_software_renderer = |
SoftwareRenderer::Create(this, &settings_.renderer_settings, |
@@ -3015,18 +3026,31 @@ void LayerTreeHostImpl::AnimateLayers(base::TimeTicks monotonic_time) { |
if (!settings_.accelerated_animation_enabled || !active_tree_->root_layer()) |
return; |
- if (animation_registrar_->AnimateLayers(monotonic_time)) |
- SetNeedsAnimate(); |
+ if (animation_host_) { |
+ if (animation_host_->AnimateLayers(monotonic_time)) |
+ SetNeedsAnimate(); |
+ } else { |
+ if (animation_registrar_->AnimateLayers(monotonic_time)) |
+ SetNeedsAnimate(); |
+ } |
} |
void LayerTreeHostImpl::UpdateAnimationState(bool start_ready_animations) { |
if (!settings_.accelerated_animation_enabled || !active_tree_->root_layer()) |
return; |
- scoped_ptr<AnimationEventsVector> events = |
- animation_registrar_->CreateEvents(); |
- const bool has_active_animations = animation_registrar_->UpdateAnimationState( |
- start_ready_animations, events.get()); |
+ bool has_active_animations = false; |
+ scoped_ptr<AnimationEventsVector> events; |
+ |
+ if (animation_host_) { |
+ events = animation_host_->CreateEvents(); |
+ has_active_animations = animation_host_->UpdateAnimationState( |
+ start_ready_animations, events.get()); |
+ } else { |
+ events = animation_registrar_->CreateEvents(); |
+ has_active_animations = animation_registrar_->UpdateAnimationState( |
+ start_ready_animations, events.get()); |
+ } |
if (!events->empty()) |
client_->PostAnimationEventsToMainThreadOnImplThread(events.Pass()); |
@@ -3039,8 +3063,13 @@ void LayerTreeHostImpl::ActivateAnimations() { |
if (!settings_.accelerated_animation_enabled || !active_tree_->root_layer()) |
return; |
- if (animation_registrar_->ActivateAnimations()) |
- SetNeedsAnimate(); |
+ if (animation_host_) { |
+ if (animation_host_->ActivateAnimations()) |
+ SetNeedsAnimate(); |
+ } else { |
+ if (animation_registrar_->ActivateAnimations()) |
+ SetNeedsAnimate(); |
+ } |
} |
std::string LayerTreeHostImpl::LayerTreeAsJson() const { |