| Index: base/callback_internal.cc
|
| diff --git a/base/callback_internal.cc b/base/callback_internal.cc
|
| index 2553fe7e1b64bf20c67dde90800377dc44b58fc2..bf68e636812621ef0e273275b6021a29fe380913 100644
|
| --- a/base/callback_internal.cc
|
| +++ b/base/callback_internal.cc
|
| @@ -18,28 +18,60 @@ void BindStateBase::Release() {
|
| destructor_(this);
|
| }
|
|
|
| -CallbackBase::CallbackBase(const CallbackBase& c) = default;
|
| -CallbackBase& CallbackBase::operator=(const CallbackBase& c) = default;
|
| +MoveOnlyCallbackBase::MoveOnlyCallbackBase(MoveOnlyCallbackBase&& c)
|
| + : bind_state_(std::move(c.bind_state_)),
|
| + polymorphic_invoke_(c.polymorphic_invoke_) {
|
| + c.polymorphic_invoke_ = nullptr;
|
| +}
|
| +
|
| +MoveOnlyCallbackBase& MoveOnlyCallbackBase::operator=(
|
| + MoveOnlyCallbackBase&& c) {
|
| + bind_state_ = std::move(c.bind_state_);
|
| + polymorphic_invoke_ = c.polymorphic_invoke_;
|
| + c.polymorphic_invoke_ = nullptr;
|
| + return *this;
|
| +}
|
|
|
| -void CallbackBase::Reset() {
|
| - polymorphic_invoke_ = NULL;
|
| +void MoveOnlyCallbackBase::Reset() {
|
| + polymorphic_invoke_ = nullptr;
|
| // NULL the bind_state_ last, since it may be holding the last ref to whatever
|
| // object owns us, and we may be deleted after that.
|
| - bind_state_ = NULL;
|
| + bind_state_ = nullptr;
|
| }
|
|
|
| -bool CallbackBase::Equals(const CallbackBase& other) const {
|
| +bool MoveOnlyCallbackBase::EqualsInternal(
|
| + const MoveOnlyCallbackBase& other) const {
|
| return bind_state_.get() == other.bind_state_.get() &&
|
| polymorphic_invoke_ == other.polymorphic_invoke_;
|
| }
|
|
|
| -CallbackBase::CallbackBase(BindStateBase* bind_state)
|
| - : bind_state_(bind_state),
|
| - polymorphic_invoke_(NULL) {
|
| +void MoveOnlyCallbackBase::set_bind_state(BindStateBase* bind_state) {
|
| + bind_state_ = bind_state;
|
| DCHECK(!bind_state_.get() || bind_state_->ref_count_ == 1);
|
| }
|
|
|
| -CallbackBase::~CallbackBase() {
|
| +MoveOnlyCallbackBase::MoveOnlyCallbackBase() {}
|
| +MoveOnlyCallbackBase::~MoveOnlyCallbackBase() {}
|
| +
|
| +CopyableCallbackBase::CopyableCallbackBase(CopyableCallbackBase&& c)
|
| + : MoveOnlyCallbackBase(std::move(c)) {}
|
| +
|
| +CopyableCallbackBase& CopyableCallbackBase::operator=(
|
| + CopyableCallbackBase&& c) {
|
| + *static_cast<MoveOnlyCallbackBase*>(this) = std::move(c);
|
| + return *this;
|
| +}
|
| +
|
| +CopyableCallbackBase::CopyableCallbackBase(const CopyableCallbackBase& c) {
|
| + bind_state_ = c.bind_state_;
|
| + polymorphic_invoke_ = c.polymorphic_invoke_;
|
| +}
|
| +
|
| +CopyableCallbackBase& CopyableCallbackBase::operator=(
|
| + const CopyableCallbackBase& c) {
|
| + bind_state_ = c.bind_state_;
|
| + polymorphic_invoke_ = c.polymorphic_invoke_;
|
| + return *this;
|
| }
|
|
|
| } // namespace internal
|
|
|