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

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

Issue 2053193002: cc : Move LayerImpl::children to test properties (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 | « cc/layers/layer_impl.h ('k') | cc/layers/layer_impl_test_properties.h » ('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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 layer_tree_impl_->RemoveFromElementMap(this); 102 layer_tree_impl_->RemoveFromElementMap(this);
103 103
104 TRACE_EVENT_OBJECT_DELETED_WITH_ID( 104 TRACE_EVENT_OBJECT_DELETED_WITH_ID(
105 TRACE_DISABLED_BY_DEFAULT("cc.debug"), "cc::LayerImpl", this); 105 TRACE_DISABLED_BY_DEFAULT("cc.debug"), "cc::LayerImpl", this);
106 106
107 // The mask and replica layers should have been removed already. 107 // The mask and replica layers should have been removed already.
108 if (mask_layer_) 108 if (mask_layer_)
109 DCHECK(!layer_tree_impl_->RemoveLayer(mask_layer_id_)); 109 DCHECK(!layer_tree_impl_->RemoveLayer(mask_layer_id_));
110 if (replica_layer_) 110 if (replica_layer_)
111 DCHECK(!layer_tree_impl_->RemoveLayer(replica_layer_id_)); 111 DCHECK(!layer_tree_impl_->RemoveLayer(replica_layer_id_));
112 children_.clear();
113 } 112 }
114 113
115 void LayerImpl::AddChild(std::unique_ptr<LayerImpl> child) { 114 void LayerImpl::AddChild(std::unique_ptr<LayerImpl> child) {
116 child->SetParent(this); 115 child->SetParent(this);
117 DCHECK_EQ(layer_tree_impl(), child->layer_tree_impl()); 116 DCHECK_EQ(layer_tree_impl(), child->layer_tree_impl());
118 children_.push_back(child.get()); 117 test_properties()->children.push_back(child.get());
119 layer_tree_impl_->AddLayer(std::move(child)); 118 layer_tree_impl_->AddLayer(std::move(child));
120 } 119 }
ajuma 2016/06/09 23:39:47 AddChild and RemoveChild should also (eventually)
jaydasika 2016/06/10 02:13:39 Acknowledged.
121 120
122 std::unique_ptr<LayerImpl> LayerImpl::RemoveChildForTesting(LayerImpl* child) { 121 std::unique_ptr<LayerImpl> LayerImpl::RemoveChildForTesting(LayerImpl* child) {
123 auto it = std::find(children_.begin(), children_.end(), child); 122 auto it = std::find(test_properties()->children.begin(),
124 if (it != children_.end()) 123 test_properties()->children.end(), child);
125 children_.erase(it); 124 if (it != test_properties()->children.end())
125 test_properties()->children.erase(it);
126 layer_tree_impl()->property_trees()->RemoveIdFromIdToIndexMaps(child->id()); 126 layer_tree_impl()->property_trees()->RemoveIdFromIdToIndexMaps(child->id());
127 return layer_tree_impl_->RemoveLayer(child->id()); 127 return layer_tree_impl_->RemoveLayer(child->id());
128 } 128 }
129 129
130 void LayerImpl::SetParent(LayerImpl* parent) { 130 void LayerImpl::SetParent(LayerImpl* parent) {
131 parent_ = parent; 131 parent_ = parent;
132 } 132 }
133 133
134 void LayerImpl::ClearLinksToOtherLayers() { 134 void LayerImpl::ClearLinksToOtherLayers() {
135 children_.clear();
136 mask_layer_ = nullptr; 135 mask_layer_ = nullptr;
137 replica_layer_ = nullptr; 136 replica_layer_ = nullptr;
138 } 137 }
139 138
140 void LayerImpl::SetHasWillChangeTransformHint(bool has_will_change) { 139 void LayerImpl::SetHasWillChangeTransformHint(bool has_will_change) {
141 if (has_will_change_transform_hint_ == has_will_change) 140 if (has_will_change_transform_hint_ == has_will_change)
142 return; 141 return;
143 has_will_change_transform_hint_ = has_will_change; 142 has_will_change_transform_hint_ = has_will_change;
144 SetNeedsPushProperties(); 143 SetNeedsPushProperties();
145 } 144 }
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 425
427 gfx::Vector2dF LayerImpl::FixedContainerSizeDelta() const { 426 gfx::Vector2dF LayerImpl::FixedContainerSizeDelta() const {
428 LayerImpl* scroll_clip_layer = 427 LayerImpl* scroll_clip_layer =
429 layer_tree_impl()->LayerById(scroll_clip_layer_id_); 428 layer_tree_impl()->LayerById(scroll_clip_layer_id_);
430 if (!scroll_clip_layer) 429 if (!scroll_clip_layer)
431 return gfx::Vector2dF(); 430 return gfx::Vector2dF();
432 431
433 return scroll_clip_layer->bounds_delta(); 432 return scroll_clip_layer->bounds_delta();
434 } 433 }
435 434
436 std::unique_ptr<base::DictionaryValue> LayerImpl::LayerTreeAsJson() const { 435 std::unique_ptr<base::DictionaryValue> LayerImpl::LayerTreeAsJson() {
437 std::unique_ptr<base::DictionaryValue> result(new base::DictionaryValue); 436 std::unique_ptr<base::DictionaryValue> result(new base::DictionaryValue);
438 result->SetInteger("LayerId", id()); 437 result->SetInteger("LayerId", id());
439 result->SetString("LayerType", LayerTypeAsString()); 438 result->SetString("LayerType", LayerTypeAsString());
440 439
441 base::ListValue* list = new base::ListValue; 440 base::ListValue* list = new base::ListValue;
442 list->AppendInteger(bounds().width()); 441 list->AppendInteger(bounds().width());
443 list->AppendInteger(bounds().height()); 442 list->AppendInteger(bounds().height());
444 result->Set("Bounds", list); 443 result->Set("Bounds", list);
445 444
446 list = new base::ListValue; 445 list = new base::ListValue;
(...skipping 16 matching lines...) Expand all
463 462
464 if (scrollable()) 463 if (scrollable())
465 result->SetBoolean("Scrollable", true); 464 result->SetBoolean("Scrollable", true);
466 465
467 if (!touch_event_handler_region_.IsEmpty()) { 466 if (!touch_event_handler_region_.IsEmpty()) {
468 std::unique_ptr<base::Value> region = touch_event_handler_region_.AsValue(); 467 std::unique_ptr<base::Value> region = touch_event_handler_region_.AsValue();
469 result->Set("TouchRegion", region.release()); 468 result->Set("TouchRegion", region.release());
470 } 469 }
471 470
472 list = new base::ListValue; 471 list = new base::ListValue;
473 for (size_t i = 0; i < children_.size(); ++i) 472 for (size_t i = 0; i < test_properties()->children.size(); ++i)
474 list->Append(children_[i]->LayerTreeAsJson()); 473 list->Append(test_properties()->children[i]->LayerTreeAsJson());
475 result->Set("Children", list); 474 result->Set("Children", list);
476 475
477 return result; 476 return result;
478 } 477 }
479 478
480 bool LayerImpl::LayerPropertyChanged() const { 479 bool LayerImpl::LayerPropertyChanged() const {
481 if (layer_property_changed_ || 480 if (layer_property_changed_ ||
482 (layer_tree_impl()->property_trees() && 481 (layer_tree_impl()->property_trees() &&
483 layer_tree_impl()->property_trees()->full_tree_damaged)) 482 layer_tree_impl()->property_trees()->full_tree_damaged))
484 return true; 483 return true;
(...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after
1357 .layer_transforms_should_scale_layer_contents) { 1356 .layer_transforms_should_scale_layer_contents) {
1358 return default_scale; 1357 return default_scale;
1359 } 1358 }
1360 1359
1361 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents( 1360 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents(
1362 ScreenSpaceTransform(), default_scale); 1361 ScreenSpaceTransform(), default_scale);
1363 return std::max(transform_scales.x(), transform_scales.y()); 1362 return std::max(transform_scales.x(), transform_scales.y());
1364 } 1363 }
1365 1364
1366 } // namespace cc 1365 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer_impl.h ('k') | cc/layers/layer_impl_test_properties.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698