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

Side by Side Diff: base/callback_internal.cc

Issue 8738001: Remove BindStateHolder and have Bind() return a Callback<> object directly. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix callback_unittest.cc Created 9 years 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/callback_internal.h" 5 #include "base/callback_internal.h"
6 6
7 namespace base { 7 namespace base {
8 namespace internal { 8 namespace internal {
9 9
10 bool CallbackBase::is_null() const { 10 bool CallbackBase::is_null() const {
11 return bind_state_.get() == NULL; 11 return bind_state_.get() == NULL;
12 } 12 }
13 13
14 void CallbackBase::Reset() { 14 void CallbackBase::Reset() {
15 bind_state_ = NULL; 15 bind_state_ = NULL;
16 polymorphic_invoke_ = NULL; 16 polymorphic_invoke_ = NULL;
17 } 17 }
18 18
19 bool CallbackBase::Equals(const CallbackBase& other) const { 19 bool CallbackBase::Equals(const CallbackBase& other) const {
20 return bind_state_.get() == other.bind_state_.get() && 20 return bind_state_.get() == other.bind_state_.get() &&
21 polymorphic_invoke_ == other.polymorphic_invoke_; 21 polymorphic_invoke_ == other.polymorphic_invoke_;
22 } 22 }
23 23
24 CallbackBase::CallbackBase(InvokeFuncStorage polymorphic_invoke, 24 CallbackBase::CallbackBase(BindStateBase* bind_state)
25 scoped_refptr<BindStateBase>* bind_state) 25 : bind_state_(bind_state),
akalin 2011/12/02 18:54:45 This constructor should only be called with a newl
awong 2011/12/06 00:21:12 Added a DCHECK, though it feels slightly overkill
26 : polymorphic_invoke_(polymorphic_invoke) { 26 polymorphic_invoke_(NULL) {
27 if (bind_state) {
28 bind_state_.swap(*bind_state);
29 }
30 } 27 }
31 28
32 CallbackBase::~CallbackBase() { 29 CallbackBase::~CallbackBase() {
33 } 30 }
34 31
35 } // namespace base 32 } // namespace base
36 } // namespace internal 33 } // namespace internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698