michael@0: // Copyright (c) 2012 The Chromium Authors. All rights reserved. michael@0: // Use of this source code is governed by a BSD-style license that can be michael@0: // found in the LICENSE file. michael@0: michael@0: #include "base/callback_internal.h" michael@0: michael@0: #include "base/logging.h" michael@0: michael@0: namespace base { michael@0: namespace internal { michael@0: michael@0: bool CallbackBase::is_null() const { michael@0: return bind_state_.get() == NULL; michael@0: } michael@0: michael@0: void CallbackBase::Reset() { michael@0: polymorphic_invoke_ = NULL; michael@0: // NULL the bind_state_ last, since it may be holding the last ref to whatever michael@0: // object owns us, and we may be deleted after that. michael@0: bind_state_ = NULL; michael@0: } michael@0: michael@0: bool CallbackBase::Equals(const CallbackBase& other) const { michael@0: return bind_state_.get() == other.bind_state_.get() && michael@0: polymorphic_invoke_ == other.polymorphic_invoke_; michael@0: } michael@0: michael@0: CallbackBase::CallbackBase(BindStateBase* bind_state) michael@0: : bind_state_(bind_state), michael@0: polymorphic_invoke_(NULL) { michael@0: DCHECK(!bind_state_.get() || bind_state_->HasOneRef()); michael@0: } michael@0: michael@0: CallbackBase::~CallbackBase() { michael@0: } michael@0: michael@0: } // namespace internal michael@0: } // namespace base