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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 if (replica_layer_.get()) { | 111 if (replica_layer_.get()) { |
112 DCHECK_EQ(this, replica_layer_->parent()); | 112 DCHECK_EQ(this, replica_layer_->parent()); |
113 replica_layer_->RemoveFromParent(); | 113 replica_layer_->RemoveFromParent(); |
114 } | 114 } |
115 } | 115 } |
116 | 116 |
117 void Layer::SetLayerTreeHost(LayerTreeHost* host) { | 117 void Layer::SetLayerTreeHost(LayerTreeHost* host) { |
118 if (layer_tree_host_ == host) | 118 if (layer_tree_host_ == host) |
119 return; | 119 return; |
120 | 120 |
| 121 if (layer_tree_host_) |
| 122 layer_tree_host_->UnregisterLayer(this); |
121 layer_tree_host_ = host; | 123 layer_tree_host_ = host; |
| 124 if (layer_tree_host_) |
| 125 layer_tree_host_->RegisterLayer(this); |
122 | 126 |
123 // When changing hosts, the layer needs to commit its properties to the impl | 127 // When changing hosts, the layer needs to commit its properties to the impl |
124 // side for the new host. | 128 // side for the new host. |
125 SetNeedsPushProperties(); | 129 SetNeedsPushProperties(); |
126 | 130 |
127 for (size_t i = 0; i < children_.size(); ++i) | 131 for (size_t i = 0; i < children_.size(); ++i) |
128 children_[i]->SetLayerTreeHost(host); | 132 children_[i]->SetLayerTreeHost(host); |
129 | 133 |
130 if (mask_layer_.get()) | 134 if (mask_layer_.get()) |
131 mask_layer_->SetLayerTreeHost(host); | 135 mask_layer_->SetLayerTreeHost(host); |
(...skipping 1243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1375 | 1379 |
1376 void Layer::DidBeginTracing() { | 1380 void Layer::DidBeginTracing() { |
1377 // We'll be dumping layer trees as part of trace, so make sure | 1381 // We'll be dumping layer trees as part of trace, so make sure |
1378 // PushPropertiesTo() propagates layer debug info to the impl | 1382 // PushPropertiesTo() propagates layer debug info to the impl |
1379 // side -- otherwise this won't happen for the the layers that | 1383 // side -- otherwise this won't happen for the the layers that |
1380 // remain unchanged since tracing started. | 1384 // remain unchanged since tracing started. |
1381 SetNeedsPushProperties(); | 1385 SetNeedsPushProperties(); |
1382 } | 1386 } |
1383 | 1387 |
1384 } // namespace cc | 1388 } // namespace cc |
OLD | NEW |