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 #ifndef TreeSynchronizer_h | 5 #ifndef TreeSynchronizer_h |
6 #define TreeSynchronizer_h | 6 #define TreeSynchronizer_h |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include <wtf/HashMap.h> | 9 #include "base/memory/scoped_ptr.h" |
10 #include <wtf/OwnPtr.h> | 10 #include "cc/scoped_ptr_hash_map.h" |
11 #include <wtf/PassOwnPtr.h> | |
12 | 11 |
13 namespace cc { | 12 namespace cc { |
14 | 13 |
15 class CCLayerImpl; | 14 class CCLayerImpl; |
16 class CCLayerTreeHostImpl; | 15 class CCLayerTreeHostImpl; |
17 class LayerChromium; | 16 class LayerChromium; |
18 | 17 |
19 class TreeSynchronizer { | 18 class TreeSynchronizer { |
20 public: | 19 public: |
21 // Accepts a LayerChromium tree and returns a reference to a CCLayerImpl tre
e that duplicates the structure | 20 // Accepts a LayerChromium tree and returns a reference to a CCLayerImpl tre
e that duplicates the structure |
22 // of the LayerChromium tree, reusing the CCLayerImpls in the tree provided
by oldCCLayerImplRoot if possible. | 21 // of the LayerChromium tree, reusing the CCLayerImpls in the tree provided
by oldCCLayerImplRoot if possible. |
23 static PassOwnPtr<CCLayerImpl> synchronizeTrees(LayerChromium* layerRoot, Pa
ssOwnPtr<CCLayerImpl> oldCCLayerImplRoot, CCLayerTreeHostImpl*); | 22 static scoped_ptr<CCLayerImpl> synchronizeTrees(LayerChromium* layerRoot, sc
oped_ptr<CCLayerImpl> oldCCLayerImplRoot, CCLayerTreeHostImpl*); |
24 | 23 |
25 private: | 24 private: |
26 TreeSynchronizer(); // Not instantiable. | 25 TreeSynchronizer(); // Not instantiable. |
27 | 26 |
28 typedef HashMap<int, OwnPtr<CCLayerImpl> > OwnPtrCCLayerImplMap; | 27 typedef ScopedPtrHashMap<int, CCLayerImpl> ScopedPtrCCLayerImplMap; |
29 typedef HashMap<int, CCLayerImpl*> RawPtrCCLayerImplMap; | 28 typedef base::hash_map<int, CCLayerImpl*> RawPtrCCLayerImplMap; |
30 | 29 |
31 // Declared as static member functions so they can access functions on Layer
Chromium as a friend class. | 30 // Declared as static member functions so they can access functions on Layer
Chromium as a friend class. |
32 static PassOwnPtr<CCLayerImpl> reuseOrCreateCCLayerImpl(RawPtrCCLayerImplMap
& newLayers, OwnPtrCCLayerImplMap& oldLayers, LayerChromium*); | 31 static scoped_ptr<CCLayerImpl> reuseOrCreateCCLayerImpl(RawPtrCCLayerImplMap
& newLayers, ScopedPtrCCLayerImplMap& oldLayers, LayerChromium*); |
33 static void collectExistingCCLayerImplRecursive(OwnPtrCCLayerImplMap& oldLay
ers, PassOwnPtr<CCLayerImpl>); | 32 static void collectExistingCCLayerImplRecursive(ScopedPtrCCLayerImplMap& old
Layers, scoped_ptr<CCLayerImpl>); |
34 static PassOwnPtr<CCLayerImpl> synchronizeTreeRecursive(RawPtrCCLayerImplMap
& newLayers, OwnPtrCCLayerImplMap& oldLayers, LayerChromium*, CCLayerTreeHostImp
l*); | 33 static scoped_ptr<CCLayerImpl> synchronizeTreeRecursive(RawPtrCCLayerImplMap
& newLayers, ScopedPtrCCLayerImplMap& oldLayers, LayerChromium*, CCLayerTreeHost
Impl*); |
35 static void updateScrollbarLayerPointersRecursive(const RawPtrCCLayerImplMap
& newLayers, LayerChromium*); | 34 static void updateScrollbarLayerPointersRecursive(const RawPtrCCLayerImplMap
& newLayers, LayerChromium*); |
36 | 35 |
37 DISALLOW_COPY_AND_ASSIGN(TreeSynchronizer); | 36 DISALLOW_COPY_AND_ASSIGN(TreeSynchronizer); |
38 }; | 37 }; |
39 | 38 |
40 } // namespace cc | 39 } // namespace cc |
41 | 40 |
42 #endif // TreeSynchronizer_h | 41 #endif // TreeSynchronizer_h |
OLD | NEW |