Chromium Code Reviews| 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 f4db3993fd723d0f04c1f613ae564cb71f1721d1..ee513a117f43b4207699699c557f7699033d93f7 100644 |
| --- a/cc/raster/one_copy_tile_task_worker_pool.cc |
| +++ b/cc/raster/one_copy_tile_task_worker_pool.cc |
| @@ -74,9 +74,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; |
| @@ -135,6 +132,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), |
| @@ -354,13 +352,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; |
|
vmpstr
2015/06/01 18:35:52
So for big tiles (that are split up into several c
reveman
2015/06/04 01:19:51
Yup, that's the behavior we want.
|
| + |
| // 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_) { |
|
vmpstr
2015/06/02 23:23:27
I think you need to DCHECK that max_bytes_per_copy
reveman
2015/06/04 01:19:51
A flush here is not required for correct behavior.
|
| task_runner_->PostTask( |
| FROM_HERE, |
| base::Bind(&OneCopyTileTaskWorkerPool::AdvanceLastFlushedCopyTo, |
| weak_ptr_factory_.GetWeakPtr(), sequence)); |
| + bytes_scheduled_since_last_flush_ = 0; |
| } |
| } |