summaryrefslogtreecommitdiffstats
path: root/base/ref_counted.h
diff options
context:
space:
mode:
authorIain Merrick <husky@google.com>2010-11-01 12:19:54 +0000
committerIain Merrick <husky@google.com>2010-11-03 10:21:10 +0000
commit731df977c0511bca2206b5f333555b1205ff1f43 (patch)
tree0e750b949b3f00a1ac11fda25d3c2de512f2b465 /base/ref_counted.h
parent5add15e10e7bb80512f2c597ca57221314abe577 (diff)
downloadexternal_chromium-731df977c0511bca2206b5f333555b1205ff1f43.zip
external_chromium-731df977c0511bca2206b5f333555b1205ff1f43.tar.gz
external_chromium-731df977c0511bca2206b5f333555b1205ff1f43.tar.bz2
Merge Chromium at r63472 : Initial merge by git.
Change-Id: Ifb9ee821af006a5f2211e81471be93ae440a1f5a
Diffstat (limited to 'base/ref_counted.h')
-rw-r--r--base/ref_counted.h22
1 files changed, 11 insertions, 11 deletions
diff --git a/base/ref_counted.h b/base/ref_counted.h
index e2b2ed2..2cc4029 100644
--- a/base/ref_counted.h
+++ b/base/ref_counted.h
@@ -23,15 +23,15 @@ class RefCountedBase {
RefCountedBase();
~RefCountedBase();
- void AddRef();
+ void AddRef() const;
// Returns true if the object should self-delete.
- bool Release();
+ bool Release() const;
private:
- int ref_count_;
+ mutable int ref_count_;
#ifndef NDEBUG
- bool in_dtor_;
+ mutable bool in_dtor_;
#endif
DFAKE_MUTEX(add_release_);
@@ -49,15 +49,15 @@ class RefCountedThreadSafeBase {
RefCountedThreadSafeBase();
~RefCountedThreadSafeBase();
- void AddRef();
+ void AddRef() const;
// Returns true if the object should self-delete.
- bool Release();
+ bool Release() const;
private:
- AtomicRefCount ref_count_;
+ mutable AtomicRefCount ref_count_;
#ifndef NDEBUG
- bool in_dtor_;
+ mutable bool in_dtor_;
#endif
DISALLOW_COPY_AND_ASSIGN(RefCountedThreadSafeBase);
@@ -85,13 +85,13 @@ class RefCounted : public subtle::RefCountedBase {
RefCounted() { }
~RefCounted() { }
- void AddRef() {
+ void AddRef() const {
subtle::RefCountedBase::AddRef();
}
- void Release() {
+ void Release() const {
if (subtle::RefCountedBase::Release()) {
- delete static_cast<T*>(this);
+ delete static_cast<const T*>(this);
}
}