| 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 "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "cc/animation/scrollbar_animation_controller.h" | 9 #include "cc/animation/scrollbar_animation_controller.h" |
| 10 #include "cc/layers/layer.h" | 10 #include "cc/layers/layer.h" |
| 11 #include "cc/layers/layer_impl.h" | 11 #include "cc/layers/layer_impl.h" |
| 12 #include "cc/layers/scrollbar_layer.h" | 12 #include "cc/layers/scrollbar_layer.h" |
| 13 #include "cc/layers/scrollbar_layer_impl.h" | 13 #include "cc/layers/scrollbar_layer_impl.h" |
| 14 | 14 |
| 15 namespace cc { | 15 namespace cc { |
| 16 | 16 |
| 17 typedef ScopedPtrHashMap<int, LayerImpl> ScopedPtrLayerImplMap; | 17 typedef ScopedPtrHashMap<int, LayerImpl> ScopedPtrLayerImplMap; |
| 18 typedef base::hash_map<int, LayerImpl*> RawPtrLayerImplMap; | 18 typedef base::hash_map<int, LayerImpl*> RawPtrLayerImplMap; |
| 19 | 19 |
| 20 void CollectExistingLayerImplRecursive(ScopedPtrLayerImplMap* old_layers, | 20 void CollectExistingLayerImplRecursive(ScopedPtrLayerImplMap* old_layers, |
| 21 scoped_ptr<LayerImpl> layer_impl) { | 21 scoped_ptr<LayerImpl> layer_impl) { |
| 22 if (!layer_impl) | 22 if (!layer_impl) |
| 23 return; | 23 return; |
| 24 | 24 |
| 25 ScopedPtrVector<LayerImpl>& children = layer_impl->children(); | 25 OwnedLayerImplList& children = layer_impl->children(); |
| 26 for (ScopedPtrVector<LayerImpl>::iterator it = children.begin(); | 26 for (OwnedLayerImplList::iterator it = children.begin(); |
| 27 it != children.end(); | 27 it != children.end(); |
| 28 ++it) | 28 ++it) |
| 29 CollectExistingLayerImplRecursive(old_layers, children.take(it)); | 29 CollectExistingLayerImplRecursive(old_layers, children.take(it)); |
| 30 | 30 |
| 31 CollectExistingLayerImplRecursive(old_layers, layer_impl->TakeMaskLayer()); | 31 CollectExistingLayerImplRecursive(old_layers, layer_impl->TakeMaskLayer()); |
| 32 CollectExistingLayerImplRecursive(old_layers, layer_impl->TakeReplicaLayer()); | 32 CollectExistingLayerImplRecursive(old_layers, layer_impl->TakeReplicaLayer()); |
| 33 | 33 |
| 34 int id = layer_impl->id(); | 34 int id = layer_impl->id(); |
| 35 old_layers->set(id, layer_impl.Pass()); | 35 old_layers->set(id, layer_impl.Pass()); |
| 36 } | 36 } |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 DCHECK(!layer_impl); | 191 DCHECK(!layer_impl); |
| 192 return; | 192 return; |
| 193 } | 193 } |
| 194 | 194 |
| 195 DCHECK_EQ(layer->id(), layer_impl->id()); | 195 DCHECK_EQ(layer->id(), layer_impl->id()); |
| 196 layer->PushPropertiesTo(layer_impl); | 196 layer->PushPropertiesTo(layer_impl); |
| 197 | 197 |
| 198 PushPropertiesInternal(layer->mask_layer(), layer_impl->mask_layer()); | 198 PushPropertiesInternal(layer->mask_layer(), layer_impl->mask_layer()); |
| 199 PushPropertiesInternal(layer->replica_layer(), layer_impl->replica_layer()); | 199 PushPropertiesInternal(layer->replica_layer(), layer_impl->replica_layer()); |
| 200 | 200 |
| 201 const ScopedPtrVector<LayerImpl>& impl_children = layer_impl->children(); | 201 const OwnedLayerImplList& impl_children = layer_impl->children(); |
| 202 DCHECK_EQ(layer->children().size(), impl_children.size()); | 202 DCHECK_EQ(layer->children().size(), impl_children.size()); |
| 203 | 203 |
| 204 for (size_t i = 0; i < layer->children().size(); ++i) { | 204 for (size_t i = 0; i < layer->children().size(); ++i) { |
| 205 PushPropertiesInternal(layer->child_at(i), impl_children[i]); | 205 PushPropertiesInternal(layer->child_at(i), impl_children[i]); |
| 206 } | 206 } |
| 207 } | 207 } |
| 208 | 208 |
| 209 void TreeSynchronizer::PushProperties(Layer* layer, LayerImpl* layer_impl) { | 209 void TreeSynchronizer::PushProperties(Layer* layer, LayerImpl* layer_impl) { |
| 210 PushPropertiesInternal(layer, layer_impl); | 210 PushPropertiesInternal(layer, layer_impl); |
| 211 } | 211 } |
| 212 | 212 |
| 213 void TreeSynchronizer::PushProperties(LayerImpl* layer, LayerImpl* layer_impl) { | 213 void TreeSynchronizer::PushProperties(LayerImpl* layer, LayerImpl* layer_impl) { |
| 214 PushPropertiesInternal(layer, layer_impl); | 214 PushPropertiesInternal(layer, layer_impl); |
| 215 } | 215 } |
| 216 | 216 |
| 217 } // namespace cc | 217 } // namespace cc |
| OLD | NEW |