Chromium Code Reviews| Index: content/common/gpu/gpu_command_buffer_stub.cc |
| diff --git a/content/common/gpu/gpu_command_buffer_stub.cc b/content/common/gpu/gpu_command_buffer_stub.cc |
| index a6b378e362b2380ab51913ba7a360f4a2f076ce9..0060831b811d904a93922317117547ae731d1a48 100644 |
| --- a/content/common/gpu/gpu_command_buffer_stub.cc |
| +++ b/content/common/gpu/gpu_command_buffer_stub.cc |
| @@ -5,6 +5,7 @@ |
| #if defined(ENABLE_GPU) |
| #include "base/bind.h" |
| +#include "base/callback.h" |
| #include "base/debug/trace_event.h" |
| #include "base/process_util.h" |
| #include "base/shared_memory.h" |
| @@ -152,6 +153,8 @@ void GpuCommandBufferStub::OnInitialize( |
| &GpuChannel::OnLatchCallback, base::Unretained(channel_), route_id_)); |
| scheduler_->SetScheduledCallback( |
| NewCallback(this, &GpuCommandBufferStub::OnScheduled)); |
| + scheduler_->SetTokenCallback(base::Bind( |
| + &GpuCommandBufferStub::OnSetToken, base::Unretained(this))); |
| if (watchdog_) |
| scheduler_->SetCommandProcessedCallback( |
| NewCallback(this, &GpuCommandBufferStub::OnCommandProcessed)); |
| @@ -488,6 +491,16 @@ void GpuCommandBufferStub::CommandBufferWasDestroyed() { |
| HandleDeferredMessages(); |
| } |
| +void GpuCommandBufferStub::AddSetTokenCallback( |
| + const base::Callback<void(int32)>& callback) { |
| + set_token_callbacks_.push_back(callback); |
| +} |
| + |
| +void GpuCommandBufferStub::OnSetToken(int32 token) { |
| + for (size_t i = 0; i < set_token_callbacks_.size(); ++i) |
| + set_token_callbacks_[i].Run(token); |
|
piman
2011/06/28 01:19:22
Can the callback remove itself ? See later comment
Ami GONE FROM CHROMIUM
2011/06/28 21:00:53
See later comment for why I don't think we need th
|
| +} |
| + |
| void GpuCommandBufferStub::ResizeCallback(gfx::Size size) { |
| if (handle_ == gfx::kNullPluginWindow) { |
| scheduler_->decoder()->ResizeOffscreenFrameBuffer(size); |