| 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/layer_tree_impl.h" | 5 #include "cc/trees/layer_tree_impl.h" |
| 6 | 6 |
| 7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
| 8 #include "cc/animation/keyframed_animation_curve.h" | 8 #include "cc/animation/keyframed_animation_curve.h" |
| 9 #include "cc/animation/scrollbar_animation_controller.h" | 9 #include "cc/animation/scrollbar_animation_controller.h" |
| 10 #include "cc/debug/traced_value.h" | 10 #include "cc/debug/traced_value.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 currently_scrolling_layer_(NULL), | 26 currently_scrolling_layer_(NULL), |
| 27 root_layer_scroll_offset_delegate_(NULL), | 27 root_layer_scroll_offset_delegate_(NULL), |
| 28 background_color_(0), | 28 background_color_(0), |
| 29 has_transparent_background_(false), | 29 has_transparent_background_(false), |
| 30 page_scale_factor_(1), | 30 page_scale_factor_(1), |
| 31 page_scale_delta_(1), | 31 page_scale_delta_(1), |
| 32 sent_page_scale_delta_(1), | 32 sent_page_scale_delta_(1), |
| 33 min_page_scale_factor_(0), | 33 min_page_scale_factor_(0), |
| 34 max_page_scale_factor_(0), | 34 max_page_scale_factor_(0), |
| 35 scrolling_layer_id_from_previous_tree_(0), | 35 scrolling_layer_id_from_previous_tree_(0), |
| 36 ui_resource_eviction_count_recreated_(0), |
| 36 contents_textures_purged_(false), | 37 contents_textures_purged_(false), |
| 37 viewport_size_invalid_(false), | 38 viewport_size_invalid_(false), |
| 38 needs_update_draw_properties_(true), | 39 needs_update_draw_properties_(true), |
| 39 needs_full_tree_sync_(true) { | 40 needs_full_tree_sync_(true) { |
| 40 } | 41 } |
| 41 | 42 |
| 42 LayerTreeImpl::~LayerTreeImpl() { | 43 LayerTreeImpl::~LayerTreeImpl() { |
| 43 // Need to explicitly clear the tree prior to destroying this so that | 44 // Need to explicitly clear the tree prior to destroying this so that |
| 44 // the LayerTreeImpl pointer is still valid in the LayerImpl dtor. | 45 // the LayerTreeImpl pointer is still valid in the LayerImpl dtor. |
| 45 root_layer_.reset(); | 46 root_layer_.reset(); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 // LayerTreeHost::finishCommitOnImplThread(). | 120 // LayerTreeHost::finishCommitOnImplThread(). |
| 120 target_tree->set_source_frame_number(source_frame_number()); | 121 target_tree->set_source_frame_number(source_frame_number()); |
| 121 target_tree->set_background_color(background_color()); | 122 target_tree->set_background_color(background_color()); |
| 122 target_tree->set_has_transparent_background(has_transparent_background()); | 123 target_tree->set_has_transparent_background(has_transparent_background()); |
| 123 | 124 |
| 124 if (ContentsTexturesPurged()) | 125 if (ContentsTexturesPurged()) |
| 125 target_tree->SetContentsTexturesPurged(); | 126 target_tree->SetContentsTexturesPurged(); |
| 126 else | 127 else |
| 127 target_tree->ResetContentsTexturesPurged(); | 128 target_tree->ResetContentsTexturesPurged(); |
| 128 | 129 |
| 130 target_tree->SetUIResourceEvictionCountRecreated( |
| 131 ui_resource_eviction_count_recreated()); |
| 132 |
| 129 if (ViewportSizeInvalid()) | 133 if (ViewportSizeInvalid()) |
| 130 target_tree->SetViewportSizeInvalid(); | 134 target_tree->SetViewportSizeInvalid(); |
| 131 else | 135 else |
| 132 target_tree->ResetViewportSizeInvalid(); | 136 target_tree->ResetViewportSizeInvalid(); |
| 133 | 137 |
| 134 if (hud_layer()) | 138 if (hud_layer()) |
| 135 target_tree->set_hud_layer(static_cast<HeadsUpDisplayLayerImpl*>( | 139 target_tree->set_hud_layer(static_cast<HeadsUpDisplayLayerImpl*>( |
| 136 LayerTreeHostCommon::FindLayerInSubtree( | 140 LayerTreeHostCommon::FindLayerInSubtree( |
| 137 target_tree->root_layer(), hud_layer()->id()))); | 141 target_tree->root_layer(), hud_layer()->id()))); |
| 138 else | 142 else |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 } | 380 } |
| 377 | 381 |
| 378 void LayerTreeImpl::DidBecomeActive() { | 382 void LayerTreeImpl::DidBecomeActive() { |
| 379 if (!root_layer()) | 383 if (!root_layer()) |
| 380 return; | 384 return; |
| 381 | 385 |
| 382 DidBecomeActiveRecursive(root_layer()); | 386 DidBecomeActiveRecursive(root_layer()); |
| 383 FindRootScrollLayer(); | 387 FindRootScrollLayer(); |
| 384 } | 388 } |
| 385 | 389 |
| 390 void LayerTreeImpl::SetUIResourceEvictionCountRecreated( |
| 391 uint64 ui_resource_eviction_count_recreated) { |
| 392 if (ui_resource_eviction_count_recreated == |
| 393 ui_resource_eviction_count_recreated_) |
| 394 return; |
| 395 |
| 396 ui_resource_eviction_count_recreated_ = ui_resource_eviction_count_recreated; |
| 397 layer_tree_host_impl_->OnCanDrawStateChangedForTree(); |
| 398 } |
| 399 |
| 386 bool LayerTreeImpl::ContentsTexturesPurged() const { | 400 bool LayerTreeImpl::ContentsTexturesPurged() const { |
| 387 return contents_textures_purged_; | 401 return contents_textures_purged_; |
| 388 } | 402 } |
| 389 | 403 |
| 390 void LayerTreeImpl::SetContentsTexturesPurged() { | 404 void LayerTreeImpl::SetContentsTexturesPurged() { |
| 391 if (contents_textures_purged_) | 405 if (contents_textures_purged_) |
| 392 return; | 406 return; |
| 393 contents_textures_purged_ = true; | 407 contents_textures_purged_ = true; |
| 394 layer_tree_host_impl_->OnCanDrawStateChangedForTree(); | 408 layer_tree_host_impl_->OnCanDrawStateChangedForTree(); |
| 395 } | 409 } |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 617 UIResourceRequest req = ui_resource_request_queue_.front(); | 631 UIResourceRequest req = ui_resource_request_queue_.front(); |
| 618 ui_resource_request_queue_.pop_front(); | 632 ui_resource_request_queue_.pop_front(); |
| 619 | 633 |
| 620 switch (req.type) { | 634 switch (req.type) { |
| 621 case UIResourceRequest::UIResourceCreate: | 635 case UIResourceRequest::UIResourceCreate: |
| 622 layer_tree_host_impl_->CreateUIResource(req.id, req.bitmap); | 636 layer_tree_host_impl_->CreateUIResource(req.id, req.bitmap); |
| 623 break; | 637 break; |
| 624 case UIResourceRequest::UIResourceDelete: | 638 case UIResourceRequest::UIResourceDelete: |
| 625 layer_tree_host_impl_->DeleteUIResource(req.id); | 639 layer_tree_host_impl_->DeleteUIResource(req.id); |
| 626 break; | 640 break; |
| 641 case UIResourceRequest::UIResourceEvictionRecreated: |
| 642 SetUIResourceEvictionCountRecreated(req.eviction_count_recreated); |
| 643 break; |
| 627 case UIResourceRequest::UIResourceInvalidRequest: | 644 case UIResourceRequest::UIResourceInvalidRequest: |
| 628 NOTREACHED(); | 645 NOTREACHED(); |
| 629 break; | 646 break; |
| 630 } | 647 } |
| 631 } | 648 } |
| 632 } | 649 } |
| 633 | 650 |
| 634 void LayerTreeImpl::AddLayerWithCopyOutputRequest(LayerImpl* layer) { | 651 void LayerTreeImpl::AddLayerWithCopyOutputRequest(LayerImpl* layer) { |
| 635 // Only the active tree needs to know about layers with copy requests, as | 652 // Only the active tree needs to know about layers with copy requests, as |
| 636 // they are aborted if not serviced during draw. | 653 // they are aborted if not serviced during draw. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 658 const std::vector<LayerImpl*> LayerTreeImpl::LayersWithCopyOutputRequest() | 675 const std::vector<LayerImpl*> LayerTreeImpl::LayersWithCopyOutputRequest() |
| 659 const { | 676 const { |
| 660 // Only the active tree needs to know about layers with copy requests, as | 677 // Only the active tree needs to know about layers with copy requests, as |
| 661 // they are aborted if not serviced during draw. | 678 // they are aborted if not serviced during draw. |
| 662 DCHECK(IsActiveTree()); | 679 DCHECK(IsActiveTree()); |
| 663 | 680 |
| 664 return layers_with_copy_output_request_; | 681 return layers_with_copy_output_request_; |
| 665 } | 682 } |
| 666 | 683 |
| 667 } // namespace cc | 684 } // namespace cc |
| OLD | NEW |