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

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

Issue 2763753002: gpu: Add callback for yielding command buffer execution. (Closed)
Patch Set: no need to !!pause Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gpu/command_buffer/service/command_executor.h ('k') | gpu/command_buffer/service/preemption_flag.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/service/command_executor.cc
diff --git a/gpu/command_buffer/service/command_executor.cc b/gpu/command_buffer/service/command_executor.cc
index ff7a910bf86a8263b70eae0440746003f5295e2b..e0bc504584b1e3d7a80007cea87c15305780b8e2 100644
--- a/gpu/command_buffer/service/command_executor.cc
+++ b/gpu/command_buffer/service/command_executor.cc
@@ -24,11 +24,7 @@ namespace gpu {
CommandExecutor::CommandExecutor(CommandBufferServiceBase* command_buffer,
AsyncAPIInterface* handler,
gles2::GLES2Decoder* decoder)
- : command_buffer_(command_buffer),
- handler_(handler),
- decoder_(decoder),
- scheduled_(true),
- was_preempted_(false) {}
+ : command_buffer_(command_buffer), handler_(handler), decoder_(decoder) {}
CommandExecutor::~CommandExecutor() {}
@@ -53,7 +49,7 @@ void CommandExecutor::PutChanged() {
if (decoder_)
decoder_->BeginDecoding();
while (!parser_->IsEmpty()) {
- if (IsPreempted())
+ if (PauseExecution())
break;
DCHECK(scheduled());
@@ -152,19 +148,21 @@ void CommandExecutor::SetCommandProcessedCallback(
command_processed_callback_ = callback;
}
-bool CommandExecutor::IsPreempted() {
- if (!preemption_flag_.get())
+void CommandExecutor::SetPauseExecutionCallback(
+ const PauseExecutionCallback& callback) {
+ pause_execution_callback_ = callback;
+}
+
+bool CommandExecutor::PauseExecution() {
+ if (pause_execution_callback_.is_null())
return false;
- if (!was_preempted_ && preemption_flag_->IsSet()) {
- TRACE_COUNTER_ID1("gpu", "CommandExecutor::Preempted", this, 1);
- was_preempted_ = true;
- } else if (was_preempted_ && !preemption_flag_->IsSet()) {
- TRACE_COUNTER_ID1("gpu", "CommandExecutor::Preempted", this, 0);
- was_preempted_ = false;
+ bool pause = pause_execution_callback_.Run();
+ if (paused_ != pause) {
+ TRACE_COUNTER_ID1("gpu", "CommandExecutor::Paused", this, pause);
+ paused_ = pause;
}
-
- return preemption_flag_->IsSet();
+ return pause;
}
bool CommandExecutor::HasMoreIdleWork() const {
« no previous file with comments | « gpu/command_buffer/service/command_executor.h ('k') | gpu/command_buffer/service/preemption_flag.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698