Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(968)

Unified Diff: gpu/command_buffer/service/in_process_command_buffer.h

Issue 143023005: Support multiple service instances with GLInProcessContext (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..e469f78a6f224b32e27ddb1eefc013db05156c46 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;
+ explicit 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);
// If |surface| is not NULL, use it directly; in this case, the command
@@ -129,16 +118,22 @@ 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:
- virtual ~SchedulerClient() {}
+ Service();
+ virtual ~Service();
- // Queues a task to run as soon as possible.
- virtual void QueueTask(const base::Closure& task) = 0;
+ virtual void AddRef() const = 0;
+ virtual void Release() const = 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;
+
+ virtual bool UseVirtualizedGLContexts() = 0;
};
#if defined(OS_ANDROID)
@@ -179,7 +174,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) { service_->ScheduleTask(task); }
void CheckSequencedThread();
// Callbacks:
@@ -189,6 +184,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 +205,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> service_;
State state_after_last_flush_;
base::Lock state_after_last_flush_lock_;
scoped_ptr<GpuControl> gpu_control_;
« no previous file with comments | « gpu/command_buffer/client/gl_in_process_context.cc ('k') | gpu/command_buffer/service/in_process_command_buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698