Chromium Code Reviews| 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 00265481a2225a98c63196ce82b25f8616eafc06..ac76de9515dc2464f34981ab703aa08d9c0da1da 100644 |
| --- a/gpu/command_buffer/service/in_process_command_buffer.h |
| +++ b/gpu/command_buffer/service/in_process_command_buffer.h |
| @@ -59,21 +59,10 @@ class TransferBufferManagerInterface; |
| class GPU_EXPORT InProcessCommandBuffer : public CommandBuffer, |
| public GpuControl { |
| public: |
| - InProcessCommandBuffer(); |
| + class Service; |
| + InProcessCommandBuffer(const scoped_refptr<Service>& service); |
|
piman
2014/02/12 04:10:42
nit: explicit
no sievers
2014/02/12 22:31:29
Done.
|
| virtual ~InProcessCommandBuffer(); |
| - // Used to override the GPU thread with explicit scheduling. |
| - // (By default an internal GPU thread will be spawned to handle all GL work |
| - // and the two functions are unused.) |
| - // The callback will be called from different client threads. After the |
| - // callback is issued, the client is expected to eventually call |
| - // ProcessGpuWorkOnCurrentThread(). The latter cannot be called from different |
| - // threads. |
| - // The callback needs to be set before any context is created. |
| - static void SetScheduleCallback(const base::Closure& callback); |
| - static void ProcessGpuWorkOnCurrentThread(); |
| - |
| - static void EnableVirtualizedContext(); |
| static void SetGpuMemoryBufferFactory(GpuMemoryBufferFactory* factory); |
| // If |surface| is not NULL, use it directly; in this case, the command |
| @@ -129,16 +118,21 @@ class GPU_EXPORT InProcessCommandBuffer : public CommandBuffer, |
| virtual uint32 CreateStreamTexture(uint32 texture_id) OVERRIDE; |
| // The serializer interface to the GPU service (i.e. thread). |
| - class SchedulerClient { |
| + class Service : public base::RefCountedThreadSafe<Service> { |
|
piman
2014/02/12 04:10:42
It isn't a great pattern to have an interface impl
no sievers
2014/02/12 22:31:29
Done.
|
| public: |
| - virtual ~SchedulerClient() {} |
| + // Queues a task to run as soon as possible. |
| + virtual void ScheduleTask(const base::Closure& task) = 0; |
| - // Queues a task to run as soon as possible. |
| - virtual void QueueTask(const base::Closure& task) = 0; |
| + // Schedules |callback| to run at an appropriate time for performing idle |
| + // work. |
| + virtual void ScheduleIdleWork(const base::Closure& task) = 0; |
| - // Schedules |callback| to run at an appropriate time for performing idle |
| - // work. |
| - virtual void ScheduleIdleWork(const base::Closure& task) = 0; |
| + virtual bool UseVirtualizedGLContexts() = 0; |
| + |
| + protected: |
| + Service(); |
| + virtual ~Service(); |
| + friend class base::RefCountedThreadSafe<Service>; |
| }; |
| #if defined(OS_ANDROID) |
| @@ -179,7 +173,7 @@ class GPU_EXPORT InProcessCommandBuffer : public CommandBuffer, |
| bool MakeCurrent(); |
| base::Closure WrapCallback(const base::Closure& callback); |
| State GetStateFast(); |
| - void QueueTask(const base::Closure& task) { queue_->QueueTask(task); } |
| + void QueueTask(const base::Closure& task) { queue_->ScheduleTask(task); } |
| void CheckSequencedThread(); |
| // Callbacks: |
| @@ -189,6 +183,8 @@ class GPU_EXPORT InProcessCommandBuffer : public CommandBuffer, |
| void PumpCommands(); |
| void ScheduleMoreIdleWork(); |
| + static scoped_refptr<Service> GetDefaultService(); |
| + |
| // Members accessed on the gpu thread (possibly with the exception of |
| // creation): |
| bool context_lost_; |
| @@ -208,7 +204,7 @@ class GPU_EXPORT InProcessCommandBuffer : public CommandBuffer, |
| scoped_ptr<CommandBuffer> command_buffer_; |
| base::Lock command_buffer_lock_; |
| base::WaitableEvent flush_event_; |
| - scoped_ptr<SchedulerClient> queue_; |
| + scoped_refptr<Service> queue_; |
|
piman
2014/02/12 04:10:42
nit: s/queue_/service_/
no sievers
2014/02/12 22:31:29
Done.
|
| State state_after_last_flush_; |
| base::Lock state_after_last_flush_lock_; |
| scoped_ptr<GpuControl> gpu_control_; |