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

Side by Side Diff: content/renderer/gpu/render_widget_compositor.cc

Issue 181063022: cc: Trigger GPU rasterization based on a per-layer hint (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move flags to RenderThreadImpl Created 6 years, 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "content/renderer/gpu/render_widget_compositor.h" 5 #include "content/renderer/gpu/render_widget_compositor.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <string> 8 #include <string>
9 9
10 #if defined(OS_ANDROID) 10 #if defined(OS_ANDROID)
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 int max_untiled_layer_height = settings.max_untiled_layer_size.height(); 119 int max_untiled_layer_height = settings.max_untiled_layer_size.height();
120 if (cmd->HasSwitch(switches::kMaxUntiledLayerHeight)) { 120 if (cmd->HasSwitch(switches::kMaxUntiledLayerHeight)) {
121 GetSwitchValueAsInt(*cmd, switches::kMaxUntiledLayerHeight, 1, 121 GetSwitchValueAsInt(*cmd, switches::kMaxUntiledLayerHeight, 1,
122 std::numeric_limits<int>::max(), 122 std::numeric_limits<int>::max(),
123 &max_untiled_layer_height); 123 &max_untiled_layer_height);
124 } 124 }
125 125
126 settings.max_untiled_layer_size = gfx::Size(max_untiled_layer_width, 126 settings.max_untiled_layer_size = gfx::Size(max_untiled_layer_width,
127 max_untiled_layer_height); 127 max_untiled_layer_height);
128 128
129 settings.impl_side_painting = cc::switches::IsImplSidePaintingEnabled(); 129 settings.impl_side_painting =
130 settings.gpu_rasterization = 130 RenderThreadImpl::current()->is_impl_side_painting_enabled();
131 cc::switches::IsGpuRasterizationEnabled() || 131 webkit::WebLayerImpl::SetImplSidePaintingEnabled(settings.impl_side_painting);
piman 2014/03/07 19:41:04 nit: I'd rather do that in RendetThreadImpl::Init.
ajuma 2014/03/07 20:21:11 Done.
132 cmd->HasSwitch(switches::kEnableBleedingEdgeRenderingFastPaths); 132 if (RenderThreadImpl::current()->is_gpu_rasterization_enabled())
133 settings.rasterization_site = cc::LayerTreeSettings::GpuRasterization;
134 else if (RenderThreadImpl::current()->is_hybrid_rasterization_enabled())
135 settings.rasterization_site = cc::LayerTreeSettings::HybridRasterization;
136 else
137 settings.rasterization_site = cc::LayerTreeSettings::CpuRasterization;
133 138
134 settings.calculate_top_controls_position = 139 settings.calculate_top_controls_position =
135 cmd->HasSwitch(cc::switches::kEnableTopControlsPositionCalculation); 140 cmd->HasSwitch(cc::switches::kEnableTopControlsPositionCalculation);
136 if (cmd->HasSwitch(cc::switches::kTopControlsHeight)) { 141 if (cmd->HasSwitch(cc::switches::kTopControlsHeight)) {
137 std::string controls_height_str = 142 std::string controls_height_str =
138 cmd->GetSwitchValueASCII(cc::switches::kTopControlsHeight); 143 cmd->GetSwitchValueASCII(cc::switches::kTopControlsHeight);
139 double controls_height; 144 double controls_height;
140 if (base::StringToDouble(controls_height_str, &controls_height) && 145 if (base::StringToDouble(controls_height_str, &controls_height) &&
141 controls_height > 0) 146 controls_height > 0)
142 settings.top_controls_height = controls_height; 147 settings.top_controls_height = controls_height;
(...skipping 21 matching lines...) Expand all
164 double hide_threshold; 169 double hide_threshold;
165 if (base::StringToDouble(top_threshold_str, &hide_threshold) && 170 if (base::StringToDouble(top_threshold_str, &hide_threshold) &&
166 hide_threshold >= 0.f && hide_threshold <= 1.f) 171 hide_threshold >= 0.f && hide_threshold <= 1.f)
167 settings.top_controls_hide_threshold = hide_threshold; 172 settings.top_controls_hide_threshold = hide_threshold;
168 } 173 }
169 174
170 settings.background_color_instead_of_checkerboard = 175 settings.background_color_instead_of_checkerboard =
171 cmd->HasSwitch(cc::switches::kBackgroundColorInsteadOfCheckerboard); 176 cmd->HasSwitch(cc::switches::kBackgroundColorInsteadOfCheckerboard);
172 settings.show_overdraw_in_tracing = 177 settings.show_overdraw_in_tracing =
173 cmd->HasSwitch(cc::switches::kTraceOverdraw); 178 cmd->HasSwitch(cc::switches::kTraceOverdraw);
174 settings.can_use_lcd_text = cc::switches::IsLCDTextEnabled(); 179 settings.can_use_lcd_text =
180 RenderThreadImpl::current()->is_lcd_text_enabled();
175 settings.use_pinch_virtual_viewport = 181 settings.use_pinch_virtual_viewport =
176 cmd->HasSwitch(cc::switches::kEnablePinchVirtualViewport); 182 cmd->HasSwitch(cc::switches::kEnablePinchVirtualViewport);
177 settings.allow_antialiasing &= 183 settings.allow_antialiasing &=
178 !cmd->HasSwitch(cc::switches::kDisableCompositedAntialiasing); 184 !cmd->HasSwitch(cc::switches::kDisableCompositedAntialiasing);
179 185
180 // These flags should be mirrored by UI versions in ui/compositor/. 186 // These flags should be mirrored by UI versions in ui/compositor/.
181 settings.initial_debug_state.show_debug_borders = 187 settings.initial_debug_state.show_debug_borders =
182 cmd->HasSwitch(cc::switches::kShowCompositedLayerBorders); 188 cmd->HasSwitch(cc::switches::kShowCompositedLayerBorders);
183 settings.initial_debug_state.show_fps_counter = 189 settings.initial_debug_state.show_fps_counter =
184 cmd->HasSwitch(cc::switches::kShowFPSCounter); 190 cmd->HasSwitch(cc::switches::kShowFPSCounter);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 0, 100, 236 0, 100,
231 &max_unused_resource_memory_percentage)) { 237 &max_unused_resource_memory_percentage)) {
232 settings.max_unused_resource_memory_percentage = 238 settings.max_unused_resource_memory_percentage =
233 max_unused_resource_memory_percentage; 239 max_unused_resource_memory_percentage;
234 } 240 }
235 } 241 }
236 242
237 settings.strict_layer_property_change_checking = 243 settings.strict_layer_property_change_checking =
238 cmd->HasSwitch(cc::switches::kStrictLayerPropertyChangeChecking); 244 cmd->HasSwitch(cc::switches::kStrictLayerPropertyChangeChecking);
239 245
240 settings.use_map_image = cc::switches::IsMapImageEnabled(); 246 settings.use_map_image = RenderThreadImpl::current()->is_map_image_enabled();
241 247
242 #if defined(OS_ANDROID) 248 #if defined(OS_ANDROID)
243 // TODO(danakj): Move these to the android code. 249 // TODO(danakj): Move these to the android code.
244 settings.max_partial_texture_updates = 0; 250 settings.max_partial_texture_updates = 0;
245 settings.scrollbar_animator = cc::LayerTreeSettings::LinearFade; 251 settings.scrollbar_animator = cc::LayerTreeSettings::LinearFade;
246 settings.solid_color_scrollbar_color = 252 settings.solid_color_scrollbar_color =
247 cmd->HasSwitch(switches::kHideScrollbars) 253 cmd->HasSwitch(switches::kHideScrollbars)
248 ? SK_ColorTRANSPARENT 254 ? SK_ColorTRANSPARENT
249 : SkColorSetARGB(128, 128, 128, 128); 255 : SkColorSetARGB(128, 128, 128, 128);
250 settings.highp_threshold_min = 2048; 256 settings.highp_threshold_min = 2048;
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 widget_->OnSwapBuffersAborted(); 640 widget_->OnSwapBuffersAborted();
635 } 641 }
636 642
637 void RenderWidgetCompositor::RateLimitSharedMainThreadContext() { 643 void RenderWidgetCompositor::RateLimitSharedMainThreadContext() {
638 cc::ContextProvider* provider = 644 cc::ContextProvider* provider =
639 RenderThreadImpl::current()->SharedMainThreadContextProvider().get(); 645 RenderThreadImpl::current()->SharedMainThreadContextProvider().get();
640 provider->ContextGL()->RateLimitOffscreenContextCHROMIUM(); 646 provider->ContextGL()->RateLimitOffscreenContextCHROMIUM();
641 } 647 }
642 648
643 } // namespace content 649 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698