summaryrefslogtreecommitdiffstats
path: root/base/ref_counted.h
diff options
context:
space:
mode:
Diffstat (limited to 'base/ref_counted.h')
-rw-r--r--base/ref_counted.h17
1 files changed, 3 insertions, 14 deletions
diff --git a/base/ref_counted.h b/base/ref_counted.h
index 6a2b996..4c3aeb8 100644
--- a/base/ref_counted.h
+++ b/base/ref_counted.h
@@ -17,25 +17,19 @@ class RefCountedBase {
public:
static bool ImplementsThreadSafeReferenceCounting() { return false; }
- bool HasOneRef() const { return counter_holder_->ref_count == 1; }
+ bool HasOneRef() const { return ref_count_ == 1; }
protected:
RefCountedBase();
~RefCountedBase();
- struct CounterHolder {
- CounterHolder() : ref_count(0), weak_count(0) {}
- int ref_count;
- int weak_count; // Simulates weak pointer.
- };
-
void AddRef() const;
// Returns true if the object should self-delete.
bool Release() const;
private:
- mutable CounterHolder* counter_holder_;
+ mutable int ref_count_;
#ifndef NDEBUG
mutable bool in_dtor_;
#endif
@@ -61,12 +55,7 @@ class RefCountedThreadSafeBase {
bool Release() const;
private:
- struct CounterHolder {
- CounterHolder() : ref_count(0), weak_count(0) {}
- AtomicRefCount ref_count;
- AtomicRefCount weak_count; // Simulates weak pointer.
- };
- mutable CounterHolder* counter_holder_;
+ mutable AtomicRefCount ref_count_;
#ifndef NDEBUG
mutable bool in_dtor_;
#endif