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

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

Issue 1126963006: Move VISUAL_STATE promise to activation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Current state (presubmit warnings, cc_unittests tests failing) Created 5 years, 7 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 needs_full_tree_sync_(true), 63 needs_full_tree_sync_(true),
64 next_activation_forces_redraw_(false), 64 next_activation_forces_redraw_(false),
65 has_ever_been_drawn_(false), 65 has_ever_been_drawn_(false),
66 render_surface_layer_list_id_(0), 66 render_surface_layer_list_id_(0),
67 top_controls_shrink_blink_size_(false), 67 top_controls_shrink_blink_size_(false),
68 top_controls_height_(0), 68 top_controls_height_(0),
69 top_controls_shown_ratio_(top_controls_shown_ratio) { 69 top_controls_shown_ratio_(top_controls_shown_ratio) {
70 } 70 }
71 71
72 LayerTreeImpl::~LayerTreeImpl() { 72 LayerTreeImpl::~LayerTreeImpl() {
73 BreakSwapPromises(SwapPromise::SWAP_FAILS); 73 promises_.OnDidNotActivate(Promise::DidNotActivate::ACTIVATION_FAILS);
74 promises_.OnDidNotSwap(Promise::DidNotSwap::SWAP_FAILS);
74 75
75 // Need to explicitly clear the tree prior to destroying this so that 76 // Need to explicitly clear the tree prior to destroying this so that
76 // the LayerTreeImpl pointer is still valid in the LayerImpl dtor. 77 // the LayerTreeImpl pointer is still valid in the LayerImpl dtor.
77 DCHECK(!root_layer_); 78 DCHECK(!root_layer_);
78 DCHECK(layers_with_copy_output_request_.empty()); 79 DCHECK(layers_with_copy_output_request_.empty());
79 } 80 }
80 81
81 void LayerTreeImpl::Shutdown() { 82 void LayerTreeImpl::Shutdown() {
82 root_layer_ = nullptr; 83 root_layer_ = nullptr;
83 } 84 }
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 // The request queue should have been processed and does not require a push. 193 // The request queue should have been processed and does not require a push.
193 DCHECK_EQ(ui_resource_request_queue_.size(), 0u); 194 DCHECK_EQ(ui_resource_request_queue_.size(), 0u);
194 195
195 target_tree->SetPropertyTrees(property_trees_); 196 target_tree->SetPropertyTrees(property_trees_);
196 197
197 if (next_activation_forces_redraw_) { 198 if (next_activation_forces_redraw_) {
198 target_tree->ForceRedrawNextActivation(); 199 target_tree->ForceRedrawNextActivation();
199 next_activation_forces_redraw_ = false; 200 next_activation_forces_redraw_ = false;
200 } 201 }
201 202
202 target_tree->PassSwapPromises(&swap_promise_list_); 203 target_tree->PassPromises(&promises_);
203 204
204 target_tree->set_top_controls_shrink_blink_size( 205 target_tree->set_top_controls_shrink_blink_size(
205 top_controls_shrink_blink_size_); 206 top_controls_shrink_blink_size_);
206 target_tree->set_top_controls_height(top_controls_height_); 207 target_tree->set_top_controls_height(top_controls_height_);
207 target_tree->PushTopControls(nullptr); 208 target_tree->PushTopControls(nullptr);
208 209
209 // Active tree already shares the page_scale_factor object with pending 210 // Active tree already shares the page_scale_factor object with pending
210 // tree so only the limits need to be provided. 211 // tree so only the limits need to be provided.
211 target_tree->PushPageScaleFactorAndLimits(nullptr, min_page_scale_factor(), 212 target_tree->PushPageScaleFactorAndLimits(nullptr, min_page_scale_factor(),
212 max_page_scale_factor()); 213 max_page_scale_factor());
(...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after
982 typedef LayerIterator<LayerImpl> LayerIteratorType; 983 typedef LayerIterator<LayerImpl> LayerIteratorType;
983 LayerIteratorType end = LayerIteratorType::End(&render_surface_layer_list_); 984 LayerIteratorType end = LayerIteratorType::End(&render_surface_layer_list_);
984 for (LayerIteratorType it = LayerIteratorType::Begin( 985 for (LayerIteratorType it = LayerIteratorType::Begin(
985 &render_surface_layer_list_); it != end; ++it) { 986 &render_surface_layer_list_); it != end; ++it) {
986 if (!it.represents_itself()) 987 if (!it.represents_itself())
987 continue; 988 continue;
988 TracedValue::AppendIDRef(*it, state); 989 TracedValue::AppendIDRef(*it, state);
989 } 990 }
990 state->EndArray(); 991 state->EndArray();
991 992
992 state->BeginArray("swap_promise_trace_ids"); 993 state->BeginArray("promise_trace_ids");
993 for (size_t i = 0; i < swap_promise_list_.size(); i++) 994 std::vector<int64> trace_ids;
994 state->AppendDouble(swap_promise_list_[i]->TraceId()); 995 promises_.GetTraceIds(&trace_ids);
996 for (size_t i = 0; i < trace_ids.size(); i++)
997 state->AppendDouble(trace_ids[i]);
995 state->EndArray(); 998 state->EndArray();
996 } 999 }
997 1000
998 void LayerTreeImpl::SetRootLayerScrollOffsetDelegate( 1001 void LayerTreeImpl::SetRootLayerScrollOffsetDelegate(
999 LayerScrollOffsetDelegate* root_layer_scroll_offset_delegate) { 1002 LayerScrollOffsetDelegate* root_layer_scroll_offset_delegate) {
1000 if (root_layer_scroll_offset_delegate_ == root_layer_scroll_offset_delegate) 1003 if (root_layer_scroll_offset_delegate_ == root_layer_scroll_offset_delegate)
1001 return; 1004 return;
1002 1005
1003 root_layer_scroll_offset_delegate_ = root_layer_scroll_offset_delegate; 1006 root_layer_scroll_offset_delegate_ = root_layer_scroll_offset_delegate;
1004 1007
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
1058 1061
1059 OuterViewportScrollLayer()->SetCurrentScrollOffsetFromDelegate( 1062 OuterViewportScrollLayer()->SetCurrentScrollOffsetFromDelegate(
1060 outer_viewport_offset); 1063 outer_viewport_offset);
1061 inner_viewport_offset = root_offset - outer_viewport_offset; 1064 inner_viewport_offset = root_offset - outer_viewport_offset;
1062 InnerViewportScrollLayer()->SetCurrentScrollOffsetFromDelegate( 1065 InnerViewportScrollLayer()->SetCurrentScrollOffsetFromDelegate(
1063 inner_viewport_offset); 1066 inner_viewport_offset);
1064 1067
1065 UpdateRootScrollOffsetDelegate(); 1068 UpdateRootScrollOffsetDelegate();
1066 } 1069 }
1067 1070
1068 void LayerTreeImpl::QueueSwapPromise(scoped_ptr<SwapPromise> swap_promise) { 1071 void LayerTreeImpl::PassPromises(PromiseList* other) {
1069 DCHECK(swap_promise); 1072 promises_.PassPromises(other);
1070 swap_promise_list_.push_back(swap_promise.Pass());
1071 } 1073 }
1072 1074
1073 void LayerTreeImpl::PassSwapPromises( 1075 void LayerTreeImpl::QueuePromise(scoped_ptr<Promise> promise) {
1074 ScopedPtrVector<SwapPromise>* new_swap_promise) { 1076 promises_.QueuePromise(promise.Pass());
1075 swap_promise_list_.insert_and_take(swap_promise_list_.end(), 1077 }
1076 new_swap_promise); 1078
1077 new_swap_promise->clear(); 1079 void LayerTreeImpl::BreakSwapPromises(Promise::DidNotSwap::Reason reason) {
1080 promises_.OnDidNotSwap(reason);
1078 } 1081 }
1079 1082
1080 void LayerTreeImpl::FinishSwapPromises(CompositorFrameMetadata* metadata) { 1083 void LayerTreeImpl::FinishSwapPromises(CompositorFrameMetadata* metadata) {
1081 for (size_t i = 0; i < swap_promise_list_.size(); i++) 1084 promises_.OnDidSwap(metadata);
1082 swap_promise_list_[i]->DidSwap(metadata);
1083 swap_promise_list_.clear();
1084 } 1085 }
1085 1086
1086 void LayerTreeImpl::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) { 1087 void LayerTreeImpl::BreakActivationPromises(Promise::DidNotActivate::Reason reas on) {
1087 for (size_t i = 0; i < swap_promise_list_.size(); i++) 1088 promises_.OnDidNotActivate(reason);
1088 swap_promise_list_[i]->DidNotSwap(reason); 1089 }
1089 swap_promise_list_.clear(); 1090
1091 void LayerTreeImpl::FinishActivationPromises(CompositorFrameMetadata* metadata) {
1092 promises_.OnDidActivate(metadata);
1090 } 1093 }
1091 1094
1092 void LayerTreeImpl::DidModifyTilePriorities() { 1095 void LayerTreeImpl::DidModifyTilePriorities() {
1093 layer_tree_host_impl_->DidModifyTilePriorities(); 1096 layer_tree_host_impl_->DidModifyTilePriorities();
1094 } 1097 }
1095 1098
1096 void LayerTreeImpl::set_ui_resource_request_queue( 1099 void LayerTreeImpl::set_ui_resource_request_queue(
1097 const UIResourceRequestQueue& queue) { 1100 const UIResourceRequestQueue& queue) {
1098 ui_resource_request_queue_ = queue; 1101 ui_resource_request_queue_ = queue;
1099 } 1102 }
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
1565 scoped_ptr<PendingPageScaleAnimation> pending_animation) { 1568 scoped_ptr<PendingPageScaleAnimation> pending_animation) {
1566 pending_page_scale_animation_ = pending_animation.Pass(); 1569 pending_page_scale_animation_ = pending_animation.Pass();
1567 } 1570 }
1568 1571
1569 scoped_ptr<PendingPageScaleAnimation> 1572 scoped_ptr<PendingPageScaleAnimation>
1570 LayerTreeImpl::TakePendingPageScaleAnimation() { 1573 LayerTreeImpl::TakePendingPageScaleAnimation() {
1571 return pending_page_scale_animation_.Pass(); 1574 return pending_page_scale_animation_.Pass();
1572 } 1575 }
1573 1576
1574 } // namespace cc 1577 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698