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 5484f2ac28d6e59e4ec22fa7994b867a51f7e584..97ec6388152cf8c0cfccb0cedce11332ddb4c747 100644 |
--- a/gpu/command_buffer/service/in_process_command_buffer.h |
+++ b/gpu/command_buffer/service/in_process_command_buffer.h |
@@ -58,20 +58,10 @@ class TransferBufferManagerInterface; |
class GPU_EXPORT InProcessCommandBuffer : public CommandBuffer, |
public GpuControl { |
public: |
- InProcessCommandBuffer(); |
+ class Service; |
+ InProcessCommandBuffer(const scoped_refptr<Service>& service); |
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); |
@@ -129,16 +119,28 @@ 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> { |
public: |
- virtual ~SchedulerClient() {} |
- |
- // 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; |
+ // Queues a task to run as soon as possible. |
+ virtual void ScheduleTask(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; |
+ |
+ InProcessCommandBuffer* GetShareGroup(unsigned int group_id); |
+ void AddToShareGroup(InProcessCommandBuffer* context); |
+ void RemoveFromShareGroup(InProcessCommandBuffer* context); |
+ void MarkShareGroupAsLost(); |
+ |
+ protected: |
+ Service(); |
+ virtual ~Service(); |
+ friend class base::RefCountedThreadSafe<Service>; |
+ |
+ private: |
+ base::SequenceChecker share_group_sequence_checker_; |
boliu
2014/02/08 18:55:54
I think this needs can be generalized for all gpu
no sievers
2014/02/12 03:09:15
This is obsolete now.
|
+ std::set<InProcessCommandBuffer*> all_shared_contexts_; |
}; |
#if defined(OS_ANDROID) |
@@ -177,7 +179,7 @@ class GPU_EXPORT InProcessCommandBuffer : public CommandBuffer, |
bool IsContextLost(); |
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: |
@@ -187,6 +189,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 +212,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_; |
State state_after_last_flush_; |
base::Lock state_after_last_flush_lock_; |
scoped_ptr<GpuControl> gpu_control_; |