| 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 23 matching lines...) Expand all Loading... |
| 440 // most long-term caching. | 439 // most long-term caching. |
| 441 settings.decoded_image_cache_budget_bytes = 2 * 1024 * 1024; | 440 settings.decoded_image_cache_budget_bytes = 2 * 1024 * 1024; |
| 442 } | 441 } |
| 443 | 442 |
| 444 // TODO(danakj): Only do this on low end devices. | 443 // TODO(danakj): Only do this on low end devices. |
| 445 settings.create_low_res_tiling = true; | 444 settings.create_low_res_tiling = true; |
| 446 #else // defined(OS_ANDROID) | 445 #else // defined(OS_ANDROID) |
| 447 #if !defined(OS_MACOSX) | 446 #if !defined(OS_MACOSX) |
| 448 if (ui::IsOverlayScrollbarEnabled()) { | 447 if (ui::IsOverlayScrollbarEnabled()) { |
| 449 settings.scrollbar_animator = cc::LayerTreeSettings::AURA_OVERLAY; | 448 settings.scrollbar_animator = cc::LayerTreeSettings::AURA_OVERLAY; |
| 450 settings.scrollbar_show_delay = ui::kOverlayScrollbarShowDelay; | 449 settings.scrollbar_fade_delay = ui::kOverlayScrollbarFadeDelay; |
| 451 settings.scrollbar_fade_out_delay = ui::kOverlayScrollbarFadeOutDelay; | 450 settings.scrollbar_fade_out_resize_delay = ui::kOverlayScrollbarFadeDelay; |
| 452 settings.scrollbar_fade_out_resize_delay = | 451 settings.scrollbar_fade_duration = ui::kOverlayScrollbarFadeDuration; |
| 453 ui::kOverlayScrollbarFadeOutDelay; | |
| 454 settings.scrollbar_fade_out_duration = ui::kOverlayScrollbarFadeOutDuration; | |
| 455 settings.scrollbar_thinning_duration = | 452 settings.scrollbar_thinning_duration = |
| 456 ui::kOverlayScrollbarThinningDuration; | 453 ui::kOverlayScrollbarThinningDuration; |
| 457 } else { | 454 } else { |
| 458 // TODO(bokan): This section is probably unneeded? We don't use scrollbar | 455 // TODO(bokan): This section is probably unneeded? We don't use scrollbar |
| 459 // animations for non overlay scrollbars. | 456 // animations for non overlay scrollbars. |
| 460 settings.scrollbar_animator = cc::LayerTreeSettings::ANDROID_OVERLAY; | 457 settings.scrollbar_animator = cc::LayerTreeSettings::ANDROID_OVERLAY; |
| 461 settings.solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128); | 458 settings.solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128); |
| 462 settings.scrollbar_fade_out_delay = base::TimeDelta::FromMilliseconds(500); | 459 settings.scrollbar_fade_delay = base::TimeDelta::FromMilliseconds(500); |
| 463 settings.scrollbar_fade_out_resize_delay = | 460 settings.scrollbar_fade_out_resize_delay = |
| 464 base::TimeDelta::FromMilliseconds(500); | 461 base::TimeDelta::FromMilliseconds(500); |
| 465 settings.scrollbar_fade_out_duration = | 462 settings.scrollbar_fade_duration = base::TimeDelta::FromMilliseconds(300); |
| 466 base::TimeDelta::FromMilliseconds(300); | |
| 467 } | 463 } |
| 468 #endif // !defined(OS_MACOSX) | 464 #endif // !defined(OS_MACOSX) |
| 469 | 465 |
| 470 // On desktop, if there's over 4GB of memory on the machine, increase the | 466 // On desktop, if there's over 4GB of memory on the machine, increase the |
| 471 // image decode budget to 256MB for both gpu and software. | 467 // image decode budget to 256MB for both gpu and software. |
| 472 const int kImageDecodeMemoryThresholdMB = 4 * 1024; | 468 const int kImageDecodeMemoryThresholdMB = 4 * 1024; |
| 473 if (base::SysInfo::AmountOfPhysicalMemoryMB() >= | 469 if (base::SysInfo::AmountOfPhysicalMemoryMB() >= |
| 474 kImageDecodeMemoryThresholdMB) { | 470 kImageDecodeMemoryThresholdMB) { |
| 475 settings.decoded_image_cache_budget_bytes = 256 * 1024 * 1024; | 471 settings.decoded_image_cache_budget_bytes = 256 * 1024 * 1024; |
| 476 settings.decoded_image_working_set_budget_bytes = 256 * 1024 * 1024; | 472 settings.decoded_image_working_set_budget_bytes = 256 * 1024 * 1024; |
| (...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1157 void RenderWidgetCompositor::SetContentSourceId(uint32_t id) { | 1153 void RenderWidgetCompositor::SetContentSourceId(uint32_t id) { |
| 1158 layer_tree_host_->SetContentSourceId(id); | 1154 layer_tree_host_->SetContentSourceId(id); |
| 1159 } | 1155 } |
| 1160 | 1156 |
| 1161 void RenderWidgetCompositor::SetLocalSurfaceId( | 1157 void RenderWidgetCompositor::SetLocalSurfaceId( |
| 1162 const cc::LocalSurfaceId& local_surface_id) { | 1158 const cc::LocalSurfaceId& local_surface_id) { |
| 1163 layer_tree_host_->SetLocalSurfaceId(local_surface_id); | 1159 layer_tree_host_->SetLocalSurfaceId(local_surface_id); |
| 1164 } | 1160 } |
| 1165 | 1161 |
| 1166 } // namespace content | 1162 } // namespace content |
| OLD | NEW |