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