Enabling tests which should be fixed by r173829.
[chromium-blink-merge.git] / cc / tree_synchronizer.h
blobd7922c36643500905aea5fbcde7a2d537939117e
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
3 // found in the LICENSE file.
5 #ifndef CC_TREE_SYNCHRONIZER_H_
6 #define CC_TREE_SYNCHRONIZER_H_
8 #include "base/basictypes.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "cc/cc_export.h"
11 #include "cc/scoped_ptr_hash_map.h"
13 namespace cc {
15 class LayerImpl;
16 class LayerTreeImpl;
17 class Layer;
19 class CC_EXPORT TreeSynchronizer {
20 public:
21 // Accepts a Layer tree and returns a reference to a LayerImpl tree that duplicates the structure
22 // of the Layer tree, reusing the LayerImpls in the tree provided by oldLayerImplRoot if possible.
23 static scoped_ptr<LayerImpl> synchronizeTrees(Layer* layerRoot, scoped_ptr<LayerImpl> oldLayerImplRoot, LayerTreeImpl*);
25 private:
26 TreeSynchronizer(); // Not instantiable.
28 typedef ScopedPtrHashMap<int, LayerImpl> ScopedPtrLayerImplMap;
29 typedef base::hash_map<int, LayerImpl*> RawPtrLayerImplMap;
31 // Declared as static member functions so they can access functions on Layer as a friend class.
32 static scoped_ptr<LayerImpl> reuseOrCreateLayerImpl(RawPtrLayerImplMap& newLayers, ScopedPtrLayerImplMap& oldLayers, Layer*, LayerTreeImpl*);
33 static void collectExistingLayerImplRecursive(ScopedPtrLayerImplMap& oldLayers, scoped_ptr<LayerImpl>);
34 static scoped_ptr<LayerImpl> synchronizeTreeRecursive(RawPtrLayerImplMap& newLayers, ScopedPtrLayerImplMap& oldLayers, Layer*, LayerTreeImpl*);
35 static void updateScrollbarLayerPointersRecursive(const RawPtrLayerImplMap& newLayers, Layer*);
37 DISALLOW_COPY_AND_ASSIGN(TreeSynchronizer);
40 } // namespace cc
42 #endif // CC_TREE_SYNCHRONIZER_H_