Index: base/callback_internal.cc |
diff --git a/base/callback_internal.cc b/base/callback_internal.cc |
index 4330e9cce511a5d819b85fe128c3ba5bc46eaf9e..3a665d28cae8fc6d5280acad88313de0a8a8ec41 100644 |
--- a/base/callback_internal.cc |
+++ b/base/callback_internal.cc |
@@ -17,6 +17,10 @@ bool ReturnFalse(const BindStateBase*) { |
} // namespace |
+void BindStateBaseRefCountTraits::Destruct(const BindStateBase* bind_state) { |
+ bind_state->destructor_(bind_state); |
+} |
+ |
BindStateBase::BindStateBase(InvokeFuncStorage polymorphic_invoke, |
void (*destructor)(const BindStateBase*)) |
: BindStateBase(polymorphic_invoke, destructor, &ReturnFalse) { |
@@ -26,19 +30,9 @@ BindStateBase::BindStateBase(InvokeFuncStorage polymorphic_invoke, |
void (*destructor)(const BindStateBase*), |
bool (*is_cancelled)(const BindStateBase*)) |
: polymorphic_invoke_(polymorphic_invoke), |
- ref_count_(0), |
destructor_(destructor), |
is_cancelled_(is_cancelled) {} |
-void BindStateBase::AddRef() const { |
- AtomicRefCountInc(&ref_count_); |
-} |
- |
-void BindStateBase::Release() const { |
- if (!AtomicRefCountDec(&ref_count_)) |
- destructor_(this); |
-} |
- |
CallbackBase<CopyMode::MoveOnly>::CallbackBase(CallbackBase&& c) = default; |
CallbackBase<CopyMode::MoveOnly>& |
@@ -83,7 +77,7 @@ bool CallbackBase<CopyMode::MoveOnly>::EqualsInternal( |
CallbackBase<CopyMode::MoveOnly>::CallbackBase( |
BindStateBase* bind_state) |
: bind_state_(bind_state) { |
- DCHECK(!bind_state_.get() || bind_state_->ref_count_ == 1); |
+ DCHECK(!bind_state_.get() || bind_state_->HasOneRef()); |
} |
CallbackBase<CopyMode::MoveOnly>::~CallbackBase() {} |