| Index: base/callback_internal.h
|
| diff --git a/base/callback_internal.h b/base/callback_internal.h
|
| index 6aa5fa4e841657bcffd64fa541ecf92c8ce99677..6de18fd39d505b42ef4c07c906ae2c4086bf59e8 100644
|
| --- a/base/callback_internal.h
|
| +++ b/base/callback_internal.h
|
| @@ -36,7 +36,8 @@ class BASE_EXPORT BindStateBase {
|
|
|
| protected:
|
| BindStateBase(InvokeFuncStorage polymorphic_invoke,
|
| - void (*destructor)(BindStateBase*));
|
| + void (*destructor)(BindStateBase*),
|
| + bool (*is_cancelled)(const BindStateBase*));
|
| ~BindStateBase() = default;
|
|
|
| private:
|
| @@ -44,6 +45,10 @@ class BASE_EXPORT BindStateBase {
|
| template <CopyMode copy_mode>
|
| friend class CallbackBase;
|
|
|
| + bool IsCancelled() const {
|
| + return is_cancelled_(this);
|
| + }
|
| +
|
| void AddRef();
|
| void Release();
|
|
|
| @@ -57,6 +62,7 @@ class BASE_EXPORT BindStateBase {
|
|
|
| // Pointer to a function that will properly destroy |this|.
|
| void (*destructor_)(BindStateBase*);
|
| + bool (*is_cancelled_)(const BindStateBase*);
|
|
|
| DISALLOW_COPY_AND_ASSIGN(BindStateBase);
|
| };
|
| @@ -75,6 +81,10 @@ class BASE_EXPORT CallbackBase<CopyMode::MoveOnly> {
|
| bool is_null() const { return bind_state_.get() == NULL; }
|
| explicit operator bool() const { return !is_null(); }
|
|
|
| + // Returns true if the callback invocation will be nop due to an cancellation.
|
| + // It's invalid to call this on uninitialized callback.
|
| + bool IsCancelled() const;
|
| +
|
| // Returns the Callback into an uninitialized state.
|
| void Reset();
|
|
|
|
|