Chromium Code Reviews| Index: content/renderer/render_widget.cc |
| diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc |
| index 7d8700f3dd79e9694600ecfbbf7af48cb7e8506e..7225f7ea33b1219f7d3acbb3fc0606543b3aefb7 100644 |
| --- a/content/renderer/render_widget.cc |
| +++ b/content/renderer/render_widget.cc |
| @@ -15,6 +15,7 @@ |
| #include "base/metrics/histogram.h" |
| #include "base/stl_util.h" |
| #include "base/strings/utf_string_conversions.h" |
| +#include "base/sys_utils.h" |
| #include "build/build_config.h" |
| #include "cc/base/switches.h" |
| #include "cc/debug/benchmark_instrumentation.h" |
| @@ -68,7 +69,6 @@ |
| #include "webkit/renderer/compositor_bindings/web_rendering_stats_impl.h" |
| #if defined(OS_ANDROID) |
| -#include "base/android/sys_utils.h" |
| #include "content/renderer/android/synchronous_compositor_factory.h" |
| #endif |
| @@ -938,10 +938,8 @@ scoped_ptr<cc::OutputSurface> RenderWidget::CreateOutputSurface(bool fallback) { |
| if (command_line.HasSwitch(cc::switches::kCompositeToMailbox)) { |
| DCHECK(is_threaded_compositing_enabled_); |
| cc::ResourceFormat format = cc::RGBA_8888; |
| -#if defined(OS_ANDROID) |
| - if (base::android::SysUtils::IsLowEndDevice()) |
| + if (base::SysUtils::IsLowEndDevice()) |
| format = cc::RGB_565; |
| -#endif |
| return scoped_ptr<cc::OutputSurface>( |
| new MailboxOutputSurface( |
| routing_id(), |
| @@ -2845,27 +2843,29 @@ RenderWidget::CreateGraphicsContext3D( |
| return scoped_ptr<WebGraphicsContext3DCommandBufferImpl>(); |
| WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits limits; |
| -#if defined(OS_ANDROID) |
| // If we raster too fast we become upload bound, and pending |
| // uploads consume memory. For maximum upload throughput, we would |
| // want to allow for upload_throughput * pipeline_time of pending |
| // uploads, after which we are just wasting memory. Since we don't |
| // know our upload throughput yet, this just caps our memory usage. |
| - size_t divider = 1; |
| - if (base::android::SysUtils::IsLowEndDevice()) |
| - divider = 6; |
| + |
| // For reference Nexus10 can upload 1MB in about 2.5ms. |
| - const double max_mb_uploaded_per_ms = 2.0 / (5 * divider); |
| + const double max_mb_uploaded_per_ms = 2.0 / 5; |
| // Deadline to draw a frame to achieve 60 frames per second. |
| const size_t kMillisecondsPerFrame = 16; |
| // Assuming a two frame deep pipeline between the CPU and the GPU. |
| - size_t max_transfer_buffer_usage_mb = |
| + const size_t max_transfer_buffer_usage_mb = |
| static_cast<size_t>(2 * kMillisecondsPerFrame * max_mb_uploaded_per_ms); |
| static const size_t kBytesPerMegabyte = 1024 * 1024; |
| // We keep the MappedMemoryReclaimLimit the same as the upload limit |
| // to avoid unnecessarily stalling the compositor thread. |
| - limits.mapped_memory_reclaim_limit = |
| - max_transfer_buffer_usage_mb * kBytesPerMegabyte; |
| + if (base::SysUtils::IsLowEndDevice()) |
|
piman
2014/01/21 21:23:49
needs braces
|
| + limits.mapped_memory_reclaim_limit = |
| + max_transfer_buffer_usage_mb / 6 * kBytesPerMegabyte; |
| +#if defined(OS_ANDROID) |
| + else |
| + limits.mapped_memory_reclaim_limit = |
| + max_transfer_buffer_usage_mb * kBytesPerMegabyte; |
| #endif |
| scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context( |