| Index: cc/raster/one_copy_tile_task_worker_pool.cc
|
| diff --git a/cc/raster/one_copy_tile_task_worker_pool.cc b/cc/raster/one_copy_tile_task_worker_pool.cc
|
| index ebc230142984f75f40592adb50af92664a4267f5..dd8937c483d2cb6b778c6dd03e6b674cbb0b64ec 100644
|
| --- a/cc/raster/one_copy_tile_task_worker_pool.cc
|
| +++ b/cc/raster/one_copy_tile_task_worker_pool.cc
|
| @@ -99,9 +99,6 @@ class RasterBufferImpl : public RasterBuffer {
|
| DISALLOW_COPY_AND_ASSIGN(RasterBufferImpl);
|
| };
|
|
|
| -// Flush interval when performing copy operations.
|
| -const int kCopyFlushPeriod = 4;
|
| -
|
| // Number of in-flight copy operations to allow.
|
| const int kMaxCopyOperations = 32;
|
|
|
| @@ -160,6 +157,7 @@ OneCopyTileTaskWorkerPool::OneCopyTileTaskWorkerPool(
|
| last_flushed_copy_operation_(0),
|
| lock_(),
|
| copy_operation_count_cv_(&lock_),
|
| + bytes_scheduled_since_last_flush_(0),
|
| issued_copy_operation_count_(0),
|
| next_copy_operation_sequence_(1),
|
| check_for_completed_copy_operations_pending_(false),
|
| @@ -401,13 +399,19 @@ OneCopyTileTaskWorkerPool::PlaybackAndScheduleCopyOnWorkerThread(
|
| // Acquire a sequence number for this copy operation.
|
| sequence = next_copy_operation_sequence_++;
|
|
|
| + // Increment |bytes_scheduled_since_last_flush_| by the amount of memory
|
| + // used for this copy operation.
|
| + bytes_scheduled_since_last_flush_ += rows_to_copy * bytes_per_row;
|
| +
|
| // Post task that will advance last flushed copy operation to |sequence|
|
| - // if we have reached the flush period.
|
| - if ((sequence % kCopyFlushPeriod) == 0) {
|
| + // when |bytes_scheduled_since_last_flush_| has reached
|
| + // |max_bytes_per_copy_operation_|.
|
| + if (bytes_scheduled_since_last_flush_ >= max_bytes_per_copy_operation_) {
|
| task_runner_->PostTask(
|
| FROM_HERE,
|
| base::Bind(&OneCopyTileTaskWorkerPool::AdvanceLastFlushedCopyTo,
|
| weak_ptr_factory_.GetWeakPtr(), sequence));
|
| + bytes_scheduled_since_last_flush_ = 0;
|
| }
|
| }
|
|
|
|
|