| 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 #include <map> | 9 #include <map> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 1635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1646 UpdateCurrentBeginFrameArgs(args); | 1646 UpdateCurrentBeginFrameArgs(args); |
| 1647 // Cache the begin impl frame interval | 1647 // Cache the begin impl frame interval |
| 1648 begin_impl_frame_interval_ = args.interval; | 1648 begin_impl_frame_interval_ = args.interval; |
| 1649 | 1649 |
| 1650 if (is_likely_to_require_a_draw_) { | 1650 if (is_likely_to_require_a_draw_) { |
| 1651 // Optimistically schedule a draw. This will let us expect the tile manager | 1651 // Optimistically schedule a draw. This will let us expect the tile manager |
| 1652 // to complete its work so that we can draw new tiles within the impl frame | 1652 // to complete its work so that we can draw new tiles within the impl frame |
| 1653 // we are beginning now. | 1653 // we are beginning now. |
| 1654 SetNeedsRedraw(); | 1654 SetNeedsRedraw(); |
| 1655 } | 1655 } |
| 1656 |
| 1657 for (auto& it : video_frame_controllers_) |
| 1658 it->OnBeginFrame(args); |
| 1656 } | 1659 } |
| 1657 | 1660 |
| 1658 void LayerTreeHostImpl::UpdateViewportContainerSizes() { | 1661 void LayerTreeHostImpl::UpdateViewportContainerSizes() { |
| 1659 LayerImpl* inner_container = active_tree_->InnerViewportContainerLayer(); | 1662 LayerImpl* inner_container = active_tree_->InnerViewportContainerLayer(); |
| 1660 LayerImpl* outer_container = active_tree_->OuterViewportContainerLayer(); | 1663 LayerImpl* outer_container = active_tree_->OuterViewportContainerLayer(); |
| 1661 | 1664 |
| 1662 if (!inner_container) | 1665 if (!inner_container) |
| 1663 return; | 1666 return; |
| 1664 | 1667 |
| 1665 // TODO(bokan): This code is currently specific to top controls. It should be | 1668 // TODO(bokan): This code is currently specific to top controls. It should be |
| (...skipping 1397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3063 void LayerTreeHostImpl::PostDelayedScrollbarAnimationTask( | 3066 void LayerTreeHostImpl::PostDelayedScrollbarAnimationTask( |
| 3064 const base::Closure& task, | 3067 const base::Closure& task, |
| 3065 base::TimeDelta delay) { | 3068 base::TimeDelta delay) { |
| 3066 client_->PostDelayedAnimationTaskOnImplThread(task, delay); | 3069 client_->PostDelayedAnimationTaskOnImplThread(task, delay); |
| 3067 } | 3070 } |
| 3068 | 3071 |
| 3069 void LayerTreeHostImpl::SetNeedsRedrawForScrollbarAnimation() { | 3072 void LayerTreeHostImpl::SetNeedsRedrawForScrollbarAnimation() { |
| 3070 SetNeedsRedraw(); | 3073 SetNeedsRedraw(); |
| 3071 } | 3074 } |
| 3072 | 3075 |
| 3076 void LayerTreeHostImpl::AddVideoFrameController( |
| 3077 VideoFrameController* controller) { |
| 3078 bool was_empty = video_frame_controllers_.empty(); |
| 3079 video_frame_controllers_.insert(controller); |
| 3080 if (was_empty) |
| 3081 client_->SetVideoNeedsBeginFrames(true); |
| 3082 } |
| 3083 |
| 3084 void LayerTreeHostImpl::RemoveVideoFrameController( |
| 3085 VideoFrameController* controller) { |
| 3086 video_frame_controllers_.erase(controller); |
| 3087 if (video_frame_controllers_.empty()) |
| 3088 client_->SetVideoNeedsBeginFrames(false); |
| 3089 } |
| 3090 |
| 3073 void LayerTreeHostImpl::SetTreePriority(TreePriority priority) { | 3091 void LayerTreeHostImpl::SetTreePriority(TreePriority priority) { |
| 3074 if (!tile_manager_) | 3092 if (!tile_manager_) |
| 3075 return; | 3093 return; |
| 3076 | 3094 |
| 3077 if (global_tile_state_.tree_priority == priority) | 3095 if (global_tile_state_.tree_priority == priority) |
| 3078 return; | 3096 return; |
| 3079 global_tile_state_.tree_priority = priority; | 3097 global_tile_state_.tree_priority = priority; |
| 3080 DidModifyTilePriorities(); | 3098 DidModifyTilePriorities(); |
| 3081 } | 3099 } |
| 3082 | 3100 |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3349 new_target.SetToMin(layer_impl->MaxScrollOffset()); | 3367 new_target.SetToMin(layer_impl->MaxScrollOffset()); |
| 3350 | 3368 |
| 3351 curve->UpdateTarget( | 3369 curve->UpdateTarget( |
| 3352 animation->TrimTimeToCurrentIteration(CurrentBeginFrameArgs().frame_time) | 3370 animation->TrimTimeToCurrentIteration(CurrentBeginFrameArgs().frame_time) |
| 3353 .InSecondsF(), | 3371 .InSecondsF(), |
| 3354 new_target); | 3372 new_target); |
| 3355 | 3373 |
| 3356 return true; | 3374 return true; |
| 3357 } | 3375 } |
| 3358 } // namespace cc | 3376 } // namespace cc |
| OLD | NEW |