| 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..0c4debec20bc329d9d71c9c018f8f96db33b5348 100644
|
| --- a/gpu/command_buffer/service/command_executor.cc
|
| +++ b/gpu/command_buffer/service/command_executor.cc
|
| @@ -152,19 +152,26 @@ void CommandExecutor::SetCommandProcessedCallback(
|
| command_processed_callback_ = callback;
|
| }
|
|
|
| +void CommandExecutor::SetPreemptionCallback(
|
| + const PreemptionCallback& callback) {
|
| + preemption_callback_ = callback;
|
| +}
|
| +
|
| bool CommandExecutor::IsPreempted() {
|
| - if (!preemption_flag_.get())
|
| + if (preemption_callback_.is_null())
|
| return false;
|
|
|
| - if (!was_preempted_ && preemption_flag_->IsSet()) {
|
| + bool preempt = preemption_callback_.Run();
|
| +
|
| + if (!was_preempted_ && preempt) {
|
| TRACE_COUNTER_ID1("gpu", "CommandExecutor::Preempted", this, 1);
|
| was_preempted_ = true;
|
| - } else if (was_preempted_ && !preemption_flag_->IsSet()) {
|
| + } else if (was_preempted_ && !preempt) {
|
| TRACE_COUNTER_ID1("gpu", "CommandExecutor::Preempted", this, 0);
|
| was_preempted_ = false;
|
| }
|
|
|
| - return preemption_flag_->IsSet();
|
| + return preempt;
|
| }
|
|
|
| bool CommandExecutor::HasMoreIdleWork() const {
|
|
|