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/trees/layer_tree_impl.h" | 5 #include "cc/trees/layer_tree_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 74 gfx::ScrollOffset last_set_scroll_offset_; | 74 gfx::ScrollOffset last_set_scroll_offset_; |
| 75 }; | 75 }; |
| 76 | 76 |
| 77 LayerTreeImpl::LayerTreeImpl( | 77 LayerTreeImpl::LayerTreeImpl( |
| 78 LayerTreeHostImpl* layer_tree_host_impl, | 78 LayerTreeHostImpl* layer_tree_host_impl, |
| 79 scoped_refptr<SyncedProperty<ScaleGroup>> page_scale_factor, | 79 scoped_refptr<SyncedProperty<ScaleGroup>> page_scale_factor, |
| 80 scoped_refptr<SyncedTopControls> top_controls_shown_ratio, | 80 scoped_refptr<SyncedTopControls> top_controls_shown_ratio, |
| 81 scoped_refptr<SyncedElasticOverscroll> elastic_overscroll) | 81 scoped_refptr<SyncedElasticOverscroll> elastic_overscroll) |
| 82 : layer_tree_host_impl_(layer_tree_host_impl), | 82 : layer_tree_host_impl_(layer_tree_host_impl), |
| 83 source_frame_number_(-1), | 83 source_frame_number_(-1), |
| 84 last_update_draw_properties_frame_number_(-1), | |
| 84 hud_layer_(0), | 85 hud_layer_(0), |
| 85 currently_scrolling_layer_(NULL), | 86 currently_scrolling_layer_(NULL), |
| 86 root_layer_scroll_offset_delegate_(NULL), | 87 root_layer_scroll_offset_delegate_(NULL), |
| 87 background_color_(0), | 88 background_color_(0), |
| 88 has_transparent_background_(false), | 89 has_transparent_background_(false), |
| 89 overscroll_elasticity_layer_(NULL), | 90 overscroll_elasticity_layer_(NULL), |
| 90 page_scale_layer_(NULL), | 91 page_scale_layer_(NULL), |
| 91 inner_viewport_scroll_layer_(NULL), | 92 inner_viewport_scroll_layer_(NULL), |
| 92 outer_viewport_scroll_layer_(NULL), | 93 outer_viewport_scroll_layer_(NULL), |
| 93 page_scale_factor_(page_scale_factor), | 94 page_scale_factor_(page_scale_factor), |
| (...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 640 } | 641 } |
| 641 } | 642 } |
| 642 | 643 |
| 643 occlusion_tracker.LeaveLayer(it); | 644 occlusion_tracker.LeaveLayer(it); |
| 644 } | 645 } |
| 645 | 646 |
| 646 unoccluded_screen_space_region_ = | 647 unoccluded_screen_space_region_ = |
| 647 occlusion_tracker.ComputeVisibleRegionInScreen(); | 648 occlusion_tracker.ComputeVisibleRegionInScreen(); |
| 648 } | 649 } |
| 649 | 650 |
| 651 // It'd be ideal if this could be done earlier, but when the raster source | |
| 652 // is updated from the main thread during push properties, update draw | |
| 653 // properties has not occurred yet and so it's not clear whether or not the | |
| 654 // layer can or cannot use lcd text. So, this is the cleanup pass to | |
| 655 // determine if the raster source needs to be replaced with a non-lcd | |
| 656 // raster source due to draw properties. | |
| 657 // | |
| 658 // TODO(enne): Make LTHI::sync_tree return this value. | |
| 659 LayerTreeImpl* sync_tree = | |
| 660 layer_tree_host_impl_->proxy()->CommitToActiveTree() | |
| 661 ? layer_tree_host_impl_->active_tree() | |
| 662 : layer_tree_host_impl_->pending_tree(); | |
| 663 if (this == sync_tree && | |
| 664 source_frame_number_ != last_update_draw_properties_frame_number_) { | |
|
danakj
2015/02/18 19:54:47
Mmmmmmh. What if we instead pass a bool to UDP() t
enne (OOO)
2015/02/18 19:59:05
Since there's UDP called at different times on dif
| |
| 665 for (const auto& layer : picture_layers_) | |
| 666 layer->UpdateCanUseLCDTextAfterCommit(); | |
| 667 } | |
| 668 last_update_draw_properties_frame_number_ = source_frame_number_; | |
| 669 | |
| 650 { | 670 { |
| 651 TRACE_EVENT_BEGIN2("cc", "LayerTreeImpl::UpdateDrawProperties::UpdateTiles", | 671 TRACE_EVENT_BEGIN2("cc", "LayerTreeImpl::UpdateDrawProperties::UpdateTiles", |
| 652 "IsActive", IsActiveTree(), "SourceFrameNumber", | 672 "IsActive", IsActiveTree(), "SourceFrameNumber", |
| 653 source_frame_number_); | 673 source_frame_number_); |
| 654 const bool resourceless_software_draw = | 674 const bool resourceless_software_draw = |
| 655 (layer_tree_host_impl_->GetDrawMode() == | 675 (layer_tree_host_impl_->GetDrawMode() == |
| 656 DRAW_MODE_RESOURCELESS_SOFTWARE); | 676 DRAW_MODE_RESOURCELESS_SOFTWARE); |
| 657 size_t layers_updated_count = 0; | 677 size_t layers_updated_count = 0; |
| 658 bool tile_priorities_updated = false; | 678 bool tile_priorities_updated = false; |
| 659 for (PictureLayerImpl* layer : picture_layers_) { | 679 for (PictureLayerImpl* layer : picture_layers_) { |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 852 } | 872 } |
| 853 | 873 |
| 854 bool LayerTreeImpl::IsPendingTree() const { | 874 bool LayerTreeImpl::IsPendingTree() const { |
| 855 return layer_tree_host_impl_->pending_tree() == this; | 875 return layer_tree_host_impl_->pending_tree() == this; |
| 856 } | 876 } |
| 857 | 877 |
| 858 bool LayerTreeImpl::IsRecycleTree() const { | 878 bool LayerTreeImpl::IsRecycleTree() const { |
| 859 return layer_tree_host_impl_->recycle_tree() == this; | 879 return layer_tree_host_impl_->recycle_tree() == this; |
| 860 } | 880 } |
| 861 | 881 |
| 882 bool LayerTreeImpl::IsSyncTree() const { | |
| 883 return layer_tree_host_impl_->sync_tree() == this; | |
| 884 } | |
| 885 | |
| 862 LayerImpl* LayerTreeImpl::FindActiveTreeLayerById(int id) { | 886 LayerImpl* LayerTreeImpl::FindActiveTreeLayerById(int id) { |
| 863 LayerTreeImpl* tree = layer_tree_host_impl_->active_tree(); | 887 LayerTreeImpl* tree = layer_tree_host_impl_->active_tree(); |
| 864 if (!tree) | 888 if (!tree) |
| 865 return NULL; | 889 return NULL; |
| 866 return tree->LayerById(id); | 890 return tree->LayerById(id); |
| 867 } | 891 } |
| 868 | 892 |
| 869 LayerImpl* LayerTreeImpl::FindPendingTreeLayerById(int id) { | 893 LayerImpl* LayerTreeImpl::FindPendingTreeLayerById(int id) { |
| 870 LayerTreeImpl* tree = layer_tree_host_impl_->pending_tree(); | 894 LayerTreeImpl* tree = layer_tree_host_impl_->pending_tree(); |
| 871 if (!tree) | 895 if (!tree) |
| (...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1621 scoped_ptr<PendingPageScaleAnimation> pending_animation) { | 1645 scoped_ptr<PendingPageScaleAnimation> pending_animation) { |
| 1622 pending_page_scale_animation_ = pending_animation.Pass(); | 1646 pending_page_scale_animation_ = pending_animation.Pass(); |
| 1623 } | 1647 } |
| 1624 | 1648 |
| 1625 scoped_ptr<PendingPageScaleAnimation> | 1649 scoped_ptr<PendingPageScaleAnimation> |
| 1626 LayerTreeImpl::TakePendingPageScaleAnimation() { | 1650 LayerTreeImpl::TakePendingPageScaleAnimation() { |
| 1627 return pending_page_scale_animation_.Pass(); | 1651 return pending_page_scale_animation_.Pass(); |
| 1628 } | 1652 } |
| 1629 | 1653 |
| 1630 } // namespace cc | 1654 } // namespace cc |
| OLD | NEW |