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