Index: gpu/command_buffer/service/in_process_command_buffer.h |
diff --git a/gpu/command_buffer/service/in_process_command_buffer.h b/gpu/command_buffer/service/in_process_command_buffer.h |
index 731c4868f54db8cffe571b1cd3c96f30a43a4037..c0221dd0288afdb824547fa7f08f78ec76d244b1 100644 |
--- a/gpu/command_buffer/service/in_process_command_buffer.h |
+++ b/gpu/command_buffer/service/in_process_command_buffer.h |
@@ -19,6 +19,7 @@ |
#include "base/memory/ref_counted.h" |
#include "base/memory/scoped_ptr.h" |
#include "base/memory/weak_ptr.h" |
+#include "base/single_thread_task_runner.h" |
#include "base/synchronization/lock.h" |
#include "base/synchronization/waitable_event.h" |
#include "base/threading/thread.h" |
@@ -92,7 +93,6 @@ class GPU_EXPORT InProcessCommandBuffer : public CommandBuffer, |
const gfx::Size& size, |
const std::vector<int32_t>& attribs, |
gfx::GpuPreference gpu_preference, |
- const base::Closure& context_lost_callback, |
InProcessCommandBuffer* share_group, |
GpuMemoryBufferManager* gpu_memory_buffer_manager, |
ImageFactory* image_factory); |
@@ -113,6 +113,8 @@ class GPU_EXPORT InProcessCommandBuffer : public CommandBuffer, |
gpu::error::Error GetLastError() override; |
// GpuControl implementation: |
+ // NOTE: The GpuControlClient will be called on the client thread. |
+ void SetGpuControlClient(GpuControlClient*) override; |
gpu::Capabilities GetCapabilities() override; |
int32_t CreateImage(ClientBuffer buffer, |
size_t width, |
@@ -239,17 +241,18 @@ class GPU_EXPORT InProcessCommandBuffer : public CommandBuffer, |
void DestroyImageOnGpuThread(int32_t id); |
void SetGetBufferOnGpuThread(int32_t shm_id, base::WaitableEvent* completion); |
- // Callbacks: |
+ // Callbacks on the gpu thread. |
+ void OnContextLostOnGpuThread(); |
+ void PumpCommandsOnGpuThread(); |
+ void PerformDelayedWorkOnGpuThread(); |
+ // Callback implementations on the client thread. |
void OnContextLost(); |
- bool GetBufferChanged(int32_t transfer_buffer_id); |
- void PumpCommands(); |
- void PerformDelayedWork(); |
const CommandBufferId command_buffer_id_; |
// Members accessed on the gpu thread (possibly with the exception of |
// creation): |
- bool context_lost_; |
+ scoped_refptr<base::SingleThreadTaskRunner> origin_task_runner_; |
scoped_refptr<TransferBufferManagerInterface> transfer_buffer_manager_; |
scoped_ptr<CommandExecutor> executor_; |
scoped_ptr<gles2::GLES2Decoder> decoder_; |
@@ -258,10 +261,15 @@ class GPU_EXPORT InProcessCommandBuffer : public CommandBuffer, |
scoped_refptr<SyncPointOrderData> sync_point_order_data_; |
scoped_ptr<SyncPointClient> sync_point_client_; |
base::Closure context_lost_callback_; |
- bool delayed_work_pending_; // Used to throttle PerformDelayedWork. |
+ // Used to throttle PerformDelayedWorkOnGpuThread. |
+ bool delayed_work_pending_; |
ImageFactory* image_factory_; |
// Members accessed on the client thread: |
+ GpuControlClient* gpu_control_client_; |
+#if DCHECK_IS_ON() |
+ bool context_lost_; |
+#endif |
State last_state_; |
int32_t last_put_offset_; |
gpu::Capabilities capabilities_; |
@@ -288,7 +296,9 @@ class GPU_EXPORT InProcessCommandBuffer : public CommandBuffer, |
// the client thread. |
scoped_ptr<base::SequenceChecker> sequence_checker_; |
+ base::WeakPtr<InProcessCommandBuffer> client_thread_weak_ptr_; |
base::WeakPtr<InProcessCommandBuffer> gpu_thread_weak_ptr_; |
+ base::WeakPtrFactory<InProcessCommandBuffer> client_thread_weak_ptr_factory_; |
base::WeakPtrFactory<InProcessCommandBuffer> gpu_thread_weak_ptr_factory_; |
DISALLOW_COPY_AND_ASSIGN(InProcessCommandBuffer); |