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