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..9bbc2ecc2763b1372d6625915119756da2ef9420 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,16 @@ 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); |
|
no sievers
2016/04/06 23:17:23
return false;
danakj
2016/04/06 23:29:38
Oops thanks.
|
| + } |
| + return true; |
| } |
| void InProcessCommandBuffer::PumpCommands() { |
| @@ -264,12 +267,10 @@ bool InProcessCommandBuffer::Initialize( |
| const gfx::Size& size, |
| const std::vector<int32_t>& attribs, |
| gfx::GpuPreference gpu_preference, |
| - const base::Closure& context_lost_callback, |
| InProcessCommandBuffer* share_group, |
| GpuMemoryBufferManager* gpu_memory_buffer_manager, |
| ImageFactory* image_factory) { |
| DCHECK(!share_group || service_.get() == share_group->service_.get()); |
| - context_lost_callback_ = WrapCallback(context_lost_callback); |
| if (surface.get()) { |
| // GPU thread must be the same as client thread due to GLSurface not being |
| @@ -324,8 +325,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( |
| - &InProcessCommandBuffer::OnContextLost, gpu_thread_weak_ptr_)); |
| if (!command_buffer->Initialize()) { |
| LOG(ERROR) << "Could not initialize command buffer."; |
| @@ -490,16 +489,6 @@ void InProcessCommandBuffer::CheckSequencedThread() { |
| sequence_checker_->CalledOnValidSequencedThread()); |
| } |
| -void InProcessCommandBuffer::OnContextLost() { |
| - CheckSequencedThread(); |
| - if (!context_lost_callback_.is_null()) { |
| - context_lost_callback_.Run(); |
| - context_lost_callback_.Reset(); |
| - } |
| - |
| - context_lost_ = true; |
| -} |
| - |
| CommandBuffer::State InProcessCommandBuffer::GetStateFast() { |
| CheckSequencedThread(); |
| base::AutoLock lock(state_after_last_flush_lock_); |
| @@ -534,14 +523,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 +904,8 @@ void InProcessCommandBuffer::SignalQueryOnGpuThread( |
| } |
| void InProcessCommandBuffer::SetLock(base::Lock*) { |
| + // No support for using on multiple threads. |
| + NOTREACHED(); |
| } |
| bool InProcessCommandBuffer::IsGpuChannelLost() { |