1 // This file was GENERATED by command:
3 // DO NOT EDIT BY HAND!!!
6 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
7 // Use of this source code is governed by a BSD-style license that can be
8 // found in the LICENSE file.
14 #include "base/bind_internal.h"
15 #include "base/callback_internal.h"
17 // See base/callback.h for how to use these functions. If reading the
18 // implementation, before proceeding further, you should read the top
19 // comment of base/bind_internal.h for a definition of common terms and
22 // IMPLEMENTATION NOTE
23 // Though Bind()'s result is meant to be stored in a Callback<> type, it
24 // cannot actually return the exact type without requiring a large amount
25 // of extra template specializations. The problem is that in order to
26 // discern the correct specialization of Callback<>, Bind would need to
27 // unwrap the function signature to determine the signature's arity, and
28 // whether or not it is a method.
30 // Each unique combination of (arity, function_type, num_prebound) where
31 // function_type is one of {function, method, const_method} would require
32 // one specialization. We eventually have to do a similar number of
33 // specializations anyways in the implementation (see the Invoker<>,
34 // classes). However, it is avoidable in Bind if we return the result
35 // via an indirection like we do below.
37 // TODO(ajwong): We might be able to avoid this now, but need to test.
39 // It is possible to move most of the COMPILE_ASSERT asserts into BindState<>,
40 // but it feels a little nicer to have the asserts here so people do not
41 // need to crack open bind_internal.h. On the other hand, it makes Bind()
46 template <typename Functor
>
48 typename
internal::BindState
<
49 typename
internal::FunctorTraits
<Functor
>::RunnableType
,
50 typename
internal::FunctorTraits
<Functor
>::RunType
,
53 Bind(Functor functor
) {
54 // Typedefs for how to store and run the functor.
55 typedef typename
internal::FunctorTraits
<Functor
>::RunnableType RunnableType
;
56 typedef typename
internal::FunctorTraits
<Functor
>::RunType RunType
;
58 // Use RunnableType::RunType instead of RunType above because our
59 // checks should below for bound references need to know what the actual
60 // functor is going to interpret the argument as.
61 typedef internal::FunctionTraits
<typename
RunnableType::RunType
>
64 typedef internal::BindState
<RunnableType
, RunType
, void()> BindState
;
67 return Callback
<typename
BindState::UnboundRunType
>(
68 new BindState(internal::MakeRunnable(functor
)));
71 template <typename Functor
, typename P1
>
73 typename
internal::BindState
<
74 typename
internal::FunctorTraits
<Functor
>::RunnableType
,
75 typename
internal::FunctorTraits
<Functor
>::RunType
,
76 void(typename
internal::CallbackParamTraits
<P1
>::StorageType
)>
78 Bind(Functor functor
, const P1
& p1
) {
79 // Typedefs for how to store and run the functor.
80 typedef typename
internal::FunctorTraits
<Functor
>::RunnableType RunnableType
;
81 typedef typename
internal::FunctorTraits
<Functor
>::RunType RunType
;
83 // Use RunnableType::RunType instead of RunType above because our
84 // checks should below for bound references need to know what the actual
85 // functor is going to interpret the argument as.
86 typedef internal::FunctionTraits
<typename
RunnableType::RunType
>
89 // Do not allow binding a non-const reference parameter. Non-const reference
90 // parameters are disallowed by the Google style guide. Also, binding a
91 // non-const reference parameter can make for subtle bugs because the
92 // invoked function will receive a reference to the stored copy of the
93 // argument and not the original.
95 !(is_non_const_reference
<typename
BoundFunctorTraits::A1Type
>::value
),
96 do_not_bind_functions_with_nonconst_ref
);
98 // For methods, we need to be careful for parameter 1. We do not require
99 // a scoped_refptr because BindState<> itself takes care of AddRef() for
100 // methods. We also disallow binding of an array as the method's target
103 internal::HasIsMethodTag
<RunnableType
>::value
||
104 !internal::NeedsScopedRefptrButGetsRawPtr
<P1
>::value
,
105 p1_is_refcounted_type_and_needs_scoped_refptr
);
106 COMPILE_ASSERT(!internal::HasIsMethodTag
<RunnableType
>::value
||
107 !is_array
<P1
>::value
,
108 first_bound_argument_to_method_cannot_be_array
);
109 typedef internal::BindState
<RunnableType
, RunType
,
110 void(typename
internal::CallbackParamTraits
<P1
>::StorageType
)> BindState
;
113 return Callback
<typename
BindState::UnboundRunType
>(
114 new BindState(internal::MakeRunnable(functor
), p1
));
117 template <typename Functor
, typename P1
, typename P2
>
119 typename
internal::BindState
<
120 typename
internal::FunctorTraits
<Functor
>::RunnableType
,
121 typename
internal::FunctorTraits
<Functor
>::RunType
,
122 void(typename
internal::CallbackParamTraits
<P1
>::StorageType
,
123 typename
internal::CallbackParamTraits
<P2
>::StorageType
)>
125 Bind(Functor functor
, const P1
& p1
, const P2
& p2
) {
126 // Typedefs for how to store and run the functor.
127 typedef typename
internal::FunctorTraits
<Functor
>::RunnableType RunnableType
;
128 typedef typename
internal::FunctorTraits
<Functor
>::RunType RunType
;
130 // Use RunnableType::RunType instead of RunType above because our
131 // checks should below for bound references need to know what the actual
132 // functor is going to interpret the argument as.
133 typedef internal::FunctionTraits
<typename
RunnableType::RunType
>
136 // Do not allow binding a non-const reference parameter. Non-const reference
137 // parameters are disallowed by the Google style guide. Also, binding a
138 // non-const reference parameter can make for subtle bugs because the
139 // invoked function will receive a reference to the stored copy of the
140 // argument and not the original.
142 !(is_non_const_reference
<typename
BoundFunctorTraits::A1Type
>::value
||
143 is_non_const_reference
<typename
BoundFunctorTraits::A2Type
>::value
),
144 do_not_bind_functions_with_nonconst_ref
);
146 // For methods, we need to be careful for parameter 1. We do not require
147 // a scoped_refptr because BindState<> itself takes care of AddRef() for
148 // methods. We also disallow binding of an array as the method's target
151 internal::HasIsMethodTag
<RunnableType
>::value
||
152 !internal::NeedsScopedRefptrButGetsRawPtr
<P1
>::value
,
153 p1_is_refcounted_type_and_needs_scoped_refptr
);
154 COMPILE_ASSERT(!internal::HasIsMethodTag
<RunnableType
>::value
||
155 !is_array
<P1
>::value
,
156 first_bound_argument_to_method_cannot_be_array
);
157 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr
<P2
>::value
,
158 p2_is_refcounted_type_and_needs_scoped_refptr
);
159 typedef internal::BindState
<RunnableType
, RunType
,
160 void(typename
internal::CallbackParamTraits
<P1
>::StorageType
,
161 typename
internal::CallbackParamTraits
<P2
>::StorageType
)> BindState
;
164 return Callback
<typename
BindState::UnboundRunType
>(
165 new BindState(internal::MakeRunnable(functor
), p1
, p2
));
168 template <typename Functor
, typename P1
, typename P2
, typename P3
>
170 typename
internal::BindState
<
171 typename
internal::FunctorTraits
<Functor
>::RunnableType
,
172 typename
internal::FunctorTraits
<Functor
>::RunType
,
173 void(typename
internal::CallbackParamTraits
<P1
>::StorageType
,
174 typename
internal::CallbackParamTraits
<P2
>::StorageType
,
175 typename
internal::CallbackParamTraits
<P3
>::StorageType
)>
177 Bind(Functor functor
, const P1
& p1
, const P2
& p2
, const P3
& p3
) {
178 // Typedefs for how to store and run the functor.
179 typedef typename
internal::FunctorTraits
<Functor
>::RunnableType RunnableType
;
180 typedef typename
internal::FunctorTraits
<Functor
>::RunType RunType
;
182 // Use RunnableType::RunType instead of RunType above because our
183 // checks should below for bound references need to know what the actual
184 // functor is going to interpret the argument as.
185 typedef internal::FunctionTraits
<typename
RunnableType::RunType
>
188 // Do not allow binding a non-const reference parameter. Non-const reference
189 // parameters are disallowed by the Google style guide. Also, binding a
190 // non-const reference parameter can make for subtle bugs because the
191 // invoked function will receive a reference to the stored copy of the
192 // argument and not the original.
194 !(is_non_const_reference
<typename
BoundFunctorTraits::A1Type
>::value
||
195 is_non_const_reference
<typename
BoundFunctorTraits::A2Type
>::value
||
196 is_non_const_reference
<typename
BoundFunctorTraits::A3Type
>::value
),
197 do_not_bind_functions_with_nonconst_ref
);
199 // For methods, we need to be careful for parameter 1. We do not require
200 // a scoped_refptr because BindState<> itself takes care of AddRef() for
201 // methods. We also disallow binding of an array as the method's target
204 internal::HasIsMethodTag
<RunnableType
>::value
||
205 !internal::NeedsScopedRefptrButGetsRawPtr
<P1
>::value
,
206 p1_is_refcounted_type_and_needs_scoped_refptr
);
207 COMPILE_ASSERT(!internal::HasIsMethodTag
<RunnableType
>::value
||
208 !is_array
<P1
>::value
,
209 first_bound_argument_to_method_cannot_be_array
);
210 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr
<P2
>::value
,
211 p2_is_refcounted_type_and_needs_scoped_refptr
);
212 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr
<P3
>::value
,
213 p3_is_refcounted_type_and_needs_scoped_refptr
);
214 typedef internal::BindState
<RunnableType
, RunType
,
215 void(typename
internal::CallbackParamTraits
<P1
>::StorageType
,
216 typename
internal::CallbackParamTraits
<P2
>::StorageType
,
217 typename
internal::CallbackParamTraits
<P3
>::StorageType
)> BindState
;
220 return Callback
<typename
BindState::UnboundRunType
>(
221 new BindState(internal::MakeRunnable(functor
), p1
, p2
, p3
));
224 template <typename Functor
, typename P1
, typename P2
, typename P3
, typename P4
>
226 typename
internal::BindState
<
227 typename
internal::FunctorTraits
<Functor
>::RunnableType
,
228 typename
internal::FunctorTraits
<Functor
>::RunType
,
229 void(typename
internal::CallbackParamTraits
<P1
>::StorageType
,
230 typename
internal::CallbackParamTraits
<P2
>::StorageType
,
231 typename
internal::CallbackParamTraits
<P3
>::StorageType
,
232 typename
internal::CallbackParamTraits
<P4
>::StorageType
)>
234 Bind(Functor functor
, const P1
& p1
, const P2
& p2
, const P3
& p3
, const P4
& p4
) {
235 // Typedefs for how to store and run the functor.
236 typedef typename
internal::FunctorTraits
<Functor
>::RunnableType RunnableType
;
237 typedef typename
internal::FunctorTraits
<Functor
>::RunType RunType
;
239 // Use RunnableType::RunType instead of RunType above because our
240 // checks should below for bound references need to know what the actual
241 // functor is going to interpret the argument as.
242 typedef internal::FunctionTraits
<typename
RunnableType::RunType
>
245 // Do not allow binding a non-const reference parameter. Non-const reference
246 // parameters are disallowed by the Google style guide. Also, binding a
247 // non-const reference parameter can make for subtle bugs because the
248 // invoked function will receive a reference to the stored copy of the
249 // argument and not the original.
251 !(is_non_const_reference
<typename
BoundFunctorTraits::A1Type
>::value
||
252 is_non_const_reference
<typename
BoundFunctorTraits::A2Type
>::value
||
253 is_non_const_reference
<typename
BoundFunctorTraits::A3Type
>::value
||
254 is_non_const_reference
<typename
BoundFunctorTraits::A4Type
>::value
),
255 do_not_bind_functions_with_nonconst_ref
);
257 // For methods, we need to be careful for parameter 1. We do not require
258 // a scoped_refptr because BindState<> itself takes care of AddRef() for
259 // methods. We also disallow binding of an array as the method's target
262 internal::HasIsMethodTag
<RunnableType
>::value
||
263 !internal::NeedsScopedRefptrButGetsRawPtr
<P1
>::value
,
264 p1_is_refcounted_type_and_needs_scoped_refptr
);
265 COMPILE_ASSERT(!internal::HasIsMethodTag
<RunnableType
>::value
||
266 !is_array
<P1
>::value
,
267 first_bound_argument_to_method_cannot_be_array
);
268 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr
<P2
>::value
,
269 p2_is_refcounted_type_and_needs_scoped_refptr
);
270 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr
<P3
>::value
,
271 p3_is_refcounted_type_and_needs_scoped_refptr
);
272 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr
<P4
>::value
,
273 p4_is_refcounted_type_and_needs_scoped_refptr
);
274 typedef internal::BindState
<RunnableType
, RunType
,
275 void(typename
internal::CallbackParamTraits
<P1
>::StorageType
,
276 typename
internal::CallbackParamTraits
<P2
>::StorageType
,
277 typename
internal::CallbackParamTraits
<P3
>::StorageType
,
278 typename
internal::CallbackParamTraits
<P4
>::StorageType
)> BindState
;
281 return Callback
<typename
BindState::UnboundRunType
>(
282 new BindState(internal::MakeRunnable(functor
), p1
, p2
, p3
, p4
));
285 template <typename Functor
, typename P1
, typename P2
, typename P3
, typename P4
,
288 typename
internal::BindState
<
289 typename
internal::FunctorTraits
<Functor
>::RunnableType
,
290 typename
internal::FunctorTraits
<Functor
>::RunType
,
291 void(typename
internal::CallbackParamTraits
<P1
>::StorageType
,
292 typename
internal::CallbackParamTraits
<P2
>::StorageType
,
293 typename
internal::CallbackParamTraits
<P3
>::StorageType
,
294 typename
internal::CallbackParamTraits
<P4
>::StorageType
,
295 typename
internal::CallbackParamTraits
<P5
>::StorageType
)>
297 Bind(Functor functor
, const P1
& p1
, const P2
& p2
, const P3
& p3
, const P4
& p4
,
299 // Typedefs for how to store and run the functor.
300 typedef typename
internal::FunctorTraits
<Functor
>::RunnableType RunnableType
;
301 typedef typename
internal::FunctorTraits
<Functor
>::RunType RunType
;
303 // Use RunnableType::RunType instead of RunType above because our
304 // checks should below for bound references need to know what the actual
305 // functor is going to interpret the argument as.
306 typedef internal::FunctionTraits
<typename
RunnableType::RunType
>
309 // Do not allow binding a non-const reference parameter. Non-const reference
310 // parameters are disallowed by the Google style guide. Also, binding a
311 // non-const reference parameter can make for subtle bugs because the
312 // invoked function will receive a reference to the stored copy of the
313 // argument and not the original.
315 !(is_non_const_reference
<typename
BoundFunctorTraits::A1Type
>::value
||
316 is_non_const_reference
<typename
BoundFunctorTraits::A2Type
>::value
||
317 is_non_const_reference
<typename
BoundFunctorTraits::A3Type
>::value
||
318 is_non_const_reference
<typename
BoundFunctorTraits::A4Type
>::value
||
319 is_non_const_reference
<typename
BoundFunctorTraits::A5Type
>::value
),
320 do_not_bind_functions_with_nonconst_ref
);
322 // For methods, we need to be careful for parameter 1. We do not require
323 // a scoped_refptr because BindState<> itself takes care of AddRef() for
324 // methods. We also disallow binding of an array as the method's target
327 internal::HasIsMethodTag
<RunnableType
>::value
||
328 !internal::NeedsScopedRefptrButGetsRawPtr
<P1
>::value
,
329 p1_is_refcounted_type_and_needs_scoped_refptr
);
330 COMPILE_ASSERT(!internal::HasIsMethodTag
<RunnableType
>::value
||
331 !is_array
<P1
>::value
,
332 first_bound_argument_to_method_cannot_be_array
);
333 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr
<P2
>::value
,
334 p2_is_refcounted_type_and_needs_scoped_refptr
);
335 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr
<P3
>::value
,
336 p3_is_refcounted_type_and_needs_scoped_refptr
);
337 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr
<P4
>::value
,
338 p4_is_refcounted_type_and_needs_scoped_refptr
);
339 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr
<P5
>::value
,
340 p5_is_refcounted_type_and_needs_scoped_refptr
);
341 typedef internal::BindState
<RunnableType
, RunType
,
342 void(typename
internal::CallbackParamTraits
<P1
>::StorageType
,
343 typename
internal::CallbackParamTraits
<P2
>::StorageType
,
344 typename
internal::CallbackParamTraits
<P3
>::StorageType
,
345 typename
internal::CallbackParamTraits
<P4
>::StorageType
,
346 typename
internal::CallbackParamTraits
<P5
>::StorageType
)> BindState
;
349 return Callback
<typename
BindState::UnboundRunType
>(
350 new BindState(internal::MakeRunnable(functor
), p1
, p2
, p3
, p4
, p5
));
353 template <typename Functor
, typename P1
, typename P2
, typename P3
, typename P4
,
354 typename P5
, typename P6
>
356 typename
internal::BindState
<
357 typename
internal::FunctorTraits
<Functor
>::RunnableType
,
358 typename
internal::FunctorTraits
<Functor
>::RunType
,
359 void(typename
internal::CallbackParamTraits
<P1
>::StorageType
,
360 typename
internal::CallbackParamTraits
<P2
>::StorageType
,
361 typename
internal::CallbackParamTraits
<P3
>::StorageType
,
362 typename
internal::CallbackParamTraits
<P4
>::StorageType
,
363 typename
internal::CallbackParamTraits
<P5
>::StorageType
,
364 typename
internal::CallbackParamTraits
<P6
>::StorageType
)>
366 Bind(Functor functor
, const P1
& p1
, const P2
& p2
, const P3
& p3
, const P4
& p4
,
367 const P5
& p5
, const P6
& p6
) {
368 // Typedefs for how to store and run the functor.
369 typedef typename
internal::FunctorTraits
<Functor
>::RunnableType RunnableType
;
370 typedef typename
internal::FunctorTraits
<Functor
>::RunType RunType
;
372 // Use RunnableType::RunType instead of RunType above because our
373 // checks should below for bound references need to know what the actual
374 // functor is going to interpret the argument as.
375 typedef internal::FunctionTraits
<typename
RunnableType::RunType
>
378 // Do not allow binding a non-const reference parameter. Non-const reference
379 // parameters are disallowed by the Google style guide. Also, binding a
380 // non-const reference parameter can make for subtle bugs because the
381 // invoked function will receive a reference to the stored copy of the
382 // argument and not the original.
384 !(is_non_const_reference
<typename
BoundFunctorTraits::A1Type
>::value
||
385 is_non_const_reference
<typename
BoundFunctorTraits::A2Type
>::value
||
386 is_non_const_reference
<typename
BoundFunctorTraits::A3Type
>::value
||
387 is_non_const_reference
<typename
BoundFunctorTraits::A4Type
>::value
||
388 is_non_const_reference
<typename
BoundFunctorTraits::A5Type
>::value
||
389 is_non_const_reference
<typename
BoundFunctorTraits::A6Type
>::value
),
390 do_not_bind_functions_with_nonconst_ref
);
392 // For methods, we need to be careful for parameter 1. We do not require
393 // a scoped_refptr because BindState<> itself takes care of AddRef() for
394 // methods. We also disallow binding of an array as the method's target
397 internal::HasIsMethodTag
<RunnableType
>::value
||
398 !internal::NeedsScopedRefptrButGetsRawPtr
<P1
>::value
,
399 p1_is_refcounted_type_and_needs_scoped_refptr
);
400 COMPILE_ASSERT(!internal::HasIsMethodTag
<RunnableType
>::value
||
401 !is_array
<P1
>::value
,
402 first_bound_argument_to_method_cannot_be_array
);
403 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr
<P2
>::value
,
404 p2_is_refcounted_type_and_needs_scoped_refptr
);
405 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr
<P3
>::value
,
406 p3_is_refcounted_type_and_needs_scoped_refptr
);
407 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr
<P4
>::value
,
408 p4_is_refcounted_type_and_needs_scoped_refptr
);
409 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr
<P5
>::value
,
410 p5_is_refcounted_type_and_needs_scoped_refptr
);
411 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr
<P6
>::value
,
412 p6_is_refcounted_type_and_needs_scoped_refptr
);
413 typedef internal::BindState
<RunnableType
, RunType
,
414 void(typename
internal::CallbackParamTraits
<P1
>::StorageType
,
415 typename
internal::CallbackParamTraits
<P2
>::StorageType
,
416 typename
internal::CallbackParamTraits
<P3
>::StorageType
,
417 typename
internal::CallbackParamTraits
<P4
>::StorageType
,
418 typename
internal::CallbackParamTraits
<P5
>::StorageType
,
419 typename
internal::CallbackParamTraits
<P6
>::StorageType
)> BindState
;
422 return Callback
<typename
BindState::UnboundRunType
>(
423 new BindState(internal::MakeRunnable(functor
), p1
, p2
, p3
, p4
, p5
, p6
));
426 template <typename Functor
, typename P1
, typename P2
, typename P3
, typename P4
,
427 typename P5
, typename P6
, typename P7
>
429 typename
internal::BindState
<
430 typename
internal::FunctorTraits
<Functor
>::RunnableType
,
431 typename
internal::FunctorTraits
<Functor
>::RunType
,
432 void(typename
internal::CallbackParamTraits
<P1
>::StorageType
,
433 typename
internal::CallbackParamTraits
<P2
>::StorageType
,
434 typename
internal::CallbackParamTraits
<P3
>::StorageType
,
435 typename
internal::CallbackParamTraits
<P4
>::StorageType
,
436 typename
internal::CallbackParamTraits
<P5
>::StorageType
,
437 typename
internal::CallbackParamTraits
<P6
>::StorageType
,
438 typename
internal::CallbackParamTraits
<P7
>::StorageType
)>
440 Bind(Functor functor
, const P1
& p1
, const P2
& p2
, const P3
& p3
, const P4
& p4
,
441 const P5
& p5
, const P6
& p6
, const P7
& p7
) {
442 // Typedefs for how to store and run the functor.
443 typedef typename
internal::FunctorTraits
<Functor
>::RunnableType RunnableType
;
444 typedef typename
internal::FunctorTraits
<Functor
>::RunType RunType
;
446 // Use RunnableType::RunType instead of RunType above because our
447 // checks should below for bound references need to know what the actual
448 // functor is going to interpret the argument as.
449 typedef internal::FunctionTraits
<typename
RunnableType::RunType
>
452 // Do not allow binding a non-const reference parameter. Non-const reference
453 // parameters are disallowed by the Google style guide. Also, binding a
454 // non-const reference parameter can make for subtle bugs because the
455 // invoked function will receive a reference to the stored copy of the
456 // argument and not the original.
458 !(is_non_const_reference
<typename
BoundFunctorTraits::A1Type
>::value
||
459 is_non_const_reference
<typename
BoundFunctorTraits::A2Type
>::value
||
460 is_non_const_reference
<typename
BoundFunctorTraits::A3Type
>::value
||
461 is_non_const_reference
<typename
BoundFunctorTraits::A4Type
>::value
||
462 is_non_const_reference
<typename
BoundFunctorTraits::A5Type
>::value
||
463 is_non_const_reference
<typename
BoundFunctorTraits::A6Type
>::value
||
464 is_non_const_reference
<typename
BoundFunctorTraits::A7Type
>::value
),
465 do_not_bind_functions_with_nonconst_ref
);
467 // For methods, we need to be careful for parameter 1. We do not require
468 // a scoped_refptr because BindState<> itself takes care of AddRef() for
469 // methods. We also disallow binding of an array as the method's target
472 internal::HasIsMethodTag
<RunnableType
>::value
||
473 !internal::NeedsScopedRefptrButGetsRawPtr
<P1
>::value
,
474 p1_is_refcounted_type_and_needs_scoped_refptr
);
475 COMPILE_ASSERT(!internal::HasIsMethodTag
<RunnableType
>::value
||
476 !is_array
<P1
>::value
,
477 first_bound_argument_to_method_cannot_be_array
);
478 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr
<P2
>::value
,
479 p2_is_refcounted_type_and_needs_scoped_refptr
);
480 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr
<P3
>::value
,
481 p3_is_refcounted_type_and_needs_scoped_refptr
);
482 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr
<P4
>::value
,
483 p4_is_refcounted_type_and_needs_scoped_refptr
);
484 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr
<P5
>::value
,
485 p5_is_refcounted_type_and_needs_scoped_refptr
);
486 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr
<P6
>::value
,
487 p6_is_refcounted_type_and_needs_scoped_refptr
);
488 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr
<P7
>::value
,
489 p7_is_refcounted_type_and_needs_scoped_refptr
);
490 typedef internal::BindState
<RunnableType
, RunType
,
491 void(typename
internal::CallbackParamTraits
<P1
>::StorageType
,
492 typename
internal::CallbackParamTraits
<P2
>::StorageType
,
493 typename
internal::CallbackParamTraits
<P3
>::StorageType
,
494 typename
internal::CallbackParamTraits
<P4
>::StorageType
,
495 typename
internal::CallbackParamTraits
<P5
>::StorageType
,
496 typename
internal::CallbackParamTraits
<P6
>::StorageType
,
497 typename
internal::CallbackParamTraits
<P7
>::StorageType
)> BindState
;
500 return Callback
<typename
BindState::UnboundRunType
>(
501 new BindState(internal::MakeRunnable(functor
), p1
, p2
, p3
, p4
, p5
, p6
,
507 #endif // BASE_BIND_H_