diff options
author | ajwong@chromium.org <ajwong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-13 16:55:34 +0000 |
---|---|---|
committer | ajwong@chromium.org <ajwong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-13 16:55:34 +0000 |
commit | 9d7557f78d893c56afcf65f2e6317feabb9af796 (patch) | |
tree | c0eef641ea0517657e5b608743a609f2f10c275d /base/ref_counted.cc | |
parent | 37c4b8f32689eeb44f69d20a99e5df0e355609e0 (diff) | |
download | chromium_src-9d7557f78d893c56afcf65f2e6317feabb9af796.zip chromium_src-9d7557f78d893c56afcf65f2e6317feabb9af796.tar.gz chromium_src-9d7557f78d893c56afcf65f2e6317feabb9af796.tar.bz2 |
Revert "Add extra heap-allocation to refcounting. For perf test only. Will Revert after one build."
This reverts commit r74764.
TBR=willchan
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@74765 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/ref_counted.cc')
-rw-r--r-- | base/ref_counted.cc | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/base/ref_counted.cc b/base/ref_counted.cc index 54c1071..2d459ae 100644 --- a/base/ref_counted.cc +++ b/base/ref_counted.cc @@ -12,7 +12,7 @@ namespace base { namespace subtle { RefCountedBase::RefCountedBase() - : counter_holder_(new CounterHolder) + : ref_count_(0) #ifndef NDEBUG , in_dtor_(false) #endif @@ -20,7 +20,6 @@ RefCountedBase::RefCountedBase() } RefCountedBase::~RefCountedBase() { - delete counter_holder_; #ifndef NDEBUG DCHECK(in_dtor_) << "RefCounted object deleted without calling Release()"; #endif @@ -33,7 +32,7 @@ void RefCountedBase::AddRef() const { #ifndef NDEBUG DCHECK(!in_dtor_); #endif - ++(counter_holder_->ref_count); + ++ref_count_; } bool RefCountedBase::Release() const { @@ -43,7 +42,7 @@ bool RefCountedBase::Release() const { #ifndef NDEBUG DCHECK(!in_dtor_); #endif - if (--(counter_holder_->ref_count) == 0) { + if (--ref_count_ == 0) { #ifndef NDEBUG in_dtor_ = true; #endif @@ -54,19 +53,16 @@ bool RefCountedBase::Release() const { bool RefCountedThreadSafeBase::HasOneRef() const { return AtomicRefCountIsOne( - &const_cast<RefCountedThreadSafeBase*>(this)-> - counter_holder_->ref_count); + &const_cast<RefCountedThreadSafeBase*>(this)->ref_count_); } -RefCountedThreadSafeBase::RefCountedThreadSafeBase() - : counter_holder_(new CounterHolder) { +RefCountedThreadSafeBase::RefCountedThreadSafeBase() : ref_count_(0) { #ifndef NDEBUG in_dtor_ = false; #endif } RefCountedThreadSafeBase::~RefCountedThreadSafeBase() { - delete counter_holder_; #ifndef NDEBUG DCHECK(in_dtor_) << "RefCountedThreadSafe object deleted without " "calling Release()"; @@ -77,15 +73,15 @@ void RefCountedThreadSafeBase::AddRef() const { #ifndef NDEBUG DCHECK(!in_dtor_); #endif - AtomicRefCountInc(&counter_holder_->ref_count); + AtomicRefCountInc(&ref_count_); } bool RefCountedThreadSafeBase::Release() const { #ifndef NDEBUG DCHECK(!in_dtor_); - DCHECK(!AtomicRefCountIsZero(&counter_holder_->ref_count)); + DCHECK(!AtomicRefCountIsZero(&ref_count_)); #endif - if (!AtomicRefCountDec(&counter_holder_->ref_count)) { + if (!AtomicRefCountDec(&ref_count_)) { #ifndef NDEBUG in_dtor_ = true; #endif |