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_->property_trees()->needs_rebuild = true; |
| 123 layer_tree_host_->UnregisterLayer(this); |
| 124 } |
| 125 layer_tree_host_ = host; |
121 if (layer_tree_host_) | 126 if (layer_tree_host_) |
122 layer_tree_host_->property_trees()->needs_rebuild = true; | 127 layer_tree_host_->RegisterLayer(this); |
123 | |
124 layer_tree_host_ = host; | |
125 | 128 |
126 // When changing hosts, the layer needs to commit its properties to the impl | 129 // When changing hosts, the layer needs to commit its properties to the impl |
127 // side for the new host. | 130 // side for the new host. |
128 SetNeedsPushProperties(); | 131 SetNeedsPushProperties(); |
129 | 132 |
130 for (size_t i = 0; i < children_.size(); ++i) | 133 for (size_t i = 0; i < children_.size(); ++i) |
131 children_[i]->SetLayerTreeHost(host); | 134 children_[i]->SetLayerTreeHost(host); |
132 | 135 |
133 if (mask_layer_.get()) | 136 if (mask_layer_.get()) |
134 mask_layer_->SetLayerTreeHost(host); | 137 mask_layer_->SetLayerTreeHost(host); |
(...skipping 1333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1468 | 1471 |
1469 void Layer::DidBeginTracing() { | 1472 void Layer::DidBeginTracing() { |
1470 // We'll be dumping layer trees as part of trace, so make sure | 1473 // We'll be dumping layer trees as part of trace, so make sure |
1471 // PushPropertiesTo() propagates layer debug info to the impl | 1474 // PushPropertiesTo() propagates layer debug info to the impl |
1472 // side -- otherwise this won't happen for the the layers that | 1475 // side -- otherwise this won't happen for the the layers that |
1473 // remain unchanged since tracing started. | 1476 // remain unchanged since tracing started. |
1474 SetNeedsPushProperties(); | 1477 SetNeedsPushProperties(); |
1475 } | 1478 } |
1476 | 1479 |
1477 } // namespace cc | 1480 } // namespace cc |
OLD | NEW |