Chromium Code Reviews| 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/layer_tree_impl.h" | 5 #include "cc/layer_tree_impl.h" |
| 6 | 6 |
| 7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
| 8 #include "cc/heads_up_display_layer_impl.h" | 8 #include "cc/heads_up_display_layer_impl.h" |
| 9 #include "cc/layer_tree_host_common.h" | 9 #include "cc/layer_tree_host_common.h" |
| 10 #include "cc/layer_tree_host_impl.h" | 10 #include "cc/layer_tree_host_impl.h" |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 22 has_transparent_background_(false), | 22 has_transparent_background_(false), |
| 23 page_scale_factor_(1), | 23 page_scale_factor_(1), |
| 24 page_scale_delta_(1), | 24 page_scale_delta_(1), |
| 25 sent_page_scale_delta_(1), | 25 sent_page_scale_delta_(1), |
| 26 min_page_scale_factor_(0), | 26 min_page_scale_factor_(0), |
| 27 max_page_scale_factor_(0), | 27 max_page_scale_factor_(0), |
| 28 scrolling_layer_id_from_previous_tree_(0), | 28 scrolling_layer_id_from_previous_tree_(0), |
| 29 contents_textures_purged_(false), | 29 contents_textures_purged_(false), |
| 30 viewport_size_invalid_(false), | 30 viewport_size_invalid_(false), |
| 31 needs_update_draw_properties_(true), | 31 needs_update_draw_properties_(true), |
| 32 needs_update_tile_priorities_(false), | |
| 32 needs_full_tree_sync_(true) { | 33 needs_full_tree_sync_(true) { |
| 33 } | 34 } |
| 34 | 35 |
| 35 LayerTreeImpl::~LayerTreeImpl() { | 36 LayerTreeImpl::~LayerTreeImpl() { |
| 36 // Need to explicitly clear the tree prior to destroying this so that | 37 // Need to explicitly clear the tree prior to destroying this so that |
| 37 // the LayerTreeImpl pointer is still valid in the LayerImpl dtor. | 38 // the LayerTreeImpl pointer is still valid in the LayerImpl dtor. |
| 38 root_layer_.reset(); | 39 root_layer_.reset(); |
| 39 } | 40 } |
| 40 | 41 |
| 41 static LayerImpl* findRootScrollLayer(LayerImpl* layer) | 42 static LayerImpl* findRootScrollLayer(LayerImpl* layer) |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 212 } | 213 } |
| 213 | 214 |
| 214 struct UpdateTilePrioritiesForLayer { | 215 struct UpdateTilePrioritiesForLayer { |
| 215 void operator()(LayerImpl *layer) { | 216 void operator()(LayerImpl *layer) { |
| 216 layer->updateTilePriorities(); | 217 layer->updateTilePriorities(); |
| 217 } | 218 } |
| 218 }; | 219 }; |
| 219 | 220 |
| 220 void LayerTreeImpl::UpdateDrawProperties(UpdateDrawPropertiesReason reason) { | 221 void LayerTreeImpl::UpdateDrawProperties(UpdateDrawPropertiesReason reason) { |
| 221 if (!needs_update_draw_properties_) { | 222 if (!needs_update_draw_properties_) { |
| 222 if (reason == UPDATE_ACTIVE_TREE_FOR_DRAW && RootLayer()) | 223 if (needs_update_tile_priorities_ && RootLayer()) { |
| 224 DCHECK_EQ(UPDATE_ACTIVE_TREE_FOR_DRAW, reason); | |
|
enne (OOO)
2013/03/04 20:16:39
The change that added this UpdateDrawProperties re
| |
| 223 LayerTreeHostCommon::callFunctionForSubtree<UpdateTilePrioritiesForLayer>( | 225 LayerTreeHostCommon::callFunctionForSubtree<UpdateTilePrioritiesForLayer>( |
| 224 RootLayer()); | 226 RootLayer()); |
| 227 needs_update_tile_priorities_ = false; | |
| 228 } | |
| 225 return; | 229 return; |
| 226 } | 230 } |
| 227 | 231 |
| 228 needs_update_draw_properties_ = false; | 232 needs_update_draw_properties_ = false; |
| 233 needs_update_tile_priorities_ = true; | |
| 229 render_surface_layer_list_.clear(); | 234 render_surface_layer_list_.clear(); |
| 230 | 235 |
| 231 // For maxTextureSize. | 236 // For maxTextureSize. |
| 232 if (!layer_tree_host_impl_->renderer()) | 237 if (!layer_tree_host_impl_->renderer()) |
| 233 return; | 238 return; |
| 234 | 239 |
| 235 if (!RootLayer()) | 240 if (!RootLayer()) |
| 236 return; | 241 return; |
| 237 | 242 |
| 238 if (root_scroll_layer_) { | 243 if (root_scroll_layer_) { |
| 239 root_scroll_layer_->setImplTransform(ImplTransform()); | 244 root_scroll_layer_->setImplTransform(ImplTransform()); |
| 240 // Setting the impl transform re-sets this. | 245 // Setting the impl transform re-sets this. |
| 241 needs_update_draw_properties_ = false; | 246 needs_update_draw_properties_ = false; |
| 242 } | 247 } |
| 243 | 248 |
| 244 { | 249 { |
| 245 TRACE_EVENT1("cc", "LayerTreeImpl::UpdateDrawProperties", "IsActive", IsActi veTree()); | 250 TRACE_EVENT1("cc", "LayerTreeImpl::UpdateDrawProperties", "IsActive", IsActi veTree()); |
| 246 bool update_tile_priorities = | 251 bool update_tile_priorities = |
| 247 reason == UPDATE_PENDING_TREE || | 252 reason == UPDATE_PENDING_TREE || |
| 248 reason == UPDATE_ACTIVE_TREE_FOR_DRAW; | 253 reason == UPDATE_ACTIVE_TREE_FOR_DRAW; |
| 249 LayerTreeHostCommon::calculateDrawProperties( | 254 LayerTreeHostCommon::calculateDrawProperties( |
| 250 RootLayer(), | 255 RootLayer(), |
| 251 device_viewport_size(), | 256 device_viewport_size(), |
| 252 device_scale_factor(), | 257 device_scale_factor(), |
| 253 total_page_scale_factor(), | 258 total_page_scale_factor(), |
| 254 MaxTextureSize(), | 259 MaxTextureSize(), |
| 255 settings().canUseLCDText, | 260 settings().canUseLCDText, |
| 256 render_surface_layer_list_, | 261 render_surface_layer_list_, |
| 257 update_tile_priorities); | 262 update_tile_priorities); |
| 263 | |
| 264 if (update_tile_priorities) | |
| 265 needs_update_tile_priorities_ = false; | |
| 258 } | 266 } |
| 259 | 267 |
| 260 DCHECK(!needs_update_draw_properties_) << | 268 DCHECK(!needs_update_draw_properties_) << |
| 261 "calcDrawProperties should not set_needs_update_draw_properties()"; | 269 "calcDrawProperties should not set_needs_update_draw_properties()"; |
| 262 } | 270 } |
| 263 | 271 |
| 264 static void ClearRenderSurfacesOnLayerImplRecursive(LayerImpl* current) | 272 static void ClearRenderSurfacesOnLayerImplRecursive(LayerImpl* current) |
| 265 { | 273 { |
| 266 DCHECK(current); | 274 DCHECK(current); |
| 267 for (size_t i = 0; i < current->children().size(); ++i) | 275 for (size_t i = 0; i < current->children().size(); ++i) |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 466 | 474 |
| 467 DebugRectHistory* LayerTreeImpl::debug_rect_history() const { | 475 DebugRectHistory* LayerTreeImpl::debug_rect_history() const { |
| 468 return layer_tree_host_impl_->debugRectHistory(); | 476 return layer_tree_host_impl_->debugRectHistory(); |
| 469 } | 477 } |
| 470 | 478 |
| 471 AnimationRegistrar* LayerTreeImpl::animationRegistrar() const { | 479 AnimationRegistrar* LayerTreeImpl::animationRegistrar() const { |
| 472 return layer_tree_host_impl_->animationRegistrar(); | 480 return layer_tree_host_impl_->animationRegistrar(); |
| 473 } | 481 } |
| 474 | 482 |
| 475 } // namespace cc | 483 } // namespace cc |
| OLD | NEW |