From 0277440d228f2366e3a6dea1f428a3a4885a427d Mon Sep 17 00:00:00 2001 From: Ben Wagner Date: Thu, 12 Jul 2018 11:13:52 -0400 Subject: Remove SkRefCnt_SafeAssign. Change-Id: I590e74c2de8e0c2b8d407bd869c97a4d3bd98fed Reviewed-on: https://skia-review.googlesource.com/141041 Commit-Queue: Herb Derby Auto-Submit: Ben Wagner Reviewed-by: Herb Derby --- include/core/SkRefCnt.h | 36 ------------------------------------ 1 file changed, 36 deletions(-) diff --git a/include/core/SkRefCnt.h b/include/core/SkRefCnt.h index adebd9b8a6..bc6ccd8dff 100644 --- a/include/core/SkRefCnt.h +++ b/include/core/SkRefCnt.h @@ -138,42 +138,6 @@ class SK_API SkRefCnt : public SkRefCntBase { /////////////////////////////////////////////////////////////////////////////// -/** Helper macro to safely assign one SkRefCnt[TS]* to another, checking for - null in on each side of the assignment, and ensuring that ref() is called - before unref(), in case the two pointers point to the same object. - */ - -#if defined(SK_BUILD_FOR_ANDROID_FRAMEWORK) -// This version heuristically detects data races, since those otherwise result -// in redundant reference count decrements, which are exceedingly -// difficult to debug. - -#define SkRefCnt_SafeAssign(dst, src) \ - do { \ - typedef typename std::remove_reference::type \ - SkRefCntPtrT; \ - SkRefCntPtrT old_dst = *const_cast(&dst); \ - if (src) src->ref(); \ - if (old_dst) old_dst->unref(); \ - if (old_dst != *const_cast(&dst)) { \ - SkDebugf("Detected racing Skia calls at %s:%d\n", \ - __FILE__, __LINE__); \ - } \ - dst = src; \ - } while (0) - -#else /* !SK_BUILD_FOR_ANDROID_FRAMEWORK */ - -#define SkRefCnt_SafeAssign(dst, src) \ - do { \ - if (src) src->ref(); \ - if (dst) dst->unref(); \ - dst = src; \ - } while (0) - -#endif - - /** Call obj->ref() and return obj. The obj must not be nullptr. */ template static inline T* SkRef(T* obj) { -- cgit v1.2.3