| 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 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 settings.solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128); | 412 settings.solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128); |
| 413 } | 413 } |
| 414 settings.renderer_settings.highp_threshold_min = 2048; | 414 settings.renderer_settings.highp_threshold_min = 2048; |
| 415 // Android WebView handles root layer flings itself. | 415 // Android WebView handles root layer flings itself. |
| 416 settings.ignore_root_layer_flings = | 416 settings.ignore_root_layer_flings = |
| 417 synchronous_compositor_factory; | 417 synchronous_compositor_factory; |
| 418 // Memory policy on Android WebView does not depend on whether device is | 418 // Memory policy on Android WebView does not depend on whether device is |
| 419 // low end, so always use default policy. | 419 // low end, so always use default policy. |
| 420 bool use_low_memory_policy = | 420 bool use_low_memory_policy = |
| 421 base::SysInfo::IsLowEndDevice() && !synchronous_compositor_factory; | 421 base::SysInfo::IsLowEndDevice() && !synchronous_compositor_factory; |
| 422 // RGBA_4444 textures are only enabled for low end devices | 422 // RGBA_4444 textures are only enabled by default for low end devices |
| 423 // and are disabled for Android WebView as it doesn't support the format. | 423 // and are disabled for Android WebView as it doesn't support the format. |
| 424 settings.renderer_settings.use_rgba_4444_textures = use_low_memory_policy; | 424 settings.renderer_settings.use_rgba_4444_textures = use_low_memory_policy; |
| 425 if (use_low_memory_policy) { | 425 if (use_low_memory_policy) { |
| 426 // On low-end we want to be very carefull about killing other | 426 // On low-end we want to be very carefull about killing other |
| 427 // apps. So initially we use 50% more memory to avoid flickering | 427 // apps. So initially we use 50% more memory to avoid flickering |
| 428 // or raster-on-demand. | 428 // or raster-on-demand. |
| 429 settings.max_memory_for_prepaint_percentage = 67; | 429 settings.max_memory_for_prepaint_percentage = 67; |
| 430 } else { | 430 } else { |
| 431 // On other devices we have increased memory excessively to avoid | 431 // On other devices we have increased memory excessively to avoid |
| 432 // raster-on-demand already, so now we reserve 50% _only_ to avoid | 432 // raster-on-demand already, so now we reserve 50% _only_ to avoid |
| (...skipping 22 matching lines...) Expand all Loading... |
| 455 settings.scrollbar_fade_duration_ms = 300; | 455 settings.scrollbar_fade_duration_ms = 300; |
| 456 #endif | 456 #endif |
| 457 | 457 |
| 458 if (cmd->HasSwitch(switches::kEnableLowResTiling)) | 458 if (cmd->HasSwitch(switches::kEnableLowResTiling)) |
| 459 settings.create_low_res_tiling = true; | 459 settings.create_low_res_tiling = true; |
| 460 if (cmd->HasSwitch(switches::kDisableLowResTiling)) | 460 if (cmd->HasSwitch(switches::kDisableLowResTiling)) |
| 461 settings.create_low_res_tiling = false; | 461 settings.create_low_res_tiling = false; |
| 462 if (cmd->HasSwitch(cc::switches::kEnableBeginFrameScheduling)) | 462 if (cmd->HasSwitch(cc::switches::kEnableBeginFrameScheduling)) |
| 463 settings.use_external_begin_frame_source = true; | 463 settings.use_external_begin_frame_source = true; |
| 464 | 464 |
| 465 settings.renderer_settings.use_rgba_4444_textures |= |
| 466 cmd->HasSwitch(switches::kEnableRGBA4444Textures); |
| 467 settings.renderer_settings.use_rgba_4444_textures &= |
| 468 !cmd->HasSwitch(switches::kDisableRGBA4444Textures); |
| 469 |
| 465 if (widget_->for_oopif()) { | 470 if (widget_->for_oopif()) { |
| 466 // TODO(simonhong): Apply BeginFrame scheduling for OOPIF. | 471 // TODO(simonhong): Apply BeginFrame scheduling for OOPIF. |
| 467 // See crbug.com/471411. | 472 // See crbug.com/471411. |
| 468 settings.use_external_begin_frame_source = false; | 473 settings.use_external_begin_frame_source = false; |
| 469 } | 474 } |
| 470 | 475 |
| 471 settings.max_staging_buffers = 32; | 476 settings.max_staging_buffers = 32; |
| 472 // Use 1/4th of staging buffers on low-end devices. | 477 // Use 1/4th of staging buffers on low-end devices. |
| 473 if (base::SysInfo::IsLowEndDevice()) | 478 if (base::SysInfo::IsLowEndDevice()) |
| 474 settings.max_staging_buffers /= 4; | 479 settings.max_staging_buffers /= 4; |
| (...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1039 return; | 1044 return; |
| 1040 provider->ContextGL()->RateLimitOffscreenContextCHROMIUM(); | 1045 provider->ContextGL()->RateLimitOffscreenContextCHROMIUM(); |
| 1041 } | 1046 } |
| 1042 | 1047 |
| 1043 void RenderWidgetCompositor::SetSurfaceIdNamespace( | 1048 void RenderWidgetCompositor::SetSurfaceIdNamespace( |
| 1044 uint32_t surface_id_namespace) { | 1049 uint32_t surface_id_namespace) { |
| 1045 layer_tree_host_->set_surface_id_namespace(surface_id_namespace); | 1050 layer_tree_host_->set_surface_id_namespace(surface_id_namespace); |
| 1046 } | 1051 } |
| 1047 | 1052 |
| 1048 } // namespace content | 1053 } // namespace content |
| OLD | NEW |