Chromium Code Reviews| Index: base/callback_internal.cc |
| diff --git a/base/callback_internal.cc b/base/callback_internal.cc |
| index 303de4d71b84d148557f17bbf388cb35849e0622..e29dd694efb5e2fabc899ef1183fbac333b042b2 100644 |
| --- a/base/callback_internal.cc |
| +++ b/base/callback_internal.cc |
| @@ -10,9 +10,12 @@ namespace base { |
| namespace internal { |
| BindStateBase::BindStateBase(InvokeFuncStorage polymorphic_invoke, |
| - void (*destructor)(BindStateBase*)) |
| + void (*destructor)(BindStateBase*), |
| + bool (*is_cancelled)(const BindStateBase*)) |
| : polymorphic_invoke_(polymorphic_invoke), |
| - ref_count_(0), destructor_(destructor) {} |
| + ref_count_(0), |
| + destructor_(destructor), |
| + is_cancelled_(is_cancelled) {} |
| void BindStateBase::AddRef() { |
| AtomicRefCountInc(&ref_count_); |
| @@ -34,6 +37,11 @@ void CallbackBase<CopyMode::MoveOnly>::Reset() { |
| bind_state_ = nullptr; |
| } |
| +bool CallbackBase<CopyMode::MoveOnly>::IsCancelled() const { |
| + DCHECK(bind_state_); |
|
alex clarke (OOO till 29th)
2016/09/07 15:53:53
Can we do this instead of the DCHECK?
if (!bind_s
dcheng
2016/09/07 21:40:27
If there's a null callback posted to the task queu
tzik
2016/09/08 03:55:10
Hmm, right, it doesn't matter for the intended usa
dcheng
2016/09/08 04:01:33
What is the use case where we'd want to call this
tzik
2016/09/08 05:21:45
There will be no actual use case for it. I just th
|
| + return bind_state_->IsCancelled(); |
| +} |
| + |
| bool CallbackBase<CopyMode::MoveOnly>::EqualsInternal( |
| const CallbackBase& other) const { |
| return bind_state_ == other.bind_state_; |