Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(749)

Side by Side Diff: cc/trees/layer_tree_host.cc

Issue 548963002: Generalize scroll parent work in CalculateDrawProperties Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 has_gpu_rasterization_trigger_(false), 116 has_gpu_rasterization_trigger_(false),
117 content_is_suitable_for_gpu_rasterization_(true), 117 content_is_suitable_for_gpu_rasterization_(true),
118 gpu_rasterization_histogram_recorded_(false), 118 gpu_rasterization_histogram_recorded_(false),
119 background_color_(SK_ColorWHITE), 119 background_color_(SK_ColorWHITE),
120 has_transparent_background_(false), 120 has_transparent_background_(false),
121 partial_texture_update_requests_(0), 121 partial_texture_update_requests_(0),
122 in_paint_layer_contents_(false), 122 in_paint_layer_contents_(false),
123 total_frames_used_for_lcd_text_metrics_(0), 123 total_frames_used_for_lcd_text_metrics_(0),
124 id_(s_layer_tree_host_sequence_number.GetNext() + 1), 124 id_(s_layer_tree_host_sequence_number.GetNext() + 1),
125 next_commit_forces_redraw_(false), 125 next_commit_forces_redraw_(false),
126 shared_bitmap_manager_(manager) { 126 shared_bitmap_manager_(manager),
127 render_surface_layer_list_id_(0) {
127 if (settings_.accelerated_animation_enabled) 128 if (settings_.accelerated_animation_enabled)
128 animation_registrar_ = AnimationRegistrar::Create(); 129 animation_registrar_ = AnimationRegistrar::Create();
129 rendering_stats_instrumentation_->set_record_rendering_stats( 130 rendering_stats_instrumentation_->set_record_rendering_stats(
130 debug_state_.RecordRenderingStats()); 131 debug_state_.RecordRenderingStats());
131 } 132 }
132 133
133 void LayerTreeHost::InitializeThreaded( 134 void LayerTreeHost::InitializeThreaded(
134 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, 135 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
135 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) { 136 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) {
136 InitializeProxy( 137 InitializeProxy(
(...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after
820 if (!page_scale_layer && root_scroll) 821 if (!page_scale_layer && root_scroll)
821 page_scale_layer = root_scroll->parent(); 822 page_scale_layer = root_scroll->parent();
822 823
823 if (hud_layer_.get()) { 824 if (hud_layer_.get()) {
824 hud_layer_->PrepareForCalculateDrawProperties( 825 hud_layer_->PrepareForCalculateDrawProperties(
825 device_viewport_size(), device_scale_factor_); 826 device_viewport_size(), device_scale_factor_);
826 } 827 }
827 828
828 TRACE_EVENT0("cc", "LayerTreeHost::UpdateLayers::CalcDrawProps"); 829 TRACE_EVENT0("cc", "LayerTreeHost::UpdateLayers::CalcDrawProps");
829 bool can_render_to_separate_surface = true; 830 bool can_render_to_separate_surface = true;
830 // TODO(vmpstr): Passing 0 as the current render surface layer list id means 831 ++render_surface_layer_list_id_;
831 // that we won't be able to detect if a layer is part of |update_list|.
832 // Change this if this information is required.
833 int render_surface_layer_list_id = 0;
834 LayerTreeHostCommon::CalcDrawPropsMainInputs inputs( 832 LayerTreeHostCommon::CalcDrawPropsMainInputs inputs(
835 root_layer, 833 root_layer,
836 device_viewport_size(), 834 device_viewport_size(),
837 gfx::Transform(), 835 gfx::Transform(),
838 device_scale_factor_, 836 device_scale_factor_,
839 page_scale_factor_, 837 page_scale_factor_,
840 page_scale_layer, 838 page_scale_layer,
841 GetRendererCapabilities().max_texture_size, 839 GetRendererCapabilities().max_texture_size,
842 settings_.can_use_lcd_text, 840 settings_.can_use_lcd_text,
843 can_render_to_separate_surface, 841 can_render_to_separate_surface,
844 settings_.layer_transforms_should_scale_layer_contents, 842 settings_.layer_transforms_should_scale_layer_contents,
845 &update_list, 843 &update_list,
846 render_surface_layer_list_id); 844 render_surface_layer_list_id_);
847 LayerTreeHostCommon::CalculateDrawProperties(&inputs); 845 LayerTreeHostCommon::CalculateDrawProperties(&inputs);
848 846
849 if (total_frames_used_for_lcd_text_metrics_ <= 847 if (total_frames_used_for_lcd_text_metrics_ <=
850 kTotalFramesToUseForLCDTextMetrics) { 848 kTotalFramesToUseForLCDTextMetrics) {
851 LayerTreeHostCommon::CallFunctionForSubtree( 849 LayerTreeHostCommon::CallFunctionForSubtree(
852 root_layer, 850 root_layer,
853 base::Bind(&LayerTreeHost::CalculateLCDTextMetricsCallback, 851 base::Bind(&LayerTreeHost::CalculateLCDTextMetricsCallback,
854 base::Unretained(this))); 852 base::Unretained(this)));
855 total_frames_used_for_lcd_text_metrics_++; 853 total_frames_used_for_lcd_text_metrics_++;
856 } 854 }
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
1324 swap_promise_list_.push_back(swap_promise.Pass()); 1322 swap_promise_list_.push_back(swap_promise.Pass());
1325 } 1323 }
1326 1324
1327 void LayerTreeHost::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) { 1325 void LayerTreeHost::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) {
1328 for (size_t i = 0; i < swap_promise_list_.size(); i++) 1326 for (size_t i = 0; i < swap_promise_list_.size(); i++)
1329 swap_promise_list_[i]->DidNotSwap(reason); 1327 swap_promise_list_[i]->DidNotSwap(reason);
1330 swap_promise_list_.clear(); 1328 swap_promise_list_.clear();
1331 } 1329 }
1332 1330
1333 } // namespace cc 1331 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698