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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 content_is_suitable_for_gpu_rasterization_(true), | 120 content_is_suitable_for_gpu_rasterization_(true), |
121 gpu_rasterization_histogram_recorded_(false), | 121 gpu_rasterization_histogram_recorded_(false), |
122 background_color_(SK_ColorWHITE), | 122 background_color_(SK_ColorWHITE), |
123 has_transparent_background_(false), | 123 has_transparent_background_(false), |
124 partial_texture_update_requests_(0), | 124 partial_texture_update_requests_(0), |
125 in_paint_layer_contents_(false), | 125 in_paint_layer_contents_(false), |
126 total_frames_used_for_lcd_text_metrics_(0), | 126 total_frames_used_for_lcd_text_metrics_(0), |
127 id_(s_layer_tree_host_sequence_number.GetNext() + 1), | 127 id_(s_layer_tree_host_sequence_number.GetNext() + 1), |
128 next_commit_forces_redraw_(false), | 128 next_commit_forces_redraw_(false), |
129 shared_bitmap_manager_(shared_bitmap_manager), | 129 shared_bitmap_manager_(shared_bitmap_manager), |
130 gpu_memory_buffer_manager_(gpu_memory_buffer_manager) { | 130 gpu_memory_buffer_manager_(gpu_memory_buffer_manager), |
| 131 render_surface_layer_list_id_(0) { |
131 if (settings_.accelerated_animation_enabled) | 132 if (settings_.accelerated_animation_enabled) |
132 animation_registrar_ = AnimationRegistrar::Create(); | 133 animation_registrar_ = AnimationRegistrar::Create(); |
133 rendering_stats_instrumentation_->set_record_rendering_stats( | 134 rendering_stats_instrumentation_->set_record_rendering_stats( |
134 debug_state_.RecordRenderingStats()); | 135 debug_state_.RecordRenderingStats()); |
135 } | 136 } |
136 | 137 |
137 void LayerTreeHost::InitializeThreaded( | 138 void LayerTreeHost::InitializeThreaded( |
138 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 139 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
139 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) { | 140 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) { |
140 InitializeProxy( | 141 InitializeProxy( |
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
825 if (!page_scale_layer && root_scroll) | 826 if (!page_scale_layer && root_scroll) |
826 page_scale_layer = root_scroll->parent(); | 827 page_scale_layer = root_scroll->parent(); |
827 | 828 |
828 if (hud_layer_.get()) { | 829 if (hud_layer_.get()) { |
829 hud_layer_->PrepareForCalculateDrawProperties( | 830 hud_layer_->PrepareForCalculateDrawProperties( |
830 device_viewport_size(), device_scale_factor_); | 831 device_viewport_size(), device_scale_factor_); |
831 } | 832 } |
832 | 833 |
833 TRACE_EVENT0("cc", "LayerTreeHost::UpdateLayers::CalcDrawProps"); | 834 TRACE_EVENT0("cc", "LayerTreeHost::UpdateLayers::CalcDrawProps"); |
834 bool can_render_to_separate_surface = true; | 835 bool can_render_to_separate_surface = true; |
835 // TODO(vmpstr): Passing 0 as the current render surface layer list id means | 836 ++render_surface_layer_list_id_; |
836 // that we won't be able to detect if a layer is part of |update_list|. | |
837 // Change this if this information is required. | |
838 int render_surface_layer_list_id = 0; | |
839 LayerTreeHostCommon::CalcDrawPropsMainInputs inputs( | 837 LayerTreeHostCommon::CalcDrawPropsMainInputs inputs( |
840 root_layer, | 838 root_layer, |
841 device_viewport_size(), | 839 device_viewport_size(), |
842 gfx::Transform(), | 840 gfx::Transform(), |
843 device_scale_factor_, | 841 device_scale_factor_, |
844 page_scale_factor_, | 842 page_scale_factor_, |
845 page_scale_layer, | 843 page_scale_layer, |
846 GetRendererCapabilities().max_texture_size, | 844 GetRendererCapabilities().max_texture_size, |
847 settings_.can_use_lcd_text, | 845 settings_.can_use_lcd_text, |
848 can_render_to_separate_surface, | 846 can_render_to_separate_surface, |
849 settings_.layer_transforms_should_scale_layer_contents, | 847 settings_.layer_transforms_should_scale_layer_contents, |
850 &update_list, | 848 &update_list, |
851 render_surface_layer_list_id); | 849 render_surface_layer_list_id_); |
852 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 850 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
853 | 851 |
854 if (total_frames_used_for_lcd_text_metrics_ <= | 852 if (total_frames_used_for_lcd_text_metrics_ <= |
855 kTotalFramesToUseForLCDTextMetrics) { | 853 kTotalFramesToUseForLCDTextMetrics) { |
856 LayerTreeHostCommon::CallFunctionForSubtree( | 854 LayerTreeHostCommon::CallFunctionForSubtree( |
857 root_layer, | 855 root_layer, |
858 base::Bind(&LayerTreeHost::CalculateLCDTextMetricsCallback, | 856 base::Bind(&LayerTreeHost::CalculateLCDTextMetricsCallback, |
859 base::Unretained(this))); | 857 base::Unretained(this))); |
860 total_frames_used_for_lcd_text_metrics_++; | 858 total_frames_used_for_lcd_text_metrics_++; |
861 } | 859 } |
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1340 swap_promise_list_.push_back(swap_promise.Pass()); | 1338 swap_promise_list_.push_back(swap_promise.Pass()); |
1341 } | 1339 } |
1342 | 1340 |
1343 void LayerTreeHost::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) { | 1341 void LayerTreeHost::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) { |
1344 for (size_t i = 0; i < swap_promise_list_.size(); i++) | 1342 for (size_t i = 0; i < swap_promise_list_.size(); i++) |
1345 swap_promise_list_[i]->DidNotSwap(reason); | 1343 swap_promise_list_[i]->DidNotSwap(reason); |
1346 swap_promise_list_.clear(); | 1344 swap_promise_list_.clear(); |
1347 } | 1345 } |
1348 | 1346 |
1349 } // namespace cc | 1347 } // namespace cc |
OLD | NEW |