Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1601)

Unified Diff: base/callback_internal.cc

Issue 2289703002: Add Callback::IsCancelled (Closed)
Patch Set: revert to PS5 Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/callback_internal.h ('k') | base/callback_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_);
+ return bind_state_->IsCancelled();
+}
+
bool CallbackBase<CopyMode::MoveOnly>::EqualsInternal(
const CallbackBase& other) const {
return bind_state_ == other.bind_state_;
« no previous file with comments | « base/callback_internal.h ('k') | base/callback_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698