| 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 10 matching lines...) Expand all Loading... |
| 21 background_color_(0), | 21 background_color_(0), |
| 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 needs_update_draw_properties_(true), | 30 needs_update_draw_properties_(true), |
| 31 needs_update_tile_priorities_(false), |
| 31 needs_full_tree_sync_(true) { | 32 needs_full_tree_sync_(true) { |
| 32 } | 33 } |
| 33 | 34 |
| 34 LayerTreeImpl::~LayerTreeImpl() { | 35 LayerTreeImpl::~LayerTreeImpl() { |
| 35 // Need to explicitly clear the tree prior to destroying this so that | 36 // Need to explicitly clear the tree prior to destroying this so that |
| 36 // the LayerTreeImpl pointer is still valid in the LayerImpl dtor. | 37 // the LayerTreeImpl pointer is still valid in the LayerImpl dtor. |
| 37 root_layer_.reset(); | 38 root_layer_.reset(); |
| 38 } | 39 } |
| 39 | 40 |
| 40 static LayerImpl* findRootScrollLayer(LayerImpl* layer) | 41 static LayerImpl* findRootScrollLayer(LayerImpl* layer) |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 } | 207 } |
| 207 | 208 |
| 208 struct UpdateTilePrioritiesForLayer { | 209 struct UpdateTilePrioritiesForLayer { |
| 209 void operator()(LayerImpl *layer) { | 210 void operator()(LayerImpl *layer) { |
| 210 layer->updateTilePriorities(); | 211 layer->updateTilePriorities(); |
| 211 } | 212 } |
| 212 }; | 213 }; |
| 213 | 214 |
| 214 void LayerTreeImpl::UpdateDrawProperties(UpdateDrawPropertiesReason reason) { | 215 void LayerTreeImpl::UpdateDrawProperties(UpdateDrawPropertiesReason reason) { |
| 215 if (!needs_update_draw_properties_) { | 216 if (!needs_update_draw_properties_) { |
| 216 if (reason == UPDATE_ACTIVE_TREE_FOR_DRAW && RootLayer()) | 217 if (needs_update_tile_priorities_ && RootLayer()) { |
| 218 DCHECK_EQ(UPDATE_ACTIVE_TREE_FOR_DRAW, reason); |
| 217 LayerTreeHostCommon::callFunctionForSubtree<UpdateTilePrioritiesForLayer>( | 219 LayerTreeHostCommon::callFunctionForSubtree<UpdateTilePrioritiesForLayer>( |
| 218 RootLayer()); | 220 RootLayer()); |
| 221 needs_update_tile_priorities_ = false; |
| 222 } |
| 219 return; | 223 return; |
| 220 } | 224 } |
| 221 | 225 |
| 222 needs_update_draw_properties_ = false; | 226 needs_update_draw_properties_ = false; |
| 227 needs_update_tile_priorities_ = true; |
| 223 render_surface_layer_list_.clear(); | 228 render_surface_layer_list_.clear(); |
| 224 | 229 |
| 225 // For maxTextureSize. | 230 // For maxTextureSize. |
| 226 if (!layer_tree_host_impl_->renderer()) | 231 if (!layer_tree_host_impl_->renderer()) |
| 227 return; | 232 return; |
| 228 | 233 |
| 229 if (!RootLayer()) | 234 if (!RootLayer()) |
| 230 return; | 235 return; |
| 231 | 236 |
| 232 if (root_scroll_layer_) { | 237 if (root_scroll_layer_) { |
| 233 root_scroll_layer_->setImplTransform(ImplTransform()); | 238 root_scroll_layer_->setImplTransform(ImplTransform()); |
| 234 // Setting the impl transform re-sets this. | 239 // Setting the impl transform re-sets this. |
| 235 needs_update_draw_properties_ = false; | 240 needs_update_draw_properties_ = false; |
| 236 } | 241 } |
| 237 | 242 |
| 238 { | 243 { |
| 239 TRACE_EVENT1("cc", "LayerTreeImpl::UpdateDrawProperties", "IsActive", IsActi
veTree()); | 244 TRACE_EVENT1("cc", "LayerTreeImpl::UpdateDrawProperties", "IsActive", IsActi
veTree()); |
| 240 bool update_tile_priorities = | 245 bool update_tile_priorities = |
| 241 reason == UPDATE_PENDING_TREE || | 246 reason == UPDATE_PENDING_TREE || |
| 242 reason == UPDATE_ACTIVE_TREE_FOR_DRAW; | 247 reason == UPDATE_ACTIVE_TREE_FOR_DRAW; |
| 243 LayerTreeHostCommon::calculateDrawProperties( | 248 LayerTreeHostCommon::calculateDrawProperties( |
| 244 RootLayer(), | 249 RootLayer(), |
| 245 device_viewport_size(), | 250 device_viewport_size(), |
| 246 device_scale_factor(), | 251 device_scale_factor(), |
| 247 total_page_scale_factor(), | 252 total_page_scale_factor(), |
| 248 MaxTextureSize(), | 253 MaxTextureSize(), |
| 249 settings().canUseLCDText, | 254 settings().canUseLCDText, |
| 250 render_surface_layer_list_, | 255 render_surface_layer_list_, |
| 251 update_tile_priorities); | 256 update_tile_priorities); |
| 257 |
| 258 if (update_tile_priorities) |
| 259 needs_update_tile_priorities_ = false; |
| 252 } | 260 } |
| 253 | 261 |
| 254 DCHECK(!needs_update_draw_properties_) << | 262 DCHECK(!needs_update_draw_properties_) << |
| 255 "calcDrawProperties should not set_needs_update_draw_properties()"; | 263 "calcDrawProperties should not set_needs_update_draw_properties()"; |
| 256 } | 264 } |
| 257 | 265 |
| 258 static void ClearRenderSurfacesOnLayerImplRecursive(LayerImpl* current) | 266 static void ClearRenderSurfacesOnLayerImplRecursive(LayerImpl* current) |
| 259 { | 267 { |
| 260 DCHECK(current); | 268 DCHECK(current); |
| 261 for (size_t i = 0; i < current->children().size(); ++i) | 269 for (size_t i = 0; i < current->children().size(); ++i) |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 | 454 |
| 447 DebugRectHistory* LayerTreeImpl::debug_rect_history() const { | 455 DebugRectHistory* LayerTreeImpl::debug_rect_history() const { |
| 448 return layer_tree_host_impl_->debugRectHistory(); | 456 return layer_tree_host_impl_->debugRectHistory(); |
| 449 } | 457 } |
| 450 | 458 |
| 451 AnimationRegistrar* LayerTreeImpl::animationRegistrar() const { | 459 AnimationRegistrar* LayerTreeImpl::animationRegistrar() const { |
| 452 return layer_tree_host_impl_->animationRegistrar(); | 460 return layer_tree_host_impl_->animationRegistrar(); |
| 453 } | 461 } |
| 454 | 462 |
| 455 } // namespace cc | 463 } // namespace cc |
| OLD | NEW |