Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(137)

Side by Side Diff: cc/trees/layer_tree_impl.cc

Issue 1292773003: Queue latency info swap promises in a separate already-active queue. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add unittest for surface layer swap promise resolution when activations occur but swaps do not. Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 // The request queue should have been processed and does not require a push. 217 // The request queue should have been processed and does not require a push.
218 DCHECK_EQ(ui_resource_request_queue_.size(), 0u); 218 DCHECK_EQ(ui_resource_request_queue_.size(), 0u);
219 219
220 target_tree->SetPropertyTrees(property_trees_); 220 target_tree->SetPropertyTrees(property_trees_);
221 221
222 if (next_activation_forces_redraw_) { 222 if (next_activation_forces_redraw_) {
223 target_tree->ForceRedrawNextActivation(); 223 target_tree->ForceRedrawNextActivation();
224 next_activation_forces_redraw_ = false; 224 next_activation_forces_redraw_ = false;
225 } 225 }
226 226
227 for (auto* swap_promise : pinned_swap_promise_list_)
danakj 2015/08/25 21:37:30 Why is this here and not in DidBecomeActive like f
Tobias Sargeant 2015/08/26 11:06:49 I've added a comment describing why this is here,
danakj 2015/08/26 18:16:16 Is there a use case for pinned swap promises on th
228 swap_promise->DidActivate();
229 pinned_swap_promise_list_.clear();
230
227 target_tree->PassSwapPromises(&swap_promise_list_); 231 target_tree->PassSwapPromises(&swap_promise_list_);
228 232
229 target_tree->set_top_controls_shrink_blink_size( 233 target_tree->set_top_controls_shrink_blink_size(
230 top_controls_shrink_blink_size_); 234 top_controls_shrink_blink_size_);
231 target_tree->set_top_controls_height(top_controls_height_); 235 target_tree->set_top_controls_height(top_controls_height_);
232 target_tree->PushTopControls(nullptr); 236 target_tree->PushTopControls(nullptr);
233 237
234 target_tree->set_hide_pinch_scrollbars_near_min_scale( 238 target_tree->set_hide_pinch_scrollbars_near_min_scale(
235 hide_pinch_scrollbars_near_min_scale_); 239 hide_pinch_scrollbars_near_min_scale_);
236 240
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after
797 // if we were in a good state. 801 // if we were in a good state.
798 layer_tree_host_impl_->ResetRequiresHighResToDraw(); 802 layer_tree_host_impl_->ResetRequiresHighResToDraw();
799 803
800 if (root_layer()) { 804 if (root_layer()) {
801 LayerTreeHostCommon::CallFunctionForSubtree( 805 LayerTreeHostCommon::CallFunctionForSubtree(
802 root_layer(), [](LayerImpl* layer) { layer->DidBecomeActive(); }); 806 root_layer(), [](LayerImpl* layer) { layer->DidBecomeActive(); });
803 } 807 }
804 808
805 for (auto* swap_promise : swap_promise_list_) 809 for (auto* swap_promise : swap_promise_list_)
806 swap_promise->DidActivate(); 810 swap_promise->DidActivate();
811
danakj 2015/08/25 21:37:31 please don't add whitespace randomly
807 devtools_instrumentation::DidActivateLayerTree(layer_tree_host_impl_->id(), 812 devtools_instrumentation::DidActivateLayerTree(layer_tree_host_impl_->id(),
808 source_frame_number_); 813 source_frame_number_);
809 } 814 }
810 815
811 bool LayerTreeImpl::RequiresHighResToDraw() const { 816 bool LayerTreeImpl::RequiresHighResToDraw() const {
812 return layer_tree_host_impl_->RequiresHighResToDraw(); 817 return layer_tree_host_impl_->RequiresHighResToDraw();
813 } 818 }
814 819
815 bool LayerTreeImpl::ViewportSizeInvalid() const { 820 bool LayerTreeImpl::ViewportSizeInvalid() const {
816 return viewport_size_invalid_; 821 return viewport_size_invalid_;
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
1024 if (!it.represents_itself()) 1029 if (!it.represents_itself())
1025 continue; 1030 continue;
1026 TracedValue::AppendIDRef(*it, state); 1031 TracedValue::AppendIDRef(*it, state);
1027 } 1032 }
1028 state->EndArray(); 1033 state->EndArray();
1029 1034
1030 state->BeginArray("swap_promise_trace_ids"); 1035 state->BeginArray("swap_promise_trace_ids");
1031 for (auto* swap_promise : swap_promise_list_) 1036 for (auto* swap_promise : swap_promise_list_)
1032 state->AppendDouble(swap_promise->TraceId()); 1037 state->AppendDouble(swap_promise->TraceId());
1033 state->EndArray(); 1038 state->EndArray();
1039
1040 state->BeginArray("pinned_swap_promise_trace_ids");
1041 for (auto* swap_promise : pinned_swap_promise_list_)
1042 state->AppendDouble(swap_promise->TraceId());
1043 state->EndArray();
1034 } 1044 }
1035 1045
1036 void LayerTreeImpl::SetRootLayerScrollOffsetDelegate( 1046 void LayerTreeImpl::SetRootLayerScrollOffsetDelegate(
1037 LayerScrollOffsetDelegate* root_layer_scroll_offset_delegate) { 1047 LayerScrollOffsetDelegate* root_layer_scroll_offset_delegate) {
1038 if (root_layer_scroll_offset_delegate_ == root_layer_scroll_offset_delegate) 1048 if (root_layer_scroll_offset_delegate_ == root_layer_scroll_offset_delegate)
1039 return; 1049 return;
1040 1050
1041 root_layer_scroll_offset_delegate_ = root_layer_scroll_offset_delegate; 1051 root_layer_scroll_offset_delegate_ = root_layer_scroll_offset_delegate;
1042 1052
1043 if (root_layer_scroll_offset_delegate_) { 1053 if (root_layer_scroll_offset_delegate_) {
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
1101 inner_viewport_offset); 1111 inner_viewport_offset);
1102 1112
1103 UpdateRootScrollOffsetDelegate(); 1113 UpdateRootScrollOffsetDelegate();
1104 } 1114 }
1105 1115
1106 void LayerTreeImpl::QueueSwapPromise(scoped_ptr<SwapPromise> swap_promise) { 1116 void LayerTreeImpl::QueueSwapPromise(scoped_ptr<SwapPromise> swap_promise) {
1107 DCHECK(swap_promise); 1117 DCHECK(swap_promise);
1108 swap_promise_list_.push_back(swap_promise.Pass()); 1118 swap_promise_list_.push_back(swap_promise.Pass());
1109 } 1119 }
1110 1120
1121 void LayerTreeImpl::QueuePinnedSwapPromise(
1122 scoped_ptr<SwapPromise> swap_promise) {
1123 DCHECK(swap_promise);
1124 pinned_swap_promise_list_.push_back(swap_promise.Pass());
1125 }
1126
1111 void LayerTreeImpl::PassSwapPromises( 1127 void LayerTreeImpl::PassSwapPromises(
1112 ScopedPtrVector<SwapPromise>* new_swap_promise) { 1128 ScopedPtrVector<SwapPromise>* new_swap_promise) {
1113 swap_promise_list_.insert_and_take(swap_promise_list_.end(), 1129 for (auto* swap_promise : swap_promise_list_) {
1114 new_swap_promise); 1130 swap_promise->DidNotSwap(SwapPromise::SWAP_FAILS);
1115 new_swap_promise->clear(); 1131 }
1132 swap_promise_list_.clear();
1133 swap_promise_list_.swap(*new_swap_promise);
1116 } 1134 }
1117 1135
1118 void LayerTreeImpl::FinishSwapPromises(CompositorFrameMetadata* metadata) { 1136 void LayerTreeImpl::FinishSwapPromises(CompositorFrameMetadata* metadata) {
1119 for (auto* swap_promise : swap_promise_list_) 1137 for (auto* swap_promise : swap_promise_list_)
1120 swap_promise->DidSwap(metadata); 1138 swap_promise->DidSwap(metadata);
1121 swap_promise_list_.clear(); 1139 swap_promise_list_.clear();
1140 for (auto* swap_promise : pinned_swap_promise_list_)
1141 swap_promise->DidSwap(metadata);
1142 pinned_swap_promise_list_.clear();
1122 } 1143 }
1123 1144
1124 void LayerTreeImpl::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) { 1145 void LayerTreeImpl::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) {
1125 for (auto* swap_promise : swap_promise_list_) 1146 for (auto* swap_promise : swap_promise_list_)
1126 swap_promise->DidNotSwap(reason); 1147 swap_promise->DidNotSwap(reason);
1127 swap_promise_list_.clear(); 1148 swap_promise_list_.clear();
1149 for (auto* swap_promise : pinned_swap_promise_list_)
1150 swap_promise->DidNotSwap(reason);
1151 pinned_swap_promise_list_.clear();
1128 } 1152 }
1129 1153
1130 void LayerTreeImpl::DidModifyTilePriorities() { 1154 void LayerTreeImpl::DidModifyTilePriorities() {
1131 layer_tree_host_impl_->DidModifyTilePriorities(); 1155 layer_tree_host_impl_->DidModifyTilePriorities();
1132 } 1156 }
1133 1157
1134 void LayerTreeImpl::set_ui_resource_request_queue( 1158 void LayerTreeImpl::set_ui_resource_request_queue(
1135 const UIResourceRequestQueue& queue) { 1159 const UIResourceRequestQueue& queue) {
1136 ui_resource_request_queue_ = queue; 1160 ui_resource_request_queue_ = queue;
1137 } 1161 }
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after
1754 const gfx::BoxF& box, 1778 const gfx::BoxF& box,
1755 gfx::BoxF* bounds) const { 1779 gfx::BoxF* bounds) const {
1756 *bounds = gfx::BoxF(); 1780 *bounds = gfx::BoxF();
1757 return layer_tree_host_impl_->animation_host() 1781 return layer_tree_host_impl_->animation_host()
1758 ? layer_tree_host_impl_->animation_host() 1782 ? layer_tree_host_impl_->animation_host()
1759 ->TransformAnimationBoundsForBox(layer->id(), box, bounds) 1783 ->TransformAnimationBoundsForBox(layer->id(), box, bounds)
1760 : true; 1784 : true;
1761 } 1785 }
1762 1786
1763 } // namespace cc 1787 } // namespace cc
OLDNEW
« cc/trees/layer_tree_host_unittest.cc ('K') | « cc/trees/layer_tree_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698