From 874a62acef5ec2ecccdbb99ec4d86402a3341e6a Mon Sep 17 00:00:00 2001 From: Mike Klein Date: Wed, 9 Jul 2014 09:04:07 -0400 Subject: Revert "Remove ability for Release code to call getRefCnt() or getWeakRefCnt()." This reverts commit 4ae94ffce5ecf1b71cb5e295b68bf4ec9e697443. BUG=skia: Review URL: https://codereview.chromium.org/382523002 --- include/core/SkImageFilter.h | 1 - include/core/SkRefCnt.h | 5 ----- include/core/SkWeakRefCnt.h | 7 +++---- 3 files changed, 3 insertions(+), 10 deletions(-) (limited to 'include/core') diff --git a/include/core/SkImageFilter.h b/include/core/SkImageFilter.h index a571184aa2..ea882537c1 100644 --- a/include/core/SkImageFilter.h +++ b/include/core/SkImageFilter.h @@ -51,7 +51,6 @@ public: class SK_API Cache : public SkRefCnt { public: // By default, we cache only image filters with 2 or more children. - // Values less than 2 mean always cache; values greater than 2 are not supported. static Cache* Create(int minChildren = 2); virtual ~Cache() {} virtual bool get(const SkImageFilter* key, SkBitmap* result, SkIPoint* offset) = 0; diff --git a/include/core/SkRefCnt.h b/include/core/SkRefCnt.h index d3a26df4d5..1724c77d8d 100644 --- a/include/core/SkRefCnt.h +++ b/include/core/SkRefCnt.h @@ -42,10 +42,8 @@ public: #endif } -#ifdef SK_DEBUG /** Return the reference count. Use only for debugging. */ int32_t getRefCnt() const { return fRefCnt; } -#endif /** May return true if the caller is the only owner. * Ensures that all previous owner's actions are complete. @@ -120,9 +118,6 @@ private: mutable int32_t fRefCnt; - // Used by tests. - friend bool RefCntIs(const SkRefCntBase&, int32_t); - typedef SkNoncopyable INHERITED; }; diff --git a/include/core/SkWeakRefCnt.h b/include/core/SkWeakRefCnt.h index d9f0dc80d6..210dcc9f1c 100644 --- a/include/core/SkWeakRefCnt.h +++ b/include/core/SkWeakRefCnt.h @@ -60,18 +60,20 @@ public: */ SkWeakRefCnt() : SkRefCnt(), fWeakCnt(1) {} -#ifdef SK_DEBUG /** Destruct, asserting that the weak reference count is 1. */ virtual ~SkWeakRefCnt() { +#ifdef SK_DEBUG SkASSERT(fWeakCnt == 1); fWeakCnt = 0; +#endif } /** Return the weak reference count. */ int32_t getWeakCnt() const { return fWeakCnt; } +#ifdef SK_DEBUG void validate() const { this->INHERITED::validate(); SkASSERT(fWeakCnt > 0); @@ -153,9 +155,6 @@ private: /* Invariant: fWeakCnt = #weak + (fRefCnt > 0 ? 1 : 0) */ mutable int32_t fWeakCnt; - // Used by tests. - friend bool WeakRefCntIs(const SkWeakRefCnt&, int32_t); - typedef SkRefCnt INHERITED; }; -- cgit v1.2.3