diff options
author | rsleevi@chromium.org <rsleevi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-26 06:23:00 +0000 |
---|---|---|
committer | rsleevi@chromium.org <rsleevi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-26 06:23:00 +0000 |
commit | cb932487f6e6f8768da2030662dcd91929f4df0b (patch) | |
tree | 4563fa67fbafbf8e979e0c69024637b5badd9ec2 /base/memory | |
parent | 3f9bfdac19db30a0a424e21d254f869eafaeb4ac (diff) | |
download | chromium_src-cb932487f6e6f8768da2030662dcd91929f4df0b.zip chromium_src-cb932487f6e6f8768da2030662dcd91929f4df0b.tar.gz chromium_src-cb932487f6e6f8768da2030662dcd91929f4df0b.tar.bz2 |
RefCounted types should not have public destructors, base/ edition
BUG=123295
TEST=it compiles
Review URL: https://chromiumcodereview.appspot.com/10332269
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@144130 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/memory')
-rw-r--r-- | base/memory/ref_counted.h | 12 | ||||
-rw-r--r-- | base/memory/weak_ptr.h | 3 |
2 files changed, 11 insertions, 4 deletions
diff --git a/base/memory/ref_counted.h b/base/memory/ref_counted.h index 858ed2b..ce0d94a 100644 --- a/base/memory/ref_counted.h +++ b/base/memory/ref_counted.h @@ -85,8 +85,7 @@ class BASE_EXPORT RefCountedThreadSafeBase { template <class T> class RefCounted : public subtle::RefCountedBase { public: - RefCounted() { } - ~RefCounted() { } + RefCounted() {} void AddRef() const { subtle::RefCountedBase::AddRef(); @@ -98,6 +97,9 @@ class RefCounted : public subtle::RefCountedBase { } } + protected: + ~RefCounted() {} + private: DISALLOW_COPY_AND_ASSIGN(RefCounted<T>); }; @@ -133,8 +135,7 @@ struct DefaultRefCountedThreadSafeTraits { template <class T, typename Traits = DefaultRefCountedThreadSafeTraits<T> > class RefCountedThreadSafe : public subtle::RefCountedThreadSafeBase { public: - RefCountedThreadSafe() { } - ~RefCountedThreadSafe() { } + RefCountedThreadSafe() {} void AddRef() const { subtle::RefCountedThreadSafeBase::AddRef(); @@ -146,6 +147,9 @@ class RefCountedThreadSafe : public subtle::RefCountedThreadSafeBase { } } + protected: + ~RefCountedThreadSafe() {} + private: friend struct DefaultRefCountedThreadSafeTraits<T>; static void DeleteInternal(const T* x) { delete x; } diff --git a/base/memory/weak_ptr.h b/base/memory/weak_ptr.h index be045a6..d7c452f 100644 --- a/base/memory/weak_ptr.h +++ b/base/memory/weak_ptr.h @@ -251,6 +251,9 @@ class SupportsWeakPtr : public internal::SupportsWeakPtrBase { weak_reference_owner_.DetachFromThread(); } + protected: + ~SupportsWeakPtr() {} + private: internal::WeakReferenceOwner weak_reference_owner_; DISALLOW_COPY_AND_ASSIGN(SupportsWeakPtr); |