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

Side by Side Diff: content/common/gpu/gpu_command_buffer_stub.cc

Issue 12340118: GPU: Only allow the UI channel to preempt if all stubs are scheduled. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix nit. Created 7 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/bind.h" 5 #include "base/bind.h"
6 #include "base/bind_helpers.h" 6 #include "base/bind_helpers.h"
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "base/hash.h" 9 #include "base/hash.h"
10 #include "base/shared_memory.h" 10 #include "base/shared_memory.h"
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 AsWeakPtr()), 258 AsWeakPtr()),
259 base::TimeDelta::FromMilliseconds(delay)); 259 base::TimeDelta::FromMilliseconds(delay));
260 } 260 }
261 } 261 }
262 262
263 void GpuCommandBufferStub::OnEcho(const IPC::Message& message) { 263 void GpuCommandBufferStub::OnEcho(const IPC::Message& message) {
264 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnEcho"); 264 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnEcho");
265 Send(new IPC::Message(message)); 265 Send(new IPC::Message(message));
266 } 266 }
267 267
268 void GpuCommandBufferStub::OnReschedule() {
269 if (!IsScheduled())
270 return;
271
272 channel_->OnScheduled();
273 }
274
275 bool GpuCommandBufferStub::MakeCurrent() { 268 bool GpuCommandBufferStub::MakeCurrent() {
276 if (decoder_->MakeCurrent()) 269 if (decoder_->MakeCurrent())
277 return true; 270 return true;
278 DLOG(ERROR) << "Context lost because MakeCurrent failed."; 271 DLOG(ERROR) << "Context lost because MakeCurrent failed.";
279 command_buffer_->SetContextLostReason(decoder_->GetContextLostReason()); 272 command_buffer_->SetContextLostReason(decoder_->GetContextLostReason());
280 command_buffer_->SetParseError(gpu::error::kLostContext); 273 command_buffer_->SetParseError(gpu::error::kLostContext);
281 if (gfx::GLContext::LosesAllContextsOnContextLost()) 274 if (gfx::GLContext::LosesAllContextsOnContextLost())
282 channel_->LoseAllContexts(); 275 channel_->LoseAllContexts();
283 return false; 276 return false;
284 } 277 }
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 base::Bind(&GpuCommandBufferStub::OnWaitSyncPoint, 471 base::Bind(&GpuCommandBufferStub::OnWaitSyncPoint,
479 base::Unretained(this))); 472 base::Unretained(this)));
480 473
481 command_buffer_->SetPutOffsetChangeCallback( 474 command_buffer_->SetPutOffsetChangeCallback(
482 base::Bind(&GpuCommandBufferStub::PutChanged, base::Unretained(this))); 475 base::Bind(&GpuCommandBufferStub::PutChanged, base::Unretained(this)));
483 command_buffer_->SetGetBufferChangeCallback( 476 command_buffer_->SetGetBufferChangeCallback(
484 base::Bind(&gpu::GpuScheduler::SetGetBuffer, 477 base::Bind(&gpu::GpuScheduler::SetGetBuffer,
485 base::Unretained(scheduler_.get()))); 478 base::Unretained(scheduler_.get())));
486 command_buffer_->SetParseErrorCallback( 479 command_buffer_->SetParseErrorCallback(
487 base::Bind(&GpuCommandBufferStub::OnParseError, base::Unretained(this))); 480 base::Bind(&GpuCommandBufferStub::OnParseError, base::Unretained(this)));
488 scheduler_->SetScheduledCallback( 481 scheduler_->SetSchedulingChangedCallback(
489 base::Bind(&GpuCommandBufferStub::OnReschedule, base::Unretained(this))); 482 base::Bind(&GpuChannel::StubSchedulingChanged,
483 base::Unretained(channel_)));
490 484
491 if (watchdog_) { 485 if (watchdog_) {
492 scheduler_->SetCommandProcessedCallback( 486 scheduler_->SetCommandProcessedCallback(
493 base::Bind(&GpuCommandBufferStub::OnCommandProcessed, 487 base::Bind(&GpuCommandBufferStub::OnCommandProcessed,
494 base::Unretained(this))); 488 base::Unretained(this)));
495 } 489 }
496 490
497 #if defined(OS_ANDROID) 491 #if defined(OS_ANDROID)
498 decoder_->SetStreamTextureManager(channel_->stream_texture_manager()); 492 decoder_->SetStreamTextureManager(channel_->stream_texture_manager());
499 #endif 493 #endif
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
879 if (surface_ && MakeCurrent()) 873 if (surface_ && MakeCurrent())
880 surface_->SetFrontbufferAllocation( 874 surface_->SetFrontbufferAllocation(
881 allocation.browser_allocation.suggest_have_frontbuffer); 875 allocation.browser_allocation.suggest_have_frontbuffer);
882 } 876 }
883 877
884 last_memory_allocation_valid_ = true; 878 last_memory_allocation_valid_ = true;
885 last_memory_allocation_ = allocation; 879 last_memory_allocation_ = allocation;
886 } 880 }
887 881
888 } // namespace content 882 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/gpu_command_buffer_stub.h ('k') | gpu/command_buffer/service/gpu_scheduler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698