| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2017 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_SERVICE_PREEMPTION_FLAG_H_ |
| 6 #define GPU_COMMAND_BUFFER_SERVICE_PREEMPTION_FLAG_H_ |
| 7 |
| 8 #include "base/atomic_ref_count.h" |
| 9 #include "base/atomicops.h" |
| 10 #include "base/memory/ref_counted.h" |
| 11 #include "gpu/gpu_export.h" |
| 12 |
| 13 namespace gpu { |
| 14 |
| 15 class PreemptionFlag : public base::RefCountedThreadSafe<PreemptionFlag> { |
| 16 public: |
| 17 PreemptionFlag() : flag_(0) {} |
| 18 |
| 19 bool IsSet() { return !base::AtomicRefCountIsZero(&flag_); } |
| 20 void Set() { base::AtomicRefCountInc(&flag_); } |
| 21 void Reset() { base::subtle::NoBarrier_Store(&flag_, 0); } |
| 22 |
| 23 private: |
| 24 base::AtomicRefCount flag_; |
| 25 |
| 26 ~PreemptionFlag() {} |
| 27 |
| 28 friend class base::RefCountedThreadSafe<PreemptionFlag>; |
| 29 }; |
| 30 |
| 31 } // namespace gpu |
| 32 |
| 33 #endif // GPU_COMMAND_BUFFER_SERVICE_PREEMPTION_FLAG_H_ |
| OLD | NEW |