Index: include/core/SkAtomics.h |
diff --git a/include/core/SkAtomics.h b/include/core/SkAtomics.h |
index 9866db4860cea31df1289391748e23bb7288cc58..be94164227b789c43899cabd38c94d6fe8e3e050 100644 |
--- a/include/core/SkAtomics.h |
+++ b/include/core/SkAtomics.h |
@@ -43,6 +43,7 @@ template <typename T> |
class SkAtomic : SkNoncopyable { |
public: |
SkAtomic() {} |
+ explicit SkAtomic(const T& val) : fVal(val) {} |
// It is essential we return by value rather than by const&. fVal may change at any time. |
T load(sk_memory_order mo = sk_memory_order_seq_cst) const { |
@@ -53,6 +54,10 @@ public: |
sk_atomic_store(&fVal, val, mo); |
} |
+ T fetch_add(const T& val, sk_memory_order mo = sk_memory_order_seq_cst) { |
+ return sk_atomic_fetch_add(&fVal, val, mo); |
+ } |
+ |
bool compare_exchange(T* expected, const T& desired, |
sk_memory_order success = sk_memory_order_seq_cst, |
sk_memory_order failure = sk_memory_order_seq_cst) { |