diff options
author | Ben Wagner <bungeman@google.com> | 2018-07-12 11:13:52 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-07-12 23:42:44 +0000 |
commit | 0277440d228f2366e3a6dea1f428a3a4885a427d (patch) | |
tree | e63c043048b3afb2327e36fb75cfccb0932c8396 /include | |
parent | 9ec70c6bd3dfe6338fbbae9c0447a5cbae770a75 (diff) |
Remove SkRefCnt_SafeAssign.
Change-Id: I590e74c2de8e0c2b8d407bd869c97a4d3bd98fed
Reviewed-on: https://skia-review.googlesource.com/141041
Commit-Queue: Herb Derby <herb@google.com>
Auto-Submit: Ben Wagner <bungeman@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/core/SkRefCnt.h | 36 |
1 files changed, 0 insertions, 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<decltype(dst)>::type \ - SkRefCntPtrT; \ - SkRefCntPtrT old_dst = *const_cast<SkRefCntPtrT volatile *>(&dst); \ - if (src) src->ref(); \ - if (old_dst) old_dst->unref(); \ - if (old_dst != *const_cast<SkRefCntPtrT volatile *>(&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 <typename T> static inline T* SkRef(T* obj) { |