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 | 10 |
(...skipping 1658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1669 UpdateCurrentBeginFrameArgs(args); | 1669 UpdateCurrentBeginFrameArgs(args); |
1670 // Cache the begin impl frame interval | 1670 // Cache the begin impl frame interval |
1671 begin_impl_frame_interval_ = args.interval; | 1671 begin_impl_frame_interval_ = args.interval; |
1672 | 1672 |
1673 if (is_likely_to_require_a_draw_) { | 1673 if (is_likely_to_require_a_draw_) { |
1674 // Optimistically schedule a draw. This will let us expect the tile manager | 1674 // Optimistically schedule a draw. This will let us expect the tile manager |
1675 // to complete its work so that we can draw new tiles within the impl frame | 1675 // to complete its work so that we can draw new tiles within the impl frame |
1676 // we are beginning now. | 1676 // we are beginning now. |
1677 SetNeedsRedraw(); | 1677 SetNeedsRedraw(); |
1678 } | 1678 } |
| 1679 |
| 1680 for (auto& it : video_frame_controllers_) |
| 1681 it->OnBeginFrame(args); |
1679 } | 1682 } |
1680 | 1683 |
1681 void LayerTreeHostImpl::UpdateViewportContainerSizes() { | 1684 void LayerTreeHostImpl::UpdateViewportContainerSizes() { |
1682 LayerImpl* inner_container = active_tree_->InnerViewportContainerLayer(); | 1685 LayerImpl* inner_container = active_tree_->InnerViewportContainerLayer(); |
1683 LayerImpl* outer_container = active_tree_->OuterViewportContainerLayer(); | 1686 LayerImpl* outer_container = active_tree_->OuterViewportContainerLayer(); |
1684 | 1687 |
1685 if (!inner_container) | 1688 if (!inner_container) |
1686 return; | 1689 return; |
1687 | 1690 |
1688 // TODO(bokan): This code is currently specific to top controls. It should be | 1691 // 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... |
3086 void LayerTreeHostImpl::PostDelayedScrollbarAnimationTask( | 3089 void LayerTreeHostImpl::PostDelayedScrollbarAnimationTask( |
3087 const base::Closure& task, | 3090 const base::Closure& task, |
3088 base::TimeDelta delay) { | 3091 base::TimeDelta delay) { |
3089 client_->PostDelayedAnimationTaskOnImplThread(task, delay); | 3092 client_->PostDelayedAnimationTaskOnImplThread(task, delay); |
3090 } | 3093 } |
3091 | 3094 |
3092 void LayerTreeHostImpl::SetNeedsRedrawForScrollbarAnimation() { | 3095 void LayerTreeHostImpl::SetNeedsRedrawForScrollbarAnimation() { |
3093 SetNeedsRedraw(); | 3096 SetNeedsRedraw(); |
3094 } | 3097 } |
3095 | 3098 |
| 3099 void LayerTreeHostImpl::AddVideoFrameController( |
| 3100 VideoFrameController* controller) { |
| 3101 bool was_empty = video_frame_controllers_.empty(); |
| 3102 video_frame_controllers_.insert(controller); |
| 3103 if (was_empty) |
| 3104 client_->SetVideoNeedsBeginFrames(true); |
| 3105 } |
| 3106 |
| 3107 void LayerTreeHostImpl::RemoveVideoFrameController( |
| 3108 VideoFrameController* controller) { |
| 3109 video_frame_controllers_.erase(controller); |
| 3110 if (video_frame_controllers_.empty()) |
| 3111 client_->SetVideoNeedsBeginFrames(false); |
| 3112 } |
| 3113 |
3096 void LayerTreeHostImpl::SetTreePriority(TreePriority priority) { | 3114 void LayerTreeHostImpl::SetTreePriority(TreePriority priority) { |
3097 if (!tile_manager_) | 3115 if (!tile_manager_) |
3098 return; | 3116 return; |
3099 | 3117 |
3100 if (global_tile_state_.tree_priority == priority) | 3118 if (global_tile_state_.tree_priority == priority) |
3101 return; | 3119 return; |
3102 global_tile_state_.tree_priority = priority; | 3120 global_tile_state_.tree_priority = priority; |
3103 DidModifyTilePriorities(); | 3121 DidModifyTilePriorities(); |
3104 } | 3122 } |
3105 | 3123 |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3372 new_target.SetToMin(layer_impl->MaxScrollOffset()); | 3390 new_target.SetToMin(layer_impl->MaxScrollOffset()); |
3373 | 3391 |
3374 curve->UpdateTarget( | 3392 curve->UpdateTarget( |
3375 animation->TrimTimeToCurrentIteration(CurrentBeginFrameArgs().frame_time) | 3393 animation->TrimTimeToCurrentIteration(CurrentBeginFrameArgs().frame_time) |
3376 .InSecondsF(), | 3394 .InSecondsF(), |
3377 new_target); | 3395 new_target); |
3378 | 3396 |
3379 return true; | 3397 return true; |
3380 } | 3398 } |
3381 } // namespace cc | 3399 } // namespace cc |
OLD | NEW |