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

Unified Diff: include/private/SkAtomics.h

Issue 1393833003: SkPath::fFirstDirection: seq-cst -> relaxed (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 2 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 | « include/core/SkPath.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/private/SkAtomics.h
diff --git a/include/private/SkAtomics.h b/include/private/SkAtomics.h
index e947d1a9a47775d1673761ab9f29657cb2e757a0..56eace4447e2b9f90f2036381eab97b1cca0026f 100644
--- a/include/private/SkAtomics.h
+++ b/include/private/SkAtomics.h
@@ -42,43 +42,44 @@ T sk_atomic_exchange(T*, T, sk_memory_order = sk_memory_order_seq_cst);
// A little wrapper class for small T (think, builtins: int, float, void*) to
// ensure they're always used atomically. This is our stand-in for std::atomic<T>.
-template <typename T>
+// !!! Please _really_ know what you're doing if you change default_memory_order. !!!
+template <typename T, sk_memory_order default_memory_order = sk_memory_order_seq_cst>
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 {
+ T load(sk_memory_order mo = default_memory_order) const {
return sk_atomic_load(&fVal, mo);
}
- void store(const T& val, sk_memory_order mo = sk_memory_order_seq_cst) {
+ void store(const T& val, sk_memory_order mo = default_memory_order) {
sk_atomic_store(&fVal, val, mo);
}
- // Alias for .load(sk_memory_order_seq_cst).
+ // Alias for .load(default_memory_order).
operator T() const {
return this->load();
}
- // Alias for .store(v, sk_memory_order_seq_cst).
+ // Alias for .store(v, default_memory_order).
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) {
+ T fetch_add(const T& val, sk_memory_order mo = default_memory_order) {
return sk_atomic_fetch_add(&fVal, val, mo);
}
- T fetch_sub(const T& val, sk_memory_order mo = sk_memory_order_seq_cst) {
+ T fetch_sub(const T& val, sk_memory_order mo = default_memory_order) {
return sk_atomic_fetch_sub(&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) {
+ sk_memory_order success = default_memory_order,
+ sk_memory_order failure = default_memory_order) {
return sk_atomic_compare_exchange(&fVal, expected, desired, success, failure);
}
private:
« no previous file with comments | « include/core/SkPath.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698