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

Side by Side Diff: base/bind.h.pump

Issue 8915024: Retry 114494 - Remove BindStateHolder and have Bind() return a Callback<> object directly." (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase 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
« no previous file with comments | « base/bind.h ('k') | base/bind_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 $$ This is a pump file for generating file templates. Pump is a python 1 $$ This is a pump file for generating file templates. Pump is a python
2 $$ script that is part of the Google Test suite of utilities. Description 2 $$ script that is part of the Google Test suite of utilities. Description
3 $$ can be found here: 3 $$ can be found here:
4 $$ 4 $$
5 $$ http://code.google.com/p/googletest/wiki/PumpManual 5 $$ http://code.google.com/p/googletest/wiki/PumpManual
6 $$ 6 $$
7 7
8 $$ 8 $$
9 $$ MAX_ARITY controls the number of arguments that Bind() supports. 9 $$ MAX_ARITY controls the number of arguments that Bind() supports.
10 $$ The amount of code, and more importantly, the number of template types 10 $$ The amount of code, and more importantly, the number of template types
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 // harder to read. 64 // harder to read.
65 65
66 namespace base { 66 namespace base {
67 67
68 $range ARITY 0..MAX_ARITY 68 $range ARITY 0..MAX_ARITY
69 $for ARITY [[ 69 $for ARITY [[
70 $range ARG 1..ARITY 70 $range ARG 1..ARITY
71 71
72 template <typename Functor[[]] 72 template <typename Functor[[]]
73 $if ARITY > 0 [[, ]] $for ARG , [[typename P$(ARG)]]> 73 $if ARITY > 0 [[, ]] $for ARG , [[typename P$(ARG)]]>
74 internal::BindStateHolder< 74 base::Callback<
75 internal::BindState< 75 typename internal::BindState<
76 typename internal::FunctorTraits<Functor>::RunnableType, 76 typename internal::FunctorTraits<Functor>::RunnableType,
77 typename internal::FunctorTraits<Functor>::RunType, 77 typename internal::FunctorTraits<Functor>::RunType,
78 void($for ARG , [[typename internal::CallbackParamTraits<P$(ARG)>::Stora geType]])> > 78 void($for ARG , [[typename internal::CallbackParamTraits<P$(ARG)>::Stora geType]])>
79 ::UnboundRunType>
79 Bind(Functor functor 80 Bind(Functor functor
80 $if ARITY > 0 [[, ]] $for ARG , [[const P$(ARG)& p$(ARG)]]) { 81 $if ARITY > 0 [[, ]] $for ARG , [[const P$(ARG)& p$(ARG)]]) {
81 // Typedefs for how to store and run the functor. 82 // Typedefs for how to store and run the functor.
82 typedef typename internal::FunctorTraits<Functor>::RunnableType RunnableType; 83 typedef typename internal::FunctorTraits<Functor>::RunnableType RunnableType;
83 typedef typename internal::FunctorTraits<Functor>::RunType RunType; 84 typedef typename internal::FunctorTraits<Functor>::RunType RunType;
84 85
85 // Use RunnableType::RunType instead of RunType above because our 86 // Use RunnableType::RunType instead of RunType above because our
86 // checks should below for bound references need to know what the actual 87 // checks should below for bound references need to know what the actual
87 // functor is going to interpret the argument as. 88 // functor is going to interpret the argument as.
88 typedef internal::FunctionTraits<typename RunnableType::RunType> 89 typedef internal::FunctionTraits<typename RunnableType::RunType>
(...skipping 29 matching lines...) Expand all
118 COMPILE_ASSERT(!internal::HasIsMethodTag<RunnableType>::value || 119 COMPILE_ASSERT(!internal::HasIsMethodTag<RunnableType>::value ||
119 !is_array<P$(ARG)>::value, 120 !is_array<P$(ARG)>::value,
120 first_bound_argument_to_method_cannot_be_array); 121 first_bound_argument_to_method_cannot_be_array);
121 ]] $else [[ 122 ]] $else [[
122 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr<P$(ARG)>::value, 123 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr<P$(ARG)>::value,
123 p$(ARG)_is_refcounted_type_and_needs_scoped_refptr); 124 p$(ARG)_is_refcounted_type_and_needs_scoped_refptr);
124 ]] $$ $if ARG 125 ]] $$ $if ARG
125 126
126 ]] $$ $for ARG 127 ]] $$ $for ARG
127 128
129 typedef internal::BindState<RunnableType, RunType, [[]]
130 void($for ARG , [[typename internal::CallbackParamTraits<P$(ARG)>::StorageType]] )> [[]]
131 BindState;
128 132
129 return internal::MakeBindStateHolder( 133
130 new internal::BindState<RunnableType, RunType, [[]] 134 return Callback<typename BindState::UnboundRunType>(
131 void($for ARG , [[typename internal::CallbackParamTraits<P$(ARG)>::StorageType]] )>( 135 new BindState(internal::MakeRunnable(functor)[[]]
132 internal::MakeRunnable(functor)[[]]
133 $if ARITY > 0 [[, ]] $for ARG , [[p$(ARG)]])); 136 $if ARITY > 0 [[, ]] $for ARG , [[p$(ARG)]]));
134 } 137 }
135 138
136 ]] $$ for ARITY 139 ]] $$ for ARITY
137 140
138 } // namespace base 141 } // namespace base
139 142
140 #endif // BASE_BIND_H_ 143 #endif // BASE_BIND_H_
OLDNEW
« no previous file with comments | « base/bind.h ('k') | base/bind_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698