| Index: base/callback_internal.cc
|
| diff --git a/base/callback_internal.cc b/base/callback_internal.cc
|
| index 4afd567f0fe32ee65c911f8a1cf55c061c7b95c3..9de164fb0585da433af2fb480df2724757ccb67d 100644
|
| --- a/base/callback_internal.cc
|
| +++ b/base/callback_internal.cc
|
| @@ -17,6 +17,11 @@ bool ReturnFalse(const BindStateBase*) {
|
|
|
| } // namespace
|
|
|
| +// static
|
| +void BindStateBaseRefCountTraits::Destruct(const BindStateBase* obj) {
|
| + obj->destructor_(obj);
|
| +}
|
| +
|
| BindStateBase::BindStateBase(InvokeFuncStorage polymorphic_invoke,
|
| void (*destructor)(const BindStateBase*))
|
| : BindStateBase(polymorphic_invoke, destructor, &ReturnFalse) {
|
| @@ -26,19 +31,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>&
|
| @@ -73,7 +68,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() {}
|
|
|