Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(398)

Unified Diff: include/core/SkAtomics.h

Issue 1369333002: Add cast and assignment operators to SkAtomic. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/AtomicTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkAtomics.h
diff --git a/include/core/SkAtomics.h b/include/core/SkAtomics.h
index 7c5294b76da582e56414cb2e7ab842d14e48b8fc..7016aef07c0a0e88400ae771f394c89f7be59b5a 100644
--- a/include/core/SkAtomics.h
+++ b/include/core/SkAtomics.h
@@ -57,6 +57,16 @@ public:
sk_atomic_store(&fVal, val, mo);
}
+ // Alias for .load(sk_memory_order_seq_cst).
+ operator T() const {
+ return load();
mtklein 2015/09/28 15:10:18 this->
+ }
+
+ // Alias for .store(v, sk_memory_order_seq_cst).
+ void operator=(const T& v) {
+ store(v);
mtklein 2015/09/28 15:10:18 this->
+ }
+
T fetch_add(const T& val, sk_memory_order mo = sk_memory_order_seq_cst) {
return sk_atomic_fetch_add(&fVal, val, mo);
}
« no previous file with comments | « no previous file | tests/AtomicTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698