diff options
author | ajwong@chromium.org <ajwong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-14 21:33:58 +0000 |
---|---|---|
committer | ajwong@chromium.org <ajwong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-14 21:33:58 +0000 |
commit | e91ac22d99252095839ca7c82c092972bd56445e (patch) | |
tree | 0054d7c65bd3ec21de4b2c776220788849b21e6a /base/callback_internal.cc | |
parent | 30d170b85b632ffe2babc4e0955b2b09851540dc (diff) | |
download | chromium_src-e91ac22d99252095839ca7c82c092972bd56445e.zip chromium_src-e91ac22d99252095839ca7c82c092972bd56445e.tar.gz chromium_src-e91ac22d99252095839ca7c82c092972bd56445e.tar.bz2 |
Remove BindStateHolder and have Bind() return a Callback<> object directly.
This removes some complexity and also fixes a bug where if you call Bind() with the result of Bind(), the resulting Callback would only be valid during the first call. Ouch.
BUG=none
TEST=new unittests
Review URL: http://codereview.chromium.org/8738001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@114494 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/callback_internal.cc')
-rw-r--r-- | base/callback_internal.cc | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/base/callback_internal.cc b/base/callback_internal.cc index 582fbdc..a483293 100644 --- a/base/callback_internal.cc +++ b/base/callback_internal.cc @@ -4,6 +4,8 @@ #include "base/callback_internal.h" +#include "base/logging.h" + namespace base { namespace internal { @@ -21,12 +23,10 @@ bool CallbackBase::Equals(const CallbackBase& other) const { polymorphic_invoke_ == other.polymorphic_invoke_; } -CallbackBase::CallbackBase(InvokeFuncStorage polymorphic_invoke, - scoped_refptr<BindStateBase>* bind_state) - : polymorphic_invoke_(polymorphic_invoke) { - if (bind_state) { - bind_state_.swap(*bind_state); - } +CallbackBase::CallbackBase(BindStateBase* bind_state) + : bind_state_(bind_state), + polymorphic_invoke_(NULL) { + DCHECK(!bind_state_ || bind_state_->HasOneRef()); } CallbackBase::~CallbackBase() { |