| 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_acked_(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->SetUIResourceEvictionCountAcked( |
| 131 ui_resource_eviction_count_acked()); |
| 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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 } | 379 } |
| 376 | 380 |
| 377 void LayerTreeImpl::DidBecomeActive() { | 381 void LayerTreeImpl::DidBecomeActive() { |
| 378 if (!root_layer()) | 382 if (!root_layer()) |
| 379 return; | 383 return; |
| 380 | 384 |
| 381 DidBecomeActiveRecursive(root_layer()); | 385 DidBecomeActiveRecursive(root_layer()); |
| 382 FindRootScrollLayer(); | 386 FindRootScrollLayer(); |
| 383 } | 387 } |
| 384 | 388 |
| 389 void LayerTreeImpl::SetUIResourceEvictionCountAcked( |
| 390 uint64 ui_resource_eviction_count_acked) { |
| 391 if (ui_resource_eviction_count_acked == ui_resource_eviction_count_acked_) |
| 392 return; |
| 393 |
| 394 ui_resource_eviction_count_acked_ = ui_resource_eviction_count_acked; |
| 395 layer_tree_host_impl_->OnCanDrawStateChangedForTree(); |
| 396 } |
| 397 |
| 385 bool LayerTreeImpl::ContentsTexturesPurged() const { | 398 bool LayerTreeImpl::ContentsTexturesPurged() const { |
| 386 return contents_textures_purged_; | 399 return contents_textures_purged_; |
| 387 } | 400 } |
| 388 | 401 |
| 389 void LayerTreeImpl::SetContentsTexturesPurged() { | 402 void LayerTreeImpl::SetContentsTexturesPurged() { |
| 390 if (contents_textures_purged_) | 403 if (contents_textures_purged_) |
| 391 return; | 404 return; |
| 392 contents_textures_purged_ = true; | 405 contents_textures_purged_ = true; |
| 393 layer_tree_host_impl_->OnCanDrawStateChangedForTree(); | 406 layer_tree_host_impl_->OnCanDrawStateChangedForTree(); |
| 394 } | 407 } |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 612 UIResourceRequest req = ui_resource_request_queue_.front(); | 625 UIResourceRequest req = ui_resource_request_queue_.front(); |
| 613 ui_resource_request_queue_.pop_front(); | 626 ui_resource_request_queue_.pop_front(); |
| 614 | 627 |
| 615 switch (req.type) { | 628 switch (req.type) { |
| 616 case UIResourceRequest::UIResourceCreate: | 629 case UIResourceRequest::UIResourceCreate: |
| 617 layer_tree_host_impl_->CreateUIResource(req.id, req.bitmap); | 630 layer_tree_host_impl_->CreateUIResource(req.id, req.bitmap); |
| 618 break; | 631 break; |
| 619 case UIResourceRequest::UIResourceDelete: | 632 case UIResourceRequest::UIResourceDelete: |
| 620 layer_tree_host_impl_->DeleteUIResource(req.id); | 633 layer_tree_host_impl_->DeleteUIResource(req.id); |
| 621 break; | 634 break; |
| 635 case UIResourceRequest::UIResourceEvictionAck: |
| 636 SetUIResourceEvictionCountAcked(req.ack); |
| 637 break; |
| 622 case UIResourceRequest::UIResourceInvalidRequest: | 638 case UIResourceRequest::UIResourceInvalidRequest: |
| 623 NOTREACHED(); | 639 NOTREACHED(); |
| 624 break; | 640 break; |
| 625 } | 641 } |
| 626 } | 642 } |
| 627 } | 643 } |
| 628 | 644 |
| 629 void LayerTreeImpl::AddLayerWithCopyOutputRequest(LayerImpl* layer) { | 645 void LayerTreeImpl::AddLayerWithCopyOutputRequest(LayerImpl* layer) { |
| 630 // Only the active tree needs to know about layers with copy requests, as | 646 // Only the active tree needs to know about layers with copy requests, as |
| 631 // they are aborted if not serviced during draw. | 647 // they are aborted if not serviced during draw. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 653 const std::vector<LayerImpl*> LayerTreeImpl::LayersWithCopyOutputRequest() | 669 const std::vector<LayerImpl*> LayerTreeImpl::LayersWithCopyOutputRequest() |
| 654 const { | 670 const { |
| 655 // Only the active tree needs to know about layers with copy requests, as | 671 // Only the active tree needs to know about layers with copy requests, as |
| 656 // they are aborted if not serviced during draw. | 672 // they are aborted if not serviced during draw. |
| 657 DCHECK(IsActiveTree()); | 673 DCHECK(IsActiveTree()); |
| 658 | 674 |
| 659 return layers_with_copy_output_request_; | 675 return layers_with_copy_output_request_; |
| 660 } | 676 } |
| 661 | 677 |
| 662 } // namespace cc | 678 } // namespace cc |
| OLD | NEW |