From ab5d5de420503018b385b73e91b24812916c2080 Mon Sep 17 00:00:00 2001 From: djsollen Date: Mon, 24 Aug 2015 14:21:23 -0700 Subject: [PATCH] Enable debug builds in the Android framework Review URL: https://codereview.chromium.org/1297093004 --- include/core/SkRefCnt.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/core/SkRefCnt.h b/include/core/SkRefCnt.h index bf97dc8..0462540 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. } -- 2.7.4