Index: src/utils/SkEventTracer.cpp |
diff --git a/src/utils/SkEventTracer.cpp b/src/utils/SkEventTracer.cpp |
index 1a669a3f8ebce471319cfc4d02df745d3e882099..b114c21c8f0864c6f6955ce163948a4b4e8eb372 100644 |
--- a/src/utils/SkEventTracer.cpp |
+++ b/src/utils/SkEventTracer.cpp |
@@ -41,18 +41,15 @@ class SkDefaultEventTracer : public SkEventTracer { |
static SkEventTracer* gUserTracer = nullptr; |
SK_DECLARE_STATIC_LAZY_PTR(SkDefaultEventTracer, gDefaultTracer); |
-// We can use relaxed memory order for gUserTracer loads and stores. |
-// It's not guarding anything but itself. |
- |
void SkEventTracer::SetInstance(SkEventTracer* tracer) { |
- SkASSERT(nullptr == sk_atomic_load(&gUserTracer, sk_memory_order_relaxed)); |
- sk_atomic_store(&gUserTracer, tracer, sk_memory_order_relaxed); |
+ SkASSERT(nullptr == sk_atomic_load(&gUserTracer, sk_memory_order_acquire)); |
Alexander Potapenko
2015/04/22 17:47:50
I may be mistaking, but this one can be demoted to
mtklein
2015/04/22 18:56:24
Yeah, seemed simpler to keep it all as _acquire so
|
+ sk_atomic_store(&gUserTracer, tracer, sk_memory_order_release); |
// An atomic load during process shutdown is probably overkill, but safe overkill. |
- atexit([](){ SkDELETE(sk_atomic_load(&gUserTracer, sk_memory_order_relaxed)); }); |
+ atexit([](){ SkDELETE(sk_atomic_load(&gUserTracer, sk_memory_order_acquire)); }); |
} |
SkEventTracer* SkEventTracer::GetInstance() { |
- if (SkEventTracer* tracer = sk_atomic_load(&gUserTracer, sk_memory_order_relaxed)) { |
+ if (SkEventTracer* tracer = sk_atomic_load(&gUserTracer, sk_memory_order_acquire)) { |
return tracer; |
} |
return gDefaultTracer.get(); |