| Index: cc/resources/one_copy_raster_worker_pool.cc
|
| diff --git a/cc/resources/one_copy_raster_worker_pool.cc b/cc/resources/one_copy_raster_worker_pool.cc
|
| index c803262f06bbb4e8b486948492359175bd4b87cc..a8b838e83908ff4dd1d215ac9223e39a937258d9 100644
|
| --- a/cc/resources/one_copy_raster_worker_pool.cc
|
| +++ b/cc/resources/one_copy_raster_worker_pool.cc
|
| @@ -54,16 +54,10 @@ class RasterBufferImpl : public RasterBuffer {
|
| // Overridden from RasterBuffer:
|
| void Playback(const RasterSource* raster_source,
|
| const gfx::Rect& rect,
|
| - float scale,
|
| - RenderingStatsInstrumentation* stats) override {
|
| + float scale) override {
|
| sequence_ = worker_pool_->PlaybackAndScheduleCopyOnWorkerThread(
|
| - lock_.Pass(),
|
| - raster_resource_.Pass(),
|
| - resource_,
|
| - raster_source,
|
| - rect,
|
| - scale,
|
| - stats);
|
| + lock_.Pass(), raster_resource_.Pass(), resource_, raster_source, rect,
|
| + scale);
|
| }
|
|
|
| private:
|
| @@ -280,68 +274,61 @@ OneCopyRasterWorkerPool::PlaybackAndScheduleCopyOnWorkerThread(
|
| const Resource* dst,
|
| const RasterSource* raster_source,
|
| const gfx::Rect& rect,
|
| - float scale,
|
| - RenderingStatsInstrumentation* stats) {
|
| - CopySequenceNumber sequence;
|
| + float scale) {
|
| + base::AutoLock lock(lock_);
|
|
|
| - {
|
| - base::AutoLock lock(lock_);
|
| -
|
| - int failed_attempts = 0;
|
| - while ((scheduled_copy_operation_count_ + issued_copy_operation_count_) >=
|
| - kMaxCopyOperations) {
|
| - // Ignore limit when shutdown is set.
|
| - if (shutdown_)
|
| - break;
|
| + int failed_attempts = 0;
|
| + while ((scheduled_copy_operation_count_ + issued_copy_operation_count_) >=
|
| + kMaxCopyOperations) {
|
| + // Ignore limit when shutdown is set.
|
| + if (shutdown_)
|
| + break;
|
|
|
| - ++failed_attempts;
|
| + ++failed_attempts;
|
|
|
| - // Schedule a check that will also wait for operations to complete
|
| - // after too many failed attempts.
|
| - bool wait_if_needed = failed_attempts > kFailedAttemptsBeforeWaitIfNeeded;
|
| + // Schedule a check that will also wait for operations to complete
|
| + // after too many failed attempts.
|
| + bool wait_if_needed = failed_attempts > kFailedAttemptsBeforeWaitIfNeeded;
|
|
|
| - // Schedule a check for completed copy operations if too many operations
|
| - // are currently in-flight.
|
| - ScheduleCheckForCompletedCopyOperationsWithLockAcquired(wait_if_needed);
|
| + // Schedule a check for completed copy operations if too many operations
|
| + // are currently in-flight.
|
| + ScheduleCheckForCompletedCopyOperationsWithLockAcquired(wait_if_needed);
|
|
|
| - {
|
| - TRACE_EVENT0("cc", "WaitingForCopyOperationsToComplete");
|
| + {
|
| + TRACE_EVENT0("cc", "WaitingForCopyOperationsToComplete");
|
|
|
| - // Wait for in-flight copy operations to drop below limit.
|
| - copy_operation_count_cv_.Wait();
|
| - }
|
| + // Wait for in-flight copy operations to drop below limit.
|
| + copy_operation_count_cv_.Wait();
|
| }
|
| + }
|
|
|
| - // Increment |scheduled_copy_operation_count_| before releasing |lock_|.
|
| - ++scheduled_copy_operation_count_;
|
| + // Increment |scheduled_copy_operation_count_| before releasing |lock_|.
|
| + ++scheduled_copy_operation_count_;
|
|
|
| - // There may be more work available, so wake up another worker thread.
|
| - copy_operation_count_cv_.Signal();
|
| + // There may be more work available, so wake up another worker thread.
|
| + copy_operation_count_cv_.Signal();
|
|
|
| - {
|
| - base::AutoUnlock unlock(lock_);
|
| -
|
| - gfx::GpuMemoryBuffer* gpu_memory_buffer =
|
| - write_lock->GetGpuMemoryBuffer();
|
| - if (gpu_memory_buffer) {
|
| - RasterWorkerPool::PlaybackToMemory(gpu_memory_buffer->Map(),
|
| - src->format(),
|
| - src->size(),
|
| - gpu_memory_buffer->GetStride(),
|
| - raster_source,
|
| - rect,
|
| - scale,
|
| - stats);
|
| - gpu_memory_buffer->Unmap();
|
| - }
|
| + {
|
| + base::AutoUnlock unlock(lock_);
|
| +
|
| + gfx::GpuMemoryBuffer* gpu_memory_buffer = write_lock->GetGpuMemoryBuffer();
|
| + if (gpu_memory_buffer) {
|
| + RasterWorkerPool::PlaybackToMemory(gpu_memory_buffer->Map(),
|
| + src->format(),
|
| + src->size(),
|
| + gpu_memory_buffer->GetStride(),
|
| + raster_source,
|
| + rect,
|
| + scale);
|
| + gpu_memory_buffer->Unmap();
|
| }
|
| + }
|
|
|
| - // Acquire a sequence number for this copy operation.
|
| - sequence = next_copy_operation_sequence_++;
|
| + pending_copy_operations_.push_back(
|
| + make_scoped_ptr(new CopyOperation(write_lock.Pass(), src.Pass(), dst)));
|
|
|
| - pending_copy_operations_.push_back(
|
| - make_scoped_ptr(new CopyOperation(write_lock.Pass(), src.Pass(), dst)));
|
| - }
|
| + // Acquire a sequence number for this copy operation.
|
| + CopySequenceNumber sequence = next_copy_operation_sequence_++;
|
|
|
| // Post task that will advance last flushed copy operation to |sequence|
|
| // if we have reached the flush period.
|
|
|