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 <stddef.h> | 7 #include <stddef.h> |
8 #include <limits> | 8 #include <limits> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 | 391 |
392 #if defined(OS_ANDROID) | 392 #if defined(OS_ANDROID) |
393 bool using_synchronous_compositor = | 393 bool using_synchronous_compositor = |
394 GetContentClient()->UsingSynchronousCompositing(); | 394 GetContentClient()->UsingSynchronousCompositing(); |
395 | 395 |
396 // We can't use GPU rasterization on low-end devices, because the Ganesh | 396 // We can't use GPU rasterization on low-end devices, because the Ganesh |
397 // cache would consume too much memory. | 397 // cache would consume too much memory. |
398 if (base::SysInfo::IsLowEndDevice()) | 398 if (base::SysInfo::IsLowEndDevice()) |
399 settings.gpu_rasterization_enabled = false; | 399 settings.gpu_rasterization_enabled = false; |
400 settings.using_synchronous_renderer_compositor = using_synchronous_compositor; | 400 settings.using_synchronous_renderer_compositor = using_synchronous_compositor; |
401 // Also hide scrollbars for Android WebView, since it uses system scrollbars. | 401 if (using_synchronous_compositor) { |
402 if (ui::ShouldHideScrollbars() || using_synchronous_compositor) { | 402 // Android WebView uses system scrollbars, so make ours invisible. |
403 settings.scrollbar_animator = cc::LayerTreeSettings::NO_ANIMATOR; | 403 settings.scrollbar_animator = cc::LayerTreeSettings::NO_ANIMATOR; |
404 settings.solid_color_scrollbar_color = SK_ColorTRANSPARENT; | 404 settings.solid_color_scrollbar_color = SK_ColorTRANSPARENT; |
405 } else { | 405 } else { |
406 settings.scrollbar_animator = cc::LayerTreeSettings::LINEAR_FADE; | 406 settings.scrollbar_animator = cc::LayerTreeSettings::LINEAR_FADE; |
407 settings.scrollbar_fade_delay_ms = 300; | 407 settings.scrollbar_fade_delay_ms = 300; |
408 settings.scrollbar_fade_resize_delay_ms = 2000; | 408 settings.scrollbar_fade_resize_delay_ms = 2000; |
409 settings.scrollbar_fade_duration_ms = 300; | 409 settings.scrollbar_fade_duration_ms = 300; |
410 settings.solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128); | 410 settings.solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128); |
411 } | 411 } |
412 settings.renderer_settings.highp_threshold_min = 2048; | 412 settings.renderer_settings.highp_threshold_min = 2048; |
(...skipping 20 matching lines...) Expand all Loading... |
433 settings.max_memory_for_prepaint_percentage = 50; | 433 settings.max_memory_for_prepaint_percentage = 50; |
434 } | 434 } |
435 // Webview does not own the surface so should not clear it. | 435 // Webview does not own the surface so should not clear it. |
436 settings.renderer_settings.should_clear_root_render_pass = | 436 settings.renderer_settings.should_clear_root_render_pass = |
437 !using_synchronous_compositor; | 437 !using_synchronous_compositor; |
438 | 438 |
439 // TODO(danakj): Only do this on low end devices. | 439 // TODO(danakj): Only do this on low end devices. |
440 settings.create_low_res_tiling = true; | 440 settings.create_low_res_tiling = true; |
441 #else // defined(OS_ANDROID) | 441 #else // defined(OS_ANDROID) |
442 #if !defined(OS_MACOSX) | 442 #if !defined(OS_MACOSX) |
443 if (ui::ShouldHideScrollbars()) { | 443 if (ui::IsOverlayScrollbarEnabled()) { |
444 settings.scrollbar_animator = cc::LayerTreeSettings::NO_ANIMATOR; | |
445 settings.solid_color_scrollbar_color = SK_ColorTRANSPARENT; | |
446 } else if (ui::IsOverlayScrollbarEnabled()) { | |
447 settings.scrollbar_animator = cc::LayerTreeSettings::THINNING; | 444 settings.scrollbar_animator = cc::LayerTreeSettings::THINNING; |
448 settings.solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128); | 445 settings.solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128); |
449 } else { | 446 } else { |
450 settings.scrollbar_animator = cc::LayerTreeSettings::LINEAR_FADE; | 447 settings.scrollbar_animator = cc::LayerTreeSettings::LINEAR_FADE; |
451 settings.solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128); | 448 settings.solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128); |
452 } | 449 } |
453 settings.scrollbar_fade_delay_ms = 500; | 450 settings.scrollbar_fade_delay_ms = 500; |
454 settings.scrollbar_fade_resize_delay_ms = 500; | 451 settings.scrollbar_fade_resize_delay_ms = 500; |
455 settings.scrollbar_fade_duration_ms = 300; | 452 settings.scrollbar_fade_duration_ms = 300; |
456 #endif // !defined(OS_MACOSX) | 453 #endif // !defined(OS_MACOSX) |
(...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1143 | 1140 |
1144 remote_proto_channel_receiver_->OnProtoReceived(std::move(deserialized)); | 1141 remote_proto_channel_receiver_->OnProtoReceived(std::move(deserialized)); |
1145 } | 1142 } |
1146 | 1143 |
1147 void RenderWidgetCompositor::SetPaintedDeviceScaleFactor( | 1144 void RenderWidgetCompositor::SetPaintedDeviceScaleFactor( |
1148 float device_scale) { | 1145 float device_scale) { |
1149 layer_tree_host_->GetLayerTree()->SetPaintedDeviceScaleFactor(device_scale); | 1146 layer_tree_host_->GetLayerTree()->SetPaintedDeviceScaleFactor(device_scale); |
1150 } | 1147 } |
1151 | 1148 |
1152 } // namespace content | 1149 } // namespace content |
OLD | NEW |