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 <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/atomic_sequence_num.h" | 9 #include "base/atomic_sequence_num.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 if (replica_layer_.get()) { | 110 if (replica_layer_.get()) { |
111 DCHECK_EQ(this, replica_layer_->parent()); | 111 DCHECK_EQ(this, replica_layer_->parent()); |
112 replica_layer_->RemoveFromParent(); | 112 replica_layer_->RemoveFromParent(); |
113 } | 113 } |
114 } | 114 } |
115 | 115 |
116 void Layer::SetLayerTreeHost(LayerTreeHost* host) { | 116 void Layer::SetLayerTreeHost(LayerTreeHost* host) { |
117 if (layer_tree_host_ == host) | 117 if (layer_tree_host_ == host) |
118 return; | 118 return; |
119 | 119 |
| 120 if (layer_tree_host_) { |
| 121 layer_tree_host_->property_trees()->needs_rebuild = true; |
| 122 layer_tree_host_->UnregisterLayer(this); |
| 123 } |
| 124 layer_tree_host_ = host; |
120 if (layer_tree_host_) | 125 if (layer_tree_host_) |
121 layer_tree_host_->property_trees()->needs_rebuild = true; | 126 layer_tree_host_->RegisterLayer(this); |
122 | |
123 layer_tree_host_ = host; | |
124 | 127 |
125 // When changing hosts, the layer needs to commit its properties to the impl | 128 // When changing hosts, the layer needs to commit its properties to the impl |
126 // side for the new host. | 129 // side for the new host. |
127 SetNeedsPushProperties(); | 130 SetNeedsPushProperties(); |
128 | 131 |
129 for (size_t i = 0; i < children_.size(); ++i) | 132 for (size_t i = 0; i < children_.size(); ++i) |
130 children_[i]->SetLayerTreeHost(host); | 133 children_[i]->SetLayerTreeHost(host); |
131 | 134 |
132 if (mask_layer_.get()) | 135 if (mask_layer_.get()) |
133 mask_layer_->SetLayerTreeHost(host); | 136 mask_layer_->SetLayerTreeHost(host); |
(...skipping 1345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1479 | 1482 |
1480 void Layer::DidBeginTracing() { | 1483 void Layer::DidBeginTracing() { |
1481 // We'll be dumping layer trees as part of trace, so make sure | 1484 // We'll be dumping layer trees as part of trace, so make sure |
1482 // PushPropertiesTo() propagates layer debug info to the impl | 1485 // PushPropertiesTo() propagates layer debug info to the impl |
1483 // side -- otherwise this won't happen for the the layers that | 1486 // side -- otherwise this won't happen for the the layers that |
1484 // remain unchanged since tracing started. | 1487 // remain unchanged since tracing started. |
1485 SetNeedsPushProperties(); | 1488 SetNeedsPushProperties(); |
1486 } | 1489 } |
1487 | 1490 |
1488 } // namespace cc | 1491 } // namespace cc |
OLD | NEW |