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 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 settings.scrollbar_fade_duration_ms = 300; | 399 settings.scrollbar_fade_duration_ms = 300; |
400 settings.solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128); | 400 settings.solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128); |
401 } | 401 } |
402 settings.renderer_settings.highp_threshold_min = 2048; | 402 settings.renderer_settings.highp_threshold_min = 2048; |
403 // Android WebView handles root layer flings itself. | 403 // Android WebView handles root layer flings itself. |
404 settings.ignore_root_layer_flings = using_synchronous_compositor; | 404 settings.ignore_root_layer_flings = using_synchronous_compositor; |
405 // Memory policy on Android WebView does not depend on whether device is | 405 // Memory policy on Android WebView does not depend on whether device is |
406 // low end, so always use default policy. | 406 // low end, so always use default policy. |
407 bool use_low_memory_policy = | 407 bool use_low_memory_policy = |
408 base::SysInfo::IsLowEndDevice() && !using_synchronous_compositor; | 408 base::SysInfo::IsLowEndDevice() && !using_synchronous_compositor; |
409 // RGBA_4444 textures are only enabled by default for low end devices | |
410 // and are disabled for Android WebView as it doesn't support the format. | |
411 settings.renderer_settings.use_rgba_4444_textures = use_low_memory_policy; | |
412 if (use_low_memory_policy) { | 409 if (use_low_memory_policy) { |
413 // On low-end we want to be very carefull about killing other | 410 // On low-end we want to be very carefull about killing other |
414 // apps. So initially we use 50% more memory to avoid flickering | 411 // apps. So initially we use 50% more memory to avoid flickering |
415 // or raster-on-demand. | 412 // or raster-on-demand. |
416 settings.max_memory_for_prepaint_percentage = 67; | 413 settings.max_memory_for_prepaint_percentage = 67; |
| 414 |
| 415 // RGBA_4444 textures are only enabled by default for low end devices |
| 416 // and are disabled for Android WebView as it doesn't support the format. |
| 417 if (!cmd->HasSwitch(switches::kDisableRGBA4444Textures)) |
| 418 settings.renderer_settings.preferred_tile_format = cc::RGBA_4444; |
417 } else { | 419 } else { |
418 // On other devices we have increased memory excessively to avoid | 420 // On other devices we have increased memory excessively to avoid |
419 // raster-on-demand already, so now we reserve 50% _only_ to avoid | 421 // raster-on-demand already, so now we reserve 50% _only_ to avoid |
420 // raster-on-demand, and use 50% of the memory otherwise. | 422 // raster-on-demand, and use 50% of the memory otherwise. |
421 settings.max_memory_for_prepaint_percentage = 50; | 423 settings.max_memory_for_prepaint_percentage = 50; |
422 } | 424 } |
423 // Webview does not own the surface so should not clear it. | 425 // Webview does not own the surface so should not clear it. |
424 settings.renderer_settings.should_clear_root_render_pass = | 426 settings.renderer_settings.should_clear_root_render_pass = |
425 !using_synchronous_compositor; | 427 !using_synchronous_compositor; |
426 | 428 |
(...skipping 15 matching lines...) Expand all Loading... |
442 settings.scrollbar_fade_duration_ms = 300; | 444 settings.scrollbar_fade_duration_ms = 300; |
443 #endif | 445 #endif |
444 | 446 |
445 if (cmd->HasSwitch(switches::kEnableLowResTiling)) | 447 if (cmd->HasSwitch(switches::kEnableLowResTiling)) |
446 settings.create_low_res_tiling = true; | 448 settings.create_low_res_tiling = true; |
447 if (cmd->HasSwitch(switches::kDisableLowResTiling)) | 449 if (cmd->HasSwitch(switches::kDisableLowResTiling)) |
448 settings.create_low_res_tiling = false; | 450 settings.create_low_res_tiling = false; |
449 if (cmd->HasSwitch(cc::switches::kEnableBeginFrameScheduling)) | 451 if (cmd->HasSwitch(cc::switches::kEnableBeginFrameScheduling)) |
450 settings.use_external_begin_frame_source = true; | 452 settings.use_external_begin_frame_source = true; |
451 | 453 |
452 settings.renderer_settings.use_rgba_4444_textures |= | 454 if (cmd->HasSwitch(switches::kEnableRGBA4444Textures) && |
453 cmd->HasSwitch(switches::kEnableRGBA4444Textures); | 455 !cmd->HasSwitch(switches::kDisableRGBA4444Textures)) { |
454 settings.renderer_settings.use_rgba_4444_textures &= | 456 settings.renderer_settings.preferred_tile_format = cc::RGBA_4444; |
455 !cmd->HasSwitch(switches::kDisableRGBA4444Textures); | 457 } |
| 458 |
| 459 if (cmd->HasSwitch(cc::switches::kEnableTileCompression)) { |
| 460 settings.renderer_settings.preferred_tile_format = cc::ETC1; |
| 461 } |
456 | 462 |
457 if (delegate_->ForOOPIF()) { | 463 if (delegate_->ForOOPIF()) { |
458 // TODO(simonhong): Apply BeginFrame scheduling for OOPIF. | 464 // TODO(simonhong): Apply BeginFrame scheduling for OOPIF. |
459 // See crbug.com/471411. | 465 // See crbug.com/471411. |
460 settings.use_external_begin_frame_source = false; | 466 settings.use_external_begin_frame_source = false; |
461 } | 467 } |
462 | 468 |
463 settings.max_staging_buffer_usage_in_bytes = 32 * 1024 * 1024; // 32MB | 469 settings.max_staging_buffer_usage_in_bytes = 32 * 1024 * 1024; // 32MB |
464 // Use 1/4th of staging buffers on low-end devices. | 470 // Use 1/4th of staging buffers on low-end devices. |
465 if (base::SysInfo::IsLowEndDevice()) | 471 if (base::SysInfo::IsLowEndDevice()) |
(...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1142 #endif | 1148 #endif |
1143 return actual; | 1149 return actual; |
1144 } | 1150 } |
1145 | 1151 |
1146 void RenderWidgetCompositor::SetPaintedDeviceScaleFactor( | 1152 void RenderWidgetCompositor::SetPaintedDeviceScaleFactor( |
1147 float device_scale) { | 1153 float device_scale) { |
1148 layer_tree_host_->SetPaintedDeviceScaleFactor(device_scale); | 1154 layer_tree_host_->SetPaintedDeviceScaleFactor(device_scale); |
1149 } | 1155 } |
1150 | 1156 |
1151 } // namespace content | 1157 } // namespace content |
OLD | NEW |