| 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 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 std::string top_threshold_str = | 268 std::string top_threshold_str = |
| 269 cmd->GetSwitchValueASCII(cc::switches::kTopControlsHideThreshold); | 269 cmd->GetSwitchValueASCII(cc::switches::kTopControlsHideThreshold); |
| 270 double hide_threshold; | 270 double hide_threshold; |
| 271 if (base::StringToDouble(top_threshold_str, &hide_threshold) && | 271 if (base::StringToDouble(top_threshold_str, &hide_threshold) && |
| 272 hide_threshold >= 0.f && hide_threshold <= 1.f) | 272 hide_threshold >= 0.f && hide_threshold <= 1.f) |
| 273 settings.top_controls_hide_threshold = hide_threshold; | 273 settings.top_controls_hide_threshold = hide_threshold; |
| 274 } | 274 } |
| 275 | 275 |
| 276 settings.use_pinch_virtual_viewport = | 276 settings.use_pinch_virtual_viewport = |
| 277 cmd->HasSwitch(cc::switches::kEnablePinchVirtualViewport); | 277 cmd->HasSwitch(cc::switches::kEnablePinchVirtualViewport); |
| 278 settings.allow_antialiasing &= | 278 settings.renderer_settings.allow_antialiasing &= |
| 279 !cmd->HasSwitch(cc::switches::kDisableCompositedAntialiasing); | 279 !cmd->HasSwitch(cc::switches::kDisableCompositedAntialiasing); |
| 280 settings.single_thread_proxy_scheduler = | 280 settings.single_thread_proxy_scheduler = |
| 281 !cmd->HasSwitch(switches::kDisableSingleThreadProxyScheduler); | 281 !cmd->HasSwitch(switches::kDisableSingleThreadProxyScheduler); |
| 282 | 282 |
| 283 // These flags should be mirrored by UI versions in ui/compositor/. | 283 // These flags should be mirrored by UI versions in ui/compositor/. |
| 284 settings.initial_debug_state.show_debug_borders = | 284 settings.initial_debug_state.show_debug_borders = |
| 285 cmd->HasSwitch(cc::switches::kShowCompositedLayerBorders); | 285 cmd->HasSwitch(cc::switches::kShowCompositedLayerBorders); |
| 286 settings.initial_debug_state.show_fps_counter = | 286 settings.initial_debug_state.show_fps_counter = |
| 287 cmd->HasSwitch(cc::switches::kShowFPSCounter); | 287 cmd->HasSwitch(cc::switches::kShowFPSCounter); |
| 288 settings.initial_debug_state.show_layer_animation_bounds_rects = | 288 settings.initial_debug_state.show_layer_animation_bounds_rects = |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 // Android WebView uses system scrollbars, so make ours invisible. | 356 // Android WebView uses system scrollbars, so make ours invisible. |
| 357 settings.scrollbar_animator = cc::LayerTreeSettings::NoAnimator; | 357 settings.scrollbar_animator = cc::LayerTreeSettings::NoAnimator; |
| 358 settings.solid_color_scrollbar_color = SK_ColorTRANSPARENT; | 358 settings.solid_color_scrollbar_color = SK_ColorTRANSPARENT; |
| 359 } else { | 359 } else { |
| 360 settings.scrollbar_animator = cc::LayerTreeSettings::LinearFade; | 360 settings.scrollbar_animator = cc::LayerTreeSettings::LinearFade; |
| 361 settings.scrollbar_fade_delay_ms = 300; | 361 settings.scrollbar_fade_delay_ms = 300; |
| 362 settings.scrollbar_fade_resize_delay_ms = 2000; | 362 settings.scrollbar_fade_resize_delay_ms = 2000; |
| 363 settings.scrollbar_fade_duration_ms = 300; | 363 settings.scrollbar_fade_duration_ms = 300; |
| 364 settings.solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128); | 364 settings.solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128); |
| 365 } | 365 } |
| 366 settings.highp_threshold_min = 2048; | 366 settings.renderer_settings.highp_threshold_min = 2048; |
| 367 // Android WebView handles root layer flings itself. | 367 // Android WebView handles root layer flings itself. |
| 368 settings.ignore_root_layer_flings = | 368 settings.ignore_root_layer_flings = |
| 369 synchronous_compositor_factory; | 369 synchronous_compositor_factory; |
| 370 // Memory policy on Android WebView does not depend on whether device is | 370 // Memory policy on Android WebView does not depend on whether device is |
| 371 // low end, so always use default policy. | 371 // low end, so always use default policy. |
| 372 bool is_low_end_device = | 372 bool is_low_end_device = |
| 373 base::SysInfo::IsLowEndDevice() && !synchronous_compositor_factory; | 373 base::SysInfo::IsLowEndDevice() && !synchronous_compositor_factory; |
| 374 // RGBA_4444 textures are only enabled for low end devices | 374 // RGBA_4444 textures are only enabled for low end devices |
| 375 // and are disabled for Android WebView as it doesn't support the format. | 375 // and are disabled for Android WebView as it doesn't support the format. |
| 376 settings.use_rgba_4444_textures = is_low_end_device; | 376 settings.renderer_settings.use_rgba_4444_textures = is_low_end_device; |
| 377 if (is_low_end_device) { | 377 if (is_low_end_device) { |
| 378 // On low-end we want to be very carefull about killing other | 378 // On low-end we want to be very carefull about killing other |
| 379 // apps. So initially we use 50% more memory to avoid flickering | 379 // apps. So initially we use 50% more memory to avoid flickering |
| 380 // or raster-on-demand. | 380 // or raster-on-demand. |
| 381 settings.max_memory_for_prepaint_percentage = 67; | 381 settings.max_memory_for_prepaint_percentage = 67; |
| 382 } else { | 382 } else { |
| 383 // On other devices we have increased memory excessively to avoid | 383 // On other devices we have increased memory excessively to avoid |
| 384 // raster-on-demand already, so now we reserve 50% _only_ to avoid | 384 // raster-on-demand already, so now we reserve 50% _only_ to avoid |
| 385 // raster-on-demand, and use 50% of the memory otherwise. | 385 // raster-on-demand, and use 50% of the memory otherwise. |
| 386 settings.max_memory_for_prepaint_percentage = 50; | 386 settings.max_memory_for_prepaint_percentage = 50; |
| 387 } | 387 } |
| 388 // Webview does not own the surface so should not clear it. | 388 // Webview does not own the surface so should not clear it. |
| 389 settings.should_clear_root_render_pass = | 389 settings.renderer_settings.should_clear_root_render_pass = |
| 390 !synchronous_compositor_factory; | 390 !synchronous_compositor_factory; |
| 391 | 391 |
| 392 // TODO(danakj): Only do this on low end devices. | 392 // TODO(danakj): Only do this on low end devices. |
| 393 settings.create_low_res_tiling = true; | 393 settings.create_low_res_tiling = true; |
| 394 | 394 |
| 395 #elif !defined(OS_MACOSX) | 395 #elif !defined(OS_MACOSX) |
| 396 if (ui::IsOverlayScrollbarEnabled()) { | 396 if (ui::IsOverlayScrollbarEnabled()) { |
| 397 settings.scrollbar_animator = cc::LayerTreeSettings::Thinning; | 397 settings.scrollbar_animator = cc::LayerTreeSettings::Thinning; |
| 398 settings.solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128); | 398 settings.solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128); |
| 399 } else if (cmd->HasSwitch(cc::switches::kEnablePinchVirtualViewport)) { | 399 } else if (cmd->HasSwitch(cc::switches::kEnablePinchVirtualViewport)) { |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 895 widget_->OnSwapBuffersAborted(); | 895 widget_->OnSwapBuffersAborted(); |
| 896 } | 896 } |
| 897 | 897 |
| 898 void RenderWidgetCompositor::RateLimitSharedMainThreadContext() { | 898 void RenderWidgetCompositor::RateLimitSharedMainThreadContext() { |
| 899 cc::ContextProvider* provider = | 899 cc::ContextProvider* provider = |
| 900 RenderThreadImpl::current()->SharedMainThreadContextProvider().get(); | 900 RenderThreadImpl::current()->SharedMainThreadContextProvider().get(); |
| 901 provider->ContextGL()->RateLimitOffscreenContextCHROMIUM(); | 901 provider->ContextGL()->RateLimitOffscreenContextCHROMIUM(); |
| 902 } | 902 } |
| 903 | 903 |
| 904 } // namespace content | 904 } // namespace content |
| OLD | NEW |