| OLD | NEW |
| 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 Loading... |
| 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 if (RenderThreadImpl::current()->is_gpu_rasterization_enabled()) |
| 132 cmd->HasSwitch(switches::kEnableBleedingEdgeRenderingFastPaths); | 132 settings.rasterization_site = cc::LayerTreeSettings::GpuRasterization; |
| 133 else if (RenderThreadImpl::current()->is_hybrid_rasterization_enabled()) |
| 134 settings.rasterization_site = cc::LayerTreeSettings::HybridRasterization; |
| 135 else |
| 136 settings.rasterization_site = cc::LayerTreeSettings::CpuRasterization; |
| 133 | 137 |
| 134 settings.calculate_top_controls_position = | 138 settings.calculate_top_controls_position = |
| 135 cmd->HasSwitch(cc::switches::kEnableTopControlsPositionCalculation); | 139 cmd->HasSwitch(cc::switches::kEnableTopControlsPositionCalculation); |
| 136 if (cmd->HasSwitch(cc::switches::kTopControlsHeight)) { | 140 if (cmd->HasSwitch(cc::switches::kTopControlsHeight)) { |
| 137 std::string controls_height_str = | 141 std::string controls_height_str = |
| 138 cmd->GetSwitchValueASCII(cc::switches::kTopControlsHeight); | 142 cmd->GetSwitchValueASCII(cc::switches::kTopControlsHeight); |
| 139 double controls_height; | 143 double controls_height; |
| 140 if (base::StringToDouble(controls_height_str, &controls_height) && | 144 if (base::StringToDouble(controls_height_str, &controls_height) && |
| 141 controls_height > 0) | 145 controls_height > 0) |
| 142 settings.top_controls_height = controls_height; | 146 settings.top_controls_height = controls_height; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 164 double hide_threshold; | 168 double hide_threshold; |
| 165 if (base::StringToDouble(top_threshold_str, &hide_threshold) && | 169 if (base::StringToDouble(top_threshold_str, &hide_threshold) && |
| 166 hide_threshold >= 0.f && hide_threshold <= 1.f) | 170 hide_threshold >= 0.f && hide_threshold <= 1.f) |
| 167 settings.top_controls_hide_threshold = hide_threshold; | 171 settings.top_controls_hide_threshold = hide_threshold; |
| 168 } | 172 } |
| 169 | 173 |
| 170 settings.background_color_instead_of_checkerboard = | 174 settings.background_color_instead_of_checkerboard = |
| 171 cmd->HasSwitch(cc::switches::kBackgroundColorInsteadOfCheckerboard); | 175 cmd->HasSwitch(cc::switches::kBackgroundColorInsteadOfCheckerboard); |
| 172 settings.show_overdraw_in_tracing = | 176 settings.show_overdraw_in_tracing = |
| 173 cmd->HasSwitch(cc::switches::kTraceOverdraw); | 177 cmd->HasSwitch(cc::switches::kTraceOverdraw); |
| 174 settings.can_use_lcd_text = cc::switches::IsLCDTextEnabled(); | 178 settings.can_use_lcd_text = |
| 179 RenderThreadImpl::current()->is_lcd_text_enabled(); |
| 175 settings.use_pinch_virtual_viewport = | 180 settings.use_pinch_virtual_viewport = |
| 176 cmd->HasSwitch(cc::switches::kEnablePinchVirtualViewport); | 181 cmd->HasSwitch(cc::switches::kEnablePinchVirtualViewport); |
| 177 settings.allow_antialiasing &= | 182 settings.allow_antialiasing &= |
| 178 !cmd->HasSwitch(cc::switches::kDisableCompositedAntialiasing); | 183 !cmd->HasSwitch(cc::switches::kDisableCompositedAntialiasing); |
| 179 | 184 |
| 180 // These flags should be mirrored by UI versions in ui/compositor/. | 185 // These flags should be mirrored by UI versions in ui/compositor/. |
| 181 settings.initial_debug_state.show_debug_borders = | 186 settings.initial_debug_state.show_debug_borders = |
| 182 cmd->HasSwitch(cc::switches::kShowCompositedLayerBorders); | 187 cmd->HasSwitch(cc::switches::kShowCompositedLayerBorders); |
| 183 settings.initial_debug_state.show_fps_counter = | 188 settings.initial_debug_state.show_fps_counter = |
| 184 cmd->HasSwitch(cc::switches::kShowFPSCounter); | 189 cmd->HasSwitch(cc::switches::kShowFPSCounter); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 0, 100, | 235 0, 100, |
| 231 &max_unused_resource_memory_percentage)) { | 236 &max_unused_resource_memory_percentage)) { |
| 232 settings.max_unused_resource_memory_percentage = | 237 settings.max_unused_resource_memory_percentage = |
| 233 max_unused_resource_memory_percentage; | 238 max_unused_resource_memory_percentage; |
| 234 } | 239 } |
| 235 } | 240 } |
| 236 | 241 |
| 237 settings.strict_layer_property_change_checking = | 242 settings.strict_layer_property_change_checking = |
| 238 cmd->HasSwitch(cc::switches::kStrictLayerPropertyChangeChecking); | 243 cmd->HasSwitch(cc::switches::kStrictLayerPropertyChangeChecking); |
| 239 | 244 |
| 240 settings.use_map_image = cc::switches::IsMapImageEnabled(); | 245 settings.use_map_image = RenderThreadImpl::current()->is_map_image_enabled(); |
| 241 | 246 |
| 242 #if defined(OS_ANDROID) | 247 #if defined(OS_ANDROID) |
| 243 // TODO(danakj): Move these to the android code. | 248 // TODO(danakj): Move these to the android code. |
| 244 settings.max_partial_texture_updates = 0; | 249 settings.max_partial_texture_updates = 0; |
| 245 settings.scrollbar_animator = cc::LayerTreeSettings::LinearFade; | 250 settings.scrollbar_animator = cc::LayerTreeSettings::LinearFade; |
| 246 settings.solid_color_scrollbar_color = | 251 settings.solid_color_scrollbar_color = |
| 247 cmd->HasSwitch(switches::kHideScrollbars) | 252 cmd->HasSwitch(switches::kHideScrollbars) |
| 248 ? SK_ColorTRANSPARENT | 253 ? SK_ColorTRANSPARENT |
| 249 : SkColorSetARGB(128, 128, 128, 128); | 254 : SkColorSetARGB(128, 128, 128, 128); |
| 250 settings.highp_threshold_min = 2048; | 255 settings.highp_threshold_min = 2048; |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 634 widget_->OnSwapBuffersAborted(); | 639 widget_->OnSwapBuffersAborted(); |
| 635 } | 640 } |
| 636 | 641 |
| 637 void RenderWidgetCompositor::RateLimitSharedMainThreadContext() { | 642 void RenderWidgetCompositor::RateLimitSharedMainThreadContext() { |
| 638 cc::ContextProvider* provider = | 643 cc::ContextProvider* provider = |
| 639 RenderThreadImpl::current()->SharedMainThreadContextProvider().get(); | 644 RenderThreadImpl::current()->SharedMainThreadContextProvider().get(); |
| 640 provider->ContextGL()->RateLimitOffscreenContextCHROMIUM(); | 645 provider->ContextGL()->RateLimitOffscreenContextCHROMIUM(); |
| 641 } | 646 } |
| 642 | 647 |
| 643 } // namespace content | 648 } // namespace content |
| OLD | NEW |