Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 100 layer_tree_impl_->RemoveLayerShouldPushProperties(this); | 100 layer_tree_impl_->RemoveLayerShouldPushProperties(this); |
| 101 | 101 |
| 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 if (mask_layer_) | 107 if (mask_layer_) |
| 108 layer_tree_impl_->RemoveLayer(mask_layer_id_); | 108 layer_tree_impl_->RemoveLayer(mask_layer_id_); |
| 109 if (replica_layer_) | 109 if (replica_layer_) |
| 110 layer_tree_impl_->RemoveLayer(replica_layer_id_); | 110 layer_tree_impl_->RemoveLayer(replica_layer_id_); |
|
ajuma
2016/06/07 23:25:36
Since masks and replicas are part of layers_ in La
jaydasika
2016/06/08 00:17:37
I din't understand that fully. masks and replicas
jaydasika
2016/06/08 00:49:32
Scratch my previous comment, I understand what you
ajuma
2016/06/08 13:48:02
That's a good point about destruction order -- eve
jaydasika
2016/06/08 16:29:30
I agree that there is no guarantee about destructi
ajuma
2016/06/08 16:40:45
Ah, got it, that makes sense.
| |
| 111 ClearChildList(); | 111 children_.clear(); |
| 112 } | 112 } |
| 113 | 113 |
| 114 void LayerImpl::AddChild(std::unique_ptr<LayerImpl> child) { | 114 void LayerImpl::AddChild(std::unique_ptr<LayerImpl> child) { |
| 115 child->SetParent(this); | 115 child->SetParent(this); |
| 116 DCHECK_EQ(layer_tree_impl(), child->layer_tree_impl()); | 116 DCHECK_EQ(layer_tree_impl(), child->layer_tree_impl()); |
| 117 children_.push_back(child.get()); | 117 children_.push_back(child.get()); |
| 118 layer_tree_impl_->AddLayer(std::move(child)); | 118 layer_tree_impl_->AddLayer(std::move(child)); |
| 119 } | 119 } |
| 120 | 120 |
| 121 std::unique_ptr<LayerImpl> LayerImpl::RemoveChildForTesting(LayerImpl* child) { | 121 std::unique_ptr<LayerImpl> LayerImpl::RemoveChildForTesting(LayerImpl* child) { |
| 122 auto it = std::find(children_.begin(), children_.end(), child); | 122 auto it = std::find(children_.begin(), children_.end(), child); |
| 123 if (it != children_.end()) | 123 if (it != children_.end()) |
| 124 children_.erase(it); | 124 children_.erase(it); |
| 125 layer_tree_impl()->property_trees()->RemoveIdFromIdToIndexMaps(child->id()); | 125 layer_tree_impl()->property_trees()->RemoveIdFromIdToIndexMaps(child->id()); |
| 126 return layer_tree_impl_->RemoveLayer(child->id()); | 126 return layer_tree_impl_->RemoveLayer(child->id()); |
| 127 } | 127 } |
| 128 | 128 |
| 129 void LayerImpl::SetParent(LayerImpl* parent) { | 129 void LayerImpl::SetParent(LayerImpl* parent) { |
| 130 parent_ = parent; | 130 parent_ = parent; |
| 131 } | 131 } |
| 132 | 132 |
| 133 void LayerImpl::ClearChildList() { | |
| 134 if (children_.empty()) | |
| 135 return; | |
| 136 for (auto* child : children_) | |
| 137 layer_tree_impl_->RemoveLayer(child->id()); | |
| 138 children_.clear(); | |
| 139 } | |
| 140 | |
| 141 void LayerImpl::ClearLinksToOtherLayers() { | 133 void LayerImpl::ClearLinksToOtherLayers() { |
| 142 children_.clear(); | 134 children_.clear(); |
| 143 mask_layer_ = nullptr; | 135 mask_layer_ = nullptr; |
| 144 replica_layer_ = nullptr; | 136 replica_layer_ = nullptr; |
| 145 } | 137 } |
| 146 | 138 |
| 147 void LayerImpl::SetHasWillChangeTransformHint(bool has_will_change) { | 139 void LayerImpl::SetHasWillChangeTransformHint(bool has_will_change) { |
| 148 if (has_will_change_transform_hint_ == has_will_change) | 140 if (has_will_change_transform_hint_ == has_will_change) |
| 149 return; | 141 return; |
| 150 has_will_change_transform_hint_ = has_will_change; | 142 has_will_change_transform_hint_ = has_will_change; |
| (...skipping 1210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1361 .layer_transforms_should_scale_layer_contents) { | 1353 .layer_transforms_should_scale_layer_contents) { |
| 1362 return default_scale; | 1354 return default_scale; |
| 1363 } | 1355 } |
| 1364 | 1356 |
| 1365 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents( | 1357 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents( |
| 1366 ScreenSpaceTransform(), default_scale); | 1358 ScreenSpaceTransform(), default_scale); |
| 1367 return std::max(transform_scales.x(), transform_scales.y()); | 1359 return std::max(transform_scales.x(), transform_scales.y()); |
| 1368 } | 1360 } |
| 1369 | 1361 |
| 1370 } // namespace cc | 1362 } // namespace cc |
| OLD | NEW |