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

Side by Side Diff: cc/trees/tree_synchronizer.cc

Issue 18341009: Refactor cc scrollbar layers to separate solid-color vs desktop. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased to account for re-naming to PaintedScrollbarLayer. Created 7 years, 3 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
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/trees/tree_synchronizer.h" 5 #include "cc/trees/tree_synchronizer.h"
6 6
7 #include "base/containers/hash_tables.h" 7 #include "base/containers/hash_tables.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "cc/animation/scrollbar_animation_controller.h" 10 #include "cc/animation/scrollbar_animation_controller.h"
11 #include "cc/input/scrollbar.h" 11 #include "cc/input/scrollbar.h"
12 #include "cc/layers/layer.h" 12 #include "cc/layers/layer.h"
13 #include "cc/layers/layer_impl.h" 13 #include "cc/layers/layer_impl.h"
14 #include "cc/layers/painted_scrollbar_layer.h" 14 #include "cc/layers/scrollbar_layer_impl_base.h"
15 #include "cc/layers/painted_scrollbar_layer_impl.h" 15 #include "cc/layers/scrollbar_layer_interface.h"
16 16
17 namespace cc { 17 namespace cc {
18 18
19 typedef ScopedPtrHashMap<int, LayerImpl> ScopedPtrLayerImplMap; 19 typedef ScopedPtrHashMap<int, LayerImpl> ScopedPtrLayerImplMap;
20 typedef base::hash_map<int, LayerImpl*> RawPtrLayerImplMap; 20 typedef base::hash_map<int, LayerImpl*> RawPtrLayerImplMap;
21 21
22 void CollectExistingLayerImplRecursive(ScopedPtrLayerImplMap* old_layers, 22 void CollectExistingLayerImplRecursive(ScopedPtrLayerImplMap* old_layers,
23 scoped_ptr<LayerImpl> layer_impl) { 23 scoped_ptr<LayerImpl> layer_impl) {
24 if (!layer_impl) 24 if (!layer_impl)
25 return; 25 return;
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 for (size_t i = 0; i < layer->children().size(); ++i) { 147 for (size_t i = 0; i < layer->children().size(); ++i) {
148 UpdateScrollbarLayerPointersRecursiveInternal< 148 UpdateScrollbarLayerPointersRecursiveInternal<
149 LayerType, ScrollbarLayerType>(new_layers, layer->child_at(i)); 149 LayerType, ScrollbarLayerType>(new_layers, layer->child_at(i));
150 } 150 }
151 151
152 ScrollbarLayerType* scrollbar_layer = layer->ToScrollbarLayer(); 152 ScrollbarLayerType* scrollbar_layer = layer->ToScrollbarLayer();
153 if (!scrollbar_layer) 153 if (!scrollbar_layer)
154 return; 154 return;
155 155
156 RawPtrLayerImplMap::const_iterator iter = 156 RawPtrLayerImplMap::const_iterator iter =
157 new_layers->find(scrollbar_layer->id()); 157 new_layers->find(layer->id());
158 PaintedScrollbarLayerImpl* scrollbar_layer_impl = 158 ScrollbarLayerImplBase* scrollbar_layer_impl =
159 iter != new_layers->end() 159 iter != new_layers->end()
160 ? static_cast<PaintedScrollbarLayerImpl*>(iter->second) 160 ? static_cast<ScrollbarLayerImplBase*>(iter->second)
161 : NULL; 161 : NULL;
162 iter = new_layers->find(scrollbar_layer->scroll_layer_id()); 162 iter = new_layers->find(scrollbar_layer->ScrollLayerId());
163 LayerImpl* scroll_layer_impl = 163 LayerImpl* scroll_layer_impl =
164 iter != new_layers->end() ? iter->second : NULL; 164 iter != new_layers->end() ? iter->second : NULL;
165 165
166 DCHECK(scrollbar_layer_impl); 166 DCHECK(scrollbar_layer_impl);
167 DCHECK(scroll_layer_impl); 167 DCHECK(scroll_layer_impl);
168 168
169 if (scrollbar_layer->Orientation() == HORIZONTAL) 169 if (scrollbar_layer->orientation() == HORIZONTAL)
170 scroll_layer_impl->SetHorizontalScrollbarLayer(scrollbar_layer_impl); 170 scroll_layer_impl->SetHorizontalScrollbarLayer(scrollbar_layer_impl);
171 else 171 else
172 scroll_layer_impl->SetVerticalScrollbarLayer(scrollbar_layer_impl); 172 scroll_layer_impl->SetVerticalScrollbarLayer(scrollbar_layer_impl);
173 } 173 }
174 174
175 void UpdateScrollbarLayerPointersRecursive(const RawPtrLayerImplMap* new_layers, 175 void UpdateScrollbarLayerPointersRecursive(const RawPtrLayerImplMap* new_layers,
176 Layer* layer) { 176 Layer* layer) {
177 UpdateScrollbarLayerPointersRecursiveInternal<Layer, PaintedScrollbarLayer>( 177 UpdateScrollbarLayerPointersRecursiveInternal<Layer, ScrollbarLayerInterface>(
178 new_layers, layer); 178 new_layers, layer);
179 } 179 }
180 180
181 void UpdateScrollbarLayerPointersRecursive(const RawPtrLayerImplMap* new_layers, 181 void UpdateScrollbarLayerPointersRecursive(const RawPtrLayerImplMap* new_layers,
182 LayerImpl* layer) { 182 LayerImpl* layer) {
183 UpdateScrollbarLayerPointersRecursiveInternal< 183 UpdateScrollbarLayerPointersRecursiveInternal<
184 LayerImpl, 184 LayerImpl,
185 PaintedScrollbarLayerImpl>(new_layers, layer); 185 ScrollbarLayerImplBase>(new_layers, layer);
186 } 186 }
187 187
188 // static 188 // static
189 void TreeSynchronizer::SetNumDependentsNeedPushProperties( 189 void TreeSynchronizer::SetNumDependentsNeedPushProperties(
190 Layer* layer, size_t num) { 190 Layer* layer, size_t num) {
191 layer->num_dependents_need_push_properties_ = num; 191 layer->num_dependents_need_push_properties_ = num;
192 } 192 }
193 193
194 // static 194 // static
195 void TreeSynchronizer::SetNumDependentsNeedPushProperties( 195 void TreeSynchronizer::SetNumDependentsNeedPushProperties(
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 layer, layer_impl, &num_dependents_need_push_properties); 255 layer, layer_impl, &num_dependents_need_push_properties);
256 } 256 }
257 257
258 void TreeSynchronizer::PushProperties(LayerImpl* layer, LayerImpl* layer_impl) { 258 void TreeSynchronizer::PushProperties(LayerImpl* layer, LayerImpl* layer_impl) {
259 size_t num_dependents_need_push_properties = 0; 259 size_t num_dependents_need_push_properties = 0;
260 PushPropertiesInternal( 260 PushPropertiesInternal(
261 layer, layer_impl, &num_dependents_need_push_properties); 261 layer, layer_impl, &num_dependents_need_push_properties);
262 } 262 }
263 263
264 } // namespace cc 264 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698