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 8fc0855090404157a7e7e565edde23370d9f5ccd..431f90d30bc8ed9fac4fa4c9e36e50ec0425ea47 100644 |
| --- a/content/common/gpu/gpu_command_buffer_stub.cc |
| +++ b/content/common/gpu/gpu_command_buffer_stub.cc |
| @@ -56,7 +56,8 @@ GpuCommandBufferStub::GpuCommandBufferStub( |
| #endif // defined(OS_WIN) |
| renderer_id_(renderer_id), |
| render_view_id_(render_view_id), |
| - watchdog_(watchdog) { |
| + watchdog_(watchdog), |
| + task_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { |
| } |
| #if defined(OS_WIN) |
| @@ -256,7 +257,7 @@ void GpuCommandBufferStub::OnInitialize( |
| parent_texture_id_)) { |
| command_buffer_->SetPutOffsetChangeCallback( |
| NewCallback(scheduler_.get(), |
| - &gpu::GpuScheduler::ProcessCommands)); |
| + &gpu::GpuScheduler::PutChanged)); |
| scheduler_->SetSwapBuffersCallback( |
| NewCallback(this, &GpuCommandBufferStub::OnSwapBuffers)); |
| scheduler_->SetLatchCallback(base::Bind( |
| @@ -301,13 +302,16 @@ void GpuCommandBufferStub::OnGetState(gpu::CommandBuffer::State* state) { |
| void GpuCommandBufferStub::OnAsyncGetState() { |
| gpu::CommandBuffer::State state = command_buffer_->GetState(); |
| - Send(new GpuCommandBufferMsg_UpdateState(route_id_, state)); |
| + IPC::Message* msg = new GpuCommandBufferMsg_UpdateState(route_id_, state); |
| + msg->set_unblock(true); |
| + Send(msg); |
| } |
| void GpuCommandBufferStub::OnFlush(int32 put_offset, |
| + int32 last_known_get, |
| gpu::CommandBuffer::State* state) { |
| GPU_TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnFlush"); |
| - *state = command_buffer_->FlushSync(put_offset); |
| + *state = command_buffer_->FlushSync(put_offset, last_known_get); |
| if (state->error == gpu::error::kLostContext && |
| gfx::GLContext::LosesAllContextsOnContextLost()) |
| channel_->LoseAllContexts(); |
| @@ -315,12 +319,11 @@ void GpuCommandBufferStub::OnFlush(int32 put_offset, |
| void GpuCommandBufferStub::OnAsyncFlush(int32 put_offset) { |
| GPU_TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnAsyncFlush"); |
| - gpu::CommandBuffer::State state = command_buffer_->FlushSync(put_offset); |
| - if (state.error == gpu::error::kLostContext && |
| - gfx::GLContext::LosesAllContextsOnContextLost()) |
| - channel_->LoseAllContexts(); |
|
apatrick_chromium
2011/04/27 22:52:44
Why did you remove this?
piman
2011/04/27 23:44:29
Since we're not waiting on any command to execute,
|
| - else |
| - Send(new GpuCommandBufferMsg_UpdateState(route_id_, state)); |
| + command_buffer_->Flush(put_offset); |
| + // TODO(piman): Do this everytime the scheduler finishes processing a batch of |
| + // commands. |
| + MessageLoop::current()->PostTask(FROM_HERE, |
| + task_factory_.NewRunnableMethod(&GpuCommandBufferStub::OnAsyncGetState)); |
| } |
| void GpuCommandBufferStub::OnCreateTransferBuffer(int32 size, |