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

Side by Side Diff: cc/layers/layer_impl.cc

Issue 1975623002: cc : Add LayerToPropertyTreeIndices map to PropertyTrees (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
« no previous file with comments | « no previous file | cc/layers/layer_impl_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/layers/layer_impl.h" 5 #include "cc/layers/layer_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 } 94 }
95 95
96 LayerImpl::~LayerImpl() { 96 LayerImpl::~LayerImpl() {
97 DCHECK_EQ(DRAW_MODE_NONE, current_draw_mode_); 97 DCHECK_EQ(DRAW_MODE_NONE, current_draw_mode_);
98 98
99 if (!copy_requests_.empty() && layer_tree_impl_->IsActiveTree()) 99 if (!copy_requests_.empty() && layer_tree_impl_->IsActiveTree())
100 layer_tree_impl()->RemoveLayerWithCopyOutputRequest(this); 100 layer_tree_impl()->RemoveLayerWithCopyOutputRequest(this);
101 layer_tree_impl_->UnregisterScrollLayer(this); 101 layer_tree_impl_->UnregisterScrollLayer(this);
102 layer_tree_impl_->UnregisterLayer(this); 102 layer_tree_impl_->UnregisterLayer(this);
103 layer_tree_impl_->RemoveLayerShouldPushProperties(this); 103 layer_tree_impl_->RemoveLayerShouldPushProperties(this);
104 layer_tree_impl_->RemoveFromLayerToPropertyTreeIndicesMap(layer_id_);
104 105
105 layer_tree_impl_->RemoveFromElementMap(this); 106 layer_tree_impl_->RemoveFromElementMap(this);
106 107
107 TRACE_EVENT_OBJECT_DELETED_WITH_ID( 108 TRACE_EVENT_OBJECT_DELETED_WITH_ID(
108 TRACE_DISABLED_BY_DEFAULT("cc.debug"), "cc::LayerImpl", this); 109 TRACE_DISABLED_BY_DEFAULT("cc.debug"), "cc::LayerImpl", this);
109 110
110 if (mask_layer_) 111 if (mask_layer_)
111 layer_tree_impl_->RemoveLayer(mask_layer_id_); 112 layer_tree_impl_->RemoveLayer(mask_layer_id_);
112 if (replica_layer_) 113 if (replica_layer_)
113 layer_tree_impl_->RemoveLayer(replica_layer_id_); 114 layer_tree_impl_->RemoveLayer(replica_layer_id_);
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 175
175 void LayerImpl::ApplyScroll(ScrollState* scroll_state) { 176 void LayerImpl::ApplyScroll(ScrollState* scroll_state) {
176 DCHECK(scroll_state); 177 DCHECK(scroll_state);
177 ScrollNode* node = layer_tree_impl()->property_trees()->scroll_tree.Node( 178 ScrollNode* node = layer_tree_impl()->property_trees()->scroll_tree.Node(
178 scroll_tree_index()); 179 scroll_tree_index());
179 layer_tree_impl()->ApplyScroll(node, scroll_state); 180 layer_tree_impl()->ApplyScroll(node, scroll_state);
180 } 181 }
181 182
182 void LayerImpl::SetTransformTreeIndex(int index) { 183 void LayerImpl::SetTransformTreeIndex(int index) {
183 transform_tree_index_ = index; 184 transform_tree_index_ = index;
185 if (layer_tree_impl_)
ajuma 2016/05/12 00:54:56 Is layer_tree_impl_ ever null? It's assumed to be
186 layer_tree_impl()->UpdateLayerToPropertyTreeIndicesMap(
187 id(), index, PropertyTrees::Types::TRANSFORM_TREE);
184 SetNeedsPushProperties(); 188 SetNeedsPushProperties();
185 } 189 }
186 190
187 void LayerImpl::SetClipTreeIndex(int index) { 191 void LayerImpl::SetClipTreeIndex(int index) {
188 clip_tree_index_ = index; 192 clip_tree_index_ = index;
193 if (layer_tree_impl_)
194 layer_tree_impl()->UpdateLayerToPropertyTreeIndicesMap(
195 id(), index, PropertyTrees::Types::CLIP_TREE);
189 SetNeedsPushProperties(); 196 SetNeedsPushProperties();
190 } 197 }
191 198
192 void LayerImpl::SetEffectTreeIndex(int index) { 199 void LayerImpl::SetEffectTreeIndex(int index) {
193 effect_tree_index_ = index; 200 effect_tree_index_ = index;
201 if (layer_tree_impl_)
202 layer_tree_impl()->UpdateLayerToPropertyTreeIndicesMap(
203 id(), index, PropertyTrees::Types::EFFECT_TREE);
194 SetNeedsPushProperties(); 204 SetNeedsPushProperties();
195 } 205 }
196 206
197 void LayerImpl::SetScrollTreeIndex(int index) { 207 void LayerImpl::SetScrollTreeIndex(int index) {
198 scroll_tree_index_ = index; 208 scroll_tree_index_ = index;
209 if (layer_tree_impl_)
210 layer_tree_impl()->UpdateLayerToPropertyTreeIndicesMap(
211 id(), index, PropertyTrees::Types::SCROLL_TREE);
199 SetNeedsPushProperties(); 212 SetNeedsPushProperties();
200 } 213 }
201 214
202 void LayerImpl::PassCopyRequests( 215 void LayerImpl::PassCopyRequests(
203 std::vector<std::unique_ptr<CopyOutputRequest>>* requests) { 216 std::vector<std::unique_ptr<CopyOutputRequest>>* requests) {
204 // In the case that a layer still has a copy request, this means that there's 217 // In the case that a layer still has a copy request, this means that there's
205 // a commit to the active tree without a draw. This only happens in some 218 // a commit to the active tree without a draw. This only happens in some
206 // edge cases during lost context or visibility changes, so don't try to 219 // edge cases during lost context or visibility changes, so don't try to
207 // handle preserving these output requests (and their surface). 220 // handle preserving these output requests (and their surface).
208 if (!copy_requests_.empty()) { 221 if (!copy_requests_.empty()) {
(...skipping 1202 matching lines...) Expand 10 before | Expand all | Expand 10 after
1411 .layer_transforms_should_scale_layer_contents) { 1424 .layer_transforms_should_scale_layer_contents) {
1412 return default_scale; 1425 return default_scale;
1413 } 1426 }
1414 1427
1415 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents( 1428 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents(
1416 DrawTransform(), default_scale); 1429 DrawTransform(), default_scale);
1417 return std::max(transform_scales.x(), transform_scales.y()); 1430 return std::max(transform_scales.x(), transform_scales.y());
1418 } 1431 }
1419 1432
1420 } // namespace cc 1433 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/layers/layer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698