| Index: gpu/command_buffer/service/gpu_scheduler.h
|
| ===================================================================
|
| --- gpu/command_buffer/service/gpu_scheduler.h (revision 93137)
|
| +++ gpu/command_buffer/service/gpu_scheduler.h (working copy)
|
| @@ -43,15 +43,20 @@
|
| // posts tasks to the current message loop to do additional work.
|
| class GpuScheduler : public CommandBufferEngine {
|
| public:
|
| + // Scheduler quantum: makes ProcessCommands continue until the specified time
|
| + // has passed, or the command buffer yields or runs out of commands.
|
| + static const int kMinimumSchedulerQuantumMicros = 2000;
|
| +
|
| // If a group is not passed in one will be created.
|
| - static GpuScheduler* Create(CommandBuffer* command_buffer,
|
| - SurfaceManager* surface_manager,
|
| - gles2::ContextGroup* group);
|
| + GpuScheduler(CommandBuffer* command_buffer,
|
| + SurfaceManager* surface_manager,
|
| + gles2::ContextGroup* group);
|
|
|
| // This constructor is for unit tests.
|
| - static GpuScheduler* CreateForTests(CommandBuffer* command_buffer,
|
| - gles2::GLES2Decoder* decoder,
|
| - CommandParser* parser);
|
| + GpuScheduler(CommandBuffer* command_buffer,
|
| + gles2::GLES2Decoder* decoder,
|
| + CommandParser* parser,
|
| + int commands_per_update);
|
|
|
| virtual ~GpuScheduler();
|
|
|
| @@ -68,7 +73,7 @@
|
|
|
| bool SetParent(GpuScheduler* parent_scheduler, uint32 parent_texture_id);
|
|
|
| - void PutChanged();
|
| + void PutChanged(bool sync);
|
|
|
| // Sets whether commands should be processed by this scheduler. Setting to
|
| // false unschedules. Setting to true reschedules. Whether or not the
|
| @@ -146,6 +151,13 @@
|
|
|
| void SetCommandProcessedCallback(Callback0::Type* callback);
|
|
|
| + // Sets a callback which is called after a Set/WaitLatch command is processed.
|
| + // The bool parameter will be true for SetLatch, and false for a WaitLatch
|
| + // that is blocked. An unblocked WaitLatch will not trigger a callback.
|
| + void SetLatchCallback(const base::Callback<void(bool)>& callback) {
|
| + decoder_->SetLatchCallback(callback);
|
| + }
|
| +
|
| // Sets a callback which is called when set_token() is called, and passes the
|
| // just-set token to the callback. DCHECKs that no callback has previously
|
| // been registered for this notification.
|
| @@ -166,10 +178,8 @@
|
|
|
|
|
| private:
|
| - // If a group is not passed in one will be created.
|
| - GpuScheduler(CommandBuffer* command_buffer,
|
| - gles2::GLES2Decoder* decoder,
|
| - CommandParser* parser);
|
| + // Helper which causes a call to ProcessCommands to be scheduled later.
|
| + void ScheduleProcessCommands();
|
|
|
| // Called via a callback just before we are supposed to call the
|
| // user's resize callback.
|
| @@ -178,12 +188,15 @@
|
| // Called via a callback just before we are supposed to call the
|
| // user's swap buffers callback.
|
| void WillSwapBuffers();
|
| + void ProcessCommands();
|
|
|
| // The GpuScheduler holds a weak reference to the CommandBuffer. The
|
| // CommandBuffer owns the GpuScheduler and holds a strong reference to it
|
| // through the ProcessCommands callback.
|
| CommandBuffer* command_buffer_;
|
|
|
| + int commands_per_update_;
|
| +
|
| scoped_ptr<gles2::GLES2Decoder> decoder_;
|
| scoped_ptr<CommandParser> parser_;
|
|
|
|
|