| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef GPU_COMMAND_BUFFER_COMMON_PREEMPTION_FLAG_H_ |
| 6 #define GPU_COMMAND_BUFFER_COMMON_PREEMPTION_FLAG_H_ |
| 7 |
| 8 #include "base/atomic_ref_count.h" |
| 9 #include "base/atomicops.h" |
| 10 #include "base/memory/ref_counted.h" |
| 11 |
| 12 namespace gpu { |
| 13 |
| 14 class PreemptionFlag : public base::RefCountedThreadSafe<PreemptionFlag> { |
| 15 public: |
| 16 PreemptionFlag() : flag_(0) {} |
| 17 |
| 18 bool IsSet() { return !base::AtomicRefCountIsZero(&flag_); } |
| 19 void Set() { base::AtomicRefCountInc(&flag_); } |
| 20 void Reset() { base::subtle::NoBarrier_Store(&flag_, 0); } |
| 21 |
| 22 private: |
| 23 base::AtomicRefCount flag_; |
| 24 |
| 25 ~PreemptionFlag() {} |
| 26 |
| 27 friend class base::RefCountedThreadSafe<PreemptionFlag>; |
| 28 }; |
| 29 |
| 30 } // namespace gpu |
| 31 |
| 32 #endif // GPU_COMMAND_BUFFER_COMMON_PREEMPTION_FLAG_H_ |
| OLD | NEW |