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

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

Issue 133553003: base: Don't generate unused BoundFunctorTraits typedef (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Update only bind.h.pump Created 6 years, 10 months 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
« no previous file with comments | « no previous file | no next file » | 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 typename internal::FunctorTraits<Functor>::RunnableType, 86 typename internal::FunctorTraits<Functor>::RunnableType,
87 typename internal::FunctorTraits<Functor>::RunType, 87 typename internal::FunctorTraits<Functor>::RunType,
88 void($for ARG , [[typename internal::CallbackParamTraits<P$(ARG)>::Stora geType]])> 88 void($for ARG , [[typename internal::CallbackParamTraits<P$(ARG)>::Stora geType]])>
89 ::UnboundRunType> 89 ::UnboundRunType>
90 Bind(Functor functor 90 Bind(Functor functor
91 $if ARITY > 0 [[, ]] $for ARG , [[const P$(ARG)& p$(ARG)]]) { 91 $if ARITY > 0 [[, ]] $for ARG , [[const P$(ARG)& p$(ARG)]]) {
92 // Typedefs for how to store and run the functor. 92 // Typedefs for how to store and run the functor.
93 typedef typename internal::FunctorTraits<Functor>::RunnableType RunnableType; 93 typedef typename internal::FunctorTraits<Functor>::RunnableType RunnableType;
94 typedef typename internal::FunctorTraits<Functor>::RunType RunType; 94 typedef typename internal::FunctorTraits<Functor>::RunType RunType;
95 95
96 $if ARITY > 0 [[
97
96 // Use RunnableType::RunType instead of RunType above because our 98 // Use RunnableType::RunType instead of RunType above because our
97 // checks should below for bound references need to know what the actual 99 // checks should below for bound references need to know what the actual
98 // functor is going to interpret the argument as. 100 // functor is going to interpret the argument as.
99 typedef internal::FunctionTraits<typename RunnableType::RunType> 101 typedef internal::FunctionTraits<typename RunnableType::RunType>
100 BoundFunctorTraits; 102 BoundFunctorTraits;
101 103
102 $if ARITY > 0 [[
103
104 // Do not allow binding a non-const reference parameter. Non-const reference 104 // Do not allow binding a non-const reference parameter. Non-const reference
105 // parameters are disallowed by the Google style guide. Also, binding a 105 // parameters are disallowed by the Google style guide. Also, binding a
106 // non-const reference parameter can make for subtle bugs because the 106 // non-const reference parameter can make for subtle bugs because the
107 // invoked function will receive a reference to the stored copy of the 107 // invoked function will receive a reference to the stored copy of the
108 // argument and not the original. 108 // argument and not the original.
109 COMPILE_ASSERT( 109 COMPILE_ASSERT(
110 !($for ARG || [[ 110 !($for ARG || [[
111 is_non_const_reference<typename BoundFunctorTraits::A$(ARG)Type>::value ]]), 111 is_non_const_reference<typename BoundFunctorTraits::A$(ARG)Type>::value ]]),
112 do_not_bind_functions_with_nonconst_ref); 112 do_not_bind_functions_with_nonconst_ref);
113 113
(...skipping 30 matching lines...) Expand all
144 return Callback<typename BindState::UnboundRunType>( 144 return Callback<typename BindState::UnboundRunType>(
145 new BindState(internal::MakeRunnable(functor)[[]] 145 new BindState(internal::MakeRunnable(functor)[[]]
146 $if ARITY > 0 [[, ]] $for ARG , [[p$(ARG)]])); 146 $if ARITY > 0 [[, ]] $for ARG , [[p$(ARG)]]));
147 } 147 }
148 148
149 ]] $$ for ARITY 149 ]] $$ for ARITY
150 150
151 } // namespace base 151 } // namespace base
152 152
153 #endif // BASE_BIND_H_ 153 #endif // BASE_BIND_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698