| Index: gpu/command_buffer/service/command_executor.h
|
| diff --git a/gpu/command_buffer/service/command_executor.h b/gpu/command_buffer/service/command_executor.h
|
| index 7493d4f6244cea0df0170dc5314b00a3c6093c31..61c41b3887b3da52088e02d87825027ee63e2a5f 100644
|
| --- a/gpu/command_buffer/service/command_executor.h
|
| +++ b/gpu/command_buffer/service/command_executor.h
|
| @@ -10,11 +10,8 @@
|
| #include <memory>
|
| #include <queue>
|
|
|
| -#include "base/atomic_ref_count.h"
|
| -#include "base/atomicops.h"
|
| #include "base/callback.h"
|
| #include "base/macros.h"
|
| -#include "base/memory/ref_counted.h"
|
| #include "base/memory/shared_memory.h"
|
| #include "base/memory/weak_ptr.h"
|
| #include "gpu/command_buffer/service/cmd_buffer_engine.h"
|
| @@ -25,22 +22,6 @@
|
|
|
| namespace gpu {
|
|
|
| -class PreemptionFlag : public base::RefCountedThreadSafe<PreemptionFlag> {
|
| - public:
|
| - PreemptionFlag() : flag_(0) {}
|
| -
|
| - bool IsSet() { return !base::AtomicRefCountIsZero(&flag_); }
|
| - void Set() { base::AtomicRefCountInc(&flag_); }
|
| - void Reset() { base::subtle::NoBarrier_Store(&flag_, 0); }
|
| -
|
| - private:
|
| - base::AtomicRefCount flag_;
|
| -
|
| - ~PreemptionFlag() {}
|
| -
|
| - friend class base::RefCountedThreadSafe<PreemptionFlag>;
|
| -};
|
| -
|
| // This class schedules commands that have been flushed. They are received via
|
| // a command buffer and forwarded to a command parser. TODO(apatrick): This
|
| // class should not know about the decoder. Do not add additional dependencies
|
| @@ -57,9 +38,10 @@ class GPU_EXPORT CommandExecutor
|
|
|
| void PutChanged();
|
|
|
| - void SetPreemptByFlag(scoped_refptr<PreemptionFlag> flag) {
|
| - preemption_flag_ = flag;
|
| - }
|
| + // This callback is checked regularly and execution is stopped if it returns
|
| + // true.
|
| + typedef base::Callback<bool(void)> PreemptionCallback;
|
| + void SetPreemptionCallback(const PreemptionCallback& callback);
|
|
|
| // Sets whether commands should be processed by this scheduler. Setting to
|
| // false unschedules. Setting to true reschedules.
|
| @@ -122,10 +104,10 @@ class GPU_EXPORT CommandExecutor
|
| // Whether the scheduler is currently able to process more commands.
|
| bool scheduled_;
|
|
|
| + PreemptionCallback preemption_callback_;
|
| +
|
| base::Closure command_processed_callback_;
|
|
|
| - // If non-NULL and |preemption_flag_->IsSet()|, exit PutChanged early.
|
| - scoped_refptr<PreemptionFlag> preemption_flag_;
|
| bool was_preempted_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(CommandExecutor);
|
|
|