aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar herb <herb@google.com>2015-09-28 08:59:18 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-09-28 08:59:18 -0700
commit0869267a7c6c58fb68a49b3c2e6d4f231d6645dc (patch)
tree338f29c03b63115d12cba8a3e602604db6944cf1 /include
parent13f48dc85aa68a60da66aaf39c93d527d11d1278 (diff)
Add cast and assignment operators to SkAtomic.
This is not really an API change. TBR=reed@google.com BUG=skia: Review URL: https://codereview.chromium.org/1369333002
Diffstat (limited to 'include')
-rw-r--r--include/core/SkAtomics.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/core/SkAtomics.h b/include/core/SkAtomics.h
index 7c5294b76d..e947d1a9a4 100644
--- a/include/core/SkAtomics.h
+++ b/include/core/SkAtomics.h
@@ -57,6 +57,17 @@ public:
sk_atomic_store(&fVal, val, mo);
}
+ // Alias for .load(sk_memory_order_seq_cst).
+ operator T() const {
+ return this->load();
+ }
+
+ // Alias for .store(v, sk_memory_order_seq_cst).
+ T operator=(const T& v) {
+ this->store(v);
+ return v;
+ }
+
T fetch_add(const T& val, sk_memory_order mo = sk_memory_order_seq_cst) {
return sk_atomic_fetch_add(&fVal, val, mo);
}