Chromium Code Reviews| Index: gpu/command_buffer/service/in_process_command_buffer.cc |
| diff --git a/gpu/command_buffer/service/in_process_command_buffer.cc b/gpu/command_buffer/service/in_process_command_buffer.cc |
| index 010c0fbb16822eb503ce89765935a47ac2d2364e..25ff43a31c7ebb5ed989f3c9000f97b55d8ed26b 100644 |
| --- a/gpu/command_buffer/service/in_process_command_buffer.cc |
| +++ b/gpu/command_buffer/service/in_process_command_buffer.cc |
| @@ -209,7 +209,6 @@ InProcessCommandBuffer::InProcessCommandBuffer( |
| const scoped_refptr<Service>& service) |
| : command_buffer_id_( |
| CommandBufferId::FromUnsafeValue(g_next_command_buffer_id.GetNext())), |
| - context_lost_(false), |
| delayed_work_pending_(false), |
| image_factory_(nullptr), |
| last_put_offset_(-1), |
| @@ -232,12 +231,17 @@ bool InProcessCommandBuffer::MakeCurrent() { |
| CheckSequencedThread(); |
| command_buffer_lock_.AssertAcquired(); |
| - if (!context_lost_ && decoder_->MakeCurrent()) |
| - return true; |
| - DLOG(ERROR) << "Context lost because MakeCurrent failed."; |
| - command_buffer_->SetContextLostReason(decoder_->GetContextLostReason()); |
| - command_buffer_->SetParseError(gpu::error::kLostContext); |
| - return false; |
| + if (error::IsError(command_buffer_->GetLastState().error)) { |
| + DLOG(ERROR) << "MakeCurrent failed because context lost."; |
| + return false; |
| + } |
| + if (!decoder_->MakeCurrent()) { |
| + DLOG(ERROR) << "Context lost because MakeCurrent failed."; |
| + command_buffer_->SetContextLostReason(decoder_->GetContextLostReason()); |
| + command_buffer_->SetParseError(gpu::error::kLostContext); |
| + return false; |
| + } |
| + return true; |
| } |
| void InProcessCommandBuffer::PumpCommands() { |
| @@ -324,8 +328,6 @@ bool InProcessCommandBuffer::InitializeOnGpuThread( |
| new CommandBufferService(transfer_buffer_manager_.get())); |
| command_buffer->SetPutOffsetChangeCallback(base::Bind( |
| &InProcessCommandBuffer::PumpCommands, gpu_thread_weak_ptr_)); |
| - command_buffer->SetParseErrorCallback(base::Bind( |
|
danakj
2016/04/06 23:44:42
Oops, gotta put this back too. :) Done.
|
| - &InProcessCommandBuffer::OnContextLost, gpu_thread_weak_ptr_)); |
| if (!command_buffer->Initialize()) { |
| LOG(ERROR) << "Could not initialize command buffer."; |
| @@ -496,8 +498,6 @@ void InProcessCommandBuffer::OnContextLost() { |
| context_lost_callback_.Run(); |
| context_lost_callback_.Reset(); |
| } |
| - |
| - context_lost_ = true; |
| } |
| CommandBuffer::State InProcessCommandBuffer::GetStateFast() { |
| @@ -534,14 +534,13 @@ void InProcessCommandBuffer::FlushOnGpuThread(int32_t put_offset, |
| base::AutoLock lock(state_after_last_flush_lock_); |
| state_after_last_flush_ = command_buffer_->GetLastState(); |
| } |
| - DCHECK((!error::IsError(state_after_last_flush_.error) && !context_lost_) || |
| - (error::IsError(state_after_last_flush_.error) && context_lost_)); |
| // Currently the in process command buffer does not support being |
| // descheduled, if it does we would need to back off on calling the finish |
| // processing number function until the message is rescheduled and finished |
| // processing. This DCHECK is to enforce this. |
| - DCHECK(context_lost_ || put_offset == state_after_last_flush_.get_offset); |
| + DCHECK(error::IsError(state_after_last_flush_.error) || |
| + put_offset == state_after_last_flush_.get_offset); |
| } |
| // If we've processed all pending commands but still have pending queries, |
| @@ -916,6 +915,8 @@ void InProcessCommandBuffer::SignalQueryOnGpuThread( |
| } |
| void InProcessCommandBuffer::SetLock(base::Lock*) { |
| + // No support for using on multiple threads. |
| + NOTREACHED(); |
| } |
| bool InProcessCommandBuffer::IsGpuChannelLost() { |