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 #include "cc/trees/tree_synchronizer.h" | 5 #include "cc/trees/tree_synchronizer.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/containers/hash_tables.h" | 9 #include "base/containers/hash_tables.h" |
10 #include "base/containers/scoped_ptr_hash_map.h" | 10 #include "base/containers/scoped_ptr_hash_map.h" |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 layer->needs_push_properties(); | 235 layer->needs_push_properties(); |
236 *num_dependents_need_push_properties_for_parent += add_self_to_parent ? 1 : 0; | 236 *num_dependents_need_push_properties_for_parent += add_self_to_parent ? 1 : 0; |
237 } | 237 } |
238 | 238 |
239 static void CheckScrollAndClipPointersRecursive(Layer* layer, | 239 static void CheckScrollAndClipPointersRecursive(Layer* layer, |
240 LayerImpl* layer_impl) { | 240 LayerImpl* layer_impl) { |
241 DCHECK_EQ(!!layer, !!layer_impl); | 241 DCHECK_EQ(!!layer, !!layer_impl); |
242 if (!layer) | 242 if (!layer) |
243 return; | 243 return; |
244 | 244 |
245 DCHECK_EQ(!!layer->scroll_parent(), !!layer_impl->scroll_parent()); | 245 // Having a scroll parent on the impl thread implies having one the main |
246 if (layer->scroll_parent()) | 246 // thread, too. The main thread may have a scroll parent that is not in the |
| 247 // tree because it's been removed but not deleted. In this case, the layer |
| 248 // impl will have no scroll parent. Same argument applies for clip parents and |
| 249 // scroll/clip children. |
| 250 DCHECK(!layer_impl->scroll_parent() || !!layer->scroll_parent()); |
| 251 DCHECK(!layer_impl->clip_parent() || !!layer->clip_parent()); |
| 252 DCHECK(!layer_impl->scroll_children() || !!layer->scroll_children()); |
| 253 DCHECK(!layer_impl->clip_children() || !!layer->clip_children()); |
| 254 |
| 255 if (layer_impl->scroll_parent()) |
247 DCHECK_EQ(layer->scroll_parent()->id(), layer_impl->scroll_parent()->id()); | 256 DCHECK_EQ(layer->scroll_parent()->id(), layer_impl->scroll_parent()->id()); |
248 | 257 |
249 DCHECK_EQ(!!layer->clip_parent(), !!layer_impl->clip_parent()); | 258 if (layer_impl->clip_parent()) |
250 if (layer->clip_parent()) | |
251 DCHECK_EQ(layer->clip_parent()->id(), layer_impl->clip_parent()->id()); | 259 DCHECK_EQ(layer->clip_parent()->id(), layer_impl->clip_parent()->id()); |
252 | 260 |
253 DCHECK_EQ(!!layer->scroll_children(), !!layer_impl->scroll_children()); | 261 if (layer_impl->scroll_children()) { |
254 if (layer->scroll_children()) { | |
255 for (std::set<Layer*>::iterator it = layer->scroll_children()->begin(); | 262 for (std::set<Layer*>::iterator it = layer->scroll_children()->begin(); |
256 it != layer->scroll_children()->end(); | 263 it != layer->scroll_children()->end(); |
257 ++it) { | 264 ++it) { |
258 DCHECK_EQ((*it)->scroll_parent(), layer); | 265 DCHECK_EQ((*it)->scroll_parent(), layer); |
259 } | 266 } |
260 for (std::set<LayerImpl*>::iterator it = | 267 for (std::set<LayerImpl*>::iterator it = |
261 layer_impl->scroll_children()->begin(); | 268 layer_impl->scroll_children()->begin(); |
262 it != layer_impl->scroll_children()->end(); | 269 it != layer_impl->scroll_children()->end(); |
263 ++it) { | 270 ++it) { |
264 DCHECK_EQ((*it)->scroll_parent(), layer_impl); | 271 DCHECK_EQ((*it)->scroll_parent(), layer_impl); |
265 } | 272 } |
266 } | 273 } |
267 | 274 |
268 DCHECK_EQ(!!layer->clip_children(), !!layer_impl->clip_children()); | 275 if (layer_impl->clip_children()) { |
269 if (layer->clip_children()) { | |
270 for (std::set<Layer*>::iterator it = layer->clip_children()->begin(); | 276 for (std::set<Layer*>::iterator it = layer->clip_children()->begin(); |
271 it != layer->clip_children()->end(); | 277 it != layer->clip_children()->end(); |
272 ++it) { | 278 ++it) { |
273 DCHECK_EQ((*it)->clip_parent(), layer); | 279 DCHECK_EQ((*it)->clip_parent(), layer); |
274 } | 280 } |
275 for (std::set<LayerImpl*>::iterator it = | 281 for (std::set<LayerImpl*>::iterator it = |
276 layer_impl->clip_children()->begin(); | 282 layer_impl->clip_children()->begin(); |
277 it != layer_impl->clip_children()->end(); | 283 it != layer_impl->clip_children()->end(); |
278 ++it) { | 284 ++it) { |
279 DCHECK_EQ((*it)->clip_parent(), layer_impl); | 285 DCHECK_EQ((*it)->clip_parent(), layer_impl); |
(...skipping 16 matching lines...) Expand all Loading... |
296 #endif | 302 #endif |
297 } | 303 } |
298 | 304 |
299 void TreeSynchronizer::PushProperties(LayerImpl* layer, LayerImpl* layer_impl) { | 305 void TreeSynchronizer::PushProperties(LayerImpl* layer, LayerImpl* layer_impl) { |
300 size_t num_dependents_need_push_properties = 0; | 306 size_t num_dependents_need_push_properties = 0; |
301 PushPropertiesInternal( | 307 PushPropertiesInternal( |
302 layer, layer_impl, &num_dependents_need_push_properties); | 308 layer, layer_impl, &num_dependents_need_push_properties); |
303 } | 309 } |
304 | 310 |
305 } // namespace cc | 311 } // namespace cc |
OLD | NEW |