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

Unified Diff: include/core/SkOnce.h

Issue 996763002: Clean up SkDynamicAnnotations. (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: remove SkThreadPriv.h too Created 5 years, 9 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
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

Powered by Google App Engine
This is Rietveld 408576698