Allow resize-to-client to be enabled by the user.
[chromium-blink-merge.git] / base / bind_internal.h
blob301b681437847fe55dfdac4a104e0a8f294ede82
1 // This file was GENERATED by command:
2 // pump.py bind_internal.h.pump
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.
10 #ifndef BASE_BIND_INTERNAL_H_
11 #define BASE_BIND_INTERNAL_H_
13 #include "base/bind_helpers.h"
14 #include "base/callback_internal.h"
15 #include "base/memory/raw_scoped_refptr_mismatch_checker.h"
16 #include "base/memory/weak_ptr.h"
17 #include "base/template_util.h"
18 #include "build/build_config.h"
20 #if defined(OS_WIN)
21 #include "base/bind_internal_win.h"
22 #endif
24 namespace base {
25 namespace internal {
27 // See base/callback.h for user documentation.
30 // CONCEPTS:
31 // Runnable -- A type (really a type class) that has a single Run() method
32 // and a RunType typedef that corresponds to the type of Run().
33 // A Runnable can declare that it should treated like a method
34 // call by including a typedef named IsMethod. The value of
35 // this typedef is NOT inspected, only the existence. When a
36 // Runnable declares itself a method, Bind() will enforce special
37 // refcounting + WeakPtr handling semantics for the first
38 // parameter which is expected to be an object.
39 // Functor -- A copyable type representing something that should be called.
40 // All function pointers, Callback<>, and Runnables are functors
41 // even if the invocation syntax differs.
42 // RunType -- A function type (as opposed to function _pointer_ type) for
43 // a Run() function. Usually just a convenience typedef.
44 // (Bound)ArgsType -- A function type that is being (ab)used to store the
45 // types of set of arguments. The "return" type is always
46 // void here. We use this hack so that we do not need
47 // a new type name for each arity of type. (eg.,
48 // BindState1, BindState2). This makes forward
49 // declarations and friending much much easier.
51 // Types:
52 // RunnableAdapter<> -- Wraps the various "function" pointer types into an
53 // object that adheres to the Runnable interface.
54 // There are |3*ARITY| RunnableAdapter types.
55 // FunctionTraits<> -- Type traits that unwrap a function signature into a
56 // a set of easier to use typedefs. Used mainly for
57 // compile time asserts.
58 // There are |ARITY| FunctionTraits types.
59 // ForceVoidReturn<> -- Helper class for translating function signatures to
60 // equivalent forms with a "void" return type.
61 // There are |ARITY| ForceVoidReturn types.
62 // FunctorTraits<> -- Type traits used determine the correct RunType and
63 // RunnableType for a Functor. This is where function
64 // signature adapters are applied.
65 // There are |ARITY| ForceVoidReturn types.
66 // MakeRunnable<> -- Takes a Functor and returns an object in the Runnable
67 // type class that represents the underlying Functor.
68 // There are |O(1)| MakeRunnable types.
69 // InvokeHelper<> -- Take a Runnable + arguments and actully invokes it.
70 // Handle the differing syntaxes needed for WeakPtr<> support,
71 // and for ignoring return values. This is separate from
72 // Invoker to avoid creating multiple version of Invoker<>
73 // which grows at O(n^2) with the arity.
74 // There are |k*ARITY| InvokeHelper types.
75 // Invoker<> -- Unwraps the curried parameters and executes the Runnable.
76 // There are |(ARITY^2 + ARITY)/2| Invoketypes.
77 // BindState<> -- Stores the curried parameters, and is the main entry point
78 // into the Bind() system, doing most of the type resolution.
79 // There are ARITY BindState types.
81 // RunnableAdapter<>
83 // The RunnableAdapter<> templates provide a uniform interface for invoking
84 // a function pointer, method pointer, or const method pointer. The adapter
85 // exposes a Run() method with an appropriate signature. Using this wrapper
86 // allows for writing code that supports all three pointer types without
87 // undue repetition. Without it, a lot of code would need to be repeated 3
88 // times.
90 // For method pointers and const method pointers the first argument to Run()
91 // is considered to be the received of the method. This is similar to STL's
92 // mem_fun().
94 // This class also exposes a RunType typedef that is the function type of the
95 // Run() function.
97 // If and only if the wrapper contains a method or const method pointer, an
98 // IsMethod typedef is exposed. The existence of this typedef (NOT the value)
99 // marks that the wrapper should be considered a method wrapper.
101 template <typename Functor>
102 class RunnableAdapter;
104 // Function: Arity 0.
105 template <typename R>
106 class RunnableAdapter<R(*)()> {
107 public:
108 typedef R (RunType)();
110 explicit RunnableAdapter(R(*function)())
111 : function_(function) {
114 R Run() {
115 return function_();
118 private:
119 R (*function_)();
122 // Method: Arity 0.
123 template <typename R, typename T>
124 class RunnableAdapter<R(T::*)()> {
125 public:
126 typedef R (RunType)(T*);
127 typedef true_type IsMethod;
129 explicit RunnableAdapter(R(T::*method)())
130 : method_(method) {
133 R Run(T* object) {
134 return (object->*method_)();
137 private:
138 R (T::*method_)();
141 // Const Method: Arity 0.
142 template <typename R, typename T>
143 class RunnableAdapter<R(T::*)() const> {
144 public:
145 typedef R (RunType)(const T*);
146 typedef true_type IsMethod;
148 explicit RunnableAdapter(R(T::*method)() const)
149 : method_(method) {
152 R Run(const T* object) {
153 return (object->*method_)();
156 private:
157 R (T::*method_)() const;
160 // Function: Arity 1.
161 template <typename R, typename A1>
162 class RunnableAdapter<R(*)(A1)> {
163 public:
164 typedef R (RunType)(A1);
166 explicit RunnableAdapter(R(*function)(A1))
167 : function_(function) {
170 R Run(typename CallbackParamTraits<A1>::ForwardType a1) {
171 return function_(CallbackForward(a1));
174 private:
175 R (*function_)(A1);
178 // Method: Arity 1.
179 template <typename R, typename T, typename A1>
180 class RunnableAdapter<R(T::*)(A1)> {
181 public:
182 typedef R (RunType)(T*, A1);
183 typedef true_type IsMethod;
185 explicit RunnableAdapter(R(T::*method)(A1))
186 : method_(method) {
189 R Run(T* object, typename CallbackParamTraits<A1>::ForwardType a1) {
190 return (object->*method_)(CallbackForward(a1));
193 private:
194 R (T::*method_)(A1);
197 // Const Method: Arity 1.
198 template <typename R, typename T, typename A1>
199 class RunnableAdapter<R(T::*)(A1) const> {
200 public:
201 typedef R (RunType)(const T*, A1);
202 typedef true_type IsMethod;
204 explicit RunnableAdapter(R(T::*method)(A1) const)
205 : method_(method) {
208 R Run(const T* object, typename CallbackParamTraits<A1>::ForwardType a1) {
209 return (object->*method_)(CallbackForward(a1));
212 private:
213 R (T::*method_)(A1) const;
216 // Function: Arity 2.
217 template <typename R, typename A1, typename A2>
218 class RunnableAdapter<R(*)(A1, A2)> {
219 public:
220 typedef R (RunType)(A1, A2);
222 explicit RunnableAdapter(R(*function)(A1, A2))
223 : function_(function) {
226 R Run(typename CallbackParamTraits<A1>::ForwardType a1,
227 typename CallbackParamTraits<A2>::ForwardType a2) {
228 return function_(CallbackForward(a1), CallbackForward(a2));
231 private:
232 R (*function_)(A1, A2);
235 // Method: Arity 2.
236 template <typename R, typename T, typename A1, typename A2>
237 class RunnableAdapter<R(T::*)(A1, A2)> {
238 public:
239 typedef R (RunType)(T*, A1, A2);
240 typedef true_type IsMethod;
242 explicit RunnableAdapter(R(T::*method)(A1, A2))
243 : method_(method) {
246 R Run(T* object, typename CallbackParamTraits<A1>::ForwardType a1,
247 typename CallbackParamTraits<A2>::ForwardType a2) {
248 return (object->*method_)(CallbackForward(a1), CallbackForward(a2));
251 private:
252 R (T::*method_)(A1, A2);
255 // Const Method: Arity 2.
256 template <typename R, typename T, typename A1, typename A2>
257 class RunnableAdapter<R(T::*)(A1, A2) const> {
258 public:
259 typedef R (RunType)(const T*, A1, A2);
260 typedef true_type IsMethod;
262 explicit RunnableAdapter(R(T::*method)(A1, A2) const)
263 : method_(method) {
266 R Run(const T* object, typename CallbackParamTraits<A1>::ForwardType a1,
267 typename CallbackParamTraits<A2>::ForwardType a2) {
268 return (object->*method_)(CallbackForward(a1), CallbackForward(a2));
271 private:
272 R (T::*method_)(A1, A2) const;
275 // Function: Arity 3.
276 template <typename R, typename A1, typename A2, typename A3>
277 class RunnableAdapter<R(*)(A1, A2, A3)> {
278 public:
279 typedef R (RunType)(A1, A2, A3);
281 explicit RunnableAdapter(R(*function)(A1, A2, A3))
282 : function_(function) {
285 R Run(typename CallbackParamTraits<A1>::ForwardType a1,
286 typename CallbackParamTraits<A2>::ForwardType a2,
287 typename CallbackParamTraits<A3>::ForwardType a3) {
288 return function_(CallbackForward(a1), CallbackForward(a2),
289 CallbackForward(a3));
292 private:
293 R (*function_)(A1, A2, A3);
296 // Method: Arity 3.
297 template <typename R, typename T, typename A1, typename A2, typename A3>
298 class RunnableAdapter<R(T::*)(A1, A2, A3)> {
299 public:
300 typedef R (RunType)(T*, A1, A2, A3);
301 typedef true_type IsMethod;
303 explicit RunnableAdapter(R(T::*method)(A1, A2, A3))
304 : method_(method) {
307 R Run(T* object, typename CallbackParamTraits<A1>::ForwardType a1,
308 typename CallbackParamTraits<A2>::ForwardType a2,
309 typename CallbackParamTraits<A3>::ForwardType a3) {
310 return (object->*method_)(CallbackForward(a1), CallbackForward(a2),
311 CallbackForward(a3));
314 private:
315 R (T::*method_)(A1, A2, A3);
318 // Const Method: Arity 3.
319 template <typename R, typename T, typename A1, typename A2, typename A3>
320 class RunnableAdapter<R(T::*)(A1, A2, A3) const> {
321 public:
322 typedef R (RunType)(const T*, A1, A2, A3);
323 typedef true_type IsMethod;
325 explicit RunnableAdapter(R(T::*method)(A1, A2, A3) const)
326 : method_(method) {
329 R Run(const T* object, typename CallbackParamTraits<A1>::ForwardType a1,
330 typename CallbackParamTraits<A2>::ForwardType a2,
331 typename CallbackParamTraits<A3>::ForwardType a3) {
332 return (object->*method_)(CallbackForward(a1), CallbackForward(a2),
333 CallbackForward(a3));
336 private:
337 R (T::*method_)(A1, A2, A3) const;
340 // Function: Arity 4.
341 template <typename R, typename A1, typename A2, typename A3, typename A4>
342 class RunnableAdapter<R(*)(A1, A2, A3, A4)> {
343 public:
344 typedef R (RunType)(A1, A2, A3, A4);
346 explicit RunnableAdapter(R(*function)(A1, A2, A3, A4))
347 : function_(function) {
350 R Run(typename CallbackParamTraits<A1>::ForwardType a1,
351 typename CallbackParamTraits<A2>::ForwardType a2,
352 typename CallbackParamTraits<A3>::ForwardType a3,
353 typename CallbackParamTraits<A4>::ForwardType a4) {
354 return function_(CallbackForward(a1), CallbackForward(a2),
355 CallbackForward(a3), CallbackForward(a4));
358 private:
359 R (*function_)(A1, A2, A3, A4);
362 // Method: Arity 4.
363 template <typename R, typename T, typename A1, typename A2, typename A3,
364 typename A4>
365 class RunnableAdapter<R(T::*)(A1, A2, A3, A4)> {
366 public:
367 typedef R (RunType)(T*, A1, A2, A3, A4);
368 typedef true_type IsMethod;
370 explicit RunnableAdapter(R(T::*method)(A1, A2, A3, A4))
371 : method_(method) {
374 R Run(T* object, typename CallbackParamTraits<A1>::ForwardType a1,
375 typename CallbackParamTraits<A2>::ForwardType a2,
376 typename CallbackParamTraits<A3>::ForwardType a3,
377 typename CallbackParamTraits<A4>::ForwardType a4) {
378 return (object->*method_)(CallbackForward(a1), CallbackForward(a2),
379 CallbackForward(a3), CallbackForward(a4));
382 private:
383 R (T::*method_)(A1, A2, A3, A4);
386 // Const Method: Arity 4.
387 template <typename R, typename T, typename A1, typename A2, typename A3,
388 typename A4>
389 class RunnableAdapter<R(T::*)(A1, A2, A3, A4) const> {
390 public:
391 typedef R (RunType)(const T*, A1, A2, A3, A4);
392 typedef true_type IsMethod;
394 explicit RunnableAdapter(R(T::*method)(A1, A2, A3, A4) const)
395 : method_(method) {
398 R Run(const T* object, typename CallbackParamTraits<A1>::ForwardType a1,
399 typename CallbackParamTraits<A2>::ForwardType a2,
400 typename CallbackParamTraits<A3>::ForwardType a3,
401 typename CallbackParamTraits<A4>::ForwardType a4) {
402 return (object->*method_)(CallbackForward(a1), CallbackForward(a2),
403 CallbackForward(a3), CallbackForward(a4));
406 private:
407 R (T::*method_)(A1, A2, A3, A4) const;
410 // Function: Arity 5.
411 template <typename R, typename A1, typename A2, typename A3, typename A4,
412 typename A5>
413 class RunnableAdapter<R(*)(A1, A2, A3, A4, A5)> {
414 public:
415 typedef R (RunType)(A1, A2, A3, A4, A5);
417 explicit RunnableAdapter(R(*function)(A1, A2, A3, A4, A5))
418 : function_(function) {
421 R Run(typename CallbackParamTraits<A1>::ForwardType a1,
422 typename CallbackParamTraits<A2>::ForwardType a2,
423 typename CallbackParamTraits<A3>::ForwardType a3,
424 typename CallbackParamTraits<A4>::ForwardType a4,
425 typename CallbackParamTraits<A5>::ForwardType a5) {
426 return function_(CallbackForward(a1), CallbackForward(a2),
427 CallbackForward(a3), CallbackForward(a4), CallbackForward(a5));
430 private:
431 R (*function_)(A1, A2, A3, A4, A5);
434 // Method: Arity 5.
435 template <typename R, typename T, typename A1, typename A2, typename A3,
436 typename A4, typename A5>
437 class RunnableAdapter<R(T::*)(A1, A2, A3, A4, A5)> {
438 public:
439 typedef R (RunType)(T*, A1, A2, A3, A4, A5);
440 typedef true_type IsMethod;
442 explicit RunnableAdapter(R(T::*method)(A1, A2, A3, A4, A5))
443 : method_(method) {
446 R Run(T* object, typename CallbackParamTraits<A1>::ForwardType a1,
447 typename CallbackParamTraits<A2>::ForwardType a2,
448 typename CallbackParamTraits<A3>::ForwardType a3,
449 typename CallbackParamTraits<A4>::ForwardType a4,
450 typename CallbackParamTraits<A5>::ForwardType a5) {
451 return (object->*method_)(CallbackForward(a1), CallbackForward(a2),
452 CallbackForward(a3), CallbackForward(a4), CallbackForward(a5));
455 private:
456 R (T::*method_)(A1, A2, A3, A4, A5);
459 // Const Method: Arity 5.
460 template <typename R, typename T, typename A1, typename A2, typename A3,
461 typename A4, typename A5>
462 class RunnableAdapter<R(T::*)(A1, A2, A3, A4, A5) const> {
463 public:
464 typedef R (RunType)(const T*, A1, A2, A3, A4, A5);
465 typedef true_type IsMethod;
467 explicit RunnableAdapter(R(T::*method)(A1, A2, A3, A4, A5) const)
468 : method_(method) {
471 R Run(const T* object, typename CallbackParamTraits<A1>::ForwardType a1,
472 typename CallbackParamTraits<A2>::ForwardType a2,
473 typename CallbackParamTraits<A3>::ForwardType a3,
474 typename CallbackParamTraits<A4>::ForwardType a4,
475 typename CallbackParamTraits<A5>::ForwardType a5) {
476 return (object->*method_)(CallbackForward(a1), CallbackForward(a2),
477 CallbackForward(a3), CallbackForward(a4), CallbackForward(a5));
480 private:
481 R (T::*method_)(A1, A2, A3, A4, A5) const;
484 // Function: Arity 6.
485 template <typename R, typename A1, typename A2, typename A3, typename A4,
486 typename A5, typename A6>
487 class RunnableAdapter<R(*)(A1, A2, A3, A4, A5, A6)> {
488 public:
489 typedef R (RunType)(A1, A2, A3, A4, A5, A6);
491 explicit RunnableAdapter(R(*function)(A1, A2, A3, A4, A5, A6))
492 : function_(function) {
495 R Run(typename CallbackParamTraits<A1>::ForwardType a1,
496 typename CallbackParamTraits<A2>::ForwardType a2,
497 typename CallbackParamTraits<A3>::ForwardType a3,
498 typename CallbackParamTraits<A4>::ForwardType a4,
499 typename CallbackParamTraits<A5>::ForwardType a5,
500 typename CallbackParamTraits<A6>::ForwardType a6) {
501 return function_(CallbackForward(a1), CallbackForward(a2),
502 CallbackForward(a3), CallbackForward(a4), CallbackForward(a5),
503 CallbackForward(a6));
506 private:
507 R (*function_)(A1, A2, A3, A4, A5, A6);
510 // Method: Arity 6.
511 template <typename R, typename T, typename A1, typename A2, typename A3,
512 typename A4, typename A5, typename A6>
513 class RunnableAdapter<R(T::*)(A1, A2, A3, A4, A5, A6)> {
514 public:
515 typedef R (RunType)(T*, A1, A2, A3, A4, A5, A6);
516 typedef true_type IsMethod;
518 explicit RunnableAdapter(R(T::*method)(A1, A2, A3, A4, A5, A6))
519 : method_(method) {
522 R Run(T* object, typename CallbackParamTraits<A1>::ForwardType a1,
523 typename CallbackParamTraits<A2>::ForwardType a2,
524 typename CallbackParamTraits<A3>::ForwardType a3,
525 typename CallbackParamTraits<A4>::ForwardType a4,
526 typename CallbackParamTraits<A5>::ForwardType a5,
527 typename CallbackParamTraits<A6>::ForwardType a6) {
528 return (object->*method_)(CallbackForward(a1), CallbackForward(a2),
529 CallbackForward(a3), CallbackForward(a4), CallbackForward(a5),
530 CallbackForward(a6));
533 private:
534 R (T::*method_)(A1, A2, A3, A4, A5, A6);
537 // Const Method: Arity 6.
538 template <typename R, typename T, typename A1, typename A2, typename A3,
539 typename A4, typename A5, typename A6>
540 class RunnableAdapter<R(T::*)(A1, A2, A3, A4, A5, A6) const> {
541 public:
542 typedef R (RunType)(const T*, A1, A2, A3, A4, A5, A6);
543 typedef true_type IsMethod;
545 explicit RunnableAdapter(R(T::*method)(A1, A2, A3, A4, A5, A6) const)
546 : method_(method) {
549 R Run(const T* object, typename CallbackParamTraits<A1>::ForwardType a1,
550 typename CallbackParamTraits<A2>::ForwardType a2,
551 typename CallbackParamTraits<A3>::ForwardType a3,
552 typename CallbackParamTraits<A4>::ForwardType a4,
553 typename CallbackParamTraits<A5>::ForwardType a5,
554 typename CallbackParamTraits<A6>::ForwardType a6) {
555 return (object->*method_)(CallbackForward(a1), CallbackForward(a2),
556 CallbackForward(a3), CallbackForward(a4), CallbackForward(a5),
557 CallbackForward(a6));
560 private:
561 R (T::*method_)(A1, A2, A3, A4, A5, A6) const;
564 // Function: Arity 7.
565 template <typename R, typename A1, typename A2, typename A3, typename A4,
566 typename A5, typename A6, typename A7>
567 class RunnableAdapter<R(*)(A1, A2, A3, A4, A5, A6, A7)> {
568 public:
569 typedef R (RunType)(A1, A2, A3, A4, A5, A6, A7);
571 explicit RunnableAdapter(R(*function)(A1, A2, A3, A4, A5, A6, A7))
572 : function_(function) {
575 R Run(typename CallbackParamTraits<A1>::ForwardType a1,
576 typename CallbackParamTraits<A2>::ForwardType a2,
577 typename CallbackParamTraits<A3>::ForwardType a3,
578 typename CallbackParamTraits<A4>::ForwardType a4,
579 typename CallbackParamTraits<A5>::ForwardType a5,
580 typename CallbackParamTraits<A6>::ForwardType a6,
581 typename CallbackParamTraits<A7>::ForwardType a7) {
582 return function_(CallbackForward(a1), CallbackForward(a2),
583 CallbackForward(a3), CallbackForward(a4), CallbackForward(a5),
584 CallbackForward(a6), CallbackForward(a7));
587 private:
588 R (*function_)(A1, A2, A3, A4, A5, A6, A7);
591 // Method: Arity 7.
592 template <typename R, typename T, typename A1, typename A2, typename A3,
593 typename A4, typename A5, typename A6, typename A7>
594 class RunnableAdapter<R(T::*)(A1, A2, A3, A4, A5, A6, A7)> {
595 public:
596 typedef R (RunType)(T*, A1, A2, A3, A4, A5, A6, A7);
597 typedef true_type IsMethod;
599 explicit RunnableAdapter(R(T::*method)(A1, A2, A3, A4, A5, A6, A7))
600 : method_(method) {
603 R Run(T* object, typename CallbackParamTraits<A1>::ForwardType a1,
604 typename CallbackParamTraits<A2>::ForwardType a2,
605 typename CallbackParamTraits<A3>::ForwardType a3,
606 typename CallbackParamTraits<A4>::ForwardType a4,
607 typename CallbackParamTraits<A5>::ForwardType a5,
608 typename CallbackParamTraits<A6>::ForwardType a6,
609 typename CallbackParamTraits<A7>::ForwardType a7) {
610 return (object->*method_)(CallbackForward(a1), CallbackForward(a2),
611 CallbackForward(a3), CallbackForward(a4), CallbackForward(a5),
612 CallbackForward(a6), CallbackForward(a7));
615 private:
616 R (T::*method_)(A1, A2, A3, A4, A5, A6, A7);
619 // Const Method: Arity 7.
620 template <typename R, typename T, typename A1, typename A2, typename A3,
621 typename A4, typename A5, typename A6, typename A7>
622 class RunnableAdapter<R(T::*)(A1, A2, A3, A4, A5, A6, A7) const> {
623 public:
624 typedef R (RunType)(const T*, A1, A2, A3, A4, A5, A6, A7);
625 typedef true_type IsMethod;
627 explicit RunnableAdapter(R(T::*method)(A1, A2, A3, A4, A5, A6, A7) const)
628 : method_(method) {
631 R Run(const T* object, typename CallbackParamTraits<A1>::ForwardType a1,
632 typename CallbackParamTraits<A2>::ForwardType a2,
633 typename CallbackParamTraits<A3>::ForwardType a3,
634 typename CallbackParamTraits<A4>::ForwardType a4,
635 typename CallbackParamTraits<A5>::ForwardType a5,
636 typename CallbackParamTraits<A6>::ForwardType a6,
637 typename CallbackParamTraits<A7>::ForwardType a7) {
638 return (object->*method_)(CallbackForward(a1), CallbackForward(a2),
639 CallbackForward(a3), CallbackForward(a4), CallbackForward(a5),
640 CallbackForward(a6), CallbackForward(a7));
643 private:
644 R (T::*method_)(A1, A2, A3, A4, A5, A6, A7) const;
648 // FunctionTraits<>
650 // Breaks a function signature apart into typedefs for easier introspection.
651 template <typename Sig>
652 struct FunctionTraits;
654 template <typename R>
655 struct FunctionTraits<R()> {
656 typedef R ReturnType;
659 template <typename R, typename A1>
660 struct FunctionTraits<R(A1)> {
661 typedef R ReturnType;
662 typedef A1 A1Type;
665 template <typename R, typename A1, typename A2>
666 struct FunctionTraits<R(A1, A2)> {
667 typedef R ReturnType;
668 typedef A1 A1Type;
669 typedef A2 A2Type;
672 template <typename R, typename A1, typename A2, typename A3>
673 struct FunctionTraits<R(A1, A2, A3)> {
674 typedef R ReturnType;
675 typedef A1 A1Type;
676 typedef A2 A2Type;
677 typedef A3 A3Type;
680 template <typename R, typename A1, typename A2, typename A3, typename A4>
681 struct FunctionTraits<R(A1, A2, A3, A4)> {
682 typedef R ReturnType;
683 typedef A1 A1Type;
684 typedef A2 A2Type;
685 typedef A3 A3Type;
686 typedef A4 A4Type;
689 template <typename R, typename A1, typename A2, typename A3, typename A4,
690 typename A5>
691 struct FunctionTraits<R(A1, A2, A3, A4, A5)> {
692 typedef R ReturnType;
693 typedef A1 A1Type;
694 typedef A2 A2Type;
695 typedef A3 A3Type;
696 typedef A4 A4Type;
697 typedef A5 A5Type;
700 template <typename R, typename A1, typename A2, typename A3, typename A4,
701 typename A5, typename A6>
702 struct FunctionTraits<R(A1, A2, A3, A4, A5, A6)> {
703 typedef R ReturnType;
704 typedef A1 A1Type;
705 typedef A2 A2Type;
706 typedef A3 A3Type;
707 typedef A4 A4Type;
708 typedef A5 A5Type;
709 typedef A6 A6Type;
712 template <typename R, typename A1, typename A2, typename A3, typename A4,
713 typename A5, typename A6, typename A7>
714 struct FunctionTraits<R(A1, A2, A3, A4, A5, A6, A7)> {
715 typedef R ReturnType;
716 typedef A1 A1Type;
717 typedef A2 A2Type;
718 typedef A3 A3Type;
719 typedef A4 A4Type;
720 typedef A5 A5Type;
721 typedef A6 A6Type;
722 typedef A7 A7Type;
726 // ForceVoidReturn<>
728 // Set of templates that support forcing the function return type to void.
729 template <typename Sig>
730 struct ForceVoidReturn;
732 template <typename R>
733 struct ForceVoidReturn<R()> {
734 typedef void(RunType)();
737 template <typename R, typename A1>
738 struct ForceVoidReturn<R(A1)> {
739 typedef void(RunType)(A1);
742 template <typename R, typename A1, typename A2>
743 struct ForceVoidReturn<R(A1, A2)> {
744 typedef void(RunType)(A1, A2);
747 template <typename R, typename A1, typename A2, typename A3>
748 struct ForceVoidReturn<R(A1, A2, A3)> {
749 typedef void(RunType)(A1, A2, A3);
752 template <typename R, typename A1, typename A2, typename A3, typename A4>
753 struct ForceVoidReturn<R(A1, A2, A3, A4)> {
754 typedef void(RunType)(A1, A2, A3, A4);
757 template <typename R, typename A1, typename A2, typename A3, typename A4,
758 typename A5>
759 struct ForceVoidReturn<R(A1, A2, A3, A4, A5)> {
760 typedef void(RunType)(A1, A2, A3, A4, A5);
763 template <typename R, typename A1, typename A2, typename A3, typename A4,
764 typename A5, typename A6>
765 struct ForceVoidReturn<R(A1, A2, A3, A4, A5, A6)> {
766 typedef void(RunType)(A1, A2, A3, A4, A5, A6);
769 template <typename R, typename A1, typename A2, typename A3, typename A4,
770 typename A5, typename A6, typename A7>
771 struct ForceVoidReturn<R(A1, A2, A3, A4, A5, A6, A7)> {
772 typedef void(RunType)(A1, A2, A3, A4, A5, A6, A7);
776 // FunctorTraits<>
778 // See description at top of file.
779 template <typename T>
780 struct FunctorTraits {
781 typedef RunnableAdapter<T> RunnableType;
782 typedef typename RunnableType::RunType RunType;
785 template <typename T>
786 struct FunctorTraits<IgnoreResultHelper<T> > {
787 typedef typename FunctorTraits<T>::RunnableType RunnableType;
788 typedef typename ForceVoidReturn<
789 typename RunnableType::RunType>::RunType RunType;
792 template <typename T>
793 struct FunctorTraits<Callback<T> > {
794 typedef Callback<T> RunnableType;
795 typedef typename Callback<T>::RunType RunType;
799 // MakeRunnable<>
801 // Converts a passed in functor to a RunnableType using type inference.
803 template <typename T>
804 typename FunctorTraits<T>::RunnableType MakeRunnable(const T& t) {
805 return RunnableAdapter<T>(t);
808 template <typename T>
809 typename FunctorTraits<T>::RunnableType
810 MakeRunnable(const IgnoreResultHelper<T>& t) {
811 return MakeRunnable(t.functor_);
814 template <typename T>
815 const typename FunctorTraits<Callback<T> >::RunnableType&
816 MakeRunnable(const Callback<T>& t) {
817 DCHECK(!t.is_null());
818 return t;
822 // InvokeHelper<>
824 // There are 3 logical InvokeHelper<> specializations: normal, void-return,
825 // WeakCalls.
827 // The normal type just calls the underlying runnable.
829 // We need a InvokeHelper to handle void return types in order to support
830 // IgnoreResult(). Normally, if the Runnable's RunType had a void return,
831 // the template system would just accept "return functor.Run()" ignoring
832 // the fact that a void function is being used with return. This piece of
833 // sugar breaks though when the Runnable's RunType is not void. Thus, we
834 // need a partial specialization to change the syntax to drop the "return"
835 // from the invocation call.
837 // WeakCalls similarly need special syntax that is applied to the first
838 // argument to check if they should no-op themselves.
839 template <bool IsWeakCall, typename ReturnType, typename Runnable,
840 typename ArgsType>
841 struct InvokeHelper;
843 template <typename ReturnType, typename Runnable>
844 struct InvokeHelper<false, ReturnType, Runnable,
845 void()> {
846 static ReturnType MakeItSo(Runnable runnable) {
847 return runnable.Run();
851 template <typename Runnable>
852 struct InvokeHelper<false, void, Runnable,
853 void()> {
854 static void MakeItSo(Runnable runnable) {
855 runnable.Run();
859 template <typename ReturnType, typename Runnable,typename A1>
860 struct InvokeHelper<false, ReturnType, Runnable,
861 void(A1)> {
862 static ReturnType MakeItSo(Runnable runnable, A1 a1) {
863 return runnable.Run(CallbackForward(a1));
867 template <typename Runnable,typename A1>
868 struct InvokeHelper<false, void, Runnable,
869 void(A1)> {
870 static void MakeItSo(Runnable runnable, A1 a1) {
871 runnable.Run(CallbackForward(a1));
875 template <typename Runnable, typename A1>
876 struct InvokeHelper<true, void, Runnable,
877 void(A1)> {
878 static void MakeItSo(Runnable runnable, A1 a1) {
879 if (!a1.get()) {
880 return;
883 runnable.Run(CallbackForward(a1));
887 template <typename ReturnType, typename Runnable,typename A1, typename A2>
888 struct InvokeHelper<false, ReturnType, Runnable,
889 void(A1, A2)> {
890 static ReturnType MakeItSo(Runnable runnable, A1 a1, A2 a2) {
891 return runnable.Run(CallbackForward(a1), CallbackForward(a2));
895 template <typename Runnable,typename A1, typename A2>
896 struct InvokeHelper<false, void, Runnable,
897 void(A1, A2)> {
898 static void MakeItSo(Runnable runnable, A1 a1, A2 a2) {
899 runnable.Run(CallbackForward(a1), CallbackForward(a2));
903 template <typename Runnable, typename A1, typename A2>
904 struct InvokeHelper<true, void, Runnable,
905 void(A1, A2)> {
906 static void MakeItSo(Runnable runnable, A1 a1, A2 a2) {
907 if (!a1.get()) {
908 return;
911 runnable.Run(CallbackForward(a1), CallbackForward(a2));
915 template <typename ReturnType, typename Runnable,typename A1, typename A2,
916 typename A3>
917 struct InvokeHelper<false, ReturnType, Runnable,
918 void(A1, A2, A3)> {
919 static ReturnType MakeItSo(Runnable runnable, A1 a1, A2 a2, A3 a3) {
920 return runnable.Run(CallbackForward(a1), CallbackForward(a2),
921 CallbackForward(a3));
925 template <typename Runnable,typename A1, typename A2, typename A3>
926 struct InvokeHelper<false, void, Runnable,
927 void(A1, A2, A3)> {
928 static void MakeItSo(Runnable runnable, A1 a1, A2 a2, A3 a3) {
929 runnable.Run(CallbackForward(a1), CallbackForward(a2), CallbackForward(a3));
933 template <typename Runnable, typename A1, typename A2, typename A3>
934 struct InvokeHelper<true, void, Runnable,
935 void(A1, A2, A3)> {
936 static void MakeItSo(Runnable runnable, A1 a1, A2 a2, A3 a3) {
937 if (!a1.get()) {
938 return;
941 runnable.Run(CallbackForward(a1), CallbackForward(a2), CallbackForward(a3));
945 template <typename ReturnType, typename Runnable,typename A1, typename A2,
946 typename A3, typename A4>
947 struct InvokeHelper<false, ReturnType, Runnable,
948 void(A1, A2, A3, A4)> {
949 static ReturnType MakeItSo(Runnable runnable, A1 a1, A2 a2, A3 a3, A4 a4) {
950 return runnable.Run(CallbackForward(a1), CallbackForward(a2),
951 CallbackForward(a3), CallbackForward(a4));
955 template <typename Runnable,typename A1, typename A2, typename A3, typename A4>
956 struct InvokeHelper<false, void, Runnable,
957 void(A1, A2, A3, A4)> {
958 static void MakeItSo(Runnable runnable, A1 a1, A2 a2, A3 a3, A4 a4) {
959 runnable.Run(CallbackForward(a1), CallbackForward(a2), CallbackForward(a3),
960 CallbackForward(a4));
964 template <typename Runnable, typename A1, typename A2, typename A3, typename A4>
965 struct InvokeHelper<true, void, Runnable,
966 void(A1, A2, A3, A4)> {
967 static void MakeItSo(Runnable runnable, A1 a1, A2 a2, A3 a3, A4 a4) {
968 if (!a1.get()) {
969 return;
972 runnable.Run(CallbackForward(a1), CallbackForward(a2), CallbackForward(a3),
973 CallbackForward(a4));
977 template <typename ReturnType, typename Runnable,typename A1, typename A2,
978 typename A3, typename A4, typename A5>
979 struct InvokeHelper<false, ReturnType, Runnable,
980 void(A1, A2, A3, A4, A5)> {
981 static ReturnType MakeItSo(Runnable runnable, A1 a1, A2 a2, A3 a3, A4 a4,
982 A5 a5) {
983 return runnable.Run(CallbackForward(a1), CallbackForward(a2),
984 CallbackForward(a3), CallbackForward(a4), CallbackForward(a5));
988 template <typename Runnable,typename A1, typename A2, typename A3, typename A4,
989 typename A5>
990 struct InvokeHelper<false, void, Runnable,
991 void(A1, A2, A3, A4, A5)> {
992 static void MakeItSo(Runnable runnable, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) {
993 runnable.Run(CallbackForward(a1), CallbackForward(a2), CallbackForward(a3),
994 CallbackForward(a4), CallbackForward(a5));
998 template <typename Runnable, typename A1, typename A2, typename A3,
999 typename A4, typename A5>
1000 struct InvokeHelper<true, void, Runnable,
1001 void(A1, A2, A3, A4, A5)> {
1002 static void MakeItSo(Runnable runnable, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) {
1003 if (!a1.get()) {
1004 return;
1007 runnable.Run(CallbackForward(a1), CallbackForward(a2), CallbackForward(a3),
1008 CallbackForward(a4), CallbackForward(a5));
1012 template <typename ReturnType, typename Runnable,typename A1, typename A2,
1013 typename A3, typename A4, typename A5, typename A6>
1014 struct InvokeHelper<false, ReturnType, Runnable,
1015 void(A1, A2, A3, A4, A5, A6)> {
1016 static ReturnType MakeItSo(Runnable runnable, A1 a1, A2 a2, A3 a3, A4 a4,
1017 A5 a5, A6 a6) {
1018 return runnable.Run(CallbackForward(a1), CallbackForward(a2),
1019 CallbackForward(a3), CallbackForward(a4), CallbackForward(a5),
1020 CallbackForward(a6));
1024 template <typename Runnable,typename A1, typename A2, typename A3, typename A4,
1025 typename A5, typename A6>
1026 struct InvokeHelper<false, void, Runnable,
1027 void(A1, A2, A3, A4, A5, A6)> {
1028 static void MakeItSo(Runnable runnable, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5,
1029 A6 a6) {
1030 runnable.Run(CallbackForward(a1), CallbackForward(a2), CallbackForward(a3),
1031 CallbackForward(a4), CallbackForward(a5), CallbackForward(a6));
1035 template <typename Runnable, typename A1, typename A2, typename A3,
1036 typename A4, typename A5, typename A6>
1037 struct InvokeHelper<true, void, Runnable,
1038 void(A1, A2, A3, A4, A5, A6)> {
1039 static void MakeItSo(Runnable runnable, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5,
1040 A6 a6) {
1041 if (!a1.get()) {
1042 return;
1045 runnable.Run(CallbackForward(a1), CallbackForward(a2), CallbackForward(a3),
1046 CallbackForward(a4), CallbackForward(a5), CallbackForward(a6));
1050 template <typename ReturnType, typename Runnable,typename A1, typename A2,
1051 typename A3, typename A4, typename A5, typename A6, typename A7>
1052 struct InvokeHelper<false, ReturnType, Runnable,
1053 void(A1, A2, A3, A4, A5, A6, A7)> {
1054 static ReturnType MakeItSo(Runnable runnable, A1 a1, A2 a2, A3 a3, A4 a4,
1055 A5 a5, A6 a6, A7 a7) {
1056 return runnable.Run(CallbackForward(a1), CallbackForward(a2),
1057 CallbackForward(a3), CallbackForward(a4), CallbackForward(a5),
1058 CallbackForward(a6), CallbackForward(a7));
1062 template <typename Runnable,typename A1, typename A2, typename A3, typename A4,
1063 typename A5, typename A6, typename A7>
1064 struct InvokeHelper<false, void, Runnable,
1065 void(A1, A2, A3, A4, A5, A6, A7)> {
1066 static void MakeItSo(Runnable runnable, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5,
1067 A6 a6, A7 a7) {
1068 runnable.Run(CallbackForward(a1), CallbackForward(a2), CallbackForward(a3),
1069 CallbackForward(a4), CallbackForward(a5), CallbackForward(a6),
1070 CallbackForward(a7));
1074 template <typename Runnable, typename A1, typename A2, typename A3,
1075 typename A4, typename A5, typename A6, typename A7>
1076 struct InvokeHelper<true, void, Runnable,
1077 void(A1, A2, A3, A4, A5, A6, A7)> {
1078 static void MakeItSo(Runnable runnable, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5,
1079 A6 a6, A7 a7) {
1080 if (!a1.get()) {
1081 return;
1084 runnable.Run(CallbackForward(a1), CallbackForward(a2), CallbackForward(a3),
1085 CallbackForward(a4), CallbackForward(a5), CallbackForward(a6),
1086 CallbackForward(a7));
1090 #if !defined(_MSC_VER)
1092 template <typename ReturnType, typename Runnable, typename ArgsType>
1093 struct InvokeHelper<true, ReturnType, Runnable, ArgsType> {
1094 // WeakCalls are only supported for functions with a void return type.
1095 // Otherwise, the function result would be undefined if the the WeakPtr<>
1096 // is invalidated.
1097 COMPILE_ASSERT(is_void<ReturnType>::value,
1098 weak_ptrs_can_only_bind_to_methods_without_return_values);
1101 #endif
1103 // Invoker<>
1105 // See description at the top of the file.
1106 template <int NumBound, typename Storage, typename RunType>
1107 struct Invoker;
1109 // Arity 0 -> 0.
1110 template <typename StorageType, typename R>
1111 struct Invoker<0, StorageType, R()> {
1112 typedef R(RunType)(BindStateBase*);
1114 typedef R(UnboundRunType)();
1116 static R Run(BindStateBase* base) {
1117 StorageType* storage = static_cast<StorageType*>(base);
1119 // Local references to make debugger stepping easier. If in a debugger,
1120 // you really want to warp ahead and step through the
1121 // InvokeHelper<>::MakeItSo() call below.
1123 return InvokeHelper<StorageType::IsWeakCall::value, R,
1124 typename StorageType::RunnableType,
1125 void()>
1126 ::MakeItSo(storage->runnable_);
1130 // Arity 1 -> 1.
1131 template <typename StorageType, typename R,typename X1>
1132 struct Invoker<0, StorageType, R(X1)> {
1133 typedef R(RunType)(BindStateBase*,
1134 typename CallbackParamTraits<X1>::ForwardType);
1136 typedef R(UnboundRunType)(X1);
1138 static R Run(BindStateBase* base,
1139 typename CallbackParamTraits<X1>::ForwardType x1) {
1140 StorageType* storage = static_cast<StorageType*>(base);
1142 // Local references to make debugger stepping easier. If in a debugger,
1143 // you really want to warp ahead and step through the
1144 // InvokeHelper<>::MakeItSo() call below.
1146 return InvokeHelper<StorageType::IsWeakCall::value, R,
1147 typename StorageType::RunnableType,
1148 void(typename CallbackParamTraits<X1>::ForwardType x1)>
1149 ::MakeItSo(storage->runnable_, CallbackForward(x1));
1153 // Arity 1 -> 0.
1154 template <typename StorageType, typename R,typename X1>
1155 struct Invoker<1, StorageType, R(X1)> {
1156 typedef R(RunType)(BindStateBase*);
1158 typedef R(UnboundRunType)();
1160 static R Run(BindStateBase* base) {
1161 StorageType* storage = static_cast<StorageType*>(base);
1163 // Local references to make debugger stepping easier. If in a debugger,
1164 // you really want to warp ahead and step through the
1165 // InvokeHelper<>::MakeItSo() call below.
1166 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
1168 typename Bound1UnwrapTraits::ForwardType x1 =
1169 Bound1UnwrapTraits::Unwrap(storage->p1_);
1170 return InvokeHelper<StorageType::IsWeakCall::value, R,
1171 typename StorageType::RunnableType,
1172 void(typename Bound1UnwrapTraits::ForwardType)>
1173 ::MakeItSo(storage->runnable_, CallbackForward(x1));
1177 // Arity 2 -> 2.
1178 template <typename StorageType, typename R,typename X1, typename X2>
1179 struct Invoker<0, StorageType, R(X1, X2)> {
1180 typedef R(RunType)(BindStateBase*,
1181 typename CallbackParamTraits<X1>::ForwardType,
1182 typename CallbackParamTraits<X2>::ForwardType);
1184 typedef R(UnboundRunType)(X1, X2);
1186 static R Run(BindStateBase* base,
1187 typename CallbackParamTraits<X1>::ForwardType x1,
1188 typename CallbackParamTraits<X2>::ForwardType x2) {
1189 StorageType* storage = static_cast<StorageType*>(base);
1191 // Local references to make debugger stepping easier. If in a debugger,
1192 // you really want to warp ahead and step through the
1193 // InvokeHelper<>::MakeItSo() call below.
1195 return InvokeHelper<StorageType::IsWeakCall::value, R,
1196 typename StorageType::RunnableType,
1197 void(typename CallbackParamTraits<X1>::ForwardType x1,
1198 typename CallbackParamTraits<X2>::ForwardType x2)>
1199 ::MakeItSo(storage->runnable_, CallbackForward(x1),
1200 CallbackForward(x2));
1204 // Arity 2 -> 1.
1205 template <typename StorageType, typename R,typename X1, typename X2>
1206 struct Invoker<1, StorageType, R(X1, X2)> {
1207 typedef R(RunType)(BindStateBase*,
1208 typename CallbackParamTraits<X2>::ForwardType);
1210 typedef R(UnboundRunType)(X2);
1212 static R Run(BindStateBase* base,
1213 typename CallbackParamTraits<X2>::ForwardType x2) {
1214 StorageType* storage = static_cast<StorageType*>(base);
1216 // Local references to make debugger stepping easier. If in a debugger,
1217 // you really want to warp ahead and step through the
1218 // InvokeHelper<>::MakeItSo() call below.
1219 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
1221 typename Bound1UnwrapTraits::ForwardType x1 =
1222 Bound1UnwrapTraits::Unwrap(storage->p1_);
1223 return InvokeHelper<StorageType::IsWeakCall::value, R,
1224 typename StorageType::RunnableType,
1225 void(typename Bound1UnwrapTraits::ForwardType,
1226 typename CallbackParamTraits<X2>::ForwardType x2)>
1227 ::MakeItSo(storage->runnable_, CallbackForward(x1),
1228 CallbackForward(x2));
1232 // Arity 2 -> 0.
1233 template <typename StorageType, typename R,typename X1, typename X2>
1234 struct Invoker<2, StorageType, R(X1, X2)> {
1235 typedef R(RunType)(BindStateBase*);
1237 typedef R(UnboundRunType)();
1239 static R Run(BindStateBase* base) {
1240 StorageType* storage = static_cast<StorageType*>(base);
1242 // Local references to make debugger stepping easier. If in a debugger,
1243 // you really want to warp ahead and step through the
1244 // InvokeHelper<>::MakeItSo() call below.
1245 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
1246 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
1248 typename Bound1UnwrapTraits::ForwardType x1 =
1249 Bound1UnwrapTraits::Unwrap(storage->p1_);
1250 typename Bound2UnwrapTraits::ForwardType x2 =
1251 Bound2UnwrapTraits::Unwrap(storage->p2_);
1252 return InvokeHelper<StorageType::IsWeakCall::value, R,
1253 typename StorageType::RunnableType,
1254 void(typename Bound1UnwrapTraits::ForwardType,
1255 typename Bound2UnwrapTraits::ForwardType)>
1256 ::MakeItSo(storage->runnable_, CallbackForward(x1),
1257 CallbackForward(x2));
1261 // Arity 3 -> 3.
1262 template <typename StorageType, typename R,typename X1, typename X2,
1263 typename X3>
1264 struct Invoker<0, StorageType, R(X1, X2, X3)> {
1265 typedef R(RunType)(BindStateBase*,
1266 typename CallbackParamTraits<X1>::ForwardType,
1267 typename CallbackParamTraits<X2>::ForwardType,
1268 typename CallbackParamTraits<X3>::ForwardType);
1270 typedef R(UnboundRunType)(X1, X2, X3);
1272 static R Run(BindStateBase* base,
1273 typename CallbackParamTraits<X1>::ForwardType x1,
1274 typename CallbackParamTraits<X2>::ForwardType x2,
1275 typename CallbackParamTraits<X3>::ForwardType x3) {
1276 StorageType* storage = static_cast<StorageType*>(base);
1278 // Local references to make debugger stepping easier. If in a debugger,
1279 // you really want to warp ahead and step through the
1280 // InvokeHelper<>::MakeItSo() call below.
1282 return InvokeHelper<StorageType::IsWeakCall::value, R,
1283 typename StorageType::RunnableType,
1284 void(typename CallbackParamTraits<X1>::ForwardType x1,
1285 typename CallbackParamTraits<X2>::ForwardType x2,
1286 typename CallbackParamTraits<X3>::ForwardType x3)>
1287 ::MakeItSo(storage->runnable_, CallbackForward(x1),
1288 CallbackForward(x2), CallbackForward(x3));
1292 // Arity 3 -> 2.
1293 template <typename StorageType, typename R,typename X1, typename X2,
1294 typename X3>
1295 struct Invoker<1, StorageType, R(X1, X2, X3)> {
1296 typedef R(RunType)(BindStateBase*,
1297 typename CallbackParamTraits<X2>::ForwardType,
1298 typename CallbackParamTraits<X3>::ForwardType);
1300 typedef R(UnboundRunType)(X2, X3);
1302 static R Run(BindStateBase* base,
1303 typename CallbackParamTraits<X2>::ForwardType x2,
1304 typename CallbackParamTraits<X3>::ForwardType x3) {
1305 StorageType* storage = static_cast<StorageType*>(base);
1307 // Local references to make debugger stepping easier. If in a debugger,
1308 // you really want to warp ahead and step through the
1309 // InvokeHelper<>::MakeItSo() call below.
1310 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
1312 typename Bound1UnwrapTraits::ForwardType x1 =
1313 Bound1UnwrapTraits::Unwrap(storage->p1_);
1314 return InvokeHelper<StorageType::IsWeakCall::value, R,
1315 typename StorageType::RunnableType,
1316 void(typename Bound1UnwrapTraits::ForwardType,
1317 typename CallbackParamTraits<X2>::ForwardType x2,
1318 typename CallbackParamTraits<X3>::ForwardType x3)>
1319 ::MakeItSo(storage->runnable_, CallbackForward(x1),
1320 CallbackForward(x2), CallbackForward(x3));
1324 // Arity 3 -> 1.
1325 template <typename StorageType, typename R,typename X1, typename X2,
1326 typename X3>
1327 struct Invoker<2, StorageType, R(X1, X2, X3)> {
1328 typedef R(RunType)(BindStateBase*,
1329 typename CallbackParamTraits<X3>::ForwardType);
1331 typedef R(UnboundRunType)(X3);
1333 static R Run(BindStateBase* base,
1334 typename CallbackParamTraits<X3>::ForwardType x3) {
1335 StorageType* storage = static_cast<StorageType*>(base);
1337 // Local references to make debugger stepping easier. If in a debugger,
1338 // you really want to warp ahead and step through the
1339 // InvokeHelper<>::MakeItSo() call below.
1340 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
1341 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
1343 typename Bound1UnwrapTraits::ForwardType x1 =
1344 Bound1UnwrapTraits::Unwrap(storage->p1_);
1345 typename Bound2UnwrapTraits::ForwardType x2 =
1346 Bound2UnwrapTraits::Unwrap(storage->p2_);
1347 return InvokeHelper<StorageType::IsWeakCall::value, R,
1348 typename StorageType::RunnableType,
1349 void(typename Bound1UnwrapTraits::ForwardType,
1350 typename Bound2UnwrapTraits::ForwardType,
1351 typename CallbackParamTraits<X3>::ForwardType x3)>
1352 ::MakeItSo(storage->runnable_, CallbackForward(x1),
1353 CallbackForward(x2), CallbackForward(x3));
1357 // Arity 3 -> 0.
1358 template <typename StorageType, typename R,typename X1, typename X2,
1359 typename X3>
1360 struct Invoker<3, StorageType, R(X1, X2, X3)> {
1361 typedef R(RunType)(BindStateBase*);
1363 typedef R(UnboundRunType)();
1365 static R Run(BindStateBase* base) {
1366 StorageType* storage = static_cast<StorageType*>(base);
1368 // Local references to make debugger stepping easier. If in a debugger,
1369 // you really want to warp ahead and step through the
1370 // InvokeHelper<>::MakeItSo() call below.
1371 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
1372 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
1373 typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits;
1375 typename Bound1UnwrapTraits::ForwardType x1 =
1376 Bound1UnwrapTraits::Unwrap(storage->p1_);
1377 typename Bound2UnwrapTraits::ForwardType x2 =
1378 Bound2UnwrapTraits::Unwrap(storage->p2_);
1379 typename Bound3UnwrapTraits::ForwardType x3 =
1380 Bound3UnwrapTraits::Unwrap(storage->p3_);
1381 return InvokeHelper<StorageType::IsWeakCall::value, R,
1382 typename StorageType::RunnableType,
1383 void(typename Bound1UnwrapTraits::ForwardType,
1384 typename Bound2UnwrapTraits::ForwardType,
1385 typename Bound3UnwrapTraits::ForwardType)>
1386 ::MakeItSo(storage->runnable_, CallbackForward(x1),
1387 CallbackForward(x2), CallbackForward(x3));
1391 // Arity 4 -> 4.
1392 template <typename StorageType, typename R,typename X1, typename X2,
1393 typename X3, typename X4>
1394 struct Invoker<0, StorageType, R(X1, X2, X3, X4)> {
1395 typedef R(RunType)(BindStateBase*,
1396 typename CallbackParamTraits<X1>::ForwardType,
1397 typename CallbackParamTraits<X2>::ForwardType,
1398 typename CallbackParamTraits<X3>::ForwardType,
1399 typename CallbackParamTraits<X4>::ForwardType);
1401 typedef R(UnboundRunType)(X1, X2, X3, X4);
1403 static R Run(BindStateBase* base,
1404 typename CallbackParamTraits<X1>::ForwardType x1,
1405 typename CallbackParamTraits<X2>::ForwardType x2,
1406 typename CallbackParamTraits<X3>::ForwardType x3,
1407 typename CallbackParamTraits<X4>::ForwardType x4) {
1408 StorageType* storage = static_cast<StorageType*>(base);
1410 // Local references to make debugger stepping easier. If in a debugger,
1411 // you really want to warp ahead and step through the
1412 // InvokeHelper<>::MakeItSo() call below.
1414 return InvokeHelper<StorageType::IsWeakCall::value, R,
1415 typename StorageType::RunnableType,
1416 void(typename CallbackParamTraits<X1>::ForwardType x1,
1417 typename CallbackParamTraits<X2>::ForwardType x2,
1418 typename CallbackParamTraits<X3>::ForwardType x3,
1419 typename CallbackParamTraits<X4>::ForwardType x4)>
1420 ::MakeItSo(storage->runnable_, CallbackForward(x1),
1421 CallbackForward(x2), CallbackForward(x3),
1422 CallbackForward(x4));
1426 // Arity 4 -> 3.
1427 template <typename StorageType, typename R,typename X1, typename X2,
1428 typename X3, typename X4>
1429 struct Invoker<1, StorageType, R(X1, X2, X3, X4)> {
1430 typedef R(RunType)(BindStateBase*,
1431 typename CallbackParamTraits<X2>::ForwardType,
1432 typename CallbackParamTraits<X3>::ForwardType,
1433 typename CallbackParamTraits<X4>::ForwardType);
1435 typedef R(UnboundRunType)(X2, X3, X4);
1437 static R Run(BindStateBase* base,
1438 typename CallbackParamTraits<X2>::ForwardType x2,
1439 typename CallbackParamTraits<X3>::ForwardType x3,
1440 typename CallbackParamTraits<X4>::ForwardType x4) {
1441 StorageType* storage = static_cast<StorageType*>(base);
1443 // Local references to make debugger stepping easier. If in a debugger,
1444 // you really want to warp ahead and step through the
1445 // InvokeHelper<>::MakeItSo() call below.
1446 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
1448 typename Bound1UnwrapTraits::ForwardType x1 =
1449 Bound1UnwrapTraits::Unwrap(storage->p1_);
1450 return InvokeHelper<StorageType::IsWeakCall::value, R,
1451 typename StorageType::RunnableType,
1452 void(typename Bound1UnwrapTraits::ForwardType,
1453 typename CallbackParamTraits<X2>::ForwardType x2,
1454 typename CallbackParamTraits<X3>::ForwardType x3,
1455 typename CallbackParamTraits<X4>::ForwardType x4)>
1456 ::MakeItSo(storage->runnable_, CallbackForward(x1),
1457 CallbackForward(x2), CallbackForward(x3),
1458 CallbackForward(x4));
1462 // Arity 4 -> 2.
1463 template <typename StorageType, typename R,typename X1, typename X2,
1464 typename X3, typename X4>
1465 struct Invoker<2, StorageType, R(X1, X2, X3, X4)> {
1466 typedef R(RunType)(BindStateBase*,
1467 typename CallbackParamTraits<X3>::ForwardType,
1468 typename CallbackParamTraits<X4>::ForwardType);
1470 typedef R(UnboundRunType)(X3, X4);
1472 static R Run(BindStateBase* base,
1473 typename CallbackParamTraits<X3>::ForwardType x3,
1474 typename CallbackParamTraits<X4>::ForwardType x4) {
1475 StorageType* storage = static_cast<StorageType*>(base);
1477 // Local references to make debugger stepping easier. If in a debugger,
1478 // you really want to warp ahead and step through the
1479 // InvokeHelper<>::MakeItSo() call below.
1480 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
1481 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
1483 typename Bound1UnwrapTraits::ForwardType x1 =
1484 Bound1UnwrapTraits::Unwrap(storage->p1_);
1485 typename Bound2UnwrapTraits::ForwardType x2 =
1486 Bound2UnwrapTraits::Unwrap(storage->p2_);
1487 return InvokeHelper<StorageType::IsWeakCall::value, R,
1488 typename StorageType::RunnableType,
1489 void(typename Bound1UnwrapTraits::ForwardType,
1490 typename Bound2UnwrapTraits::ForwardType,
1491 typename CallbackParamTraits<X3>::ForwardType x3,
1492 typename CallbackParamTraits<X4>::ForwardType x4)>
1493 ::MakeItSo(storage->runnable_, CallbackForward(x1),
1494 CallbackForward(x2), CallbackForward(x3),
1495 CallbackForward(x4));
1499 // Arity 4 -> 1.
1500 template <typename StorageType, typename R,typename X1, typename X2,
1501 typename X3, typename X4>
1502 struct Invoker<3, StorageType, R(X1, X2, X3, X4)> {
1503 typedef R(RunType)(BindStateBase*,
1504 typename CallbackParamTraits<X4>::ForwardType);
1506 typedef R(UnboundRunType)(X4);
1508 static R Run(BindStateBase* base,
1509 typename CallbackParamTraits<X4>::ForwardType x4) {
1510 StorageType* storage = static_cast<StorageType*>(base);
1512 // Local references to make debugger stepping easier. If in a debugger,
1513 // you really want to warp ahead and step through the
1514 // InvokeHelper<>::MakeItSo() call below.
1515 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
1516 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
1517 typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits;
1519 typename Bound1UnwrapTraits::ForwardType x1 =
1520 Bound1UnwrapTraits::Unwrap(storage->p1_);
1521 typename Bound2UnwrapTraits::ForwardType x2 =
1522 Bound2UnwrapTraits::Unwrap(storage->p2_);
1523 typename Bound3UnwrapTraits::ForwardType x3 =
1524 Bound3UnwrapTraits::Unwrap(storage->p3_);
1525 return InvokeHelper<StorageType::IsWeakCall::value, R,
1526 typename StorageType::RunnableType,
1527 void(typename Bound1UnwrapTraits::ForwardType,
1528 typename Bound2UnwrapTraits::ForwardType,
1529 typename Bound3UnwrapTraits::ForwardType,
1530 typename CallbackParamTraits<X4>::ForwardType x4)>
1531 ::MakeItSo(storage->runnable_, CallbackForward(x1),
1532 CallbackForward(x2), CallbackForward(x3),
1533 CallbackForward(x4));
1537 // Arity 4 -> 0.
1538 template <typename StorageType, typename R,typename X1, typename X2,
1539 typename X3, typename X4>
1540 struct Invoker<4, StorageType, R(X1, X2, X3, X4)> {
1541 typedef R(RunType)(BindStateBase*);
1543 typedef R(UnboundRunType)();
1545 static R Run(BindStateBase* base) {
1546 StorageType* storage = static_cast<StorageType*>(base);
1548 // Local references to make debugger stepping easier. If in a debugger,
1549 // you really want to warp ahead and step through the
1550 // InvokeHelper<>::MakeItSo() call below.
1551 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
1552 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
1553 typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits;
1554 typedef typename StorageType::Bound4UnwrapTraits Bound4UnwrapTraits;
1556 typename Bound1UnwrapTraits::ForwardType x1 =
1557 Bound1UnwrapTraits::Unwrap(storage->p1_);
1558 typename Bound2UnwrapTraits::ForwardType x2 =
1559 Bound2UnwrapTraits::Unwrap(storage->p2_);
1560 typename Bound3UnwrapTraits::ForwardType x3 =
1561 Bound3UnwrapTraits::Unwrap(storage->p3_);
1562 typename Bound4UnwrapTraits::ForwardType x4 =
1563 Bound4UnwrapTraits::Unwrap(storage->p4_);
1564 return InvokeHelper<StorageType::IsWeakCall::value, R,
1565 typename StorageType::RunnableType,
1566 void(typename Bound1UnwrapTraits::ForwardType,
1567 typename Bound2UnwrapTraits::ForwardType,
1568 typename Bound3UnwrapTraits::ForwardType,
1569 typename Bound4UnwrapTraits::ForwardType)>
1570 ::MakeItSo(storage->runnable_, CallbackForward(x1),
1571 CallbackForward(x2), CallbackForward(x3),
1572 CallbackForward(x4));
1576 // Arity 5 -> 5.
1577 template <typename StorageType, typename R,typename X1, typename X2,
1578 typename X3, typename X4, typename X5>
1579 struct Invoker<0, StorageType, R(X1, X2, X3, X4, X5)> {
1580 typedef R(RunType)(BindStateBase*,
1581 typename CallbackParamTraits<X1>::ForwardType,
1582 typename CallbackParamTraits<X2>::ForwardType,
1583 typename CallbackParamTraits<X3>::ForwardType,
1584 typename CallbackParamTraits<X4>::ForwardType,
1585 typename CallbackParamTraits<X5>::ForwardType);
1587 typedef R(UnboundRunType)(X1, X2, X3, X4, X5);
1589 static R Run(BindStateBase* base,
1590 typename CallbackParamTraits<X1>::ForwardType x1,
1591 typename CallbackParamTraits<X2>::ForwardType x2,
1592 typename CallbackParamTraits<X3>::ForwardType x3,
1593 typename CallbackParamTraits<X4>::ForwardType x4,
1594 typename CallbackParamTraits<X5>::ForwardType x5) {
1595 StorageType* storage = static_cast<StorageType*>(base);
1597 // Local references to make debugger stepping easier. If in a debugger,
1598 // you really want to warp ahead and step through the
1599 // InvokeHelper<>::MakeItSo() call below.
1601 return InvokeHelper<StorageType::IsWeakCall::value, R,
1602 typename StorageType::RunnableType,
1603 void(typename CallbackParamTraits<X1>::ForwardType x1,
1604 typename CallbackParamTraits<X2>::ForwardType x2,
1605 typename CallbackParamTraits<X3>::ForwardType x3,
1606 typename CallbackParamTraits<X4>::ForwardType x4,
1607 typename CallbackParamTraits<X5>::ForwardType x5)>
1608 ::MakeItSo(storage->runnable_, CallbackForward(x1),
1609 CallbackForward(x2), CallbackForward(x3),
1610 CallbackForward(x4), CallbackForward(x5));
1614 // Arity 5 -> 4.
1615 template <typename StorageType, typename R,typename X1, typename X2,
1616 typename X3, typename X4, typename X5>
1617 struct Invoker<1, StorageType, R(X1, X2, X3, X4, X5)> {
1618 typedef R(RunType)(BindStateBase*,
1619 typename CallbackParamTraits<X2>::ForwardType,
1620 typename CallbackParamTraits<X3>::ForwardType,
1621 typename CallbackParamTraits<X4>::ForwardType,
1622 typename CallbackParamTraits<X5>::ForwardType);
1624 typedef R(UnboundRunType)(X2, X3, X4, X5);
1626 static R Run(BindStateBase* base,
1627 typename CallbackParamTraits<X2>::ForwardType x2,
1628 typename CallbackParamTraits<X3>::ForwardType x3,
1629 typename CallbackParamTraits<X4>::ForwardType x4,
1630 typename CallbackParamTraits<X5>::ForwardType x5) {
1631 StorageType* storage = static_cast<StorageType*>(base);
1633 // Local references to make debugger stepping easier. If in a debugger,
1634 // you really want to warp ahead and step through the
1635 // InvokeHelper<>::MakeItSo() call below.
1636 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
1638 typename Bound1UnwrapTraits::ForwardType x1 =
1639 Bound1UnwrapTraits::Unwrap(storage->p1_);
1640 return InvokeHelper<StorageType::IsWeakCall::value, R,
1641 typename StorageType::RunnableType,
1642 void(typename Bound1UnwrapTraits::ForwardType,
1643 typename CallbackParamTraits<X2>::ForwardType x2,
1644 typename CallbackParamTraits<X3>::ForwardType x3,
1645 typename CallbackParamTraits<X4>::ForwardType x4,
1646 typename CallbackParamTraits<X5>::ForwardType x5)>
1647 ::MakeItSo(storage->runnable_, CallbackForward(x1),
1648 CallbackForward(x2), CallbackForward(x3),
1649 CallbackForward(x4), CallbackForward(x5));
1653 // Arity 5 -> 3.
1654 template <typename StorageType, typename R,typename X1, typename X2,
1655 typename X3, typename X4, typename X5>
1656 struct Invoker<2, StorageType, R(X1, X2, X3, X4, X5)> {
1657 typedef R(RunType)(BindStateBase*,
1658 typename CallbackParamTraits<X3>::ForwardType,
1659 typename CallbackParamTraits<X4>::ForwardType,
1660 typename CallbackParamTraits<X5>::ForwardType);
1662 typedef R(UnboundRunType)(X3, X4, X5);
1664 static R Run(BindStateBase* base,
1665 typename CallbackParamTraits<X3>::ForwardType x3,
1666 typename CallbackParamTraits<X4>::ForwardType x4,
1667 typename CallbackParamTraits<X5>::ForwardType x5) {
1668 StorageType* storage = static_cast<StorageType*>(base);
1670 // Local references to make debugger stepping easier. If in a debugger,
1671 // you really want to warp ahead and step through the
1672 // InvokeHelper<>::MakeItSo() call below.
1673 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
1674 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
1676 typename Bound1UnwrapTraits::ForwardType x1 =
1677 Bound1UnwrapTraits::Unwrap(storage->p1_);
1678 typename Bound2UnwrapTraits::ForwardType x2 =
1679 Bound2UnwrapTraits::Unwrap(storage->p2_);
1680 return InvokeHelper<StorageType::IsWeakCall::value, R,
1681 typename StorageType::RunnableType,
1682 void(typename Bound1UnwrapTraits::ForwardType,
1683 typename Bound2UnwrapTraits::ForwardType,
1684 typename CallbackParamTraits<X3>::ForwardType x3,
1685 typename CallbackParamTraits<X4>::ForwardType x4,
1686 typename CallbackParamTraits<X5>::ForwardType x5)>
1687 ::MakeItSo(storage->runnable_, CallbackForward(x1),
1688 CallbackForward(x2), CallbackForward(x3),
1689 CallbackForward(x4), CallbackForward(x5));
1693 // Arity 5 -> 2.
1694 template <typename StorageType, typename R,typename X1, typename X2,
1695 typename X3, typename X4, typename X5>
1696 struct Invoker<3, StorageType, R(X1, X2, X3, X4, X5)> {
1697 typedef R(RunType)(BindStateBase*,
1698 typename CallbackParamTraits<X4>::ForwardType,
1699 typename CallbackParamTraits<X5>::ForwardType);
1701 typedef R(UnboundRunType)(X4, X5);
1703 static R Run(BindStateBase* base,
1704 typename CallbackParamTraits<X4>::ForwardType x4,
1705 typename CallbackParamTraits<X5>::ForwardType x5) {
1706 StorageType* storage = static_cast<StorageType*>(base);
1708 // Local references to make debugger stepping easier. If in a debugger,
1709 // you really want to warp ahead and step through the
1710 // InvokeHelper<>::MakeItSo() call below.
1711 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
1712 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
1713 typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits;
1715 typename Bound1UnwrapTraits::ForwardType x1 =
1716 Bound1UnwrapTraits::Unwrap(storage->p1_);
1717 typename Bound2UnwrapTraits::ForwardType x2 =
1718 Bound2UnwrapTraits::Unwrap(storage->p2_);
1719 typename Bound3UnwrapTraits::ForwardType x3 =
1720 Bound3UnwrapTraits::Unwrap(storage->p3_);
1721 return InvokeHelper<StorageType::IsWeakCall::value, R,
1722 typename StorageType::RunnableType,
1723 void(typename Bound1UnwrapTraits::ForwardType,
1724 typename Bound2UnwrapTraits::ForwardType,
1725 typename Bound3UnwrapTraits::ForwardType,
1726 typename CallbackParamTraits<X4>::ForwardType x4,
1727 typename CallbackParamTraits<X5>::ForwardType x5)>
1728 ::MakeItSo(storage->runnable_, CallbackForward(x1),
1729 CallbackForward(x2), CallbackForward(x3),
1730 CallbackForward(x4), CallbackForward(x5));
1734 // Arity 5 -> 1.
1735 template <typename StorageType, typename R,typename X1, typename X2,
1736 typename X3, typename X4, typename X5>
1737 struct Invoker<4, StorageType, R(X1, X2, X3, X4, X5)> {
1738 typedef R(RunType)(BindStateBase*,
1739 typename CallbackParamTraits<X5>::ForwardType);
1741 typedef R(UnboundRunType)(X5);
1743 static R Run(BindStateBase* base,
1744 typename CallbackParamTraits<X5>::ForwardType x5) {
1745 StorageType* storage = static_cast<StorageType*>(base);
1747 // Local references to make debugger stepping easier. If in a debugger,
1748 // you really want to warp ahead and step through the
1749 // InvokeHelper<>::MakeItSo() call below.
1750 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
1751 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
1752 typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits;
1753 typedef typename StorageType::Bound4UnwrapTraits Bound4UnwrapTraits;
1755 typename Bound1UnwrapTraits::ForwardType x1 =
1756 Bound1UnwrapTraits::Unwrap(storage->p1_);
1757 typename Bound2UnwrapTraits::ForwardType x2 =
1758 Bound2UnwrapTraits::Unwrap(storage->p2_);
1759 typename Bound3UnwrapTraits::ForwardType x3 =
1760 Bound3UnwrapTraits::Unwrap(storage->p3_);
1761 typename Bound4UnwrapTraits::ForwardType x4 =
1762 Bound4UnwrapTraits::Unwrap(storage->p4_);
1763 return InvokeHelper<StorageType::IsWeakCall::value, R,
1764 typename StorageType::RunnableType,
1765 void(typename Bound1UnwrapTraits::ForwardType,
1766 typename Bound2UnwrapTraits::ForwardType,
1767 typename Bound3UnwrapTraits::ForwardType,
1768 typename Bound4UnwrapTraits::ForwardType,
1769 typename CallbackParamTraits<X5>::ForwardType x5)>
1770 ::MakeItSo(storage->runnable_, CallbackForward(x1),
1771 CallbackForward(x2), CallbackForward(x3),
1772 CallbackForward(x4), CallbackForward(x5));
1776 // Arity 5 -> 0.
1777 template <typename StorageType, typename R,typename X1, typename X2,
1778 typename X3, typename X4, typename X5>
1779 struct Invoker<5, StorageType, R(X1, X2, X3, X4, X5)> {
1780 typedef R(RunType)(BindStateBase*);
1782 typedef R(UnboundRunType)();
1784 static R Run(BindStateBase* base) {
1785 StorageType* storage = static_cast<StorageType*>(base);
1787 // Local references to make debugger stepping easier. If in a debugger,
1788 // you really want to warp ahead and step through the
1789 // InvokeHelper<>::MakeItSo() call below.
1790 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
1791 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
1792 typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits;
1793 typedef typename StorageType::Bound4UnwrapTraits Bound4UnwrapTraits;
1794 typedef typename StorageType::Bound5UnwrapTraits Bound5UnwrapTraits;
1796 typename Bound1UnwrapTraits::ForwardType x1 =
1797 Bound1UnwrapTraits::Unwrap(storage->p1_);
1798 typename Bound2UnwrapTraits::ForwardType x2 =
1799 Bound2UnwrapTraits::Unwrap(storage->p2_);
1800 typename Bound3UnwrapTraits::ForwardType x3 =
1801 Bound3UnwrapTraits::Unwrap(storage->p3_);
1802 typename Bound4UnwrapTraits::ForwardType x4 =
1803 Bound4UnwrapTraits::Unwrap(storage->p4_);
1804 typename Bound5UnwrapTraits::ForwardType x5 =
1805 Bound5UnwrapTraits::Unwrap(storage->p5_);
1806 return InvokeHelper<StorageType::IsWeakCall::value, R,
1807 typename StorageType::RunnableType,
1808 void(typename Bound1UnwrapTraits::ForwardType,
1809 typename Bound2UnwrapTraits::ForwardType,
1810 typename Bound3UnwrapTraits::ForwardType,
1811 typename Bound4UnwrapTraits::ForwardType,
1812 typename Bound5UnwrapTraits::ForwardType)>
1813 ::MakeItSo(storage->runnable_, CallbackForward(x1),
1814 CallbackForward(x2), CallbackForward(x3),
1815 CallbackForward(x4), CallbackForward(x5));
1819 // Arity 6 -> 6.
1820 template <typename StorageType, typename R,typename X1, typename X2,
1821 typename X3, typename X4, typename X5, typename X6>
1822 struct Invoker<0, StorageType, R(X1, X2, X3, X4, X5, X6)> {
1823 typedef R(RunType)(BindStateBase*,
1824 typename CallbackParamTraits<X1>::ForwardType,
1825 typename CallbackParamTraits<X2>::ForwardType,
1826 typename CallbackParamTraits<X3>::ForwardType,
1827 typename CallbackParamTraits<X4>::ForwardType,
1828 typename CallbackParamTraits<X5>::ForwardType,
1829 typename CallbackParamTraits<X6>::ForwardType);
1831 typedef R(UnboundRunType)(X1, X2, X3, X4, X5, X6);
1833 static R Run(BindStateBase* base,
1834 typename CallbackParamTraits<X1>::ForwardType x1,
1835 typename CallbackParamTraits<X2>::ForwardType x2,
1836 typename CallbackParamTraits<X3>::ForwardType x3,
1837 typename CallbackParamTraits<X4>::ForwardType x4,
1838 typename CallbackParamTraits<X5>::ForwardType x5,
1839 typename CallbackParamTraits<X6>::ForwardType x6) {
1840 StorageType* storage = static_cast<StorageType*>(base);
1842 // Local references to make debugger stepping easier. If in a debugger,
1843 // you really want to warp ahead and step through the
1844 // InvokeHelper<>::MakeItSo() call below.
1846 return InvokeHelper<StorageType::IsWeakCall::value, R,
1847 typename StorageType::RunnableType,
1848 void(typename CallbackParamTraits<X1>::ForwardType x1,
1849 typename CallbackParamTraits<X2>::ForwardType x2,
1850 typename CallbackParamTraits<X3>::ForwardType x3,
1851 typename CallbackParamTraits<X4>::ForwardType x4,
1852 typename CallbackParamTraits<X5>::ForwardType x5,
1853 typename CallbackParamTraits<X6>::ForwardType x6)>
1854 ::MakeItSo(storage->runnable_, CallbackForward(x1),
1855 CallbackForward(x2), CallbackForward(x3),
1856 CallbackForward(x4), CallbackForward(x5),
1857 CallbackForward(x6));
1861 // Arity 6 -> 5.
1862 template <typename StorageType, typename R,typename X1, typename X2,
1863 typename X3, typename X4, typename X5, typename X6>
1864 struct Invoker<1, StorageType, R(X1, X2, X3, X4, X5, X6)> {
1865 typedef R(RunType)(BindStateBase*,
1866 typename CallbackParamTraits<X2>::ForwardType,
1867 typename CallbackParamTraits<X3>::ForwardType,
1868 typename CallbackParamTraits<X4>::ForwardType,
1869 typename CallbackParamTraits<X5>::ForwardType,
1870 typename CallbackParamTraits<X6>::ForwardType);
1872 typedef R(UnboundRunType)(X2, X3, X4, X5, X6);
1874 static R Run(BindStateBase* base,
1875 typename CallbackParamTraits<X2>::ForwardType x2,
1876 typename CallbackParamTraits<X3>::ForwardType x3,
1877 typename CallbackParamTraits<X4>::ForwardType x4,
1878 typename CallbackParamTraits<X5>::ForwardType x5,
1879 typename CallbackParamTraits<X6>::ForwardType x6) {
1880 StorageType* storage = static_cast<StorageType*>(base);
1882 // Local references to make debugger stepping easier. If in a debugger,
1883 // you really want to warp ahead and step through the
1884 // InvokeHelper<>::MakeItSo() call below.
1885 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
1887 typename Bound1UnwrapTraits::ForwardType x1 =
1888 Bound1UnwrapTraits::Unwrap(storage->p1_);
1889 return InvokeHelper<StorageType::IsWeakCall::value, R,
1890 typename StorageType::RunnableType,
1891 void(typename Bound1UnwrapTraits::ForwardType,
1892 typename CallbackParamTraits<X2>::ForwardType x2,
1893 typename CallbackParamTraits<X3>::ForwardType x3,
1894 typename CallbackParamTraits<X4>::ForwardType x4,
1895 typename CallbackParamTraits<X5>::ForwardType x5,
1896 typename CallbackParamTraits<X6>::ForwardType x6)>
1897 ::MakeItSo(storage->runnable_, CallbackForward(x1),
1898 CallbackForward(x2), CallbackForward(x3),
1899 CallbackForward(x4), CallbackForward(x5),
1900 CallbackForward(x6));
1904 // Arity 6 -> 4.
1905 template <typename StorageType, typename R,typename X1, typename X2,
1906 typename X3, typename X4, typename X5, typename X6>
1907 struct Invoker<2, StorageType, R(X1, X2, X3, X4, X5, X6)> {
1908 typedef R(RunType)(BindStateBase*,
1909 typename CallbackParamTraits<X3>::ForwardType,
1910 typename CallbackParamTraits<X4>::ForwardType,
1911 typename CallbackParamTraits<X5>::ForwardType,
1912 typename CallbackParamTraits<X6>::ForwardType);
1914 typedef R(UnboundRunType)(X3, X4, X5, X6);
1916 static R Run(BindStateBase* base,
1917 typename CallbackParamTraits<X3>::ForwardType x3,
1918 typename CallbackParamTraits<X4>::ForwardType x4,
1919 typename CallbackParamTraits<X5>::ForwardType x5,
1920 typename CallbackParamTraits<X6>::ForwardType x6) {
1921 StorageType* storage = static_cast<StorageType*>(base);
1923 // Local references to make debugger stepping easier. If in a debugger,
1924 // you really want to warp ahead and step through the
1925 // InvokeHelper<>::MakeItSo() call below.
1926 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
1927 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
1929 typename Bound1UnwrapTraits::ForwardType x1 =
1930 Bound1UnwrapTraits::Unwrap(storage->p1_);
1931 typename Bound2UnwrapTraits::ForwardType x2 =
1932 Bound2UnwrapTraits::Unwrap(storage->p2_);
1933 return InvokeHelper<StorageType::IsWeakCall::value, R,
1934 typename StorageType::RunnableType,
1935 void(typename Bound1UnwrapTraits::ForwardType,
1936 typename Bound2UnwrapTraits::ForwardType,
1937 typename CallbackParamTraits<X3>::ForwardType x3,
1938 typename CallbackParamTraits<X4>::ForwardType x4,
1939 typename CallbackParamTraits<X5>::ForwardType x5,
1940 typename CallbackParamTraits<X6>::ForwardType x6)>
1941 ::MakeItSo(storage->runnable_, CallbackForward(x1),
1942 CallbackForward(x2), CallbackForward(x3),
1943 CallbackForward(x4), CallbackForward(x5),
1944 CallbackForward(x6));
1948 // Arity 6 -> 3.
1949 template <typename StorageType, typename R,typename X1, typename X2,
1950 typename X3, typename X4, typename X5, typename X6>
1951 struct Invoker<3, StorageType, R(X1, X2, X3, X4, X5, X6)> {
1952 typedef R(RunType)(BindStateBase*,
1953 typename CallbackParamTraits<X4>::ForwardType,
1954 typename CallbackParamTraits<X5>::ForwardType,
1955 typename CallbackParamTraits<X6>::ForwardType);
1957 typedef R(UnboundRunType)(X4, X5, X6);
1959 static R Run(BindStateBase* base,
1960 typename CallbackParamTraits<X4>::ForwardType x4,
1961 typename CallbackParamTraits<X5>::ForwardType x5,
1962 typename CallbackParamTraits<X6>::ForwardType x6) {
1963 StorageType* storage = static_cast<StorageType*>(base);
1965 // Local references to make debugger stepping easier. If in a debugger,
1966 // you really want to warp ahead and step through the
1967 // InvokeHelper<>::MakeItSo() call below.
1968 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
1969 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
1970 typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits;
1972 typename Bound1UnwrapTraits::ForwardType x1 =
1973 Bound1UnwrapTraits::Unwrap(storage->p1_);
1974 typename Bound2UnwrapTraits::ForwardType x2 =
1975 Bound2UnwrapTraits::Unwrap(storage->p2_);
1976 typename Bound3UnwrapTraits::ForwardType x3 =
1977 Bound3UnwrapTraits::Unwrap(storage->p3_);
1978 return InvokeHelper<StorageType::IsWeakCall::value, R,
1979 typename StorageType::RunnableType,
1980 void(typename Bound1UnwrapTraits::ForwardType,
1981 typename Bound2UnwrapTraits::ForwardType,
1982 typename Bound3UnwrapTraits::ForwardType,
1983 typename CallbackParamTraits<X4>::ForwardType x4,
1984 typename CallbackParamTraits<X5>::ForwardType x5,
1985 typename CallbackParamTraits<X6>::ForwardType x6)>
1986 ::MakeItSo(storage->runnable_, CallbackForward(x1),
1987 CallbackForward(x2), CallbackForward(x3),
1988 CallbackForward(x4), CallbackForward(x5),
1989 CallbackForward(x6));
1993 // Arity 6 -> 2.
1994 template <typename StorageType, typename R,typename X1, typename X2,
1995 typename X3, typename X4, typename X5, typename X6>
1996 struct Invoker<4, StorageType, R(X1, X2, X3, X4, X5, X6)> {
1997 typedef R(RunType)(BindStateBase*,
1998 typename CallbackParamTraits<X5>::ForwardType,
1999 typename CallbackParamTraits<X6>::ForwardType);
2001 typedef R(UnboundRunType)(X5, X6);
2003 static R Run(BindStateBase* base,
2004 typename CallbackParamTraits<X5>::ForwardType x5,
2005 typename CallbackParamTraits<X6>::ForwardType x6) {
2006 StorageType* storage = static_cast<StorageType*>(base);
2008 // Local references to make debugger stepping easier. If in a debugger,
2009 // you really want to warp ahead and step through the
2010 // InvokeHelper<>::MakeItSo() call below.
2011 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
2012 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
2013 typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits;
2014 typedef typename StorageType::Bound4UnwrapTraits Bound4UnwrapTraits;
2016 typename Bound1UnwrapTraits::ForwardType x1 =
2017 Bound1UnwrapTraits::Unwrap(storage->p1_);
2018 typename Bound2UnwrapTraits::ForwardType x2 =
2019 Bound2UnwrapTraits::Unwrap(storage->p2_);
2020 typename Bound3UnwrapTraits::ForwardType x3 =
2021 Bound3UnwrapTraits::Unwrap(storage->p3_);
2022 typename Bound4UnwrapTraits::ForwardType x4 =
2023 Bound4UnwrapTraits::Unwrap(storage->p4_);
2024 return InvokeHelper<StorageType::IsWeakCall::value, R,
2025 typename StorageType::RunnableType,
2026 void(typename Bound1UnwrapTraits::ForwardType,
2027 typename Bound2UnwrapTraits::ForwardType,
2028 typename Bound3UnwrapTraits::ForwardType,
2029 typename Bound4UnwrapTraits::ForwardType,
2030 typename CallbackParamTraits<X5>::ForwardType x5,
2031 typename CallbackParamTraits<X6>::ForwardType x6)>
2032 ::MakeItSo(storage->runnable_, CallbackForward(x1),
2033 CallbackForward(x2), CallbackForward(x3),
2034 CallbackForward(x4), CallbackForward(x5),
2035 CallbackForward(x6));
2039 // Arity 6 -> 1.
2040 template <typename StorageType, typename R,typename X1, typename X2,
2041 typename X3, typename X4, typename X5, typename X6>
2042 struct Invoker<5, StorageType, R(X1, X2, X3, X4, X5, X6)> {
2043 typedef R(RunType)(BindStateBase*,
2044 typename CallbackParamTraits<X6>::ForwardType);
2046 typedef R(UnboundRunType)(X6);
2048 static R Run(BindStateBase* base,
2049 typename CallbackParamTraits<X6>::ForwardType x6) {
2050 StorageType* storage = static_cast<StorageType*>(base);
2052 // Local references to make debugger stepping easier. If in a debugger,
2053 // you really want to warp ahead and step through the
2054 // InvokeHelper<>::MakeItSo() call below.
2055 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
2056 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
2057 typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits;
2058 typedef typename StorageType::Bound4UnwrapTraits Bound4UnwrapTraits;
2059 typedef typename StorageType::Bound5UnwrapTraits Bound5UnwrapTraits;
2061 typename Bound1UnwrapTraits::ForwardType x1 =
2062 Bound1UnwrapTraits::Unwrap(storage->p1_);
2063 typename Bound2UnwrapTraits::ForwardType x2 =
2064 Bound2UnwrapTraits::Unwrap(storage->p2_);
2065 typename Bound3UnwrapTraits::ForwardType x3 =
2066 Bound3UnwrapTraits::Unwrap(storage->p3_);
2067 typename Bound4UnwrapTraits::ForwardType x4 =
2068 Bound4UnwrapTraits::Unwrap(storage->p4_);
2069 typename Bound5UnwrapTraits::ForwardType x5 =
2070 Bound5UnwrapTraits::Unwrap(storage->p5_);
2071 return InvokeHelper<StorageType::IsWeakCall::value, R,
2072 typename StorageType::RunnableType,
2073 void(typename Bound1UnwrapTraits::ForwardType,
2074 typename Bound2UnwrapTraits::ForwardType,
2075 typename Bound3UnwrapTraits::ForwardType,
2076 typename Bound4UnwrapTraits::ForwardType,
2077 typename Bound5UnwrapTraits::ForwardType,
2078 typename CallbackParamTraits<X6>::ForwardType x6)>
2079 ::MakeItSo(storage->runnable_, CallbackForward(x1),
2080 CallbackForward(x2), CallbackForward(x3),
2081 CallbackForward(x4), CallbackForward(x5),
2082 CallbackForward(x6));
2086 // Arity 6 -> 0.
2087 template <typename StorageType, typename R,typename X1, typename X2,
2088 typename X3, typename X4, typename X5, typename X6>
2089 struct Invoker<6, StorageType, R(X1, X2, X3, X4, X5, X6)> {
2090 typedef R(RunType)(BindStateBase*);
2092 typedef R(UnboundRunType)();
2094 static R Run(BindStateBase* base) {
2095 StorageType* storage = static_cast<StorageType*>(base);
2097 // Local references to make debugger stepping easier. If in a debugger,
2098 // you really want to warp ahead and step through the
2099 // InvokeHelper<>::MakeItSo() call below.
2100 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
2101 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
2102 typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits;
2103 typedef typename StorageType::Bound4UnwrapTraits Bound4UnwrapTraits;
2104 typedef typename StorageType::Bound5UnwrapTraits Bound5UnwrapTraits;
2105 typedef typename StorageType::Bound6UnwrapTraits Bound6UnwrapTraits;
2107 typename Bound1UnwrapTraits::ForwardType x1 =
2108 Bound1UnwrapTraits::Unwrap(storage->p1_);
2109 typename Bound2UnwrapTraits::ForwardType x2 =
2110 Bound2UnwrapTraits::Unwrap(storage->p2_);
2111 typename Bound3UnwrapTraits::ForwardType x3 =
2112 Bound3UnwrapTraits::Unwrap(storage->p3_);
2113 typename Bound4UnwrapTraits::ForwardType x4 =
2114 Bound4UnwrapTraits::Unwrap(storage->p4_);
2115 typename Bound5UnwrapTraits::ForwardType x5 =
2116 Bound5UnwrapTraits::Unwrap(storage->p5_);
2117 typename Bound6UnwrapTraits::ForwardType x6 =
2118 Bound6UnwrapTraits::Unwrap(storage->p6_);
2119 return InvokeHelper<StorageType::IsWeakCall::value, R,
2120 typename StorageType::RunnableType,
2121 void(typename Bound1UnwrapTraits::ForwardType,
2122 typename Bound2UnwrapTraits::ForwardType,
2123 typename Bound3UnwrapTraits::ForwardType,
2124 typename Bound4UnwrapTraits::ForwardType,
2125 typename Bound5UnwrapTraits::ForwardType,
2126 typename Bound6UnwrapTraits::ForwardType)>
2127 ::MakeItSo(storage->runnable_, CallbackForward(x1),
2128 CallbackForward(x2), CallbackForward(x3),
2129 CallbackForward(x4), CallbackForward(x5),
2130 CallbackForward(x6));
2134 // Arity 7 -> 7.
2135 template <typename StorageType, typename R,typename X1, typename X2,
2136 typename X3, typename X4, typename X5, typename X6, typename X7>
2137 struct Invoker<0, StorageType, R(X1, X2, X3, X4, X5, X6, X7)> {
2138 typedef R(RunType)(BindStateBase*,
2139 typename CallbackParamTraits<X1>::ForwardType,
2140 typename CallbackParamTraits<X2>::ForwardType,
2141 typename CallbackParamTraits<X3>::ForwardType,
2142 typename CallbackParamTraits<X4>::ForwardType,
2143 typename CallbackParamTraits<X5>::ForwardType,
2144 typename CallbackParamTraits<X6>::ForwardType,
2145 typename CallbackParamTraits<X7>::ForwardType);
2147 typedef R(UnboundRunType)(X1, X2, X3, X4, X5, X6, X7);
2149 static R Run(BindStateBase* base,
2150 typename CallbackParamTraits<X1>::ForwardType x1,
2151 typename CallbackParamTraits<X2>::ForwardType x2,
2152 typename CallbackParamTraits<X3>::ForwardType x3,
2153 typename CallbackParamTraits<X4>::ForwardType x4,
2154 typename CallbackParamTraits<X5>::ForwardType x5,
2155 typename CallbackParamTraits<X6>::ForwardType x6,
2156 typename CallbackParamTraits<X7>::ForwardType x7) {
2157 StorageType* storage = static_cast<StorageType*>(base);
2159 // Local references to make debugger stepping easier. If in a debugger,
2160 // you really want to warp ahead and step through the
2161 // InvokeHelper<>::MakeItSo() call below.
2163 return InvokeHelper<StorageType::IsWeakCall::value, R,
2164 typename StorageType::RunnableType,
2165 void(typename CallbackParamTraits<X1>::ForwardType x1,
2166 typename CallbackParamTraits<X2>::ForwardType x2,
2167 typename CallbackParamTraits<X3>::ForwardType x3,
2168 typename CallbackParamTraits<X4>::ForwardType x4,
2169 typename CallbackParamTraits<X5>::ForwardType x5,
2170 typename CallbackParamTraits<X6>::ForwardType x6,
2171 typename CallbackParamTraits<X7>::ForwardType x7)>
2172 ::MakeItSo(storage->runnable_, CallbackForward(x1),
2173 CallbackForward(x2), CallbackForward(x3),
2174 CallbackForward(x4), CallbackForward(x5),
2175 CallbackForward(x6), CallbackForward(x7));
2179 // Arity 7 -> 6.
2180 template <typename StorageType, typename R,typename X1, typename X2,
2181 typename X3, typename X4, typename X5, typename X6, typename X7>
2182 struct Invoker<1, StorageType, R(X1, X2, X3, X4, X5, X6, X7)> {
2183 typedef R(RunType)(BindStateBase*,
2184 typename CallbackParamTraits<X2>::ForwardType,
2185 typename CallbackParamTraits<X3>::ForwardType,
2186 typename CallbackParamTraits<X4>::ForwardType,
2187 typename CallbackParamTraits<X5>::ForwardType,
2188 typename CallbackParamTraits<X6>::ForwardType,
2189 typename CallbackParamTraits<X7>::ForwardType);
2191 typedef R(UnboundRunType)(X2, X3, X4, X5, X6, X7);
2193 static R Run(BindStateBase* base,
2194 typename CallbackParamTraits<X2>::ForwardType x2,
2195 typename CallbackParamTraits<X3>::ForwardType x3,
2196 typename CallbackParamTraits<X4>::ForwardType x4,
2197 typename CallbackParamTraits<X5>::ForwardType x5,
2198 typename CallbackParamTraits<X6>::ForwardType x6,
2199 typename CallbackParamTraits<X7>::ForwardType x7) {
2200 StorageType* storage = static_cast<StorageType*>(base);
2202 // Local references to make debugger stepping easier. If in a debugger,
2203 // you really want to warp ahead and step through the
2204 // InvokeHelper<>::MakeItSo() call below.
2205 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
2207 typename Bound1UnwrapTraits::ForwardType x1 =
2208 Bound1UnwrapTraits::Unwrap(storage->p1_);
2209 return InvokeHelper<StorageType::IsWeakCall::value, R,
2210 typename StorageType::RunnableType,
2211 void(typename Bound1UnwrapTraits::ForwardType,
2212 typename CallbackParamTraits<X2>::ForwardType x2,
2213 typename CallbackParamTraits<X3>::ForwardType x3,
2214 typename CallbackParamTraits<X4>::ForwardType x4,
2215 typename CallbackParamTraits<X5>::ForwardType x5,
2216 typename CallbackParamTraits<X6>::ForwardType x6,
2217 typename CallbackParamTraits<X7>::ForwardType x7)>
2218 ::MakeItSo(storage->runnable_, CallbackForward(x1),
2219 CallbackForward(x2), CallbackForward(x3),
2220 CallbackForward(x4), CallbackForward(x5),
2221 CallbackForward(x6), CallbackForward(x7));
2225 // Arity 7 -> 5.
2226 template <typename StorageType, typename R,typename X1, typename X2,
2227 typename X3, typename X4, typename X5, typename X6, typename X7>
2228 struct Invoker<2, StorageType, R(X1, X2, X3, X4, X5, X6, X7)> {
2229 typedef R(RunType)(BindStateBase*,
2230 typename CallbackParamTraits<X3>::ForwardType,
2231 typename CallbackParamTraits<X4>::ForwardType,
2232 typename CallbackParamTraits<X5>::ForwardType,
2233 typename CallbackParamTraits<X6>::ForwardType,
2234 typename CallbackParamTraits<X7>::ForwardType);
2236 typedef R(UnboundRunType)(X3, X4, X5, X6, X7);
2238 static R Run(BindStateBase* base,
2239 typename CallbackParamTraits<X3>::ForwardType x3,
2240 typename CallbackParamTraits<X4>::ForwardType x4,
2241 typename CallbackParamTraits<X5>::ForwardType x5,
2242 typename CallbackParamTraits<X6>::ForwardType x6,
2243 typename CallbackParamTraits<X7>::ForwardType x7) {
2244 StorageType* storage = static_cast<StorageType*>(base);
2246 // Local references to make debugger stepping easier. If in a debugger,
2247 // you really want to warp ahead and step through the
2248 // InvokeHelper<>::MakeItSo() call below.
2249 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
2250 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
2252 typename Bound1UnwrapTraits::ForwardType x1 =
2253 Bound1UnwrapTraits::Unwrap(storage->p1_);
2254 typename Bound2UnwrapTraits::ForwardType x2 =
2255 Bound2UnwrapTraits::Unwrap(storage->p2_);
2256 return InvokeHelper<StorageType::IsWeakCall::value, R,
2257 typename StorageType::RunnableType,
2258 void(typename Bound1UnwrapTraits::ForwardType,
2259 typename Bound2UnwrapTraits::ForwardType,
2260 typename CallbackParamTraits<X3>::ForwardType x3,
2261 typename CallbackParamTraits<X4>::ForwardType x4,
2262 typename CallbackParamTraits<X5>::ForwardType x5,
2263 typename CallbackParamTraits<X6>::ForwardType x6,
2264 typename CallbackParamTraits<X7>::ForwardType x7)>
2265 ::MakeItSo(storage->runnable_, CallbackForward(x1),
2266 CallbackForward(x2), CallbackForward(x3),
2267 CallbackForward(x4), CallbackForward(x5),
2268 CallbackForward(x6), CallbackForward(x7));
2272 // Arity 7 -> 4.
2273 template <typename StorageType, typename R,typename X1, typename X2,
2274 typename X3, typename X4, typename X5, typename X6, typename X7>
2275 struct Invoker<3, StorageType, R(X1, X2, X3, X4, X5, X6, X7)> {
2276 typedef R(RunType)(BindStateBase*,
2277 typename CallbackParamTraits<X4>::ForwardType,
2278 typename CallbackParamTraits<X5>::ForwardType,
2279 typename CallbackParamTraits<X6>::ForwardType,
2280 typename CallbackParamTraits<X7>::ForwardType);
2282 typedef R(UnboundRunType)(X4, X5, X6, X7);
2284 static R Run(BindStateBase* base,
2285 typename CallbackParamTraits<X4>::ForwardType x4,
2286 typename CallbackParamTraits<X5>::ForwardType x5,
2287 typename CallbackParamTraits<X6>::ForwardType x6,
2288 typename CallbackParamTraits<X7>::ForwardType x7) {
2289 StorageType* storage = static_cast<StorageType*>(base);
2291 // Local references to make debugger stepping easier. If in a debugger,
2292 // you really want to warp ahead and step through the
2293 // InvokeHelper<>::MakeItSo() call below.
2294 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
2295 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
2296 typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits;
2298 typename Bound1UnwrapTraits::ForwardType x1 =
2299 Bound1UnwrapTraits::Unwrap(storage->p1_);
2300 typename Bound2UnwrapTraits::ForwardType x2 =
2301 Bound2UnwrapTraits::Unwrap(storage->p2_);
2302 typename Bound3UnwrapTraits::ForwardType x3 =
2303 Bound3UnwrapTraits::Unwrap(storage->p3_);
2304 return InvokeHelper<StorageType::IsWeakCall::value, R,
2305 typename StorageType::RunnableType,
2306 void(typename Bound1UnwrapTraits::ForwardType,
2307 typename Bound2UnwrapTraits::ForwardType,
2308 typename Bound3UnwrapTraits::ForwardType,
2309 typename CallbackParamTraits<X4>::ForwardType x4,
2310 typename CallbackParamTraits<X5>::ForwardType x5,
2311 typename CallbackParamTraits<X6>::ForwardType x6,
2312 typename CallbackParamTraits<X7>::ForwardType x7)>
2313 ::MakeItSo(storage->runnable_, CallbackForward(x1),
2314 CallbackForward(x2), CallbackForward(x3),
2315 CallbackForward(x4), CallbackForward(x5),
2316 CallbackForward(x6), CallbackForward(x7));
2320 // Arity 7 -> 3.
2321 template <typename StorageType, typename R,typename X1, typename X2,
2322 typename X3, typename X4, typename X5, typename X6, typename X7>
2323 struct Invoker<4, StorageType, R(X1, X2, X3, X4, X5, X6, X7)> {
2324 typedef R(RunType)(BindStateBase*,
2325 typename CallbackParamTraits<X5>::ForwardType,
2326 typename CallbackParamTraits<X6>::ForwardType,
2327 typename CallbackParamTraits<X7>::ForwardType);
2329 typedef R(UnboundRunType)(X5, X6, X7);
2331 static R Run(BindStateBase* base,
2332 typename CallbackParamTraits<X5>::ForwardType x5,
2333 typename CallbackParamTraits<X6>::ForwardType x6,
2334 typename CallbackParamTraits<X7>::ForwardType x7) {
2335 StorageType* storage = static_cast<StorageType*>(base);
2337 // Local references to make debugger stepping easier. If in a debugger,
2338 // you really want to warp ahead and step through the
2339 // InvokeHelper<>::MakeItSo() call below.
2340 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
2341 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
2342 typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits;
2343 typedef typename StorageType::Bound4UnwrapTraits Bound4UnwrapTraits;
2345 typename Bound1UnwrapTraits::ForwardType x1 =
2346 Bound1UnwrapTraits::Unwrap(storage->p1_);
2347 typename Bound2UnwrapTraits::ForwardType x2 =
2348 Bound2UnwrapTraits::Unwrap(storage->p2_);
2349 typename Bound3UnwrapTraits::ForwardType x3 =
2350 Bound3UnwrapTraits::Unwrap(storage->p3_);
2351 typename Bound4UnwrapTraits::ForwardType x4 =
2352 Bound4UnwrapTraits::Unwrap(storage->p4_);
2353 return InvokeHelper<StorageType::IsWeakCall::value, R,
2354 typename StorageType::RunnableType,
2355 void(typename Bound1UnwrapTraits::ForwardType,
2356 typename Bound2UnwrapTraits::ForwardType,
2357 typename Bound3UnwrapTraits::ForwardType,
2358 typename Bound4UnwrapTraits::ForwardType,
2359 typename CallbackParamTraits<X5>::ForwardType x5,
2360 typename CallbackParamTraits<X6>::ForwardType x6,
2361 typename CallbackParamTraits<X7>::ForwardType x7)>
2362 ::MakeItSo(storage->runnable_, CallbackForward(x1),
2363 CallbackForward(x2), CallbackForward(x3),
2364 CallbackForward(x4), CallbackForward(x5),
2365 CallbackForward(x6), CallbackForward(x7));
2369 // Arity 7 -> 2.
2370 template <typename StorageType, typename R,typename X1, typename X2,
2371 typename X3, typename X4, typename X5, typename X6, typename X7>
2372 struct Invoker<5, StorageType, R(X1, X2, X3, X4, X5, X6, X7)> {
2373 typedef R(RunType)(BindStateBase*,
2374 typename CallbackParamTraits<X6>::ForwardType,
2375 typename CallbackParamTraits<X7>::ForwardType);
2377 typedef R(UnboundRunType)(X6, X7);
2379 static R Run(BindStateBase* base,
2380 typename CallbackParamTraits<X6>::ForwardType x6,
2381 typename CallbackParamTraits<X7>::ForwardType x7) {
2382 StorageType* storage = static_cast<StorageType*>(base);
2384 // Local references to make debugger stepping easier. If in a debugger,
2385 // you really want to warp ahead and step through the
2386 // InvokeHelper<>::MakeItSo() call below.
2387 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
2388 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
2389 typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits;
2390 typedef typename StorageType::Bound4UnwrapTraits Bound4UnwrapTraits;
2391 typedef typename StorageType::Bound5UnwrapTraits Bound5UnwrapTraits;
2393 typename Bound1UnwrapTraits::ForwardType x1 =
2394 Bound1UnwrapTraits::Unwrap(storage->p1_);
2395 typename Bound2UnwrapTraits::ForwardType x2 =
2396 Bound2UnwrapTraits::Unwrap(storage->p2_);
2397 typename Bound3UnwrapTraits::ForwardType x3 =
2398 Bound3UnwrapTraits::Unwrap(storage->p3_);
2399 typename Bound4UnwrapTraits::ForwardType x4 =
2400 Bound4UnwrapTraits::Unwrap(storage->p4_);
2401 typename Bound5UnwrapTraits::ForwardType x5 =
2402 Bound5UnwrapTraits::Unwrap(storage->p5_);
2403 return InvokeHelper<StorageType::IsWeakCall::value, R,
2404 typename StorageType::RunnableType,
2405 void(typename Bound1UnwrapTraits::ForwardType,
2406 typename Bound2UnwrapTraits::ForwardType,
2407 typename Bound3UnwrapTraits::ForwardType,
2408 typename Bound4UnwrapTraits::ForwardType,
2409 typename Bound5UnwrapTraits::ForwardType,
2410 typename CallbackParamTraits<X6>::ForwardType x6,
2411 typename CallbackParamTraits<X7>::ForwardType x7)>
2412 ::MakeItSo(storage->runnable_, CallbackForward(x1),
2413 CallbackForward(x2), CallbackForward(x3),
2414 CallbackForward(x4), CallbackForward(x5),
2415 CallbackForward(x6), CallbackForward(x7));
2419 // Arity 7 -> 1.
2420 template <typename StorageType, typename R,typename X1, typename X2,
2421 typename X3, typename X4, typename X5, typename X6, typename X7>
2422 struct Invoker<6, StorageType, R(X1, X2, X3, X4, X5, X6, X7)> {
2423 typedef R(RunType)(BindStateBase*,
2424 typename CallbackParamTraits<X7>::ForwardType);
2426 typedef R(UnboundRunType)(X7);
2428 static R Run(BindStateBase* base,
2429 typename CallbackParamTraits<X7>::ForwardType x7) {
2430 StorageType* storage = static_cast<StorageType*>(base);
2432 // Local references to make debugger stepping easier. If in a debugger,
2433 // you really want to warp ahead and step through the
2434 // InvokeHelper<>::MakeItSo() call below.
2435 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
2436 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
2437 typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits;
2438 typedef typename StorageType::Bound4UnwrapTraits Bound4UnwrapTraits;
2439 typedef typename StorageType::Bound5UnwrapTraits Bound5UnwrapTraits;
2440 typedef typename StorageType::Bound6UnwrapTraits Bound6UnwrapTraits;
2442 typename Bound1UnwrapTraits::ForwardType x1 =
2443 Bound1UnwrapTraits::Unwrap(storage->p1_);
2444 typename Bound2UnwrapTraits::ForwardType x2 =
2445 Bound2UnwrapTraits::Unwrap(storage->p2_);
2446 typename Bound3UnwrapTraits::ForwardType x3 =
2447 Bound3UnwrapTraits::Unwrap(storage->p3_);
2448 typename Bound4UnwrapTraits::ForwardType x4 =
2449 Bound4UnwrapTraits::Unwrap(storage->p4_);
2450 typename Bound5UnwrapTraits::ForwardType x5 =
2451 Bound5UnwrapTraits::Unwrap(storage->p5_);
2452 typename Bound6UnwrapTraits::ForwardType x6 =
2453 Bound6UnwrapTraits::Unwrap(storage->p6_);
2454 return InvokeHelper<StorageType::IsWeakCall::value, R,
2455 typename StorageType::RunnableType,
2456 void(typename Bound1UnwrapTraits::ForwardType,
2457 typename Bound2UnwrapTraits::ForwardType,
2458 typename Bound3UnwrapTraits::ForwardType,
2459 typename Bound4UnwrapTraits::ForwardType,
2460 typename Bound5UnwrapTraits::ForwardType,
2461 typename Bound6UnwrapTraits::ForwardType,
2462 typename CallbackParamTraits<X7>::ForwardType x7)>
2463 ::MakeItSo(storage->runnable_, CallbackForward(x1),
2464 CallbackForward(x2), CallbackForward(x3),
2465 CallbackForward(x4), CallbackForward(x5),
2466 CallbackForward(x6), CallbackForward(x7));
2470 // Arity 7 -> 0.
2471 template <typename StorageType, typename R,typename X1, typename X2,
2472 typename X3, typename X4, typename X5, typename X6, typename X7>
2473 struct Invoker<7, StorageType, R(X1, X2, X3, X4, X5, X6, X7)> {
2474 typedef R(RunType)(BindStateBase*);
2476 typedef R(UnboundRunType)();
2478 static R Run(BindStateBase* base) {
2479 StorageType* storage = static_cast<StorageType*>(base);
2481 // Local references to make debugger stepping easier. If in a debugger,
2482 // you really want to warp ahead and step through the
2483 // InvokeHelper<>::MakeItSo() call below.
2484 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
2485 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
2486 typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits;
2487 typedef typename StorageType::Bound4UnwrapTraits Bound4UnwrapTraits;
2488 typedef typename StorageType::Bound5UnwrapTraits Bound5UnwrapTraits;
2489 typedef typename StorageType::Bound6UnwrapTraits Bound6UnwrapTraits;
2490 typedef typename StorageType::Bound7UnwrapTraits Bound7UnwrapTraits;
2492 typename Bound1UnwrapTraits::ForwardType x1 =
2493 Bound1UnwrapTraits::Unwrap(storage->p1_);
2494 typename Bound2UnwrapTraits::ForwardType x2 =
2495 Bound2UnwrapTraits::Unwrap(storage->p2_);
2496 typename Bound3UnwrapTraits::ForwardType x3 =
2497 Bound3UnwrapTraits::Unwrap(storage->p3_);
2498 typename Bound4UnwrapTraits::ForwardType x4 =
2499 Bound4UnwrapTraits::Unwrap(storage->p4_);
2500 typename Bound5UnwrapTraits::ForwardType x5 =
2501 Bound5UnwrapTraits::Unwrap(storage->p5_);
2502 typename Bound6UnwrapTraits::ForwardType x6 =
2503 Bound6UnwrapTraits::Unwrap(storage->p6_);
2504 typename Bound7UnwrapTraits::ForwardType x7 =
2505 Bound7UnwrapTraits::Unwrap(storage->p7_);
2506 return InvokeHelper<StorageType::IsWeakCall::value, R,
2507 typename StorageType::RunnableType,
2508 void(typename Bound1UnwrapTraits::ForwardType,
2509 typename Bound2UnwrapTraits::ForwardType,
2510 typename Bound3UnwrapTraits::ForwardType,
2511 typename Bound4UnwrapTraits::ForwardType,
2512 typename Bound5UnwrapTraits::ForwardType,
2513 typename Bound6UnwrapTraits::ForwardType,
2514 typename Bound7UnwrapTraits::ForwardType)>
2515 ::MakeItSo(storage->runnable_, CallbackForward(x1),
2516 CallbackForward(x2), CallbackForward(x3),
2517 CallbackForward(x4), CallbackForward(x5),
2518 CallbackForward(x6), CallbackForward(x7));
2523 // BindState<>
2525 // This stores all the state passed into Bind() and is also where most
2526 // of the template resolution magic occurs.
2528 // Runnable is the functor we are binding arguments to.
2529 // RunType is type of the Run() function that the Invoker<> should use.
2530 // Normally, this is the same as the RunType of the Runnable, but it can
2531 // be different if an adapter like IgnoreResult() has been used.
2533 // BoundArgsType contains the storage type for all the bound arguments by
2534 // (ab)using a function type.
2535 template <typename Runnable, typename RunType, typename BoundArgsType>
2536 struct BindState;
2538 template <typename Runnable, typename RunType>
2539 struct BindState<Runnable, RunType, void()> : public BindStateBase {
2540 typedef Runnable RunnableType;
2541 typedef false_type IsWeakCall;
2542 typedef Invoker<0, BindState, RunType> InvokerType;
2543 typedef typename InvokerType::UnboundRunType UnboundRunType;
2544 explicit BindState(const Runnable& runnable)
2545 : runnable_(runnable) {
2548 virtual ~BindState() { }
2550 RunnableType runnable_;
2553 template <typename Runnable, typename RunType, typename P1>
2554 struct BindState<Runnable, RunType, void(P1)> : public BindStateBase {
2555 typedef Runnable RunnableType;
2556 typedef IsWeakMethod<HasIsMethodTag<Runnable>::value, P1> IsWeakCall;
2557 typedef Invoker<1, BindState, RunType> InvokerType;
2558 typedef typename InvokerType::UnboundRunType UnboundRunType;
2560 // Convenience typedefs for bound argument types.
2561 typedef UnwrapTraits<P1> Bound1UnwrapTraits;
2563 BindState(const Runnable& runnable, const P1& p1)
2564 : runnable_(runnable),
2565 p1_(p1) {
2566 MaybeRefcount<HasIsMethodTag<Runnable>::value, P1>::AddRef(p1_);
2569 virtual ~BindState() { MaybeRefcount<HasIsMethodTag<Runnable>::value,
2570 P1>::Release(p1_); }
2572 RunnableType runnable_;
2573 P1 p1_;
2576 template <typename Runnable, typename RunType, typename P1, typename P2>
2577 struct BindState<Runnable, RunType, void(P1, P2)> : public BindStateBase {
2578 typedef Runnable RunnableType;
2579 typedef IsWeakMethod<HasIsMethodTag<Runnable>::value, P1> IsWeakCall;
2580 typedef Invoker<2, BindState, RunType> InvokerType;
2581 typedef typename InvokerType::UnboundRunType UnboundRunType;
2583 // Convenience typedefs for bound argument types.
2584 typedef UnwrapTraits<P1> Bound1UnwrapTraits;
2585 typedef UnwrapTraits<P2> Bound2UnwrapTraits;
2587 BindState(const Runnable& runnable, const P1& p1, const P2& p2)
2588 : runnable_(runnable),
2589 p1_(p1),
2590 p2_(p2) {
2591 MaybeRefcount<HasIsMethodTag<Runnable>::value, P1>::AddRef(p1_);
2594 virtual ~BindState() { MaybeRefcount<HasIsMethodTag<Runnable>::value,
2595 P1>::Release(p1_); }
2597 RunnableType runnable_;
2598 P1 p1_;
2599 P2 p2_;
2602 template <typename Runnable, typename RunType, typename P1, typename P2,
2603 typename P3>
2604 struct BindState<Runnable, RunType, void(P1, P2, P3)> : public BindStateBase {
2605 typedef Runnable RunnableType;
2606 typedef IsWeakMethod<HasIsMethodTag<Runnable>::value, P1> IsWeakCall;
2607 typedef Invoker<3, BindState, RunType> InvokerType;
2608 typedef typename InvokerType::UnboundRunType UnboundRunType;
2610 // Convenience typedefs for bound argument types.
2611 typedef UnwrapTraits<P1> Bound1UnwrapTraits;
2612 typedef UnwrapTraits<P2> Bound2UnwrapTraits;
2613 typedef UnwrapTraits<P3> Bound3UnwrapTraits;
2615 BindState(const Runnable& runnable, const P1& p1, const P2& p2, const P3& p3)
2616 : runnable_(runnable),
2617 p1_(p1),
2618 p2_(p2),
2619 p3_(p3) {
2620 MaybeRefcount<HasIsMethodTag<Runnable>::value, P1>::AddRef(p1_);
2623 virtual ~BindState() { MaybeRefcount<HasIsMethodTag<Runnable>::value,
2624 P1>::Release(p1_); }
2626 RunnableType runnable_;
2627 P1 p1_;
2628 P2 p2_;
2629 P3 p3_;
2632 template <typename Runnable, typename RunType, typename P1, typename P2,
2633 typename P3, typename P4>
2634 struct BindState<Runnable, RunType, void(P1, P2, P3,
2635 P4)> : public BindStateBase {
2636 typedef Runnable RunnableType;
2637 typedef IsWeakMethod<HasIsMethodTag<Runnable>::value, P1> IsWeakCall;
2638 typedef Invoker<4, BindState, RunType> InvokerType;
2639 typedef typename InvokerType::UnboundRunType UnboundRunType;
2641 // Convenience typedefs for bound argument types.
2642 typedef UnwrapTraits<P1> Bound1UnwrapTraits;
2643 typedef UnwrapTraits<P2> Bound2UnwrapTraits;
2644 typedef UnwrapTraits<P3> Bound3UnwrapTraits;
2645 typedef UnwrapTraits<P4> Bound4UnwrapTraits;
2647 BindState(const Runnable& runnable, const P1& p1, const P2& p2, const P3& p3,
2648 const P4& p4)
2649 : runnable_(runnable),
2650 p1_(p1),
2651 p2_(p2),
2652 p3_(p3),
2653 p4_(p4) {
2654 MaybeRefcount<HasIsMethodTag<Runnable>::value, P1>::AddRef(p1_);
2657 virtual ~BindState() { MaybeRefcount<HasIsMethodTag<Runnable>::value,
2658 P1>::Release(p1_); }
2660 RunnableType runnable_;
2661 P1 p1_;
2662 P2 p2_;
2663 P3 p3_;
2664 P4 p4_;
2667 template <typename Runnable, typename RunType, typename P1, typename P2,
2668 typename P3, typename P4, typename P5>
2669 struct BindState<Runnable, RunType, void(P1, P2, P3, P4,
2670 P5)> : public BindStateBase {
2671 typedef Runnable RunnableType;
2672 typedef IsWeakMethod<HasIsMethodTag<Runnable>::value, P1> IsWeakCall;
2673 typedef Invoker<5, BindState, RunType> InvokerType;
2674 typedef typename InvokerType::UnboundRunType UnboundRunType;
2676 // Convenience typedefs for bound argument types.
2677 typedef UnwrapTraits<P1> Bound1UnwrapTraits;
2678 typedef UnwrapTraits<P2> Bound2UnwrapTraits;
2679 typedef UnwrapTraits<P3> Bound3UnwrapTraits;
2680 typedef UnwrapTraits<P4> Bound4UnwrapTraits;
2681 typedef UnwrapTraits<P5> Bound5UnwrapTraits;
2683 BindState(const Runnable& runnable, const P1& p1, const P2& p2, const P3& p3,
2684 const P4& p4, const P5& p5)
2685 : runnable_(runnable),
2686 p1_(p1),
2687 p2_(p2),
2688 p3_(p3),
2689 p4_(p4),
2690 p5_(p5) {
2691 MaybeRefcount<HasIsMethodTag<Runnable>::value, P1>::AddRef(p1_);
2694 virtual ~BindState() { MaybeRefcount<HasIsMethodTag<Runnable>::value,
2695 P1>::Release(p1_); }
2697 RunnableType runnable_;
2698 P1 p1_;
2699 P2 p2_;
2700 P3 p3_;
2701 P4 p4_;
2702 P5 p5_;
2705 template <typename Runnable, typename RunType, typename P1, typename P2,
2706 typename P3, typename P4, typename P5, typename P6>
2707 struct BindState<Runnable, RunType, void(P1, P2, P3, P4, P5,
2708 P6)> : public BindStateBase {
2709 typedef Runnable RunnableType;
2710 typedef IsWeakMethod<HasIsMethodTag<Runnable>::value, P1> IsWeakCall;
2711 typedef Invoker<6, BindState, RunType> InvokerType;
2712 typedef typename InvokerType::UnboundRunType UnboundRunType;
2714 // Convenience typedefs for bound argument types.
2715 typedef UnwrapTraits<P1> Bound1UnwrapTraits;
2716 typedef UnwrapTraits<P2> Bound2UnwrapTraits;
2717 typedef UnwrapTraits<P3> Bound3UnwrapTraits;
2718 typedef UnwrapTraits<P4> Bound4UnwrapTraits;
2719 typedef UnwrapTraits<P5> Bound5UnwrapTraits;
2720 typedef UnwrapTraits<P6> Bound6UnwrapTraits;
2722 BindState(const Runnable& runnable, const P1& p1, const P2& p2, const P3& p3,
2723 const P4& p4, const P5& p5, const P6& p6)
2724 : runnable_(runnable),
2725 p1_(p1),
2726 p2_(p2),
2727 p3_(p3),
2728 p4_(p4),
2729 p5_(p5),
2730 p6_(p6) {
2731 MaybeRefcount<HasIsMethodTag<Runnable>::value, P1>::AddRef(p1_);
2734 virtual ~BindState() { MaybeRefcount<HasIsMethodTag<Runnable>::value,
2735 P1>::Release(p1_); }
2737 RunnableType runnable_;
2738 P1 p1_;
2739 P2 p2_;
2740 P3 p3_;
2741 P4 p4_;
2742 P5 p5_;
2743 P6 p6_;
2746 template <typename Runnable, typename RunType, typename P1, typename P2,
2747 typename P3, typename P4, typename P5, typename P6, typename P7>
2748 struct BindState<Runnable, RunType, void(P1, P2, P3, P4, P5, P6,
2749 P7)> : public BindStateBase {
2750 typedef Runnable RunnableType;
2751 typedef IsWeakMethod<HasIsMethodTag<Runnable>::value, P1> IsWeakCall;
2752 typedef Invoker<7, BindState, RunType> InvokerType;
2753 typedef typename InvokerType::UnboundRunType UnboundRunType;
2755 // Convenience typedefs for bound argument types.
2756 typedef UnwrapTraits<P1> Bound1UnwrapTraits;
2757 typedef UnwrapTraits<P2> Bound2UnwrapTraits;
2758 typedef UnwrapTraits<P3> Bound3UnwrapTraits;
2759 typedef UnwrapTraits<P4> Bound4UnwrapTraits;
2760 typedef UnwrapTraits<P5> Bound5UnwrapTraits;
2761 typedef UnwrapTraits<P6> Bound6UnwrapTraits;
2762 typedef UnwrapTraits<P7> Bound7UnwrapTraits;
2764 BindState(const Runnable& runnable, const P1& p1, const P2& p2, const P3& p3,
2765 const P4& p4, const P5& p5, const P6& p6, const P7& p7)
2766 : runnable_(runnable),
2767 p1_(p1),
2768 p2_(p2),
2769 p3_(p3),
2770 p4_(p4),
2771 p5_(p5),
2772 p6_(p6),
2773 p7_(p7) {
2774 MaybeRefcount<HasIsMethodTag<Runnable>::value, P1>::AddRef(p1_);
2777 virtual ~BindState() { MaybeRefcount<HasIsMethodTag<Runnable>::value,
2778 P1>::Release(p1_); }
2780 RunnableType runnable_;
2781 P1 p1_;
2782 P2 p2_;
2783 P3 p3_;
2784 P4 p4_;
2785 P5 p5_;
2786 P6 p6_;
2787 P7 p7_;
2790 } // namespace internal
2791 } // namespace base
2793 #endif // BASE_BIND_INTERNAL_H_