| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/trees/tree_synchronizer.h" | 5 #include "cc/trees/tree_synchronizer.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 scoped_ptr<OwnedLayerImplList> old_layers(tree_impl->DetachLayers()); | 26 scoped_ptr<OwnedLayerImplList> old_layers(tree_impl->DetachLayers()); |
| 27 | 27 |
| 28 OwnedLayerImplMap old_layer_map; | 28 OwnedLayerImplMap old_layer_map; |
| 29 for (auto& it : *old_layers) | 29 for (auto& it : *old_layers) |
| 30 old_layer_map[it->id()] = std::move(it); | 30 old_layer_map[it->id()] = std::move(it); |
| 31 | 31 |
| 32 SynchronizeTreesRecursive(&old_layer_map, layer_root, tree_impl); | 32 SynchronizeTreesRecursive(&old_layer_map, layer_root, tree_impl); |
| 33 | 33 |
| 34 for (auto& it : old_layer_map) { | 34 for (auto& it : old_layer_map) { |
| 35 if (it.second) { | 35 if (it.second) { |
| 36 // Need to ensure that layer destruction doesn't tear down child | 36 // Need to ensure that layer destruction doesn't tear down other layers |
| 37 // LayerImpl that have been used in the new tree. | 37 // linked to this LayerImpl that have been used in the new tree. |
| 38 it.second->children().clear(); | 38 it.second->ClearLinksToOtherLayers(); |
| 39 } | 39 } |
| 40 } | 40 } |
| 41 } | 41 } |
| 42 | 42 |
| 43 void TreeSynchronizer::SynchronizeTrees(Layer* layer_root, | 43 void TreeSynchronizer::SynchronizeTrees(Layer* layer_root, |
| 44 LayerTreeImpl* tree_impl) { | 44 LayerTreeImpl* tree_impl) { |
| 45 if (!layer_root) | 45 if (!layer_root) |
| 46 tree_impl->ClearLayers(); | 46 tree_impl->ClearLayers(); |
| 47 else | 47 else |
| 48 SynchronizeTreesInternal(layer_root, tree_impl); | 48 SynchronizeTreesInternal(layer_root, tree_impl); |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 impl_tree); | 199 impl_tree); |
| 200 | 200 |
| 201 #if DCHECK_IS_ON() | 201 #if DCHECK_IS_ON() |
| 202 if (host_tree->root_layer() && impl_tree->root_layer()) | 202 if (host_tree->root_layer() && impl_tree->root_layer()) |
| 203 CheckScrollAndClipPointersRecursive(host_tree->root_layer(), | 203 CheckScrollAndClipPointersRecursive(host_tree->root_layer(), |
| 204 impl_tree->root_layer()); | 204 impl_tree->root_layer()); |
| 205 #endif | 205 #endif |
| 206 } | 206 } |
| 207 | 207 |
| 208 } // namespace cc | 208 } // namespace cc |
| OLD | NEW |