| 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 | 8 |
| 9 #include <cmath> | 9 #include <cmath> |
| 10 #include <limits> | 10 #include <limits> |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 if (using_synchronous_compositor) { | 391 if (using_synchronous_compositor) { |
| 392 // Android WebView uses system scrollbars, so make ours invisible. | 392 // Android WebView uses system scrollbars, so make ours invisible. |
| 393 // http://crbug.com/677348: This can't be done using hide_scrollbars | 393 // http://crbug.com/677348: This can't be done using hide_scrollbars |
| 394 // setting because supporting -webkit custom scrollbars is still desired | 394 // setting because supporting -webkit custom scrollbars is still desired |
| 395 // on sublayers. | 395 // on sublayers. |
| 396 settings.scrollbar_animator = cc::LayerTreeSettings::NO_ANIMATOR; | 396 settings.scrollbar_animator = cc::LayerTreeSettings::NO_ANIMATOR; |
| 397 settings.solid_color_scrollbar_color = SK_ColorTRANSPARENT; | 397 settings.solid_color_scrollbar_color = SK_ColorTRANSPARENT; |
| 398 } else { | 398 } else { |
| 399 settings.scrollbar_animator = cc::LayerTreeSettings::ANDROID_OVERLAY; | 399 settings.scrollbar_animator = cc::LayerTreeSettings::ANDROID_OVERLAY; |
| 400 settings.scrollbar_fade_delay = base::TimeDelta::FromMilliseconds(300); | 400 settings.scrollbar_fade_delay = base::TimeDelta::FromMilliseconds(300); |
| 401 settings.scrollbar_fade_out_resize_delay = | |
| 402 base::TimeDelta::FromMilliseconds(2000); | |
| 403 settings.scrollbar_fade_duration = base::TimeDelta::FromMilliseconds(300); | 401 settings.scrollbar_fade_duration = base::TimeDelta::FromMilliseconds(300); |
| 404 settings.solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128); | 402 settings.solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128); |
| 405 } | 403 } |
| 406 settings.renderer_settings.highp_threshold_min = 2048; | 404 settings.renderer_settings.highp_threshold_min = 2048; |
| 407 // Android WebView handles root layer flings itself. | 405 // Android WebView handles root layer flings itself. |
| 408 settings.ignore_root_layer_flings = using_synchronous_compositor; | 406 settings.ignore_root_layer_flings = using_synchronous_compositor; |
| 409 // Memory policy on Android WebView does not depend on whether device is | 407 // Memory policy on Android WebView does not depend on whether device is |
| 410 // low end, so always use default policy. | 408 // low end, so always use default policy. |
| 411 bool use_low_memory_policy = | 409 bool use_low_memory_policy = |
| 412 base::SysInfo::IsLowEndDevice() && !using_synchronous_compositor; | 410 base::SysInfo::IsLowEndDevice() && !using_synchronous_compositor; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 438 settings.decoded_image_cache_budget_bytes = 2 * 1024 * 1024; | 436 settings.decoded_image_cache_budget_bytes = 2 * 1024 * 1024; |
| 439 } | 437 } |
| 440 | 438 |
| 441 // TODO(danakj): Only do this on low end devices. | 439 // TODO(danakj): Only do this on low end devices. |
| 442 settings.create_low_res_tiling = true; | 440 settings.create_low_res_tiling = true; |
| 443 #else // defined(OS_ANDROID) | 441 #else // defined(OS_ANDROID) |
| 444 #if !defined(OS_MACOSX) | 442 #if !defined(OS_MACOSX) |
| 445 if (ui::IsOverlayScrollbarEnabled()) { | 443 if (ui::IsOverlayScrollbarEnabled()) { |
| 446 settings.scrollbar_animator = cc::LayerTreeSettings::AURA_OVERLAY; | 444 settings.scrollbar_animator = cc::LayerTreeSettings::AURA_OVERLAY; |
| 447 settings.scrollbar_fade_delay = ui::kOverlayScrollbarFadeDelay; | 445 settings.scrollbar_fade_delay = ui::kOverlayScrollbarFadeDelay; |
| 448 settings.scrollbar_fade_out_resize_delay = ui::kOverlayScrollbarFadeDelay; | |
| 449 settings.scrollbar_fade_duration = ui::kOverlayScrollbarFadeDuration; | 446 settings.scrollbar_fade_duration = ui::kOverlayScrollbarFadeDuration; |
| 450 settings.scrollbar_thinning_duration = | 447 settings.scrollbar_thinning_duration = |
| 451 ui::kOverlayScrollbarThinningDuration; | 448 ui::kOverlayScrollbarThinningDuration; |
| 452 } else { | 449 } else { |
| 453 // TODO(bokan): This section is probably unneeded? We don't use scrollbar | 450 // TODO(bokan): This section is probably unneeded? We don't use scrollbar |
| 454 // animations for non overlay scrollbars. | 451 // animations for non overlay scrollbars. |
| 455 settings.scrollbar_animator = cc::LayerTreeSettings::ANDROID_OVERLAY; | 452 settings.scrollbar_animator = cc::LayerTreeSettings::ANDROID_OVERLAY; |
| 456 settings.solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128); | 453 settings.solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128); |
| 457 settings.scrollbar_fade_delay = base::TimeDelta::FromMilliseconds(500); | 454 settings.scrollbar_fade_delay = base::TimeDelta::FromMilliseconds(500); |
| 458 settings.scrollbar_fade_out_resize_delay = | |
| 459 base::TimeDelta::FromMilliseconds(500); | |
| 460 settings.scrollbar_fade_duration = base::TimeDelta::FromMilliseconds(300); | 455 settings.scrollbar_fade_duration = base::TimeDelta::FromMilliseconds(300); |
| 461 } | 456 } |
| 462 #endif // !defined(OS_MACOSX) | 457 #endif // !defined(OS_MACOSX) |
| 463 | 458 |
| 464 // On desktop, if there's over 4GB of memory on the machine, increase the | 459 // On desktop, if there's over 4GB of memory on the machine, increase the |
| 465 // image decode budget to 256MB for both gpu and software. | 460 // image decode budget to 256MB for both gpu and software. |
| 466 const int kImageDecodeMemoryThresholdMB = 4 * 1024; | 461 const int kImageDecodeMemoryThresholdMB = 4 * 1024; |
| 467 if (base::SysInfo::AmountOfPhysicalMemoryMB() >= | 462 if (base::SysInfo::AmountOfPhysicalMemoryMB() >= |
| 468 kImageDecodeMemoryThresholdMB) { | 463 kImageDecodeMemoryThresholdMB) { |
| 469 settings.decoded_image_cache_budget_bytes = 256 * 1024 * 1024; | 464 settings.decoded_image_cache_budget_bytes = 256 * 1024 * 1024; |
| (...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1154 void RenderWidgetCompositor::SetContentSourceId(uint32_t id) { | 1149 void RenderWidgetCompositor::SetContentSourceId(uint32_t id) { |
| 1155 layer_tree_host_->SetContentSourceId(id); | 1150 layer_tree_host_->SetContentSourceId(id); |
| 1156 } | 1151 } |
| 1157 | 1152 |
| 1158 void RenderWidgetCompositor::SetLocalSurfaceId( | 1153 void RenderWidgetCompositor::SetLocalSurfaceId( |
| 1159 const cc::LocalSurfaceId& local_surface_id) { | 1154 const cc::LocalSurfaceId& local_surface_id) { |
| 1160 layer_tree_host_->SetLocalSurfaceId(local_surface_id); | 1155 layer_tree_host_->SetLocalSurfaceId(local_surface_id); |
| 1161 } | 1156 } |
| 1162 | 1157 |
| 1163 } // namespace content | 1158 } // namespace content |
| OLD | NEW |