Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(764)

Unified Diff: cc/resources/pixel_buffer_raster_worker_pool.cc

Issue 22900018: cc: Set the mapped memory reclaim limit for the renderer compositor on Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: cc/resources/pixel_buffer_raster_worker_pool.cc
diff --git a/cc/resources/pixel_buffer_raster_worker_pool.cc b/cc/resources/pixel_buffer_raster_worker_pool.cc
index 5685b609a1920cbc3bcf4c5bb5486fea41a01539..22e796d7ef4f89119cc44bfdb4f600f14d81f64f 100644
--- a/cc/resources/pixel_buffer_raster_worker_pool.cc
+++ b/cc/resources/pixel_buffer_raster_worker_pool.cc
@@ -4,6 +4,8 @@
#include "cc/resources/pixel_buffer_raster_worker_pool.h"
+#include <limits>
+
#include "base/containers/stack_container.h"
#include "base/debug/trace_event.h"
#include "base/values.h"
@@ -94,7 +96,8 @@ bool WasCanceled(const internal::RasterWorkerPoolTask* task) {
PixelBufferRasterWorkerPool::PixelBufferRasterWorkerPool(
ResourceProvider* resource_provider,
- size_t num_threads)
+ size_t num_threads,
+ ContextProvider* context_provider)
: RasterWorkerPool(resource_provider, num_threads),
shutdown_(false),
scheduled_raster_task_count_(0),
@@ -104,25 +107,14 @@ PixelBufferRasterWorkerPool::PixelBufferRasterWorkerPool(
should_notify_client_if_no_tasks_are_pending_(false),
should_notify_client_if_no_tasks_required_for_activation_are_pending_(
false) {
-// 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.
-#if defined(OS_ANDROID)
- size_t divider = 1;
- if (base::android::SysUtils::IsLowEndDevice())
- divider = 3;
-
- // For reference Nexus10 can upload 1MB in about 2.5ms.
- const size_t kMaxBytesUploadedPerMs = (2 * 1024 * 1024) / (5 * divider);
-#else
- // For reference Chromebook Pixel can upload 1MB in about 0.5ms.
- const size_t kMaxBytesUploadedPerMs = 1024 * 1024 * 2;
-#endif
-
- // Assuming a two frame deep pipeline.
- max_bytes_pending_upload_ = 16 * 2 * kMaxBytesUploadedPerMs;
+ if (context_provider != NULL) {
+ max_bytes_pending_upload_ =
+ context_provider->ContextCapabilities().max_transfer_buffer_usage_bytes;
+ } else {
+ // For unit tests:
danakj 2013/08/29 20:10:28 // Software compositing should not use this path i
danakj 2013/08/29 20:10:28 reveman@ can we #if !defined(UNIT_TEST) => NOT_REA
kaanb 2013/08/30 01:11:35 Done.
+ // TODO(kaanb): make this a static const somewhere?
danakj 2013/08/29 20:10:28 No idea where. If reveman@ has an idea let's do th
kaanb 2013/08/30 01:11:35 Done.
+ max_bytes_pending_upload_ = std::numeric_limits<size_t>::max();
+ }
}
PixelBufferRasterWorkerPool::~PixelBufferRasterWorkerPool() {

Powered by Google App Engine
This is Rietveld 408576698