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

Side by Side Diff: cc/tree_synchronizer.cc

Issue 11472021: cc: Pass LayerTreeHostImpl to LayerImpl constructor (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 8 years 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/tree_synchronizer.h ('k') | cc/tree_synchronizer_unittest.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 #include "cc/tree_synchronizer.h" 5 #include "cc/tree_synchronizer.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "cc/layer.h" 8 #include "cc/layer.h"
9 #include "cc/layer_impl.h" 9 #include "cc/layer_impl.h"
10 #include "cc/scrollbar_animation_controller.h" 10 #include "cc/scrollbar_animation_controller.h"
(...skipping 26 matching lines...) Expand all
37 for (size_t i = 0; i < children.size(); ++i) 37 for (size_t i = 0; i < children.size(); ++i)
38 collectExistingLayerImplRecursive(oldLayers, children.take(i)); 38 collectExistingLayerImplRecursive(oldLayers, children.take(i));
39 39
40 collectExistingLayerImplRecursive(oldLayers, layerImpl->m_maskLayer.Pass()); 40 collectExistingLayerImplRecursive(oldLayers, layerImpl->m_maskLayer.Pass());
41 collectExistingLayerImplRecursive(oldLayers, layerImpl->m_replicaLayer.Pass( )); 41 collectExistingLayerImplRecursive(oldLayers, layerImpl->m_replicaLayer.Pass( ));
42 42
43 int id = layerImpl->id(); 43 int id = layerImpl->id();
44 oldLayers.set(id, layerImpl.Pass()); 44 oldLayers.set(id, layerImpl.Pass());
45 } 45 }
46 46
47 scoped_ptr<LayerImpl> TreeSynchronizer::reuseOrCreateLayerImpl(RawPtrLayerImplMa p& newLayers, ScopedPtrLayerImplMap& oldLayers, Layer* layer) 47 scoped_ptr<LayerImpl> TreeSynchronizer::reuseOrCreateLayerImpl(RawPtrLayerImplMa p& newLayers, ScopedPtrLayerImplMap& oldLayers, Layer* layer, LayerTreeHostImpl* hostImpl)
48 { 48 {
49 scoped_ptr<LayerImpl> layerImpl = oldLayers.take(layer->id()); 49 scoped_ptr<LayerImpl> layerImpl = oldLayers.take(layer->id());
50 50
51 if (!layerImpl) 51 if (!layerImpl)
52 layerImpl = layer->createLayerImpl(); 52 layerImpl = layer->createLayerImpl(hostImpl);
53 53
54 newLayers[layer->id()] = layerImpl.get(); 54 newLayers[layer->id()] = layerImpl.get();
55 return layerImpl.Pass(); 55 return layerImpl.Pass();
56 } 56 }
57 57
58 scoped_ptr<LayerImpl> TreeSynchronizer::synchronizeTreeRecursive(RawPtrLayerImpl Map& newLayers, ScopedPtrLayerImplMap& oldLayers, Layer* layer, LayerTreeHostImp l* hostImpl) 58 scoped_ptr<LayerImpl> TreeSynchronizer::synchronizeTreeRecursive(RawPtrLayerImpl Map& newLayers, ScopedPtrLayerImplMap& oldLayers, Layer* layer, LayerTreeHostImp l* hostImpl)
59 { 59 {
60 if (!layer) 60 if (!layer)
61 return scoped_ptr<LayerImpl>(); 61 return scoped_ptr<LayerImpl>();
62 62
63 scoped_ptr<LayerImpl> layerImpl = reuseOrCreateLayerImpl(newLayers, oldLayer s, layer); 63 scoped_ptr<LayerImpl> layerImpl = reuseOrCreateLayerImpl(newLayers, oldLayer s, layer, hostImpl);
64 64
65 layerImpl->clearChildList(); 65 layerImpl->clearChildList();
66 const std::vector<scoped_refptr<Layer> >& children = layer->children(); 66 const std::vector<scoped_refptr<Layer> >& children = layer->children();
67 for (size_t i = 0; i < children.size(); ++i) 67 for (size_t i = 0; i < children.size(); ++i)
68 layerImpl->addChild(synchronizeTreeRecursive(newLayers, oldLayers, child ren[i].get(), hostImpl)); 68 layerImpl->addChild(synchronizeTreeRecursive(newLayers, oldLayers, child ren[i].get(), hostImpl));
69 69
70 layerImpl->setMaskLayer(synchronizeTreeRecursive(newLayers, oldLayers, layer ->maskLayer(), hostImpl)); 70 layerImpl->setMaskLayer(synchronizeTreeRecursive(newLayers, oldLayers, layer ->maskLayer(), hostImpl));
71 layerImpl->setReplicaLayer(synchronizeTreeRecursive(newLayers, oldLayers, la yer->replicaLayer(), hostImpl)); 71 layerImpl->setReplicaLayer(synchronizeTreeRecursive(newLayers, oldLayers, la yer->replicaLayer(), hostImpl));
72 72
73 layer->pushPropertiesTo(layerImpl.get()); 73 layer->pushPropertiesTo(layerImpl.get());
74 layerImpl->setLayerTreeHostImpl(hostImpl);
75 74
76 // Remove all dangling pointers. The pointers will be setup later in updateS crollbarLayerPointersRecursive phase 75 // Remove all dangling pointers. The pointers will be setup later in updateS crollbarLayerPointersRecursive phase
77 if (ScrollbarAnimationController* scrollbarController = layerImpl->scrollbar AnimationController()) { 76 if (ScrollbarAnimationController* scrollbarController = layerImpl->scrollbar AnimationController()) {
78 scrollbarController->setHorizontalScrollbarLayer(0); 77 scrollbarController->setHorizontalScrollbarLayer(0);
79 scrollbarController->setVerticalScrollbarLayer(0); 78 scrollbarController->setVerticalScrollbarLayer(0);
80 } 79 }
81 80
82 return layerImpl.Pass(); 81 return layerImpl.Pass();
83 } 82 }
84 83
(...skipping 18 matching lines...) Expand all
103 DCHECK(scrollbarLayerImpl); 102 DCHECK(scrollbarLayerImpl);
104 DCHECK(scrollLayerImpl); 103 DCHECK(scrollLayerImpl);
105 104
106 if (scrollbarLayerImpl->orientation() == WebKit::WebScrollbar::Horizontal) 105 if (scrollbarLayerImpl->orientation() == WebKit::WebScrollbar::Horizontal)
107 scrollLayerImpl->setHorizontalScrollbarLayer(scrollbarLayerImpl); 106 scrollLayerImpl->setHorizontalScrollbarLayer(scrollbarLayerImpl);
108 else 107 else
109 scrollLayerImpl->setVerticalScrollbarLayer(scrollbarLayerImpl); 108 scrollLayerImpl->setVerticalScrollbarLayer(scrollbarLayerImpl);
110 } 109 }
111 110
112 } // namespace cc 111 } // namespace cc
OLDNEW
« no previous file with comments | « cc/tree_synchronizer.h ('k') | cc/tree_synchronizer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698