OLD | NEW |
1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 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.h" | 5 #include "cc/layers/layer.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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 } | 117 } |
118 | 118 |
119 void Layer::SetLayerTreeHost(LayerTreeHost* host) { | 119 void Layer::SetLayerTreeHost(LayerTreeHost* host) { |
120 if (layer_tree_host_ == host) | 120 if (layer_tree_host_ == host) |
121 return; | 121 return; |
122 | 122 |
123 if (layer_tree_host_) { | 123 if (layer_tree_host_) { |
124 layer_tree_host_->property_trees()->RemoveIdFromIdToIndexMaps(id()); | 124 layer_tree_host_->property_trees()->RemoveIdFromIdToIndexMaps(id()); |
125 layer_tree_host_->property_trees()->needs_rebuild = true; | 125 layer_tree_host_->property_trees()->needs_rebuild = true; |
126 layer_tree_host_->UnregisterLayer(this); | 126 layer_tree_host_->UnregisterLayer(this); |
127 if (inputs_.element_id) { | 127 if (inputs_.element_id.id) { |
128 layer_tree_host_->UnregisterElement(inputs_.element_id, | 128 layer_tree_host_->UnregisterElement(inputs_.element_id, |
129 ElementListType::ACTIVE, this); | 129 ElementListType::ACTIVE, this); |
130 } | 130 } |
131 } | 131 } |
132 if (host) { | 132 if (host) { |
133 host->property_trees()->needs_rebuild = true; | 133 host->property_trees()->needs_rebuild = true; |
134 host->RegisterLayer(this); | 134 host->RegisterLayer(this); |
135 if (inputs_.element_id) { | 135 if (inputs_.element_id) { |
136 host->RegisterElement(inputs_.element_id, ElementListType::ACTIVE, this); | 136 host->RegisterElement(inputs_.element_id, ElementListType::ACTIVE, this); |
137 } | 137 } |
(...skipping 1277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1415 num_descendants_that_draw_content_ += num; | 1415 num_descendants_that_draw_content_ += num; |
1416 SetNeedsCommit(); | 1416 SetNeedsCommit(); |
1417 if (parent()) | 1417 if (parent()) |
1418 parent()->AddDrawableDescendants(num); | 1418 parent()->AddDrawableDescendants(num); |
1419 } | 1419 } |
1420 | 1420 |
1421 void Layer::RunMicroBenchmark(MicroBenchmark* benchmark) { | 1421 void Layer::RunMicroBenchmark(MicroBenchmark* benchmark) { |
1422 benchmark->RunOnLayer(this); | 1422 benchmark->RunOnLayer(this); |
1423 } | 1423 } |
1424 | 1424 |
1425 void Layer::SetElementId(ElementId id) { | 1425 void Layer::SetElementId(ElementId element_id) { |
1426 DCHECK(IsPropertyChangeAllowed()); | 1426 DCHECK(IsPropertyChangeAllowed()); |
1427 if (inputs_.element_id == id) | 1427 if (inputs_.element_id == element_id) |
1428 return; | 1428 return; |
1429 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("compositor-worker"), | 1429 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("compositor-worker"), |
1430 "Layer::SetElementId", "element", id.AsValue().release()); | 1430 "Layer::SetElementId", "element", element_id.id); |
1431 if (inputs_.element_id && layer_tree_host()) { | 1431 if (inputs_.element_id && layer_tree_host()) { |
1432 layer_tree_host_->UnregisterElement(inputs_.element_id, | 1432 layer_tree_host_->UnregisterElement(inputs_.element_id, |
1433 ElementListType::ACTIVE, this); | 1433 ElementListType::ACTIVE, this); |
1434 } | 1434 } |
1435 | 1435 |
1436 inputs_.element_id = id; | 1436 inputs_.element_id = element_id; |
1437 | 1437 |
1438 if (inputs_.element_id && layer_tree_host()) { | 1438 if (inputs_.element_id && layer_tree_host()) { |
1439 layer_tree_host_->RegisterElement(inputs_.element_id, | 1439 layer_tree_host_->RegisterElement(inputs_.element_id, |
1440 ElementListType::ACTIVE, this); | 1440 ElementListType::ACTIVE, this); |
1441 } | 1441 } |
1442 | 1442 |
1443 SetNeedsCommit(); | 1443 SetNeedsCommit(); |
1444 } | 1444 } |
1445 | 1445 |
1446 void Layer::SetMutableProperties(uint32_t properties) { | 1446 void Layer::SetMutableProperties(uint32_t properties) { |
(...skipping 12 matching lines...) Expand all Loading... |
1459 ->subtree_has_copy_request; | 1459 ->subtree_has_copy_request; |
1460 } | 1460 } |
1461 | 1461 |
1462 gfx::Transform Layer::ScreenSpaceTransform() const { | 1462 gfx::Transform Layer::ScreenSpaceTransform() const { |
1463 DCHECK_NE(transform_tree_index_, TransformTree::kInvalidNodeId); | 1463 DCHECK_NE(transform_tree_index_, TransformTree::kInvalidNodeId); |
1464 return draw_property_utils::ScreenSpaceTransform( | 1464 return draw_property_utils::ScreenSpaceTransform( |
1465 this, layer_tree_host_->property_trees()->transform_tree); | 1465 this, layer_tree_host_->property_trees()->transform_tree); |
1466 } | 1466 } |
1467 | 1467 |
1468 } // namespace cc | 1468 } // namespace cc |
OLD | NEW |