Chromium Code Reviews| Index: gpu/command_buffer/service/command_buffer_service.cc |
| diff --git a/gpu/command_buffer/service/command_buffer_service.cc b/gpu/command_buffer/service/command_buffer_service.cc |
| index bae2d801dd5021612ce6550bdcd7197c10082c72..02c255060ca745c823abd5be5289211bff86a7b3 100644 |
| --- a/gpu/command_buffer/service/command_buffer_service.cc |
| +++ b/gpu/command_buffer/service/command_buffer_service.cc |
| @@ -13,6 +13,7 @@ |
| #include "gpu/command_buffer/service/transfer_buffer_manager.h" |
| using ::base::SharedMemory; |
| +using ::base::AutoLock; |
| namespace gpu { |
| @@ -25,6 +26,7 @@ CommandBufferService::CommandBufferService( |
| put_offset_(0), |
| transfer_buffer_manager_(transfer_buffer_manager), |
| token_(0), |
| + async_token_(0), |
| generation_(0), |
| error_(error::kNoError), |
| context_lost_reason_(error::kUnknown) { |
| @@ -38,11 +40,17 @@ bool CommandBufferService::Initialize() { |
| } |
| CommandBufferService::State CommandBufferService::GetState() { |
| + AutoLock lock(lock_); |
| + return GetStateImpl(); |
| +} |
| + |
| +CommandBufferService::State CommandBufferService::GetStateImpl() { |
|
reveman
2014/01/22 17:30:04
Please add a lock_.AssertAcquired() call here to p
|
| State state; |
| state.num_entries = num_entries_; |
| state.get_offset = get_offset_; |
| state.put_offset = put_offset_; |
| state.token = token_; |
| + state.async_token = async_token_; |
| state.error = error_; |
| state.context_lost_reason = context_lost_reason_; |
| state.generation = ++generation_; |
| @@ -59,8 +67,9 @@ int32 CommandBufferService::GetLastToken() { |
| } |
| void CommandBufferService::UpdateState() { |
| + AutoLock lock(lock_); |
| if (shared_state_) { |
| - CommandBufferService::State state = GetState(); |
| + CommandBufferService::State state = GetStateImpl(); |
| shared_state_->Write(state); |
| } |
| } |
| @@ -174,6 +183,11 @@ void CommandBufferService::SetToken(int32 token) { |
| UpdateState(); |
| } |
| +void CommandBufferService::SetAsyncToken(uint32 token) { |
| + async_token_ = token; |
|
reveman
2014/01/22 17:30:04
Do you need to acquire the lock before writing to
|
| + UpdateState(); |
| +} |
| + |
| void CommandBufferService::SetParseError(error::Error error) { |
| if (error_ == error::kNoError) { |
| error_ = error; |