diff options
author | vmiura <vmiura@chromium.org> | 2015-02-16 11:10:45 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-02-16 19:11:24 +0000 |
commit | 4ee2c6b9e8337563158c183e9775765d5613e2d9 (patch) | |
tree | 12523a43fbe1dc69cec509423f13e62884e0ef32 /cc | |
parent | a14137b0e7bf0c5a2af3083d0faeb6a68bac8795 (diff) | |
download | chromium_src-4ee2c6b9e8337563158c183e9775765d5613e2d9.zip chromium_src-4ee2c6b9e8337563158c183e9775765d5613e2d9.tar.gz chromium_src-4ee2c6b9e8337563158c183e9775765d5613e2d9.tar.bz2 |
cc: Threaded GPU - fix thread binding.
In theaded GPU raster mode, the compositor & worker threads can
take control of the worker_context_provider while holding the
context lock.
Currently if GpuTTWP binds to the thread and the compositor
needs to take ownership under lock, then the context's thread
checker may DCHECK(). Similarly in the reverse.
This change fixes binding of the context's thread checker,
allowing binding to the worker thread under lock, and detaching
before releasing the lock, so the compositor may bind again.
TBR=vmpstr@chromium.org
TBR=jbauman@chromium.org
BUG=454500
Review URL: https://codereview.chromium.org/925183002
Cr-Commit-Position: refs/heads/master@{#316498}
Diffstat (limited to 'cc')
-rw-r--r-- | cc/resources/gpu_tile_task_worker_pool.cc | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/cc/resources/gpu_tile_task_worker_pool.cc b/cc/resources/gpu_tile_task_worker_pool.cc index dd55b94..c57d25a 100644 --- a/cc/resources/gpu_tile_task_worker_pool.cc +++ b/cc/resources/gpu_tile_task_worker_pool.cc @@ -33,23 +33,25 @@ class RasterBufferImpl : public RasterBuffer { const gfx::Rect& rect, float scale) override { TRACE_EVENT0("cc", "RasterBufferImpl::Playback"); - ContextProvider* context_provider = rasterizer_->resource_provider() ->output_surface() ->worker_context_provider(); - // We must hold the context lock while accessing the context on the + // The context lock must be held while accessing the context on a // worker thread. - scoped_ptr<base::AutoLock> scoped_auto_lock; - base::Lock* lock = context_provider->GetLock(); - if (lock) - scoped_auto_lock.reset(new base::AutoLock(*lock)); + base::AutoLock context_lock(*context_provider->GetLock()); + + // Allow this worker thread to bind to context_provider. + context_provider->DetachFromThread(); // Rasterize source into resource. rasterizer_->RasterizeSource(true, &lock_, raster_source, rect, scale); // Barrier to sync worker context output to cc context. context_provider->ContextGL()->OrderingBarrierCHROMIUM(); + + // Allow compositor thread to bind to context_provider. + context_provider->DetachFromThread(); } private: @@ -81,20 +83,10 @@ GpuTileTaskWorkerPool::GpuTileTaskWorkerPool( rasterizer_(rasterizer), task_set_finished_weak_ptr_factory_(this), weak_ptr_factory_(this) { - // Allow |worker_context_provider| to bind to the worker thread. - rasterizer_->resource_provider() - ->output_surface() - ->worker_context_provider() - ->DetachFromThread(); } GpuTileTaskWorkerPool::~GpuTileTaskWorkerPool() { DCHECK_EQ(0u, completed_tasks_.size()); - // Allow |worker_context_provider| to bind to the cc thread. - rasterizer_->resource_provider() - ->output_surface() - ->worker_context_provider() - ->DetachFromThread(); } TileTaskRunner* GpuTileTaskWorkerPool::AsTileTaskRunner() { |