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

Unified Diff: cc/resources/one_copy_raster_worker_pool.cc

Issue 706203003: Update from https://crrev.com/303153 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « cc/resources/one_copy_raster_worker_pool.h ('k') | cc/resources/picture_pile.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« no previous file with comments | « cc/resources/one_copy_raster_worker_pool.h ('k') | cc/resources/picture_pile.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698