Issue acquire barrier in SkRefCnt::unique().
When unique() returns true, it must also issue an acquire barrier.
Note that this change may adversly impact SkPath performance,
but editing SkPaths is already a performance issue.
BUG=chromium:258499
No API changes.
TBR=reed@google.com
Review URL: https://codereview.chromium.org/687293002
diff --git a/include/core/SkRefCnt.h b/include/core/SkRefCnt.h
index 459ad25..4da2fbb 100644
--- a/include/core/SkRefCnt.h
+++ b/include/core/SkRefCnt.h
@@ -51,11 +51,11 @@
bool unique() const {
// We believe we're reading fRefCnt in a safe way here, so we stifle the TSAN warning about
// an unproctected read. Generally, don't read fRefCnt, and don't stifle this warning.
- bool const unique = (1 == SK_ANNOTATE_UNPROTECTED_READ(fRefCnt));
+ bool const unique = (1 == sk_acquire_load(&fRefCnt));
if (unique) {
// Acquire barrier (L/SL), if not provided by load of fRefCnt.
// Prevents user's 'unique' code from happening before decrements.
- //TODO: issue the barrier.
+ //TODO: issue the barrier only when unique is true
}
return unique;
}