Index: include/core/SkRefCnt.h |
diff --git a/include/core/SkRefCnt.h b/include/core/SkRefCnt.h |
index bf97dc8560529a4d5aa09d635043e4369d0cc5a2..04625407328281a17e776bda83349ae7bf3ba15e 100644 |
--- a/include/core/SkRefCnt.h |
+++ b/include/core/SkRefCnt.h |
@@ -57,7 +57,15 @@ public: |
/** Increment the reference count. Must be balanced by a call to unref(). |
*/ |
void ref() const { |
+#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK |
+ // Android employs some special subclasses that enable the fRefCnt to |
+ // go to zero, but not below, prior to reusing the object. This breaks |
+ // the use of unique() on such objects and as such should be removed |
+ // once the Android code is fixed. |
+ SkASSERT(fRefCnt >= 0); |
+#else |
SkASSERT(fRefCnt > 0); |
+#endif |
(void)sk_atomic_fetch_add(&fRefCnt, +1, sk_memory_order_relaxed); // No barrier required. |
} |