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