Commit d130dcdd authored by reveman's avatar reveman Committed by Commit bot

cc: Fix WeakPtrFactory::GetWeakPtr() race when using multiple raster worker threads.

This prevents multiple threads from being able to call GetWeakPtr()
at the same time by making sure the lock is acquired when this is
called.

R=vmpstr@chromium.org
BUG=

Review URL: https://codereview.chromium.org/700843004

Cr-Commit-Position: refs/heads/master@{#302717}
parent 2610ea15
...@@ -275,9 +275,6 @@ OneCopyRasterWorkerPool::PlaybackAndScheduleCopyOnWorkerThread( ...@@ -275,9 +275,6 @@ OneCopyRasterWorkerPool::PlaybackAndScheduleCopyOnWorkerThread(
const RasterSource* raster_source, const RasterSource* raster_source,
const gfx::Rect& rect, const gfx::Rect& rect,
float scale) { float scale) {
CopySequenceNumber sequence;
{
base::AutoLock lock(lock_); base::AutoLock lock(lock_);
int failed_attempts = 0; int failed_attempts = 0;
...@@ -314,22 +311,24 @@ OneCopyRasterWorkerPool::PlaybackAndScheduleCopyOnWorkerThread( ...@@ -314,22 +311,24 @@ OneCopyRasterWorkerPool::PlaybackAndScheduleCopyOnWorkerThread(
{ {
base::AutoUnlock unlock(lock_); base::AutoUnlock unlock(lock_);
gfx::GpuMemoryBuffer* gpu_memory_buffer = gfx::GpuMemoryBuffer* gpu_memory_buffer = write_lock->GetGpuMemoryBuffer();
write_lock->GetGpuMemoryBuffer();
if (gpu_memory_buffer) { if (gpu_memory_buffer) {
RasterWorkerPool::PlaybackToMemory( RasterWorkerPool::PlaybackToMemory(gpu_memory_buffer->Map(),
gpu_memory_buffer->Map(), src->format(), src->size(), src->format(),
gpu_memory_buffer->GetStride(), raster_source, rect, scale); src->size(),
gpu_memory_buffer->GetStride(),
raster_source,
rect,
scale);
gpu_memory_buffer->Unmap(); gpu_memory_buffer->Unmap();
} }
} }
// Acquire a sequence number for this copy operation.
sequence = next_copy_operation_sequence_++;
pending_copy_operations_.push_back( pending_copy_operations_.push_back(
make_scoped_ptr(new CopyOperation(write_lock.Pass(), src.Pass(), dst))); 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| // Post task that will advance last flushed copy operation to |sequence|
// if we have reached the flush period. // if we have reached the flush period.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment