callback_internal.cc revision dc0f95d653279beabeb9817299e2902918ba123e
1// Copyright (c) 2011 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
5#include "base/callback_internal.h"
6
7namespace base {
8namespace internal {
9
10bool CallbackBase::is_null() const {
11  return invoker_storage_.get() == NULL;
12}
13
14void CallbackBase::Reset() {
15  invoker_storage_ = NULL;
16  polymorphic_invoke_ = NULL;
17}
18
19bool CallbackBase::Equals(const CallbackBase& other) const {
20  return invoker_storage_.get() == other.invoker_storage_.get() &&
21         polymorphic_invoke_ == other.polymorphic_invoke_;
22}
23
24CallbackBase::CallbackBase(InvokeFuncStorage polymorphic_invoke,
25                           scoped_refptr<InvokerStorageBase>* invoker_storage)
26    : polymorphic_invoke_(polymorphic_invoke) {
27  if (invoker_storage) {
28    invoker_storage_.swap(*invoker_storage);
29  }
30}
31
32CallbackBase::~CallbackBase() {
33}
34
35}  // namespace base
36}  // namespace internal
37