Chromium Code Reviews| Index: content/common/gpu/client/command_buffer_proxy_impl.h |
| diff --git a/content/common/gpu/client/command_buffer_proxy_impl.h b/content/common/gpu/client/command_buffer_proxy_impl.h |
| index ea3974029cd1f820de57afbd8895504bed5ed174..13a11acc85db5c0a9b0af284fa07e2aee82ea587 100644 |
| --- a/content/common/gpu/client/command_buffer_proxy_impl.h |
| +++ b/content/common/gpu/client/command_buffer_proxy_impl.h |
| @@ -150,12 +150,50 @@ class CommandBufferProxyImpl |
| return shared_state_shm_->handle(); |
| } |
| + void WaitForPendingGpuMemoryBufferUsageToComplete( |
| + const base::Closure& callback); |
| + |
| private: |
| typedef std::map<int32, scoped_refptr<gpu::Buffer> > TransferBufferMap; |
| typedef base::hash_map<uint32, base::Closure> SignalTaskMap; |
| typedef base::ScopedPtrHashMap<int32, gfx::GpuMemoryBuffer> |
| GpuMemoryBufferMap; |
| + struct CallbackMessageLoopPair { |
| + CallbackMessageLoopPair(const base::Closure& callback, |
| + scoped_refptr<base::MessageLoopProxy> message_loop); |
| + ~CallbackMessageLoopPair(); |
| + base::Closure callback; |
| + scoped_refptr<base::MessageLoopProxy> message_loop; |
|
reveman
2014/10/23 19:46:43
I just realized that GpuChannelHost::MessageFilter
|
| + }; |
| + |
| + class GpuMemoryBufferUsageTracker |
| + : public base::RefCountedThreadSafe<GpuMemoryBufferUsageTracker>, |
| + public DeletionObserver { |
| + public: |
| + GpuMemoryBufferUsageTracker(); |
| + |
| + // DeletionObserver implementation: |
| + void OnWillDeleteImpl() override; |
| + |
| + uint32 AddUsage(const CallbackMessageLoopPair& task); |
| + void UsageCompleted(uint32 task_id); |
| + |
| + private: |
| + typedef base::hash_map<uint32, CallbackMessageLoopPair> |
| + GpuMemoryBufferUsageCompletedMap; |
| + friend class base::RefCountedThreadSafe<GpuMemoryBufferUsageTracker>; |
| + ~GpuMemoryBufferUsageTracker(); |
| + |
| + void UsageCompletedOnCaller(uint32 task_id); |
| + |
| + uint32 next_gpu_memory_buffer_usage_id_; |
| + GpuMemoryBufferUsageCompletedMap gpu_memory_buffer_tasks_; |
| + mutable base::Lock gpu_memory_buffer_task_lock_; |
| + }; |
| + |
| + void WaitForPendingGpuMemoryBufferUsageToCompleteOnMain(uint32 usage_id); |
| + |
| // Send an IPC message over the GPU channel. This is private to fully |
| // encapsulate the channel; all callers of this function must explicitly |
| // verify that the context has not been lost. |
| @@ -210,6 +248,9 @@ class CommandBufferProxyImpl |
| SwapBuffersCompletionCallback swap_buffers_completion_callback_; |
| + scoped_refptr<base::MessageLoopProxy> main_loop_proxy_; |
| + scoped_refptr<GpuMemoryBufferUsageTracker> tracker_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(CommandBufferProxyImpl); |
| }; |