| 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" |
| 11 #include "ui/gfx/vector2d_conversions.h" | 11 #include "ui/gfx/vector2d_conversions.h" |
| 12 | 12 |
| 13 namespace cc { | 13 namespace cc { |
| 14 | 14 |
| 15 LayerTreeImpl::LayerTreeImpl(LayerTreeHostImpl* layer_tree_host_impl) | 15 LayerTreeImpl::LayerTreeImpl(LayerTreeHostImpl* layer_tree_host_impl) |
| 16 : layer_tree_host_impl_(layer_tree_host_impl), | 16 : layer_tree_host_impl_(layer_tree_host_impl), |
| 17 source_frame_number_(-1), | 17 source_frame_number_(-1), |
| 18 hud_layer_(0), | 18 hud_layer_(0), |
| 19 root_scroll_layer_(0), | 19 root_scroll_layer_(0), |
| 20 currently_scrolling_layer_(0), | 20 currently_scrolling_layer_(0), |
| 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 viewport_size_invalid_(false), |
| 30 needs_update_draw_properties_(true), | 31 needs_update_draw_properties_(true), |
| 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 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 // LayerTreeHost::finishCommitOnImplThread(). | 98 // LayerTreeHost::finishCommitOnImplThread(). |
| 98 target_tree->set_source_frame_number(source_frame_number()); | 99 target_tree->set_source_frame_number(source_frame_number()); |
| 99 target_tree->set_background_color(background_color()); | 100 target_tree->set_background_color(background_color()); |
| 100 target_tree->set_has_transparent_background(has_transparent_background()); | 101 target_tree->set_has_transparent_background(has_transparent_background()); |
| 101 | 102 |
| 102 if (ContentsTexturesPurged()) | 103 if (ContentsTexturesPurged()) |
| 103 target_tree->SetContentsTexturesPurged(); | 104 target_tree->SetContentsTexturesPurged(); |
| 104 else | 105 else |
| 105 target_tree->ResetContentsTexturesPurged(); | 106 target_tree->ResetContentsTexturesPurged(); |
| 106 | 107 |
| 108 if (ViewportSizeInvalid()) |
| 109 target_tree->SetViewportSizeInvalid(); |
| 110 else |
| 111 target_tree->ResetViewportSizeInvalid(); |
| 112 |
| 107 if (hud_layer()) | 113 if (hud_layer()) |
| 108 target_tree->set_hud_layer(static_cast<HeadsUpDisplayLayerImpl*>( | 114 target_tree->set_hud_layer(static_cast<HeadsUpDisplayLayerImpl*>( |
| 109 LayerTreeHostCommon::findLayerInSubtree( | 115 LayerTreeHostCommon::findLayerInSubtree( |
| 110 target_tree->RootLayer(), hud_layer()->id()))); | 116 target_tree->RootLayer(), hud_layer()->id()))); |
| 111 else | 117 else |
| 112 target_tree->set_hud_layer(NULL); | 118 target_tree->set_hud_layer(NULL); |
| 113 } | 119 } |
| 114 | 120 |
| 115 LayerImpl* LayerTreeImpl::RootScrollLayer() { | 121 LayerImpl* LayerTreeImpl::RootScrollLayer() { |
| 116 DCHECK(IsActiveTree()); | 122 DCHECK(IsActiveTree()); |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 void LayerTreeImpl::SetContentsTexturesPurged() { | 345 void LayerTreeImpl::SetContentsTexturesPurged() { |
| 340 contents_textures_purged_ = true; | 346 contents_textures_purged_ = true; |
| 341 layer_tree_host_impl_->OnCanDrawStateChangedForTree(this); | 347 layer_tree_host_impl_->OnCanDrawStateChangedForTree(this); |
| 342 } | 348 } |
| 343 | 349 |
| 344 void LayerTreeImpl::ResetContentsTexturesPurged() { | 350 void LayerTreeImpl::ResetContentsTexturesPurged() { |
| 345 contents_textures_purged_ = false; | 351 contents_textures_purged_ = false; |
| 346 layer_tree_host_impl_->OnCanDrawStateChangedForTree(this); | 352 layer_tree_host_impl_->OnCanDrawStateChangedForTree(this); |
| 347 } | 353 } |
| 348 | 354 |
| 355 bool LayerTreeImpl::ViewportSizeInvalid() const { |
| 356 return viewport_size_invalid_; |
| 357 } |
| 358 |
| 359 void LayerTreeImpl::SetViewportSizeInvalid() { |
| 360 viewport_size_invalid_ = true; |
| 361 layer_tree_host_impl_->OnCanDrawStateChangedForTree(this); |
| 362 } |
| 363 |
| 364 void LayerTreeImpl::ResetViewportSizeInvalid() { |
| 365 viewport_size_invalid_ = false; |
| 366 layer_tree_host_impl_->OnCanDrawStateChangedForTree(this); |
| 367 } |
| 368 |
| 349 Proxy* LayerTreeImpl::proxy() const { | 369 Proxy* LayerTreeImpl::proxy() const { |
| 350 return layer_tree_host_impl_->proxy(); | 370 return layer_tree_host_impl_->proxy(); |
| 351 } | 371 } |
| 352 | 372 |
| 353 const LayerTreeSettings& LayerTreeImpl::settings() const { | 373 const LayerTreeSettings& LayerTreeImpl::settings() const { |
| 354 return layer_tree_host_impl_->settings(); | 374 return layer_tree_host_impl_->settings(); |
| 355 } | 375 } |
| 356 | 376 |
| 357 const RendererCapabilities& LayerTreeImpl::rendererCapabilities() const { | 377 const RendererCapabilities& LayerTreeImpl::rendererCapabilities() const { |
| 358 return layer_tree_host_impl_->rendererCapabilities(); | 378 return layer_tree_host_impl_->rendererCapabilities(); |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 | 466 |
| 447 DebugRectHistory* LayerTreeImpl::debug_rect_history() const { | 467 DebugRectHistory* LayerTreeImpl::debug_rect_history() const { |
| 448 return layer_tree_host_impl_->debugRectHistory(); | 468 return layer_tree_host_impl_->debugRectHistory(); |
| 449 } | 469 } |
| 450 | 470 |
| 451 AnimationRegistrar* LayerTreeImpl::animationRegistrar() const { | 471 AnimationRegistrar* LayerTreeImpl::animationRegistrar() const { |
| 452 return layer_tree_host_impl_->animationRegistrar(); | 472 return layer_tree_host_impl_->animationRegistrar(); |
| 453 } | 473 } |
| 454 | 474 |
| 455 } // namespace cc | 475 } // namespace cc |
| OLD | NEW |