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

Unified Diff: src/utils/SkEventTracer.cpp

Issue 1091283006: use acquire/release in SkEventTracer.cpp (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: Created 5 years, 8 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698