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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 #include "third_party/WebKit/public/platform/WebCompositeAndReadbackAsyncCallbac
k.h" | 53 #include "third_party/WebKit/public/platform/WebCompositeAndReadbackAsyncCallbac
k.h" |
54 #include "third_party/WebKit/public/platform/WebCompositorMutatorClient.h" | 54 #include "third_party/WebKit/public/platform/WebCompositorMutatorClient.h" |
55 #include "third_party/WebKit/public/platform/WebLayoutAndPaintAsyncCallback.h" | 55 #include "third_party/WebKit/public/platform/WebLayoutAndPaintAsyncCallback.h" |
56 #include "third_party/WebKit/public/platform/WebSize.h" | 56 #include "third_party/WebKit/public/platform/WebSize.h" |
57 #include "third_party/WebKit/public/platform/scheduler/renderer/renderer_schedul
er.h" | 57 #include "third_party/WebKit/public/platform/scheduler/renderer/renderer_schedul
er.h" |
58 #include "third_party/WebKit/public/web/WebKit.h" | 58 #include "third_party/WebKit/public/web/WebKit.h" |
59 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" | 59 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" |
60 #include "third_party/WebKit/public/web/WebSelection.h" | 60 #include "third_party/WebKit/public/web/WebSelection.h" |
61 #include "ui/gl/gl_switches.h" | 61 #include "ui/gl/gl_switches.h" |
62 #include "ui/native_theme/native_theme_switches.h" | 62 #include "ui/native_theme/native_theme_switches.h" |
| 63 #include "ui/native_theme/overlay_scrollbar_constants_aura.h" |
63 | 64 |
64 #if defined(OS_ANDROID) | 65 #if defined(OS_ANDROID) |
65 #include "base/android/build_info.h" | 66 #include "base/android/build_info.h" |
66 #include "ui/gfx/android/device_display_info.h" | 67 #include "ui/gfx/android/device_display_info.h" |
67 #endif | 68 #endif |
68 | 69 |
69 namespace base { | 70 namespace base { |
70 class Value; | 71 class Value; |
71 } | 72 } |
72 | 73 |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 #if defined(OS_ANDROID) | 377 #if defined(OS_ANDROID) |
377 bool using_synchronous_compositor = | 378 bool using_synchronous_compositor = |
378 GetContentClient()->UsingSynchronousCompositing(); | 379 GetContentClient()->UsingSynchronousCompositing(); |
379 | 380 |
380 // We can't use GPU rasterization on low-end devices, because the Ganesh | 381 // We can't use GPU rasterization on low-end devices, because the Ganesh |
381 // cache would consume too much memory. | 382 // cache would consume too much memory. |
382 if (base::SysInfo::IsLowEndDevice()) | 383 if (base::SysInfo::IsLowEndDevice()) |
383 settings.gpu_rasterization_enabled = false; | 384 settings.gpu_rasterization_enabled = false; |
384 settings.using_synchronous_renderer_compositor = using_synchronous_compositor; | 385 settings.using_synchronous_renderer_compositor = using_synchronous_compositor; |
385 settings.scrollbar_animator = cc::LayerTreeSettings::LINEAR_FADE; | 386 settings.scrollbar_animator = cc::LayerTreeSettings::LINEAR_FADE; |
386 settings.scrollbar_fade_delay_ms = 300; | 387 settings.scrollbar_fade_delay = base::TimeDelta::FromMilliseconds(300); |
387 settings.scrollbar_fade_resize_delay_ms = 2000; | 388 settings.scrollbar_fade_resize_delay = |
388 settings.scrollbar_fade_duration_ms = 300; | 389 base::TimeDelta::FromMilliseconds(2000); |
| 390 settings.scrollbar_fade_duration = base::TimeDelta::FromMilliseconds(300); |
389 settings.solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128); | 391 settings.solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128); |
390 settings.renderer_settings.highp_threshold_min = 2048; | 392 settings.renderer_settings.highp_threshold_min = 2048; |
391 // Android WebView handles root layer flings itself. | 393 // Android WebView handles root layer flings itself. |
392 settings.ignore_root_layer_flings = using_synchronous_compositor; | 394 settings.ignore_root_layer_flings = using_synchronous_compositor; |
393 // Memory policy on Android WebView does not depend on whether device is | 395 // Memory policy on Android WebView does not depend on whether device is |
394 // low end, so always use default policy. | 396 // low end, so always use default policy. |
395 bool use_low_memory_policy = | 397 bool use_low_memory_policy = |
396 base::SysInfo::IsLowEndDevice() && !using_synchronous_compositor; | 398 base::SysInfo::IsLowEndDevice() && !using_synchronous_compositor; |
397 if (use_low_memory_policy) { | 399 if (use_low_memory_policy) { |
398 // On low-end we want to be very carefull about killing other | 400 // On low-end we want to be very carefull about killing other |
(...skipping 14 matching lines...) Expand all Loading... |
413 // Webview does not own the surface so should not clear it. | 415 // Webview does not own the surface so should not clear it. |
414 settings.renderer_settings.should_clear_root_render_pass = | 416 settings.renderer_settings.should_clear_root_render_pass = |
415 !using_synchronous_compositor; | 417 !using_synchronous_compositor; |
416 | 418 |
417 // TODO(danakj): Only do this on low end devices. | 419 // TODO(danakj): Only do this on low end devices. |
418 settings.create_low_res_tiling = true; | 420 settings.create_low_res_tiling = true; |
419 #else // defined(OS_ANDROID) | 421 #else // defined(OS_ANDROID) |
420 #if !defined(OS_MACOSX) | 422 #if !defined(OS_MACOSX) |
421 if (ui::IsOverlayScrollbarEnabled()) { | 423 if (ui::IsOverlayScrollbarEnabled()) { |
422 settings.scrollbar_animator = cc::LayerTreeSettings::THINNING; | 424 settings.scrollbar_animator = cc::LayerTreeSettings::THINNING; |
423 settings.solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128); | 425 settings.scrollbar_fade_delay = ui::kOverlayScrollbarFadeOutDelay; |
| 426 settings.scrollbar_fade_resize_delay = |
| 427 ui::kOverlayScrollbarFadeOutDelay; |
| 428 settings.scrollbar_fade_duration = |
| 429 ui::kOverlayScrollbarFadeOutDuration; |
| 430 settings.scrollbar_thinning_duration = |
| 431 ui::kOverlayScrollbarThinningDuration; |
424 } else { | 432 } else { |
| 433 // TODO(bokan): This section is probably unneeded? We don't use scrollbar |
| 434 // animations for non overlay scrollbars. |
425 settings.scrollbar_animator = cc::LayerTreeSettings::LINEAR_FADE; | 435 settings.scrollbar_animator = cc::LayerTreeSettings::LINEAR_FADE; |
426 settings.solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128); | 436 settings.solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128); |
| 437 settings.scrollbar_fade_delay = base::TimeDelta::FromMilliseconds(500); |
| 438 settings.scrollbar_fade_resize_delay = |
| 439 base::TimeDelta::FromMilliseconds(500); |
| 440 settings.scrollbar_fade_duration = base::TimeDelta::FromMilliseconds(300); |
427 } | 441 } |
428 settings.scrollbar_fade_delay_ms = 500; | |
429 settings.scrollbar_fade_resize_delay_ms = 500; | |
430 settings.scrollbar_fade_duration_ms = 300; | |
431 #endif // !defined(OS_MACOSX) | 442 #endif // !defined(OS_MACOSX) |
432 | 443 |
433 // On desktop, if there's over 4GB of memory on the machine, increase the | 444 // On desktop, if there's over 4GB of memory on the machine, increase the |
434 // image decode budget to 256MB for both gpu and software. | 445 // image decode budget to 256MB for both gpu and software. |
435 const int kImageDecodeMemoryThresholdMB = 4 * 1024; | 446 const int kImageDecodeMemoryThresholdMB = 4 * 1024; |
436 if (base::SysInfo::AmountOfPhysicalMemoryMB() >= | 447 if (base::SysInfo::AmountOfPhysicalMemoryMB() >= |
437 kImageDecodeMemoryThresholdMB) { | 448 kImageDecodeMemoryThresholdMB) { |
438 settings.gpu_decoded_image_budget_bytes = 256 * 1024 * 1024; | 449 settings.gpu_decoded_image_budget_bytes = 256 * 1024 * 1024; |
439 settings.software_decoded_image_budget_bytes = 256 * 1024 * 1024; | 450 settings.software_decoded_image_budget_bytes = 256 * 1024 * 1024; |
440 } else { | 451 } else { |
(...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1117 float device_scale) { | 1128 float device_scale) { |
1118 layer_tree_host_->GetLayerTree()->SetPaintedDeviceScaleFactor(device_scale); | 1129 layer_tree_host_->GetLayerTree()->SetPaintedDeviceScaleFactor(device_scale); |
1119 } | 1130 } |
1120 | 1131 |
1121 void RenderWidgetCompositor::SetDeviceColorSpace( | 1132 void RenderWidgetCompositor::SetDeviceColorSpace( |
1122 const gfx::ColorSpace& color_space) { | 1133 const gfx::ColorSpace& color_space) { |
1123 layer_tree_host_->GetLayerTree()->SetDeviceColorSpace(color_space); | 1134 layer_tree_host_->GetLayerTree()->SetDeviceColorSpace(color_space); |
1124 } | 1135 } |
1125 | 1136 |
1126 } // namespace content | 1137 } // namespace content |
OLD | NEW |