| Index: content/common/gpu/gpu_command_buffer_stub.h
|
| diff --git a/content/common/gpu/gpu_command_buffer_stub.h b/content/common/gpu/gpu_command_buffer_stub.h
|
| index fa8d7eeb969cdd37c0a2076e85c3f034b34b9709..5fdb0e930f497beab8c7456e1ded330a5413a459 100644
|
| --- a/content/common/gpu/gpu_command_buffer_stub.h
|
| +++ b/content/common/gpu/gpu_command_buffer_stub.h
|
| @@ -63,6 +63,12 @@ class GpuCommandBufferStub
|
| // to the same renderer process.
|
| int32 route_id() const { return route_id_; }
|
|
|
| + // Return the current token in the underlying command buffer, or 0 if not yet
|
| + // initialized.
|
| + int32 token() const {
|
| + return command_buffer_.get() ? command_buffer_->GetState().token : 0;
|
| + }
|
| +
|
| #if defined(OS_WIN)
|
| // Called only by the compositor window's window proc
|
| void OnCompositorWindowPainted();
|
| @@ -84,6 +90,11 @@ class GpuCommandBufferStub
|
| // unblock itself and handle pending messages.
|
| void CommandBufferWasDestroyed();
|
|
|
| + // Register a callback to be Run() whenever the underlying scheduler receives
|
| + // a set_token() call. The callback will be Run() with the just-set token as
|
| + // its only parameter. Multiple callbacks may be registered.
|
| + void AddSetTokenCallback(const base::Callback<void(int32)>& callback);
|
| +
|
| private:
|
| // Message handlers:
|
| void OnInitialize(base::SharedMemoryHandle ring_buffer,
|
| @@ -126,6 +137,9 @@ class GpuCommandBufferStub
|
| void ResizeCallback(gfx::Size size);
|
| void ReportState();
|
|
|
| + // Callback registered with GpuScheduler to receive set_token() notifications.
|
| + void OnSetToken(int32 token);
|
| +
|
| // The lifetime of objects of this class is managed by a GpuChannel. The
|
| // GpuChannels destroy all the GpuCommandBufferStubs that they own when they
|
| // are destroyed. So a raw pointer is safe.
|
| @@ -147,6 +161,7 @@ class GpuCommandBufferStub
|
| scoped_ptr<gpu::CommandBufferService> command_buffer_;
|
| scoped_ptr<gpu::GpuScheduler> scheduler_;
|
| std::queue<IPC::Message*> deferred_messages_;
|
| + std::vector<base::Callback<void(int32)> > set_token_callbacks_;
|
|
|
| // SetParent may be called before Initialize, in which case we need to keep
|
| // around the parent stub, so that Initialize can set the parent correctly.
|
|
|