| 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 5f3baaba03641c26751e5a8eeda66ffda4921bc5..9d0bb74849f72c2e4f7e8eef8fd2d833b654b2c2 100644
|
| --- a/cc/trees/layer_tree_host_impl.cc
|
| +++ b/cc/trees/layer_tree_host_impl.cc
|
| @@ -18,8 +18,6 @@
|
| #include "base/strings/stringprintf.h"
|
| #include "base/trace_event/trace_event_argument.h"
|
| #include "cc/animation/animation_host.h"
|
| -#include "cc/animation/animation_id_provider.h"
|
| -#include "cc/animation/scroll_offset_animation_curve.h"
|
| #include "cc/animation/scrollbar_animation_controller.h"
|
| #include "cc/animation/timing_function.h"
|
| #include "cc/base/math_util.h"
|
| @@ -229,16 +227,9 @@ LayerTreeHostImpl::LayerTreeHostImpl(
|
| requires_high_res_to_draw_(false),
|
| is_likely_to_require_a_draw_(false),
|
| frame_timing_tracker_(FrameTimingTracker::Create()) {
|
| - 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());
|
| - }
|
| + animation_host_ = AnimationHost::Create(true);
|
| + animation_host_->SetLayerTreeMutatorsClient(this);
|
| + animation_host_->SetSupportsScrollAnimations(proxy_->SupportsImplScrolling());
|
|
|
| DCHECK(proxy_->IsImplThread());
|
| DidVisibilityChange(this, visible_);
|
| @@ -1548,9 +1539,7 @@ void LayerTreeHostImpl::DrawLayers(FrameData* frame,
|
|
|
| if (draw_mode == DRAW_MODE_RESOURCELESS_SOFTWARE) {
|
| bool disable_picture_quad_image_filtering =
|
| - IsActivelyScrolling() ||
|
| - (animation_host_ ? animation_host_->NeedsAnimateLayers()
|
| - : animation_registrar_->needs_animate_layers());
|
| + IsActivelyScrolling() || animation_host_->NeedsAnimateLayers();
|
|
|
| scoped_ptr<SoftwareRenderer> temp_software_renderer =
|
| SoftwareRenderer::Create(this, &settings_.renderer_settings,
|
| @@ -3026,13 +3015,8 @@ void LayerTreeHostImpl::AnimateLayers(base::TimeTicks monotonic_time) {
|
| if (!settings_.accelerated_animation_enabled || !active_tree_->root_layer())
|
| return;
|
|
|
| - if (animation_host_) {
|
| - if (animation_host_->AnimateLayers(monotonic_time))
|
| - SetNeedsAnimate();
|
| - } else {
|
| - if (animation_registrar_->AnimateLayers(monotonic_time))
|
| - SetNeedsAnimate();
|
| - }
|
| + if (animation_host_->AnimateLayers(monotonic_time))
|
| + SetNeedsAnimate();
|
| }
|
|
|
| void LayerTreeHostImpl::UpdateAnimationState(bool start_ready_animations) {
|
| @@ -3042,15 +3026,9 @@ void LayerTreeHostImpl::UpdateAnimationState(bool start_ready_animations) {
|
| 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());
|
| - }
|
| + events = animation_host_->CreateEvents();
|
| + has_active_animations = animation_host_->UpdateAnimationState(
|
| + start_ready_animations, events.get());
|
|
|
| if (!events->empty())
|
| client_->PostAnimationEventsToMainThreadOnImplThread(events.Pass());
|
| @@ -3063,13 +3041,8 @@ void LayerTreeHostImpl::ActivateAnimations() {
|
| if (!settings_.accelerated_animation_enabled || !active_tree_->root_layer())
|
| return;
|
|
|
| - if (animation_host_) {
|
| - if (animation_host_->ActivateAnimations())
|
| - SetNeedsAnimate();
|
| - } else {
|
| - if (animation_registrar_->ActivateAnimations())
|
| - SetNeedsAnimate();
|
| - }
|
| + if (animation_host_->ActivateAnimations())
|
| + SetNeedsAnimate();
|
| }
|
|
|
| std::string LayerTreeHostImpl::LayerTreeAsJson() const {
|
| @@ -3368,53 +3341,16 @@ void LayerTreeHostImpl::ScrollAnimationCreate(
|
| LayerImpl* layer_impl,
|
| const gfx::ScrollOffset& target_offset,
|
| const gfx::ScrollOffset& current_offset) {
|
| - if (animation_host_)
|
| - return animation_host_->ImplOnlyScrollAnimationCreate(
|
| - layer_impl->id(), target_offset, current_offset);
|
| -
|
| - scoped_ptr<ScrollOffsetAnimationCurve> curve =
|
| - ScrollOffsetAnimationCurve::Create(target_offset,
|
| - EaseInOutTimingFunction::Create());
|
| - curve->SetInitialValue(current_offset);
|
| -
|
| - scoped_ptr<Animation> animation = Animation::Create(
|
| - curve.Pass(), AnimationIdProvider::NextAnimationId(),
|
| - AnimationIdProvider::NextGroupId(), Animation::SCROLL_OFFSET);
|
| - animation->set_is_impl_only(true);
|
| -
|
| - layer_impl->layer_animation_controller()->AddAnimation(animation.Pass());
|
| + return animation_host_->ImplOnlyScrollAnimationCreate(
|
| + layer_impl->id(), target_offset, current_offset);
|
| }
|
|
|
| bool LayerTreeHostImpl::ScrollAnimationUpdateTarget(
|
| LayerImpl* layer_impl,
|
| const gfx::Vector2dF& scroll_delta) {
|
| - if (animation_host_)
|
| - return animation_host_->ImplOnlyScrollAnimationUpdateTarget(
|
| - layer_impl->id(), scroll_delta, layer_impl->MaxScrollOffset(),
|
| - CurrentBeginFrameArgs().frame_time);
|
| -
|
| - Animation* animation =
|
| - layer_impl->layer_animation_controller()
|
| - ? layer_impl->layer_animation_controller()->GetAnimation(
|
| - Animation::SCROLL_OFFSET)
|
| - : nullptr;
|
| - if (!animation)
|
| - return false;
|
| -
|
| - ScrollOffsetAnimationCurve* curve =
|
| - animation->curve()->ToScrollOffsetAnimationCurve();
|
| -
|
| - gfx::ScrollOffset new_target =
|
| - gfx::ScrollOffsetWithDelta(curve->target_value(), scroll_delta);
|
| - new_target.SetToMax(gfx::ScrollOffset());
|
| - new_target.SetToMin(layer_impl->MaxScrollOffset());
|
| -
|
| - curve->UpdateTarget(
|
| - animation->TrimTimeToCurrentIteration(CurrentBeginFrameArgs().frame_time)
|
| - .InSecondsF(),
|
| - new_target);
|
| -
|
| - return true;
|
| + return animation_host_->ImplOnlyScrollAnimationUpdateTarget(
|
| + layer_impl->id(), scroll_delta, layer_impl->MaxScrollOffset(),
|
| + CurrentBeginFrameArgs().frame_time);
|
| }
|
|
|
| bool LayerTreeHostImpl::IsLayerInActiveTree(int layer_id) const {
|
| @@ -3441,7 +3377,7 @@ void LayerTreeHostImpl::SetTreeLayerFilterMutated(
|
| if (!tree)
|
| return;
|
|
|
| - LayerAnimationValueObserver* layer = tree->LayerById(layer_id);
|
| + LayerImpl* layer = tree->LayerById(layer_id);
|
| if (layer)
|
| layer->OnFilterAnimated(filters);
|
| }
|
| @@ -3452,7 +3388,7 @@ void LayerTreeHostImpl::SetTreeLayerOpacityMutated(int layer_id,
|
| if (!tree)
|
| return;
|
|
|
| - LayerAnimationValueObserver* layer = tree->LayerById(layer_id);
|
| + LayerImpl* layer = tree->LayerById(layer_id);
|
| if (layer)
|
| layer->OnOpacityAnimated(opacity);
|
| }
|
| @@ -3464,7 +3400,7 @@ void LayerTreeHostImpl::SetTreeLayerTransformMutated(
|
| if (!tree)
|
| return;
|
|
|
| - LayerAnimationValueObserver* layer = tree->LayerById(layer_id);
|
| + LayerImpl* layer = tree->LayerById(layer_id);
|
| if (layer)
|
| layer->OnTransformAnimated(transform);
|
| }
|
| @@ -3476,7 +3412,7 @@ void LayerTreeHostImpl::SetTreeLayerScrollOffsetMutated(
|
| if (!tree)
|
| return;
|
|
|
| - LayerAnimationValueObserver* layer = tree->LayerById(layer_id);
|
| + LayerImpl* layer = tree->LayerById(layer_id);
|
| if (layer)
|
| layer->OnScrollOffsetAnimated(scroll_offset);
|
| }
|
| @@ -3534,7 +3470,7 @@ void LayerTreeHostImpl::ScrollOffsetAnimationFinished() {
|
| gfx::ScrollOffset LayerTreeHostImpl::GetScrollOffsetForAnimation(
|
| int layer_id) const {
|
| if (active_tree()) {
|
| - LayerAnimationValueProvider* layer = active_tree()->LayerById(layer_id);
|
| + LayerImpl* layer = active_tree()->LayerById(layer_id);
|
| if (layer)
|
| return layer->ScrollOffsetForAnimation();
|
| }
|
|
|