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_impl.h" | 5 #include "cc/trees/layer_tree_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <set> | 9 #include <set> |
10 | 10 |
(...skipping 1013 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1024 if (!it.represents_itself()) | 1024 if (!it.represents_itself()) |
1025 continue; | 1025 continue; |
1026 TracedValue::AppendIDRef(*it, state); | 1026 TracedValue::AppendIDRef(*it, state); |
1027 } | 1027 } |
1028 state->EndArray(); | 1028 state->EndArray(); |
1029 | 1029 |
1030 state->BeginArray("swap_promise_trace_ids"); | 1030 state->BeginArray("swap_promise_trace_ids"); |
1031 for (auto* swap_promise : swap_promise_list_) | 1031 for (auto* swap_promise : swap_promise_list_) |
1032 state->AppendDouble(swap_promise->TraceId()); | 1032 state->AppendDouble(swap_promise->TraceId()); |
1033 state->EndArray(); | 1033 state->EndArray(); |
| 1034 |
| 1035 state->BeginArray("pinned_swap_promise_trace_ids"); |
| 1036 for (auto* swap_promise : pinned_swap_promise_list_) |
| 1037 state->AppendDouble(swap_promise->TraceId()); |
| 1038 state->EndArray(); |
1034 } | 1039 } |
1035 | 1040 |
1036 void LayerTreeImpl::SetRootLayerScrollOffsetDelegate( | 1041 void LayerTreeImpl::SetRootLayerScrollOffsetDelegate( |
1037 LayerScrollOffsetDelegate* root_layer_scroll_offset_delegate) { | 1042 LayerScrollOffsetDelegate* root_layer_scroll_offset_delegate) { |
1038 if (root_layer_scroll_offset_delegate_ == root_layer_scroll_offset_delegate) | 1043 if (root_layer_scroll_offset_delegate_ == root_layer_scroll_offset_delegate) |
1039 return; | 1044 return; |
1040 | 1045 |
1041 root_layer_scroll_offset_delegate_ = root_layer_scroll_offset_delegate; | 1046 root_layer_scroll_offset_delegate_ = root_layer_scroll_offset_delegate; |
1042 | 1047 |
1043 if (root_layer_scroll_offset_delegate_) { | 1048 if (root_layer_scroll_offset_delegate_) { |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1101 inner_viewport_offset); | 1106 inner_viewport_offset); |
1102 | 1107 |
1103 UpdateRootScrollOffsetDelegate(); | 1108 UpdateRootScrollOffsetDelegate(); |
1104 } | 1109 } |
1105 | 1110 |
1106 void LayerTreeImpl::QueueSwapPromise(scoped_ptr<SwapPromise> swap_promise) { | 1111 void LayerTreeImpl::QueueSwapPromise(scoped_ptr<SwapPromise> swap_promise) { |
1107 DCHECK(swap_promise); | 1112 DCHECK(swap_promise); |
1108 swap_promise_list_.push_back(swap_promise.Pass()); | 1113 swap_promise_list_.push_back(swap_promise.Pass()); |
1109 } | 1114 } |
1110 | 1115 |
| 1116 void LayerTreeImpl::QueuePinnedSwapPromise( |
| 1117 scoped_ptr<SwapPromise> swap_promise) { |
| 1118 DCHECK(IsActiveTree()); |
| 1119 DCHECK(swap_promise); |
| 1120 pinned_swap_promise_list_.push_back(swap_promise.Pass()); |
| 1121 } |
| 1122 |
1111 void LayerTreeImpl::PassSwapPromises( | 1123 void LayerTreeImpl::PassSwapPromises( |
1112 ScopedPtrVector<SwapPromise>* new_swap_promise) { | 1124 ScopedPtrVector<SwapPromise>* new_swap_promise) { |
1113 swap_promise_list_.insert_and_take(swap_promise_list_.end(), | 1125 for (auto* swap_promise : swap_promise_list_) |
1114 new_swap_promise); | 1126 swap_promise->DidNotSwap(SwapPromise::SWAP_FAILS); |
1115 new_swap_promise->clear(); | 1127 swap_promise_list_.clear(); |
| 1128 swap_promise_list_.swap(*new_swap_promise); |
1116 } | 1129 } |
1117 | 1130 |
1118 void LayerTreeImpl::FinishSwapPromises(CompositorFrameMetadata* metadata) { | 1131 void LayerTreeImpl::FinishSwapPromises(CompositorFrameMetadata* metadata) { |
1119 for (auto* swap_promise : swap_promise_list_) | 1132 for (auto* swap_promise : swap_promise_list_) |
1120 swap_promise->DidSwap(metadata); | 1133 swap_promise->DidSwap(metadata); |
1121 swap_promise_list_.clear(); | 1134 swap_promise_list_.clear(); |
| 1135 for (auto* swap_promise : pinned_swap_promise_list_) |
| 1136 swap_promise->DidSwap(metadata); |
| 1137 pinned_swap_promise_list_.clear(); |
1122 } | 1138 } |
1123 | 1139 |
1124 void LayerTreeImpl::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) { | 1140 void LayerTreeImpl::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) { |
1125 for (auto* swap_promise : swap_promise_list_) | 1141 for (auto* swap_promise : swap_promise_list_) |
1126 swap_promise->DidNotSwap(reason); | 1142 swap_promise->DidNotSwap(reason); |
1127 swap_promise_list_.clear(); | 1143 swap_promise_list_.clear(); |
| 1144 for (auto* swap_promise : pinned_swap_promise_list_) |
| 1145 swap_promise->DidNotSwap(reason); |
| 1146 pinned_swap_promise_list_.clear(); |
1128 } | 1147 } |
1129 | 1148 |
1130 void LayerTreeImpl::DidModifyTilePriorities() { | 1149 void LayerTreeImpl::DidModifyTilePriorities() { |
1131 layer_tree_host_impl_->DidModifyTilePriorities(); | 1150 layer_tree_host_impl_->DidModifyTilePriorities(); |
1132 } | 1151 } |
1133 | 1152 |
1134 void LayerTreeImpl::set_ui_resource_request_queue( | 1153 void LayerTreeImpl::set_ui_resource_request_queue( |
1135 const UIResourceRequestQueue& queue) { | 1154 const UIResourceRequestQueue& queue) { |
1136 ui_resource_request_queue_ = queue; | 1155 ui_resource_request_queue_ = queue; |
1137 } | 1156 } |
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1754 const gfx::BoxF& box, | 1773 const gfx::BoxF& box, |
1755 gfx::BoxF* bounds) const { | 1774 gfx::BoxF* bounds) const { |
1756 *bounds = gfx::BoxF(); | 1775 *bounds = gfx::BoxF(); |
1757 return layer_tree_host_impl_->animation_host() | 1776 return layer_tree_host_impl_->animation_host() |
1758 ? layer_tree_host_impl_->animation_host() | 1777 ? layer_tree_host_impl_->animation_host() |
1759 ->TransformAnimationBoundsForBox(layer->id(), box, bounds) | 1778 ->TransformAnimationBoundsForBox(layer->id(), box, bounds) |
1760 : true; | 1779 : true; |
1761 } | 1780 } |
1762 | 1781 |
1763 } // namespace cc | 1782 } // namespace cc |
OLD | NEW |