diff options
author | mikhail.pozdnyakov@intel.com <mikhail.pozdnyakov@intel.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-19 20:48:41 +0000 |
---|---|---|
committer | mikhail.pozdnyakov@intel.com <mikhail.pozdnyakov@intel.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-19 20:48:41 +0000 |
commit | b17f77c4bb34d4f04a94fa573c4ecdb91d9cbaa7 (patch) | |
tree | 7c13f90ee2d8273665593d8300513bf9233911be /base/memory/ref_counted.cc | |
parent | 7d3c082ea63628f065991b5ef48ab93ed478257d (diff) | |
download | chromium_src-b17f77c4bb34d4f04a94fa573c4ecdb91d9cbaa7.zip chromium_src-b17f77c4bb34d4f04a94fa573c4ecdb91d9cbaa7.tar.gz chromium_src-b17f77c4bb34d4f04a94fa573c4ecdb91d9cbaa7.tar.bz2 |
Make base::RefCountedBase methods inline
Re-applying of the reverted https://codereview.chromium.org/88993002/ as it gives significant performance improvement.
Please see http://code.google.com/p/chromium/issues/detail?id=328329 for the details.
BUG=328329
Review URL: https://codereview.chromium.org/119143003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@241937 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/memory/ref_counted.cc')
-rw-r--r-- | base/memory/ref_counted.cc | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/base/memory/ref_counted.cc b/base/memory/ref_counted.cc index 31ad509..f5924d0 100644 --- a/base/memory/ref_counted.cc +++ b/base/memory/ref_counted.cc @@ -3,54 +3,12 @@ // found in the LICENSE file. #include "base/memory/ref_counted.h" - -#include "base/logging.h" #include "base/threading/thread_collision_warner.h" 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_); |