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/bind.h.pump | |
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/bind.h.pump')
-rw-r--r-- | base/bind.h.pump | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/base/bind.h.pump b/base/bind.h.pump index 9d4c5ee..494d716 100644 --- a/base/bind.h.pump +++ b/base/bind.h.pump @@ -71,11 +71,12 @@ $range ARG 1..ARITY template <typename Functor[[]] $if ARITY > 0 [[, ]] $for ARG , [[typename P$(ARG)]]> -internal::BindStateHolder< - internal::BindState< +base::Callback< + typename internal::BindState< typename internal::FunctorTraits<Functor>::RunnableType, typename internal::FunctorTraits<Functor>::RunType, - void($for ARG , [[typename internal::CallbackParamTraits<P$(ARG)>::StorageType]])> > + void($for ARG , [[typename internal::CallbackParamTraits<P$(ARG)>::StorageType]])> + ::UnboundRunType> Bind(Functor functor $if ARITY > 0 [[, ]] $for ARG , [[const P$(ARG)& p$(ARG)]]) { // Typedefs for how to store and run the functor. @@ -125,11 +126,13 @@ $if ARG == 1 [[ ]] $$ $for ARG + typedef internal::BindState<RunnableType, RunType, [[]] +void($for ARG , [[typename internal::CallbackParamTraits<P$(ARG)>::StorageType]])> [[]] +BindState; - return internal::MakeBindStateHolder( - new internal::BindState<RunnableType, RunType, [[]] -void($for ARG , [[typename internal::CallbackParamTraits<P$(ARG)>::StorageType]])>( - internal::MakeRunnable(functor)[[]] + + return Callback<typename BindState::UnboundRunType>( + new BindState(internal::MakeRunnable(functor)[[]] $if ARITY > 0 [[, ]] $for ARG , [[p$(ARG)]])); } |