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_host.h" | 5 #include "cc/trees/layer_tree_host.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <stack> | 8 #include <stack> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 device_scale_factor_(1.f), | 104 device_scale_factor_(1.f), |
105 visible_(true), | 105 visible_(true), |
106 page_scale_factor_(1.f), | 106 page_scale_factor_(1.f), |
107 min_page_scale_factor_(1.f), | 107 min_page_scale_factor_(1.f), |
108 max_page_scale_factor_(1.f), | 108 max_page_scale_factor_(1.f), |
109 has_gpu_rasterization_trigger_(false), | 109 has_gpu_rasterization_trigger_(false), |
110 content_is_suitable_for_gpu_rasterization_(true), | 110 content_is_suitable_for_gpu_rasterization_(true), |
111 gpu_rasterization_histogram_recorded_(false), | 111 gpu_rasterization_histogram_recorded_(false), |
112 background_color_(SK_ColorWHITE), | 112 background_color_(SK_ColorWHITE), |
113 has_transparent_background_(false), | 113 has_transparent_background_(false), |
114 partial_texture_update_requests_(0), | |
115 did_complete_scale_animation_(false), | 114 did_complete_scale_animation_(false), |
116 in_paint_layer_contents_(false), | 115 in_paint_layer_contents_(false), |
117 id_(s_layer_tree_host_sequence_number.GetNext() + 1), | 116 id_(s_layer_tree_host_sequence_number.GetNext() + 1), |
118 next_commit_forces_redraw_(false), | 117 next_commit_forces_redraw_(false), |
119 shared_bitmap_manager_(params->shared_bitmap_manager), | 118 shared_bitmap_manager_(params->shared_bitmap_manager), |
120 gpu_memory_buffer_manager_(params->gpu_memory_buffer_manager), | 119 gpu_memory_buffer_manager_(params->gpu_memory_buffer_manager), |
121 task_graph_runner_(params->task_graph_runner), | 120 task_graph_runner_(params->task_graph_runner), |
122 surface_id_namespace_(0u), | 121 surface_id_namespace_(0u), |
123 next_surface_sequence_(1u) { | 122 next_surface_sequence_(1u) { |
124 DCHECK_IMPLIES(settings_.impl_side_painting, task_graph_runner_); | 123 DCHECK_IMPLIES(settings_.impl_side_painting, task_graph_runner_); |
(...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
864 } | 863 } |
865 | 864 |
866 void LayerTreeHost::RateLimit() { | 865 void LayerTreeHost::RateLimit() { |
867 // Force a no-op command on the compositor context, so that any ratelimiting | 866 // Force a no-op command on the compositor context, so that any ratelimiting |
868 // commands will wait for the compositing context, and therefore for the | 867 // commands will wait for the compositing context, and therefore for the |
869 // SwapBuffers. | 868 // SwapBuffers. |
870 proxy_->ForceSerializeOnSwapBuffers(); | 869 proxy_->ForceSerializeOnSwapBuffers(); |
871 client_->RateLimitSharedMainThreadContext(); | 870 client_->RateLimitSharedMainThreadContext(); |
872 } | 871 } |
873 | 872 |
874 bool LayerTreeHost::AlwaysUsePartialTextureUpdates() { | |
875 if (!proxy_->GetRendererCapabilities().allow_partial_texture_updates) | |
876 return false; | |
877 return !proxy_->HasImplThread(); | |
878 } | |
879 | |
880 size_t LayerTreeHost::MaxPartialTextureUpdates() const { | |
881 size_t max_partial_texture_updates = 0; | |
882 if (proxy_->GetRendererCapabilities().allow_partial_texture_updates && | |
883 !settings_.impl_side_painting) { | |
884 max_partial_texture_updates = | |
885 std::min(settings_.max_partial_texture_updates, | |
886 proxy_->MaxPartialTextureUpdates()); | |
887 } | |
888 return max_partial_texture_updates; | |
889 } | |
890 | |
891 bool LayerTreeHost::RequestPartialTextureUpdate() { | |
892 if (partial_texture_update_requests_ >= MaxPartialTextureUpdates()) | |
893 return false; | |
894 | |
895 partial_texture_update_requests_++; | |
896 return true; | |
897 } | |
898 | |
899 void LayerTreeHost::SetDeviceScaleFactor(float device_scale_factor) { | 873 void LayerTreeHost::SetDeviceScaleFactor(float device_scale_factor) { |
900 if (device_scale_factor == device_scale_factor_) | 874 if (device_scale_factor == device_scale_factor_) |
901 return; | 875 return; |
902 device_scale_factor_ = device_scale_factor; | 876 device_scale_factor_ = device_scale_factor; |
903 | 877 |
904 property_trees_.needs_rebuild = true; | 878 property_trees_.needs_rebuild = true; |
905 SetNeedsCommit(); | 879 SetNeedsCommit(); |
906 } | 880 } |
907 | 881 |
908 void LayerTreeHost::UpdateTopControlsState(TopControlsState constraints, | 882 void LayerTreeHost::UpdateTopControlsState(TopControlsState constraints, |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1070 } | 1044 } |
1071 | 1045 |
1072 void LayerTreeHost::RecordFrameTimingEvents( | 1046 void LayerTreeHost::RecordFrameTimingEvents( |
1073 scoped_ptr<FrameTimingTracker::CompositeTimingSet> composite_events, | 1047 scoped_ptr<FrameTimingTracker::CompositeTimingSet> composite_events, |
1074 scoped_ptr<FrameTimingTracker::MainFrameTimingSet> main_frame_events) { | 1048 scoped_ptr<FrameTimingTracker::MainFrameTimingSet> main_frame_events) { |
1075 client_->RecordFrameTimingEvents(composite_events.Pass(), | 1049 client_->RecordFrameTimingEvents(composite_events.Pass(), |
1076 main_frame_events.Pass()); | 1050 main_frame_events.Pass()); |
1077 } | 1051 } |
1078 | 1052 |
1079 } // namespace cc | 1053 } // namespace cc |
OLD | NEW |