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

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: Fix Windows compile. 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
« no previous file with comments | « cc/trees/layer_tree_impl.cc ('k') | content/browser/android/content_startup_flags.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/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/containers/scoped_ptr_hash_map.h" 8 #include "base/containers/scoped_ptr_hash_map.h"
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "cc/animation/scrollbar_animation_controller.h" 11 #include "cc/animation/scrollbar_animation_controller.h"
12 #include "cc/input/scrollbar.h" 12 #include "cc/input/scrollbar.h"
13 #include "cc/layers/layer.h" 13 #include "cc/layers/layer.h"
14 #include "cc/layers/layer_impl.h" 14 #include "cc/layers/layer_impl.h"
15 #include "cc/layers/painted_scrollbar_layer.h" 15 #include "cc/layers/scrollbar_layer_impl_base.h"
16 #include "cc/layers/painted_scrollbar_layer_impl.h" 16 #include "cc/layers/scrollbar_layer_interface.h"
17 17
18 namespace cc { 18 namespace cc {
19 19
20 typedef base::ScopedPtrHashMap<int, LayerImpl> ScopedPtrLayerImplMap; 20 typedef base::ScopedPtrHashMap<int, LayerImpl> ScopedPtrLayerImplMap;
21 typedef base::hash_map<int, LayerImpl*> RawPtrLayerImplMap; 21 typedef base::hash_map<int, LayerImpl*> RawPtrLayerImplMap;
22 22
23 void CollectExistingLayerImplRecursive(ScopedPtrLayerImplMap* old_layers, 23 void CollectExistingLayerImplRecursive(ScopedPtrLayerImplMap* old_layers,
24 scoped_ptr<LayerImpl> layer_impl) { 24 scoped_ptr<LayerImpl> layer_impl) {
25 if (!layer_impl) 25 if (!layer_impl)
26 return; 26 return;
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 for (size_t i = 0; i < layer->children().size(); ++i) { 148 for (size_t i = 0; i < layer->children().size(); ++i) {
149 UpdateScrollbarLayerPointersRecursiveInternal< 149 UpdateScrollbarLayerPointersRecursiveInternal<
150 LayerType, ScrollbarLayerType>(new_layers, layer->child_at(i)); 150 LayerType, ScrollbarLayerType>(new_layers, layer->child_at(i));
151 } 151 }
152 152
153 ScrollbarLayerType* scrollbar_layer = layer->ToScrollbarLayer(); 153 ScrollbarLayerType* scrollbar_layer = layer->ToScrollbarLayer();
154 if (!scrollbar_layer) 154 if (!scrollbar_layer)
155 return; 155 return;
156 156
157 RawPtrLayerImplMap::const_iterator iter = 157 RawPtrLayerImplMap::const_iterator iter =
158 new_layers->find(scrollbar_layer->id()); 158 new_layers->find(layer->id());
159 PaintedScrollbarLayerImpl* scrollbar_layer_impl = 159 ScrollbarLayerImplBase* scrollbar_layer_impl =
160 iter != new_layers->end() 160 iter != new_layers->end()
161 ? static_cast<PaintedScrollbarLayerImpl*>(iter->second) 161 ? static_cast<ScrollbarLayerImplBase*>(iter->second)
162 : NULL; 162 : NULL;
163 iter = new_layers->find(scrollbar_layer->scroll_layer_id()); 163 iter = new_layers->find(scrollbar_layer->ScrollLayerId());
164 LayerImpl* scroll_layer_impl = 164 LayerImpl* scroll_layer_impl =
165 iter != new_layers->end() ? iter->second : NULL; 165 iter != new_layers->end() ? iter->second : NULL;
166 166
167 DCHECK(scrollbar_layer_impl); 167 DCHECK(scrollbar_layer_impl);
168 DCHECK(scroll_layer_impl); 168 DCHECK(scroll_layer_impl);
169 169
170 if (scrollbar_layer->Orientation() == HORIZONTAL) 170 if (scrollbar_layer->orientation() == HORIZONTAL)
171 scroll_layer_impl->SetHorizontalScrollbarLayer(scrollbar_layer_impl); 171 scroll_layer_impl->SetHorizontalScrollbarLayer(scrollbar_layer_impl);
172 else 172 else
173 scroll_layer_impl->SetVerticalScrollbarLayer(scrollbar_layer_impl); 173 scroll_layer_impl->SetVerticalScrollbarLayer(scrollbar_layer_impl);
174 } 174 }
175 175
176 void UpdateScrollbarLayerPointersRecursive(const RawPtrLayerImplMap* new_layers, 176 void UpdateScrollbarLayerPointersRecursive(const RawPtrLayerImplMap* new_layers,
177 Layer* layer) { 177 Layer* layer) {
178 UpdateScrollbarLayerPointersRecursiveInternal<Layer, PaintedScrollbarLayer>( 178 UpdateScrollbarLayerPointersRecursiveInternal<Layer, ScrollbarLayerInterface>(
179 new_layers, layer); 179 new_layers, layer);
180 } 180 }
181 181
182 void UpdateScrollbarLayerPointersRecursive(const RawPtrLayerImplMap* new_layers, 182 void UpdateScrollbarLayerPointersRecursive(const RawPtrLayerImplMap* new_layers,
183 LayerImpl* layer) { 183 LayerImpl* layer) {
184 UpdateScrollbarLayerPointersRecursiveInternal< 184 UpdateScrollbarLayerPointersRecursiveInternal<
185 LayerImpl, 185 LayerImpl,
186 PaintedScrollbarLayerImpl>(new_layers, layer); 186 ScrollbarLayerImplBase>(new_layers, layer);
187 } 187 }
188 188
189 // static 189 // static
190 void TreeSynchronizer::SetNumDependentsNeedPushProperties( 190 void TreeSynchronizer::SetNumDependentsNeedPushProperties(
191 Layer* layer, size_t num) { 191 Layer* layer, size_t num) {
192 layer->num_dependents_need_push_properties_ = num; 192 layer->num_dependents_need_push_properties_ = num;
193 } 193 }
194 194
195 // static 195 // static
196 void TreeSynchronizer::SetNumDependentsNeedPushProperties( 196 void TreeSynchronizer::SetNumDependentsNeedPushProperties(
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 layer, layer_impl, &num_dependents_need_push_properties); 256 layer, layer_impl, &num_dependents_need_push_properties);
257 } 257 }
258 258
259 void TreeSynchronizer::PushProperties(LayerImpl* layer, LayerImpl* layer_impl) { 259 void TreeSynchronizer::PushProperties(LayerImpl* layer, LayerImpl* layer_impl) {
260 size_t num_dependents_need_push_properties = 0; 260 size_t num_dependents_need_push_properties = 0;
261 PushPropertiesInternal( 261 PushPropertiesInternal(
262 layer, layer_impl, &num_dependents_need_push_properties); 262 layer, layer_impl, &num_dependents_need_push_properties);
263 } 263 }
264 264
265 } // namespace cc 265 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_impl.cc ('k') | content/browser/android/content_startup_flags.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698