summaryrefslogtreecommitdiffstats
path: root/base/ref_counted.cc
diff options
context:
space:
mode:
authorlevin@chromium.org <levin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-28 01:54:15 +0000
committerlevin@chromium.org <levin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-28 01:54:15 +0000
commit3b63f8f451afcf414a59c529f627c620e4d449d9 (patch)
tree2dcbab1c060b29a260c29bb19b67bf97a8293ca3 /base/ref_counted.cc
parent9174a108509c2aafe513da68e6e63fbc7df38c85 (diff)
downloadchromium_src-3b63f8f451afcf414a59c529f627c620e4d449d9.zip
chromium_src-3b63f8f451afcf414a59c529f627c620e4d449d9.tar.gz
chromium_src-3b63f8f451afcf414a59c529f627c620e4d449d9.tar.bz2
Move some files from base to base/memory.
raw_scoped_refptr_mismatch_checker.h ref_counted.cc ref_counted.h ref_counted_memory.cc ref_counted_memory.h ref_counted_unittest.cc scoped_callback_factory.h scoped_comptr_win.h scoped_handle.h scoped_native_library.cc scoped_native_library.h scoped_native_library_unittest.cc scoped_nsobject.h scoped_open_process.h scoped_ptr.h scoped_ptr_unittest.cc scoped_temp_dir.cc scoped_temp_dir.h scoped_temp_dir_unittest.cc scoped_vector.h singleton.h singleton_objc.h singleton_unittest.cc linked_ptr.h linked_ptr_unittest.cc weak_ptr.cc weak_ptr.h weak_ptr_unittest.cc BUG=None TEST=Compile Review URL: http://codereview.chromium.org/6714032 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@79524 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/ref_counted.cc')
-rw-r--r--base/ref_counted.cc95
1 files changed, 0 insertions, 95 deletions
diff --git a/base/ref_counted.cc b/base/ref_counted.cc
deleted file mode 100644
index 2d459ae..0000000
--- a/base/ref_counted.cc
+++ /dev/null
@@ -1,95 +0,0 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "base/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_);
-}
-
-RefCountedThreadSafeBase::RefCountedThreadSafeBase() : ref_count_(0) {
-#ifndef NDEBUG
- in_dtor_ = false;
-#endif
-}
-
-RefCountedThreadSafeBase::~RefCountedThreadSafeBase() {
-#ifndef NDEBUG
- DCHECK(in_dtor_) << "RefCountedThreadSafe object deleted without "
- "calling Release()";
-#endif
-}
-
-void RefCountedThreadSafeBase::AddRef() const {
-#ifndef NDEBUG
- DCHECK(!in_dtor_);
-#endif
- AtomicRefCountInc(&ref_count_);
-}
-
-bool RefCountedThreadSafeBase::Release() const {
-#ifndef NDEBUG
- DCHECK(!in_dtor_);
- DCHECK(!AtomicRefCountIsZero(&ref_count_));
-#endif
- if (!AtomicRefCountDec(&ref_count_)) {
-#ifndef NDEBUG
- in_dtor_ = true;
-#endif
- return true;
- }
- return false;
-}
-
-} // namespace subtle
-
-} // namespace base