callback_internal.cc 1010 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. // Copyright (c) 2012 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #include "base/callback_internal.h"
  5. #include "base/logging.h"
  6. namespace base {
  7. namespace internal {
  8. bool CallbackBase::is_null() const {
  9. return bind_state_.get() == NULL;
  10. }
  11. void CallbackBase::Reset() {
  12. polymorphic_invoke_ = NULL;
  13. // NULL the bind_state_ last, since it may be holding the last ref to whatever
  14. // object owns us, and we may be deleted after that.
  15. bind_state_ = NULL;
  16. }
  17. bool CallbackBase::Equals(const CallbackBase& other) const {
  18. return bind_state_.get() == other.bind_state_.get() &&
  19. polymorphic_invoke_ == other.polymorphic_invoke_;
  20. }
  21. CallbackBase::CallbackBase(BindStateBase* bind_state)
  22. : bind_state_(bind_state),
  23. polymorphic_invoke_(NULL) {
  24. DCHECK(!bind_state_.get() || bind_state_->HasOneRef());
  25. }
  26. CallbackBase::~CallbackBase() {
  27. }
  28. } // namespace internal
  29. } // namespace base