OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "cc/trees/layer_tree_host_impl.h" | 5 #include "cc/trees/layer_tree_host_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 2679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2690 | 2690 |
2691 void LayerTreeHostImpl::AnimateLayers(base::TimeTicks monotonic_time, | 2691 void LayerTreeHostImpl::AnimateLayers(base::TimeTicks monotonic_time, |
2692 base::Time wall_clock_time) { | 2692 base::Time wall_clock_time) { |
2693 if (!settings_.accelerated_animation_enabled || | 2693 if (!settings_.accelerated_animation_enabled || |
2694 animation_registrar_->active_animation_controllers().empty() || | 2694 animation_registrar_->active_animation_controllers().empty() || |
2695 !active_tree_->root_layer()) | 2695 !active_tree_->root_layer()) |
2696 return; | 2696 return; |
2697 | 2697 |
2698 TRACE_EVENT0("cc", "LayerTreeHostImpl::AnimateLayers"); | 2698 TRACE_EVENT0("cc", "LayerTreeHostImpl::AnimateLayers"); |
2699 | 2699 |
2700 last_animation_time_ = wall_clock_time; | |
2701 double monotonic_seconds = (monotonic_time - base::TimeTicks()).InSecondsF(); | 2700 double monotonic_seconds = (monotonic_time - base::TimeTicks()).InSecondsF(); |
2702 | 2701 |
2703 AnimationRegistrar::AnimationControllerMap copy = | 2702 AnimationRegistrar::AnimationControllerMap copy = |
2704 animation_registrar_->active_animation_controllers(); | 2703 animation_registrar_->active_animation_controllers(); |
2705 for (AnimationRegistrar::AnimationControllerMap::iterator iter = copy.begin(); | 2704 for (AnimationRegistrar::AnimationControllerMap::iterator iter = copy.begin(); |
2706 iter != copy.end(); | 2705 iter != copy.end(); |
2707 ++iter) | 2706 ++iter) |
2708 (*iter).second->Animate(monotonic_seconds); | 2707 (*iter).second->Animate(monotonic_seconds); |
2709 | 2708 |
2710 SetNeedsRedraw(); | 2709 SetNeedsRedraw(); |
2711 } | 2710 } |
2712 | 2711 |
2713 void LayerTreeHostImpl::UpdateAnimationState(bool start_ready_animations) { | 2712 void LayerTreeHostImpl::UpdateAnimationState(bool start_ready_animations) { |
2714 if (!settings_.accelerated_animation_enabled || | 2713 if (!settings_.accelerated_animation_enabled || |
2715 animation_registrar_->active_animation_controllers().empty() || | 2714 animation_registrar_->active_animation_controllers().empty() || |
2716 !active_tree_->root_layer()) | 2715 !active_tree_->root_layer()) |
2717 return; | 2716 return; |
2718 | 2717 |
2719 TRACE_EVENT0("cc", "LayerTreeHostImpl::UpdateAnimationState"); | 2718 TRACE_EVENT0("cc", "LayerTreeHostImpl::UpdateAnimationState"); |
2720 scoped_ptr<AnimationEventsVector> events = | 2719 scoped_ptr<AnimationEventsVector> events = |
2721 make_scoped_ptr(new AnimationEventsVector); | 2720 make_scoped_ptr(new AnimationEventsVector); |
2722 AnimationRegistrar::AnimationControllerMap copy = | 2721 AnimationRegistrar::AnimationControllerMap copy = |
2723 animation_registrar_->active_animation_controllers(); | 2722 animation_registrar_->active_animation_controllers(); |
2724 for (AnimationRegistrar::AnimationControllerMap::iterator iter = copy.begin(); | 2723 for (AnimationRegistrar::AnimationControllerMap::iterator iter = copy.begin(); |
2725 iter != copy.end(); | 2724 iter != copy.end(); |
2726 ++iter) | 2725 ++iter) |
2727 (*iter).second->UpdateState(start_ready_animations, events.get()); | 2726 (*iter).second->UpdateState(start_ready_animations, events.get()); |
2728 | 2727 |
2729 if (!events->empty()) { | 2728 if (!events->empty()) { |
2730 client_->PostAnimationEventsToMainThreadOnImplThread(events.Pass(), | 2729 client_->PostAnimationEventsToMainThreadOnImplThread(events.Pass()); |
2731 last_animation_time_); | |
2732 } | 2730 } |
2733 } | 2731 } |
2734 | 2732 |
2735 base::TimeDelta LayerTreeHostImpl::LowFrequencyAnimationInterval() const { | 2733 base::TimeDelta LayerTreeHostImpl::LowFrequencyAnimationInterval() const { |
2736 return base::TimeDelta::FromSeconds(1); | 2734 return base::TimeDelta::FromSeconds(1); |
2737 } | 2735 } |
2738 | 2736 |
2739 void LayerTreeHostImpl::SendReleaseResourcesRecursive(LayerImpl* current) { | 2737 void LayerTreeHostImpl::SendReleaseResourcesRecursive(LayerImpl* current) { |
2740 DCHECK(current); | 2738 DCHECK(current); |
2741 current->ReleaseResources(); | 2739 current->ReleaseResources(); |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3038 swap_promise_monitor_.erase(monitor); | 3036 swap_promise_monitor_.erase(monitor); |
3039 } | 3037 } |
3040 | 3038 |
3041 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfSetNeedsRedraw() { | 3039 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfSetNeedsRedraw() { |
3042 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); | 3040 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); |
3043 for (; it != swap_promise_monitor_.end(); it++) | 3041 for (; it != swap_promise_monitor_.end(); it++) |
3044 (*it)->OnSetNeedsRedrawOnImpl(); | 3042 (*it)->OnSetNeedsRedrawOnImpl(); |
3045 } | 3043 } |
3046 | 3044 |
3047 } // namespace cc | 3045 } // namespace cc |
OLD | NEW |