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..d0e203e3455525fa3806a8dc573bd6d8cb5db762 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; |
scherkus (not reviewing)
2011/06/27 22:54:47
sntyck: worth constant-izing 0 token, or is that t
Ami GONE FROM CHROMIUM
2011/06/28 00:06:35
I am following command_buffer.h:CommandBuffer::Sta
|
+ } |
+ |
#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); |
scherkus (not reviewing)
2011/06/27 22:54:47
IWYU: base/callback.h ?
Ami GONE FROM CHROMIUM
2011/06/28 00:06:35
I'm not U'ing it here, I only need a fwd decl. Bu
|
+ |
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. |