diff options
author | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-18 02:08:17 +0000 |
---|---|---|
committer | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-18 02:08:17 +0000 |
commit | ce21d0fcc67de4f167cad948f767b01bb6862030 (patch) | |
tree | 5421554a1a8005f606aa3704d81b9c4d75629782 /base/ref_counted.cc | |
parent | 9ca245e3b2d0e2271c7124d3aceb8179903718e2 (diff) | |
download | chromium_src-ce21d0fcc67de4f167cad948f767b01bb6862030.zip chromium_src-ce21d0fcc67de4f167cad948f767b01bb6862030.tar.gz chromium_src-ce21d0fcc67de4f167cad948f767b01bb6862030.tar.bz2 |
Chrome is too fast, make it slower.
Test out using RefCountedThreadSafeBase for all refcounting. Will revert
after I'm done testing performance implications.
BUG=
TEST=
Review URL: http://codereview.chromium.org/6712009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@78649 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/ref_counted.cc')
-rw-r--r-- | base/ref_counted.cc | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/base/ref_counted.cc b/base/ref_counted.cc index 2d459ae..8d2c5fd 100644 --- a/base/ref_counted.cc +++ b/base/ref_counted.cc @@ -11,46 +11,6 @@ namespace base { namespace subtle { -RefCountedBase::RefCountedBase() - : ref_count_(0) -#ifndef NDEBUG - , in_dtor_(false) -#endif - { -} - -RefCountedBase::~RefCountedBase() { -#ifndef NDEBUG - DCHECK(in_dtor_) << "RefCounted object deleted without calling Release()"; -#endif -} - -void RefCountedBase::AddRef() const { - // TODO(maruel): Add back once it doesn't assert 500 times/sec. - // Current thread books the critical section "AddRelease" without release it. - // DFAKE_SCOPED_LOCK_THREAD_LOCKED(add_release_); -#ifndef NDEBUG - DCHECK(!in_dtor_); -#endif - ++ref_count_; -} - -bool RefCountedBase::Release() const { - // TODO(maruel): Add back once it doesn't assert 500 times/sec. - // Current thread books the critical section "AddRelease" without release it. - // DFAKE_SCOPED_LOCK_THREAD_LOCKED(add_release_); -#ifndef NDEBUG - DCHECK(!in_dtor_); -#endif - if (--ref_count_ == 0) { -#ifndef NDEBUG - in_dtor_ = true; -#endif - return true; - } - return false; -} - bool RefCountedThreadSafeBase::HasOneRef() const { return AtomicRefCountIsOne( &const_cast<RefCountedThreadSafeBase*>(this)->ref_count_); |