| Index: gpu/command_buffer/common/preemption_flag.h
|
| diff --git a/gpu/command_buffer/common/preemption_flag.h b/gpu/command_buffer/common/preemption_flag.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..b2994aa906b8e89eadeaa3fc94b0683d871d6adc
|
| --- /dev/null
|
| +++ b/gpu/command_buffer/common/preemption_flag.h
|
| @@ -0,0 +1,32 @@
|
| +// Copyright (c) 2016 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef GPU_COMMAND_BUFFER_COMMON_PREEMPTION_FLAG_H_
|
| +#define GPU_COMMAND_BUFFER_COMMON_PREEMPTION_FLAG_H_
|
| +
|
| +#include "base/atomic_ref_count.h"
|
| +#include "base/atomicops.h"
|
| +#include "base/memory/ref_counted.h"
|
| +
|
| +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>;
|
| +};
|
| +
|
| +} // namespace gpu
|
| +
|
| +#endif // GPU_COMMAND_BUFFER_COMMON_PREEMPTION_FLAG_H_
|
|
|