Index: include/core/SkRefCnt.h |
diff --git a/include/core/SkRefCnt.h b/include/core/SkRefCnt.h |
index 2ac68ddbcdff6c33c4c131fc18a35202af31d2a5..41c78293fa7f2824d9ecc755c085d7242b845ab2 100644 |
--- a/include/core/SkRefCnt.h |
+++ b/include/core/SkRefCnt.h |
@@ -37,7 +37,7 @@ public: |
*/ |
virtual ~SkRefCntBase() { |
#ifdef SK_DEBUG |
- SkASSERT(this->unique()); |
+ SkASSERT(fRefCnt == 1); |
fRefCnt = 0; // illegal value, to catch us if we reuse after delete |
#endif |
} |
@@ -53,7 +53,6 @@ public: |
// an unproctected read. Generally, don't read fRefCnt, and don't stifle this warning. |
bool const unique = (1 == SK_ANNOTATE_UNPROTECTED_READ(fRefCnt)); |
if (unique) { |
- SK_ANNOTATE_HAPPENS_AFTER(this); |
// Acquire barrier (L/SL), if not provided by load of fRefCnt. |
// Prevents user's 'unique' code from happening before decrements. |
//TODO: issue the barrier. |
@@ -64,7 +63,7 @@ public: |
/** Increment the reference count. Must be balanced by a call to unref(). |
*/ |
void ref() const { |
- SkASSERT(this->unsafeGetRefCnt() > 0); |
+ SkASSERT(fRefCnt > 0); |
sk_atomic_inc(&fRefCnt); // No barrier required. |
} |
@@ -73,11 +72,9 @@ public: |
the object needs to have been allocated via new, and not on the stack. |
*/ |
void unref() const { |
- SkASSERT(this->unsafeGetRefCnt() > 0); |
- SK_ANNOTATE_HAPPENS_BEFORE(this); |
+ SkASSERT(fRefCnt > 0); |
// Release barrier (SL/S), if not provided below. |
if (sk_atomic_dec(&fRefCnt) == 1) { |
- SK_ANNOTATE_HAPPENS_AFTER(this); |
// Acquire barrier (L/SL), if not provided above. |
// Prevents code in dispose from happening before the decrement. |
sk_membar_acquire__after_atomic_dec(); |
@@ -87,7 +84,7 @@ public: |
#ifdef SK_DEBUG |
void validate() const { |
- SkASSERT(this->unsafeGetRefCnt() > 0); |
+ SkASSERT(fRefCnt > 0); |
} |
#endif |
@@ -106,9 +103,6 @@ protected: |
} |
private: |
- // OK for use in asserts, but not much else. |
- int32_t unsafeGetRefCnt() { return SK_ANNOTATE_UNPROTECTED_READ(fRefCnt); } |
- |
/** |
* Called when the ref count goes to 0. |
*/ |