Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Side by Side Diff: cc/tree_synchronizer.h

Issue 11882037: Activate LayerImpl tree with sync+push instead of pointer swap (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/tiled_layer_impl.cc ('k') | cc/tree_synchronizer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef CC_TREE_SYNCHRONIZER_H_ 5 #ifndef CC_TREE_SYNCHRONIZER_H_
6 #define CC_TREE_SYNCHRONIZER_H_ 6 #define CC_TREE_SYNCHRONIZER_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "cc/cc_export.h" 10 #include "cc/cc_export.h"
11 #include "cc/scoped_ptr_hash_map.h" 11 #include "cc/scoped_ptr_hash_map.h"
12 12
13 namespace cc { 13 namespace cc {
14 14
15 class LayerImpl; 15 class LayerImpl;
16 class LayerTreeImpl; 16 class LayerTreeImpl;
17 class Layer; 17 class Layer;
18 18
19 class CC_EXPORT TreeSynchronizer { 19 class CC_EXPORT TreeSynchronizer {
20 public: 20 public:
21 // Accepts a Layer tree and returns a reference to a LayerImpl tree that dup licates the structure 21 // Accepts a Layer tree and returns a reference to a LayerImpl tree that dup licates the structure
22 // of the Layer tree, reusing the LayerImpls in the tree provided by oldLaye rImplRoot if possible. 22 // of the Layer tree, reusing the LayerImpls in the tree provided by oldLaye rImplRoot if possible.
23 static scoped_ptr<LayerImpl> synchronizeTrees(Layer* layerRoot, scoped_ptr<L ayerImpl> oldLayerImplRoot, LayerTreeImpl*); 23 static scoped_ptr<LayerImpl> synchronizeTrees(Layer* layerRoot, scoped_ptr<L ayerImpl> oldLayerImplRoot, LayerTreeImpl*);
24 static scoped_ptr<LayerImpl> synchronizeTrees(LayerImpl* layerRoot, scoped_p tr<LayerImpl> oldLayerImplRoot, LayerTreeImpl*);
24 25
25 // Pushes properties from a Layer tree to a structurally equivalent 26 // Pushes properties from a Layer or LayerImpl tree to a structurally equiva lent
26 // LayerImpl tree. 27 // LayerImpl tree.
27 static void pushProperties(Layer* layerRoot, LayerImpl* layerImplRoot); 28 static void pushProperties(Layer* layerRoot, LayerImpl* layerImplRoot);
29 static void pushProperties(LayerImpl* layerRoot, LayerImpl* layerImplRoot);
28 30
29 private: 31 private:
30 TreeSynchronizer(); // Not instantiable. 32 TreeSynchronizer(); // Not instantiable.
31 33
32 typedef ScopedPtrHashMap<int, LayerImpl> ScopedPtrLayerImplMap;
33 typedef base::hash_map<int, LayerImpl*> RawPtrLayerImplMap;
34
35 // Declared as static member functions so they can access functions on Layer as a friend class.
36 static scoped_ptr<LayerImpl> reuseOrCreateLayerImpl(RawPtrLayerImplMap& newL ayers, ScopedPtrLayerImplMap& oldLayers, Layer*, LayerTreeImpl*);
37 static void collectExistingLayerImplRecursive(ScopedPtrLayerImplMap& oldLaye rs, scoped_ptr<LayerImpl>);
38 static scoped_ptr<LayerImpl> synchronizeTreeRecursive(RawPtrLayerImplMap& ne wLayers, ScopedPtrLayerImplMap& oldLayers, Layer*, LayerTreeImpl*);
39 static void updateScrollbarLayerPointersRecursive(const RawPtrLayerImplMap& newLayers, Layer*);
40
41 DISALLOW_COPY_AND_ASSIGN(TreeSynchronizer); 34 DISALLOW_COPY_AND_ASSIGN(TreeSynchronizer);
42 }; 35 };
43 36
44 } // namespace cc 37 } // namespace cc
45 38
46 #endif // CC_TREE_SYNCHRONIZER_H_ 39 #endif // CC_TREE_SYNCHRONIZER_H_
OLDNEW
« no previous file with comments | « cc/tiled_layer_impl.cc ('k') | cc/tree_synchronizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698