Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(182)

Unified Diff: gpu/command_buffer/service/in_process_command_buffer.cc

Issue 1864373002: Remove unused features for in-process GL contexts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: inproclost: . Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gpu/command_buffer/service/in_process_command_buffer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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() {
« no previous file with comments | « gpu/command_buffer/service/in_process_command_buffer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698