diff options
author | ajwong@chromium.org <ajwong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-20 00:10:04 +0000 |
---|---|---|
committer | ajwong@chromium.org <ajwong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-20 00:10:04 +0000 |
commit | e24f876c537646cab5a9e8492658f570ccd7da4a (patch) | |
tree | 85aa283d18c10b47f1e3acbafce3283661407477 /base/bind.h.pump | |
parent | b538d7ea0b2484074dea680d60f7f68750d1d1e3 (diff) | |
download | chromium_src-e24f876c537646cab5a9e8492658f570ccd7da4a.zip chromium_src-e24f876c537646cab5a9e8492658f570ccd7da4a.tar.gz chromium_src-e24f876c537646cab5a9e8492658f570ccd7da4a.tar.bz2 |
Retry 114494 - 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.
Also makes the static type checking a bit more strict when assigning into a Callback<>.
BUG=none
TEST=new unittests
Review URL: http://codereview.chromium.org/8915024
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@115045 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)]])); } |