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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 if (replica_layer_.get()) { | 121 if (replica_layer_.get()) { |
122 DCHECK_EQ(this, replica_layer_->parent()); | 122 DCHECK_EQ(this, replica_layer_->parent()); |
123 replica_layer_->RemoveFromParent(); | 123 replica_layer_->RemoveFromParent(); |
124 } | 124 } |
125 } | 125 } |
126 | 126 |
127 void Layer::SetLayerTreeHost(LayerTreeHost* host) { | 127 void Layer::SetLayerTreeHost(LayerTreeHost* host) { |
128 if (layer_tree_host_ == host) | 128 if (layer_tree_host_ == host) |
129 return; | 129 return; |
130 | 130 |
131 if (layer_tree_host_) | 131 if (layer_tree_host_) { |
132 layer_tree_host_->property_trees()->needs_rebuild = true; | 132 layer_tree_host_->property_trees()->needs_rebuild = true; |
133 | 133 layer_tree_host_->UnregisterLayer(this); |
134 if (host) | 134 } |
| 135 if (host) { |
135 host->property_trees()->needs_rebuild = true; | 136 host->property_trees()->needs_rebuild = true; |
| 137 host->RegisterLayer(this); |
| 138 } |
136 | 139 |
137 InvalidatePropertyTreesIndices(); | 140 InvalidatePropertyTreesIndices(); |
138 | 141 |
139 layer_tree_host_ = host; | 142 layer_tree_host_ = host; |
140 | 143 |
141 // When changing hosts, the layer needs to commit its properties to the impl | 144 // When changing hosts, the layer needs to commit its properties to the impl |
142 // side for the new host. | 145 // side for the new host. |
143 SetNeedsPushProperties(); | 146 SetNeedsPushProperties(); |
144 | 147 |
145 for (size_t i = 0; i < children_.size(); ++i) | 148 for (size_t i = 0; i < children_.size(); ++i) |
(...skipping 1451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1597 ? layer_tree_host()->meta_information_sequence_number() | 1600 ? layer_tree_host()->meta_information_sequence_number() |
1598 : 0; | 1601 : 0; |
1599 } | 1602 } |
1600 | 1603 |
1601 bool Layer::sorted_for_recursion() { | 1604 bool Layer::sorted_for_recursion() { |
1602 return sorted_for_recursion_tracker_ == | 1605 return sorted_for_recursion_tracker_ == |
1603 layer_tree_host()->meta_information_sequence_number(); | 1606 layer_tree_host()->meta_information_sequence_number(); |
1604 } | 1607 } |
1605 | 1608 |
1606 } // namespace cc | 1609 } // namespace cc |
OLD | NEW |