Index: include/core/SkOnce.h |
diff --git a/include/core/SkOnce.h b/include/core/SkOnce.h |
index f025cc2abf8db5d282ac02e6d80f3a015faedc81..e02d30b3052e6f082915d8280a97185cfa37b9b6 100644 |
--- a/include/core/SkOnce.h |
+++ b/include/core/SkOnce.h |
@@ -27,9 +27,7 @@ |
// No matter how many times you call EnsureRegistered(), register_my_stuff will be called just once. |
// OnceTest.cpp also should serve as a few other simple examples. |
-#include "SkDynamicAnnotations.h" |
-#include "SkThread.h" |
-#include "SkTypes.h" |
+#include "SkAtomics.h" |
// This must be used in a global scope, not in fuction scope or as a class member. |
#define SK_DECLARE_STATIC_ONCE(name) namespace {} static SkOnceFlag name |
@@ -104,7 +102,7 @@ static void sk_once_slow(bool* done, Lock* lock, void (*f)(Arg), Arg arg) { |
// This is our fast path, called all the time. We do really want it to be inlined. |
template <typename Lock, typename Arg> |
inline void SkOnce(bool* done, Lock* lock, void (*f)(Arg), Arg arg) { |
- if (!SK_ANNOTATE_UNPROTECTED_READ(*done)) { |
+ if (!sk_atomic_load(done, sk_memory_order_relaxed)) { |
sk_once_slow(done, lock, f, arg); |
} |
// Also known as a load-load/load-store barrier, this acquire barrier makes |