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