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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 if (replica_layer_.get()) { | 122 if (replica_layer_.get()) { |
123 DCHECK_EQ(this, replica_layer_->parent()); | 123 DCHECK_EQ(this, replica_layer_->parent()); |
124 replica_layer_->RemoveFromParent(); | 124 replica_layer_->RemoveFromParent(); |
125 } | 125 } |
126 } | 126 } |
127 | 127 |
128 void Layer::SetLayerTreeHost(LayerTreeHost* host) { | 128 void Layer::SetLayerTreeHost(LayerTreeHost* host) { |
129 if (layer_tree_host_ == host) | 129 if (layer_tree_host_ == host) |
130 return; | 130 return; |
131 | 131 |
132 if (layer_tree_host_) | 132 if (layer_tree_host_) { |
133 layer_tree_host_->property_trees()->needs_rebuild = true; | 133 layer_tree_host_->property_trees()->needs_rebuild = true; |
134 | 134 layer_tree_host_->UnregisterLayer(this); |
135 if (host) | 135 } |
| 136 if (host) { |
136 host->property_trees()->needs_rebuild = true; | 137 host->property_trees()->needs_rebuild = true; |
| 138 host->RegisterLayer(this); |
| 139 } |
137 | 140 |
138 InvalidatePropertyTreesIndices(); | 141 InvalidatePropertyTreesIndices(); |
139 | 142 |
140 layer_tree_host_ = host; | 143 layer_tree_host_ = host; |
141 | 144 |
142 // When changing hosts, the layer needs to commit its properties to the impl | 145 // When changing hosts, the layer needs to commit its properties to the impl |
143 // side for the new host. | 146 // side for the new host. |
144 SetNeedsPushProperties(); | 147 SetNeedsPushProperties(); |
145 | 148 |
146 for (size_t i = 0; i < children_.size(); ++i) | 149 for (size_t i = 0; i < children_.size(); ++i) |
(...skipping 1505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1652 ? layer_tree_host()->meta_information_sequence_number() | 1655 ? layer_tree_host()->meta_information_sequence_number() |
1653 : 0; | 1656 : 0; |
1654 } | 1657 } |
1655 | 1658 |
1656 bool Layer::sorted_for_recursion() { | 1659 bool Layer::sorted_for_recursion() { |
1657 return sorted_for_recursion_tracker_ == | 1660 return sorted_for_recursion_tracker_ == |
1658 layer_tree_host()->meta_information_sequence_number(); | 1661 layer_tree_host()->meta_information_sequence_number(); |
1659 } | 1662 } |
1660 | 1663 |
1661 } // namespace cc | 1664 } // namespace cc |
OLD | NEW |