Fix style nits in gdata directory.
[chromium-blink-merge.git] / base / bind_internal.h
blob50ffaa526787864e72138f3ae98d0b6597b8e635
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_
12 #pragma once
14 #include "base/bind_helpers.h"
15 #include "base/callback_internal.h"
16 #include "base/memory/raw_scoped_refptr_mismatch_checker.h"
17 #include "base/memory/weak_ptr.h"
18 #include "base/template_util.h"
19 #include "build/build_config.h"
21 #if defined(OS_WIN)
22 #include "base/bind_internal_win.h"
23 #endif
25 namespace base {
26 namespace internal {
28 // CONCEPTS:
29 // Runnable -- A type (really a type class) that has a single Run() method
30 // and a RunType typedef that corresponds to the type of Run().
31 // A Runnable can declare that it should treated like a method
32 // call by including a typedef named IsMethod. The value of
33 // this typedef is NOT inspected, only the existence. When a
34 // Runnable declares itself a method, Bind() will enforce special
35 // refcounting + WeakPtr handling semantics for the first
36 // parameter which is expected to be an object.
37 // Functor -- A copyable type representing something that should be called.
38 // All function pointers, Callback<>, and Runnables are functors
39 // even if the invocation syntax differs.
40 // RunType -- A function type (as opposed to function _pointer_ type) for
41 // a Run() function. Usually just a convenience typedef.
42 // (Bound)ArgsType -- A function type that is being (ab)used to store the
43 // types of set of arguments. The "return" type is always
44 // void here. We use this hack so that we do not need
45 // a new type name for each arity of type. (eg.,
46 // BindState1, BindState2). This makes forward
47 // declarations and friending much much easier.
49 // Types:
50 // RunnableAdapter<> -- Wraps the various "function" pointer types into an
51 // object that adheres to the Runnable interface.
52 // There are |3*ARITY| RunnableAdapter types.
53 // FunctionTraits<> -- Type traits that unwrap a function signature into a
54 // a set of easier to use typedefs. Used mainly for
55 // compile time asserts.
56 // There are |ARITY| FunctionTraits types.
57 // ForceVoidReturn<> -- Helper class for translating function signatures to
58 // equivalent forms with a "void" return type.
59 // There are |ARITY| ForceVoidReturn types.
60 // FunctorTraits<> -- Type traits used determine the correct RunType and
61 // RunnableType for a Functor. This is where function
62 // signature adapters are applied.
63 // There are |ARITY| ForceVoidReturn types.
64 // MakeRunnable<> -- Takes a Functor and returns an object in the Runnable
65 // type class that represents the underlying Functor.
66 // There are |O(1)| MakeRunnable types.
67 // InvokeHelper<> -- Take a Runnable + arguments and actully invokes it.
68 // Handle the differing syntaxes needed for WeakPtr<> support,
69 // and for ignoring return values. This is separate from
70 // Invoker to avoid creating multiple version of Invoker<>
71 // which grows at O(n^2) with the arity.
72 // There are |k*ARITY| InvokeHelper types.
73 // Invoker<> -- Unwraps the curried parameters and executes the Runnable.
74 // There are |(ARITY^2 + ARITY)/2| Invoketypes.
75 // BindState<> -- Stores the curried parameters, and is the main entry point
76 // into the Bind() system, doing most of the type resolution.
77 // There are ARITY BindState types.
79 // RunnableAdapter<>
81 // The RunnableAdapter<> templates provide a uniform interface for invoking
82 // a function pointer, method pointer, or const method pointer. The adapter
83 // exposes a Run() method with an appropriate signature. Using this wrapper
84 // allows for writing code that supports all three pointer types without
85 // undue repetition. Without it, a lot of code would need to be repeated 3
86 // times.
88 // For method pointers and const method pointers the first argument to Run()
89 // is considered to be the received of the method. This is similar to STL's
90 // mem_fun().
92 // This class also exposes a RunType typedef that is the function type of the
93 // Run() function.
95 // If and only if the wrapper contains a method or const method pointer, an
96 // IsMethod typedef is exposed. The existence of this typedef (NOT the value)
97 // marks that the wrapper should be considered a method wrapper.
99 template <typename Functor>
100 class RunnableAdapter;
102 // Function: Arity 0.
103 template <typename R>
104 class RunnableAdapter<R(*)()> {
105 public:
106 typedef R (RunType)();
108 explicit RunnableAdapter(R(*function)())
109 : function_(function) {
112 R Run() {
113 return function_();
116 private:
117 R (*function_)();
120 // Method: Arity 0.
121 template <typename R, typename T>
122 class RunnableAdapter<R(T::*)()> {
123 public:
124 typedef R (RunType)(T*);
125 typedef true_type IsMethod;
127 explicit RunnableAdapter(R(T::*method)())
128 : method_(method) {
131 R Run(T* object) {
132 return (object->*method_)();
135 private:
136 R (T::*method_)();
139 // Const Method: Arity 0.
140 template <typename R, typename T>
141 class RunnableAdapter<R(T::*)() const> {
142 public:
143 typedef R (RunType)(const T*);
144 typedef true_type IsMethod;
146 explicit RunnableAdapter(R(T::*method)() const)
147 : method_(method) {
150 R Run(const T* object) {
151 return (object->*method_)();
154 private:
155 R (T::*method_)() const;
158 // Function: Arity 1.
159 template <typename R, typename A1>
160 class RunnableAdapter<R(*)(A1)> {
161 public:
162 typedef R (RunType)(A1);
164 explicit RunnableAdapter(R(*function)(A1))
165 : function_(function) {
168 R Run(typename CallbackParamTraits<A1>::ForwardType a1) {
169 return function_(CallbackForward(a1));
172 private:
173 R (*function_)(A1);
176 // Method: Arity 1.
177 template <typename R, typename T, typename A1>
178 class RunnableAdapter<R(T::*)(A1)> {
179 public:
180 typedef R (RunType)(T*, A1);
181 typedef true_type IsMethod;
183 explicit RunnableAdapter(R(T::*method)(A1))
184 : method_(method) {
187 R Run(T* object, typename CallbackParamTraits<A1>::ForwardType a1) {
188 return (object->*method_)(CallbackForward(a1));
191 private:
192 R (T::*method_)(A1);
195 // Const Method: Arity 1.
196 template <typename R, typename T, typename A1>
197 class RunnableAdapter<R(T::*)(A1) const> {
198 public:
199 typedef R (RunType)(const T*, A1);
200 typedef true_type IsMethod;
202 explicit RunnableAdapter(R(T::*method)(A1) const)
203 : method_(method) {
206 R Run(const T* object, typename CallbackParamTraits<A1>::ForwardType a1) {
207 return (object->*method_)(CallbackForward(a1));
210 private:
211 R (T::*method_)(A1) const;
214 // Function: Arity 2.
215 template <typename R, typename A1, typename A2>
216 class RunnableAdapter<R(*)(A1, A2)> {
217 public:
218 typedef R (RunType)(A1, A2);
220 explicit RunnableAdapter(R(*function)(A1, A2))
221 : function_(function) {
224 R Run(typename CallbackParamTraits<A1>::ForwardType a1,
225 typename CallbackParamTraits<A2>::ForwardType a2) {
226 return function_(CallbackForward(a1), CallbackForward(a2));
229 private:
230 R (*function_)(A1, A2);
233 // Method: Arity 2.
234 template <typename R, typename T, typename A1, typename A2>
235 class RunnableAdapter<R(T::*)(A1, A2)> {
236 public:
237 typedef R (RunType)(T*, A1, A2);
238 typedef true_type IsMethod;
240 explicit RunnableAdapter(R(T::*method)(A1, A2))
241 : method_(method) {
244 R Run(T* object, typename CallbackParamTraits<A1>::ForwardType a1,
245 typename CallbackParamTraits<A2>::ForwardType a2) {
246 return (object->*method_)(CallbackForward(a1), CallbackForward(a2));
249 private:
250 R (T::*method_)(A1, A2);
253 // Const Method: Arity 2.
254 template <typename R, typename T, typename A1, typename A2>
255 class RunnableAdapter<R(T::*)(A1, A2) const> {
256 public:
257 typedef R (RunType)(const T*, A1, A2);
258 typedef true_type IsMethod;
260 explicit RunnableAdapter(R(T::*method)(A1, A2) const)
261 : method_(method) {
264 R Run(const T* object, typename CallbackParamTraits<A1>::ForwardType a1,
265 typename CallbackParamTraits<A2>::ForwardType a2) {
266 return (object->*method_)(CallbackForward(a1), CallbackForward(a2));
269 private:
270 R (T::*method_)(A1, A2) const;
273 // Function: Arity 3.
274 template <typename R, typename A1, typename A2, typename A3>
275 class RunnableAdapter<R(*)(A1, A2, A3)> {
276 public:
277 typedef R (RunType)(A1, A2, A3);
279 explicit RunnableAdapter(R(*function)(A1, A2, A3))
280 : function_(function) {
283 R Run(typename CallbackParamTraits<A1>::ForwardType a1,
284 typename CallbackParamTraits<A2>::ForwardType a2,
285 typename CallbackParamTraits<A3>::ForwardType a3) {
286 return function_(CallbackForward(a1), CallbackForward(a2),
287 CallbackForward(a3));
290 private:
291 R (*function_)(A1, A2, A3);
294 // Method: Arity 3.
295 template <typename R, typename T, typename A1, typename A2, typename A3>
296 class RunnableAdapter<R(T::*)(A1, A2, A3)> {
297 public:
298 typedef R (RunType)(T*, A1, A2, A3);
299 typedef true_type IsMethod;
301 explicit RunnableAdapter(R(T::*method)(A1, A2, A3))
302 : method_(method) {
305 R Run(T* object, typename CallbackParamTraits<A1>::ForwardType a1,
306 typename CallbackParamTraits<A2>::ForwardType a2,
307 typename CallbackParamTraits<A3>::ForwardType a3) {
308 return (object->*method_)(CallbackForward(a1), CallbackForward(a2),
309 CallbackForward(a3));
312 private:
313 R (T::*method_)(A1, A2, A3);
316 // Const Method: Arity 3.
317 template <typename R, typename T, typename A1, typename A2, typename A3>
318 class RunnableAdapter<R(T::*)(A1, A2, A3) const> {
319 public:
320 typedef R (RunType)(const T*, A1, A2, A3);
321 typedef true_type IsMethod;
323 explicit RunnableAdapter(R(T::*method)(A1, A2, A3) const)
324 : method_(method) {
327 R Run(const T* object, typename CallbackParamTraits<A1>::ForwardType a1,
328 typename CallbackParamTraits<A2>::ForwardType a2,
329 typename CallbackParamTraits<A3>::ForwardType a3) {
330 return (object->*method_)(CallbackForward(a1), CallbackForward(a2),
331 CallbackForward(a3));
334 private:
335 R (T::*method_)(A1, A2, A3) const;
338 // Function: Arity 4.
339 template <typename R, typename A1, typename A2, typename A3, typename A4>
340 class RunnableAdapter<R(*)(A1, A2, A3, A4)> {
341 public:
342 typedef R (RunType)(A1, A2, A3, A4);
344 explicit RunnableAdapter(R(*function)(A1, A2, A3, A4))
345 : function_(function) {
348 R Run(typename CallbackParamTraits<A1>::ForwardType a1,
349 typename CallbackParamTraits<A2>::ForwardType a2,
350 typename CallbackParamTraits<A3>::ForwardType a3,
351 typename CallbackParamTraits<A4>::ForwardType a4) {
352 return function_(CallbackForward(a1), CallbackForward(a2),
353 CallbackForward(a3), CallbackForward(a4));
356 private:
357 R (*function_)(A1, A2, A3, A4);
360 // Method: Arity 4.
361 template <typename R, typename T, typename A1, typename A2, typename A3,
362 typename A4>
363 class RunnableAdapter<R(T::*)(A1, A2, A3, A4)> {
364 public:
365 typedef R (RunType)(T*, A1, A2, A3, A4);
366 typedef true_type IsMethod;
368 explicit RunnableAdapter(R(T::*method)(A1, A2, A3, A4))
369 : method_(method) {
372 R Run(T* object, typename CallbackParamTraits<A1>::ForwardType a1,
373 typename CallbackParamTraits<A2>::ForwardType a2,
374 typename CallbackParamTraits<A3>::ForwardType a3,
375 typename CallbackParamTraits<A4>::ForwardType a4) {
376 return (object->*method_)(CallbackForward(a1), CallbackForward(a2),
377 CallbackForward(a3), CallbackForward(a4));
380 private:
381 R (T::*method_)(A1, A2, A3, A4);
384 // Const Method: Arity 4.
385 template <typename R, typename T, typename A1, typename A2, typename A3,
386 typename A4>
387 class RunnableAdapter<R(T::*)(A1, A2, A3, A4) const> {
388 public:
389 typedef R (RunType)(const T*, A1, A2, A3, A4);
390 typedef true_type IsMethod;
392 explicit RunnableAdapter(R(T::*method)(A1, A2, A3, A4) const)
393 : method_(method) {
396 R Run(const T* object, typename CallbackParamTraits<A1>::ForwardType a1,
397 typename CallbackParamTraits<A2>::ForwardType a2,
398 typename CallbackParamTraits<A3>::ForwardType a3,
399 typename CallbackParamTraits<A4>::ForwardType a4) {
400 return (object->*method_)(CallbackForward(a1), CallbackForward(a2),
401 CallbackForward(a3), CallbackForward(a4));
404 private:
405 R (T::*method_)(A1, A2, A3, A4) const;
408 // Function: Arity 5.
409 template <typename R, typename A1, typename A2, typename A3, typename A4,
410 typename A5>
411 class RunnableAdapter<R(*)(A1, A2, A3, A4, A5)> {
412 public:
413 typedef R (RunType)(A1, A2, A3, A4, A5);
415 explicit RunnableAdapter(R(*function)(A1, A2, A3, A4, A5))
416 : function_(function) {
419 R Run(typename CallbackParamTraits<A1>::ForwardType a1,
420 typename CallbackParamTraits<A2>::ForwardType a2,
421 typename CallbackParamTraits<A3>::ForwardType a3,
422 typename CallbackParamTraits<A4>::ForwardType a4,
423 typename CallbackParamTraits<A5>::ForwardType a5) {
424 return function_(CallbackForward(a1), CallbackForward(a2),
425 CallbackForward(a3), CallbackForward(a4), CallbackForward(a5));
428 private:
429 R (*function_)(A1, A2, A3, A4, A5);
432 // Method: Arity 5.
433 template <typename R, typename T, typename A1, typename A2, typename A3,
434 typename A4, typename A5>
435 class RunnableAdapter<R(T::*)(A1, A2, A3, A4, A5)> {
436 public:
437 typedef R (RunType)(T*, A1, A2, A3, A4, A5);
438 typedef true_type IsMethod;
440 explicit RunnableAdapter(R(T::*method)(A1, A2, A3, A4, A5))
441 : method_(method) {
444 R Run(T* object, typename CallbackParamTraits<A1>::ForwardType a1,
445 typename CallbackParamTraits<A2>::ForwardType a2,
446 typename CallbackParamTraits<A3>::ForwardType a3,
447 typename CallbackParamTraits<A4>::ForwardType a4,
448 typename CallbackParamTraits<A5>::ForwardType a5) {
449 return (object->*method_)(CallbackForward(a1), CallbackForward(a2),
450 CallbackForward(a3), CallbackForward(a4), CallbackForward(a5));
453 private:
454 R (T::*method_)(A1, A2, A3, A4, A5);
457 // Const Method: Arity 5.
458 template <typename R, typename T, typename A1, typename A2, typename A3,
459 typename A4, typename A5>
460 class RunnableAdapter<R(T::*)(A1, A2, A3, A4, A5) const> {
461 public:
462 typedef R (RunType)(const T*, A1, A2, A3, A4, A5);
463 typedef true_type IsMethod;
465 explicit RunnableAdapter(R(T::*method)(A1, A2, A3, A4, A5) const)
466 : method_(method) {
469 R Run(const T* object, typename CallbackParamTraits<A1>::ForwardType a1,
470 typename CallbackParamTraits<A2>::ForwardType a2,
471 typename CallbackParamTraits<A3>::ForwardType a3,
472 typename CallbackParamTraits<A4>::ForwardType a4,
473 typename CallbackParamTraits<A5>::ForwardType a5) {
474 return (object->*method_)(CallbackForward(a1), CallbackForward(a2),
475 CallbackForward(a3), CallbackForward(a4), CallbackForward(a5));
478 private:
479 R (T::*method_)(A1, A2, A3, A4, A5) const;
482 // Function: Arity 6.
483 template <typename R, typename A1, typename A2, typename A3, typename A4,
484 typename A5, typename A6>
485 class RunnableAdapter<R(*)(A1, A2, A3, A4, A5, A6)> {
486 public:
487 typedef R (RunType)(A1, A2, A3, A4, A5, A6);
489 explicit RunnableAdapter(R(*function)(A1, A2, A3, A4, A5, A6))
490 : function_(function) {
493 R Run(typename CallbackParamTraits<A1>::ForwardType a1,
494 typename CallbackParamTraits<A2>::ForwardType a2,
495 typename CallbackParamTraits<A3>::ForwardType a3,
496 typename CallbackParamTraits<A4>::ForwardType a4,
497 typename CallbackParamTraits<A5>::ForwardType a5,
498 typename CallbackParamTraits<A6>::ForwardType a6) {
499 return function_(CallbackForward(a1), CallbackForward(a2),
500 CallbackForward(a3), CallbackForward(a4), CallbackForward(a5),
501 CallbackForward(a6));
504 private:
505 R (*function_)(A1, A2, A3, A4, A5, A6);
508 // Method: Arity 6.
509 template <typename R, typename T, typename A1, typename A2, typename A3,
510 typename A4, typename A5, typename A6>
511 class RunnableAdapter<R(T::*)(A1, A2, A3, A4, A5, A6)> {
512 public:
513 typedef R (RunType)(T*, A1, A2, A3, A4, A5, A6);
514 typedef true_type IsMethod;
516 explicit RunnableAdapter(R(T::*method)(A1, A2, A3, A4, A5, A6))
517 : method_(method) {
520 R Run(T* object, typename CallbackParamTraits<A1>::ForwardType a1,
521 typename CallbackParamTraits<A2>::ForwardType a2,
522 typename CallbackParamTraits<A3>::ForwardType a3,
523 typename CallbackParamTraits<A4>::ForwardType a4,
524 typename CallbackParamTraits<A5>::ForwardType a5,
525 typename CallbackParamTraits<A6>::ForwardType a6) {
526 return (object->*method_)(CallbackForward(a1), CallbackForward(a2),
527 CallbackForward(a3), CallbackForward(a4), CallbackForward(a5),
528 CallbackForward(a6));
531 private:
532 R (T::*method_)(A1, A2, A3, A4, A5, A6);
535 // Const Method: Arity 6.
536 template <typename R, typename T, typename A1, typename A2, typename A3,
537 typename A4, typename A5, typename A6>
538 class RunnableAdapter<R(T::*)(A1, A2, A3, A4, A5, A6) const> {
539 public:
540 typedef R (RunType)(const T*, A1, A2, A3, A4, A5, A6);
541 typedef true_type IsMethod;
543 explicit RunnableAdapter(R(T::*method)(A1, A2, A3, A4, A5, A6) const)
544 : method_(method) {
547 R Run(const T* object, typename CallbackParamTraits<A1>::ForwardType a1,
548 typename CallbackParamTraits<A2>::ForwardType a2,
549 typename CallbackParamTraits<A3>::ForwardType a3,
550 typename CallbackParamTraits<A4>::ForwardType a4,
551 typename CallbackParamTraits<A5>::ForwardType a5,
552 typename CallbackParamTraits<A6>::ForwardType a6) {
553 return (object->*method_)(CallbackForward(a1), CallbackForward(a2),
554 CallbackForward(a3), CallbackForward(a4), CallbackForward(a5),
555 CallbackForward(a6));
558 private:
559 R (T::*method_)(A1, A2, A3, A4, A5, A6) const;
562 // Function: Arity 7.
563 template <typename R, typename A1, typename A2, typename A3, typename A4,
564 typename A5, typename A6, typename A7>
565 class RunnableAdapter<R(*)(A1, A2, A3, A4, A5, A6, A7)> {
566 public:
567 typedef R (RunType)(A1, A2, A3, A4, A5, A6, A7);
569 explicit RunnableAdapter(R(*function)(A1, A2, A3, A4, A5, A6, A7))
570 : function_(function) {
573 R Run(typename CallbackParamTraits<A1>::ForwardType a1,
574 typename CallbackParamTraits<A2>::ForwardType a2,
575 typename CallbackParamTraits<A3>::ForwardType a3,
576 typename CallbackParamTraits<A4>::ForwardType a4,
577 typename CallbackParamTraits<A5>::ForwardType a5,
578 typename CallbackParamTraits<A6>::ForwardType a6,
579 typename CallbackParamTraits<A7>::ForwardType a7) {
580 return function_(CallbackForward(a1), CallbackForward(a2),
581 CallbackForward(a3), CallbackForward(a4), CallbackForward(a5),
582 CallbackForward(a6), CallbackForward(a7));
585 private:
586 R (*function_)(A1, A2, A3, A4, A5, A6, A7);
589 // Method: Arity 7.
590 template <typename R, typename T, typename A1, typename A2, typename A3,
591 typename A4, typename A5, typename A6, typename A7>
592 class RunnableAdapter<R(T::*)(A1, A2, A3, A4, A5, A6, A7)> {
593 public:
594 typedef R (RunType)(T*, A1, A2, A3, A4, A5, A6, A7);
595 typedef true_type IsMethod;
597 explicit RunnableAdapter(R(T::*method)(A1, A2, A3, A4, A5, A6, A7))
598 : method_(method) {
601 R Run(T* object, typename CallbackParamTraits<A1>::ForwardType a1,
602 typename CallbackParamTraits<A2>::ForwardType a2,
603 typename CallbackParamTraits<A3>::ForwardType a3,
604 typename CallbackParamTraits<A4>::ForwardType a4,
605 typename CallbackParamTraits<A5>::ForwardType a5,
606 typename CallbackParamTraits<A6>::ForwardType a6,
607 typename CallbackParamTraits<A7>::ForwardType a7) {
608 return (object->*method_)(CallbackForward(a1), CallbackForward(a2),
609 CallbackForward(a3), CallbackForward(a4), CallbackForward(a5),
610 CallbackForward(a6), CallbackForward(a7));
613 private:
614 R (T::*method_)(A1, A2, A3, A4, A5, A6, A7);
617 // Const Method: Arity 7.
618 template <typename R, typename T, typename A1, typename A2, typename A3,
619 typename A4, typename A5, typename A6, typename A7>
620 class RunnableAdapter<R(T::*)(A1, A2, A3, A4, A5, A6, A7) const> {
621 public:
622 typedef R (RunType)(const T*, A1, A2, A3, A4, A5, A6, A7);
623 typedef true_type IsMethod;
625 explicit RunnableAdapter(R(T::*method)(A1, A2, A3, A4, A5, A6, A7) const)
626 : method_(method) {
629 R Run(const T* object, typename CallbackParamTraits<A1>::ForwardType a1,
630 typename CallbackParamTraits<A2>::ForwardType a2,
631 typename CallbackParamTraits<A3>::ForwardType a3,
632 typename CallbackParamTraits<A4>::ForwardType a4,
633 typename CallbackParamTraits<A5>::ForwardType a5,
634 typename CallbackParamTraits<A6>::ForwardType a6,
635 typename CallbackParamTraits<A7>::ForwardType a7) {
636 return (object->*method_)(CallbackForward(a1), CallbackForward(a2),
637 CallbackForward(a3), CallbackForward(a4), CallbackForward(a5),
638 CallbackForward(a6), CallbackForward(a7));
641 private:
642 R (T::*method_)(A1, A2, A3, A4, A5, A6, A7) const;
646 // FunctionTraits<>
648 // Breaks a function signature apart into typedefs for easier introspection.
649 template <typename Sig>
650 struct FunctionTraits;
652 template <typename R>
653 struct FunctionTraits<R()> {
654 typedef R ReturnType;
657 template <typename R, typename A1>
658 struct FunctionTraits<R(A1)> {
659 typedef R ReturnType;
660 typedef A1 A1Type;
663 template <typename R, typename A1, typename A2>
664 struct FunctionTraits<R(A1, A2)> {
665 typedef R ReturnType;
666 typedef A1 A1Type;
667 typedef A2 A2Type;
670 template <typename R, typename A1, typename A2, typename A3>
671 struct FunctionTraits<R(A1, A2, A3)> {
672 typedef R ReturnType;
673 typedef A1 A1Type;
674 typedef A2 A2Type;
675 typedef A3 A3Type;
678 template <typename R, typename A1, typename A2, typename A3, typename A4>
679 struct FunctionTraits<R(A1, A2, A3, A4)> {
680 typedef R ReturnType;
681 typedef A1 A1Type;
682 typedef A2 A2Type;
683 typedef A3 A3Type;
684 typedef A4 A4Type;
687 template <typename R, typename A1, typename A2, typename A3, typename A4,
688 typename A5>
689 struct FunctionTraits<R(A1, A2, A3, A4, A5)> {
690 typedef R ReturnType;
691 typedef A1 A1Type;
692 typedef A2 A2Type;
693 typedef A3 A3Type;
694 typedef A4 A4Type;
695 typedef A5 A5Type;
698 template <typename R, typename A1, typename A2, typename A3, typename A4,
699 typename A5, typename A6>
700 struct FunctionTraits<R(A1, A2, A3, A4, A5, A6)> {
701 typedef R ReturnType;
702 typedef A1 A1Type;
703 typedef A2 A2Type;
704 typedef A3 A3Type;
705 typedef A4 A4Type;
706 typedef A5 A5Type;
707 typedef A6 A6Type;
710 template <typename R, typename A1, typename A2, typename A3, typename A4,
711 typename A5, typename A6, typename A7>
712 struct FunctionTraits<R(A1, A2, A3, A4, A5, A6, A7)> {
713 typedef R ReturnType;
714 typedef A1 A1Type;
715 typedef A2 A2Type;
716 typedef A3 A3Type;
717 typedef A4 A4Type;
718 typedef A5 A5Type;
719 typedef A6 A6Type;
720 typedef A7 A7Type;
724 // ForceVoidReturn<>
726 // Set of templates that support forcing the function return type to void.
727 template <typename Sig>
728 struct ForceVoidReturn;
730 template <typename R>
731 struct ForceVoidReturn<R()> {
732 typedef void(RunType)();
735 template <typename R, typename A1>
736 struct ForceVoidReturn<R(A1)> {
737 typedef void(RunType)(A1);
740 template <typename R, typename A1, typename A2>
741 struct ForceVoidReturn<R(A1, A2)> {
742 typedef void(RunType)(A1, A2);
745 template <typename R, typename A1, typename A2, typename A3>
746 struct ForceVoidReturn<R(A1, A2, A3)> {
747 typedef void(RunType)(A1, A2, A3);
750 template <typename R, typename A1, typename A2, typename A3, typename A4>
751 struct ForceVoidReturn<R(A1, A2, A3, A4)> {
752 typedef void(RunType)(A1, A2, A3, A4);
755 template <typename R, typename A1, typename A2, typename A3, typename A4,
756 typename A5>
757 struct ForceVoidReturn<R(A1, A2, A3, A4, A5)> {
758 typedef void(RunType)(A1, A2, A3, A4, A5);
761 template <typename R, typename A1, typename A2, typename A3, typename A4,
762 typename A5, typename A6>
763 struct ForceVoidReturn<R(A1, A2, A3, A4, A5, A6)> {
764 typedef void(RunType)(A1, A2, A3, A4, A5, A6);
767 template <typename R, typename A1, typename A2, typename A3, typename A4,
768 typename A5, typename A6, typename A7>
769 struct ForceVoidReturn<R(A1, A2, A3, A4, A5, A6, A7)> {
770 typedef void(RunType)(A1, A2, A3, A4, A5, A6, A7);
774 // FunctorTraits<>
776 // See description at top of file.
777 template <typename T>
778 struct FunctorTraits {
779 typedef RunnableAdapter<T> RunnableType;
780 typedef typename RunnableType::RunType RunType;
783 template <typename T>
784 struct FunctorTraits<IgnoreResultHelper<T> > {
785 typedef typename FunctorTraits<T>::RunnableType RunnableType;
786 typedef typename ForceVoidReturn<
787 typename RunnableType::RunType>::RunType RunType;
790 template <typename T>
791 struct FunctorTraits<Callback<T> > {
792 typedef Callback<T> RunnableType;
793 typedef typename Callback<T>::RunType RunType;
797 // MakeRunnable<>
799 // Converts a passed in functor to a RunnableType using type inference.
801 template <typename T>
802 typename FunctorTraits<T>::RunnableType MakeRunnable(const T& t) {
803 return RunnableAdapter<T>(t);
806 template <typename T>
807 typename FunctorTraits<T>::RunnableType
808 MakeRunnable(const IgnoreResultHelper<T>& t) {
809 return MakeRunnable(t.functor_);
812 template <typename T>
813 const typename FunctorTraits<Callback<T> >::RunnableType&
814 MakeRunnable(const Callback<T>& t) {
815 return t;
819 // InvokeHelper<>
821 // There are 3 logical InvokeHelper<> specializations: normal, void-return,
822 // WeakCalls.
824 // The normal type just calls the underlying runnable.
826 // We need a InvokeHelper to handle void return types in order to support
827 // IgnoreResult(). Normally, if the Runnable's RunType had a void return,
828 // the template system would just accept "return functor.Run()" ignoring
829 // the fact that a void function is being used with return. This piece of
830 // sugar breaks though when the Runnable's RunType is not void. Thus, we
831 // need a partial specialization to change the syntax to drop the "return"
832 // from the invocation call.
834 // WeakCalls similarly need special syntax that is applied to the first
835 // argument to check if they should no-op themselves.
836 template <bool IsWeakCall, typename ReturnType, typename Runnable,
837 typename ArgsType>
838 struct InvokeHelper;
840 template <typename ReturnType, typename Runnable>
841 struct InvokeHelper<false, ReturnType, Runnable,
842 void()> {
843 static ReturnType MakeItSo(Runnable runnable) {
844 return runnable.Run();
848 template <typename Runnable>
849 struct InvokeHelper<false, void, Runnable,
850 void()> {
851 static void MakeItSo(Runnable runnable) {
852 runnable.Run();
856 template <typename ReturnType, typename Runnable,typename A1>
857 struct InvokeHelper<false, ReturnType, Runnable,
858 void(A1)> {
859 static ReturnType MakeItSo(Runnable runnable, A1 a1) {
860 return runnable.Run(CallbackForward(a1));
864 template <typename Runnable,typename A1>
865 struct InvokeHelper<false, void, Runnable,
866 void(A1)> {
867 static void MakeItSo(Runnable runnable, A1 a1) {
868 runnable.Run(CallbackForward(a1));
872 template <typename Runnable, typename A1>
873 struct InvokeHelper<true, void, Runnable,
874 void(A1)> {
875 static void MakeItSo(Runnable runnable, A1 a1) {
876 if (!a1.get()) {
877 return;
880 runnable.Run(CallbackForward(a1));
884 template <typename ReturnType, typename Runnable,typename A1, typename A2>
885 struct InvokeHelper<false, ReturnType, Runnable,
886 void(A1, A2)> {
887 static ReturnType MakeItSo(Runnable runnable, A1 a1, A2 a2) {
888 return runnable.Run(CallbackForward(a1), CallbackForward(a2));
892 template <typename Runnable,typename A1, typename A2>
893 struct InvokeHelper<false, void, Runnable,
894 void(A1, A2)> {
895 static void MakeItSo(Runnable runnable, A1 a1, A2 a2) {
896 runnable.Run(CallbackForward(a1), CallbackForward(a2));
900 template <typename Runnable, typename A1, typename A2>
901 struct InvokeHelper<true, void, Runnable,
902 void(A1, A2)> {
903 static void MakeItSo(Runnable runnable, A1 a1, A2 a2) {
904 if (!a1.get()) {
905 return;
908 runnable.Run(CallbackForward(a1), CallbackForward(a2));
912 template <typename ReturnType, typename Runnable,typename A1, typename A2,
913 typename A3>
914 struct InvokeHelper<false, ReturnType, Runnable,
915 void(A1, A2, A3)> {
916 static ReturnType MakeItSo(Runnable runnable, A1 a1, A2 a2, A3 a3) {
917 return runnable.Run(CallbackForward(a1), CallbackForward(a2),
918 CallbackForward(a3));
922 template <typename Runnable,typename A1, typename A2, typename A3>
923 struct InvokeHelper<false, void, Runnable,
924 void(A1, A2, A3)> {
925 static void MakeItSo(Runnable runnable, A1 a1, A2 a2, A3 a3) {
926 runnable.Run(CallbackForward(a1), CallbackForward(a2), CallbackForward(a3));
930 template <typename Runnable, typename A1, typename A2, typename A3>
931 struct InvokeHelper<true, void, Runnable,
932 void(A1, A2, A3)> {
933 static void MakeItSo(Runnable runnable, A1 a1, A2 a2, A3 a3) {
934 if (!a1.get()) {
935 return;
938 runnable.Run(CallbackForward(a1), CallbackForward(a2), CallbackForward(a3));
942 template <typename ReturnType, typename Runnable,typename A1, typename A2,
943 typename A3, typename A4>
944 struct InvokeHelper<false, ReturnType, Runnable,
945 void(A1, A2, A3, A4)> {
946 static ReturnType MakeItSo(Runnable runnable, A1 a1, A2 a2, A3 a3, A4 a4) {
947 return runnable.Run(CallbackForward(a1), CallbackForward(a2),
948 CallbackForward(a3), CallbackForward(a4));
952 template <typename Runnable,typename A1, typename A2, typename A3, typename A4>
953 struct InvokeHelper<false, void, Runnable,
954 void(A1, A2, A3, A4)> {
955 static void MakeItSo(Runnable runnable, A1 a1, A2 a2, A3 a3, A4 a4) {
956 runnable.Run(CallbackForward(a1), CallbackForward(a2), CallbackForward(a3),
957 CallbackForward(a4));
961 template <typename Runnable, typename A1, typename A2, typename A3, typename A4>
962 struct InvokeHelper<true, void, Runnable,
963 void(A1, A2, A3, A4)> {
964 static void MakeItSo(Runnable runnable, A1 a1, A2 a2, A3 a3, A4 a4) {
965 if (!a1.get()) {
966 return;
969 runnable.Run(CallbackForward(a1), CallbackForward(a2), CallbackForward(a3),
970 CallbackForward(a4));
974 template <typename ReturnType, typename Runnable,typename A1, typename A2,
975 typename A3, typename A4, typename A5>
976 struct InvokeHelper<false, ReturnType, Runnable,
977 void(A1, A2, A3, A4, A5)> {
978 static ReturnType MakeItSo(Runnable runnable, A1 a1, A2 a2, A3 a3, A4 a4,
979 A5 a5) {
980 return runnable.Run(CallbackForward(a1), CallbackForward(a2),
981 CallbackForward(a3), CallbackForward(a4), CallbackForward(a5));
985 template <typename Runnable,typename A1, typename A2, typename A3, typename A4,
986 typename A5>
987 struct InvokeHelper<false, void, Runnable,
988 void(A1, A2, A3, A4, A5)> {
989 static void MakeItSo(Runnable runnable, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) {
990 runnable.Run(CallbackForward(a1), CallbackForward(a2), CallbackForward(a3),
991 CallbackForward(a4), CallbackForward(a5));
995 template <typename Runnable, typename A1, typename A2, typename A3,
996 typename A4, typename A5>
997 struct InvokeHelper<true, void, Runnable,
998 void(A1, A2, A3, A4, A5)> {
999 static void MakeItSo(Runnable runnable, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) {
1000 if (!a1.get()) {
1001 return;
1004 runnable.Run(CallbackForward(a1), CallbackForward(a2), CallbackForward(a3),
1005 CallbackForward(a4), CallbackForward(a5));
1009 template <typename ReturnType, typename Runnable,typename A1, typename A2,
1010 typename A3, typename A4, typename A5, typename A6>
1011 struct InvokeHelper<false, ReturnType, Runnable,
1012 void(A1, A2, A3, A4, A5, A6)> {
1013 static ReturnType MakeItSo(Runnable runnable, A1 a1, A2 a2, A3 a3, A4 a4,
1014 A5 a5, A6 a6) {
1015 return runnable.Run(CallbackForward(a1), CallbackForward(a2),
1016 CallbackForward(a3), CallbackForward(a4), CallbackForward(a5),
1017 CallbackForward(a6));
1021 template <typename Runnable,typename A1, typename A2, typename A3, typename A4,
1022 typename A5, typename A6>
1023 struct InvokeHelper<false, void, Runnable,
1024 void(A1, A2, A3, A4, A5, A6)> {
1025 static void MakeItSo(Runnable runnable, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5,
1026 A6 a6) {
1027 runnable.Run(CallbackForward(a1), CallbackForward(a2), CallbackForward(a3),
1028 CallbackForward(a4), CallbackForward(a5), CallbackForward(a6));
1032 template <typename Runnable, typename A1, typename A2, typename A3,
1033 typename A4, typename A5, typename A6>
1034 struct InvokeHelper<true, void, Runnable,
1035 void(A1, A2, A3, A4, A5, A6)> {
1036 static void MakeItSo(Runnable runnable, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5,
1037 A6 a6) {
1038 if (!a1.get()) {
1039 return;
1042 runnable.Run(CallbackForward(a1), CallbackForward(a2), CallbackForward(a3),
1043 CallbackForward(a4), CallbackForward(a5), CallbackForward(a6));
1047 template <typename ReturnType, typename Runnable,typename A1, typename A2,
1048 typename A3, typename A4, typename A5, typename A6, typename A7>
1049 struct InvokeHelper<false, ReturnType, Runnable,
1050 void(A1, A2, A3, A4, A5, A6, A7)> {
1051 static ReturnType MakeItSo(Runnable runnable, A1 a1, A2 a2, A3 a3, A4 a4,
1052 A5 a5, A6 a6, A7 a7) {
1053 return runnable.Run(CallbackForward(a1), CallbackForward(a2),
1054 CallbackForward(a3), CallbackForward(a4), CallbackForward(a5),
1055 CallbackForward(a6), CallbackForward(a7));
1059 template <typename Runnable,typename A1, typename A2, typename A3, typename A4,
1060 typename A5, typename A6, typename A7>
1061 struct InvokeHelper<false, void, Runnable,
1062 void(A1, A2, A3, A4, A5, A6, A7)> {
1063 static void MakeItSo(Runnable runnable, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5,
1064 A6 a6, A7 a7) {
1065 runnable.Run(CallbackForward(a1), CallbackForward(a2), CallbackForward(a3),
1066 CallbackForward(a4), CallbackForward(a5), CallbackForward(a6),
1067 CallbackForward(a7));
1071 template <typename Runnable, typename A1, typename A2, typename A3,
1072 typename A4, typename A5, typename A6, typename A7>
1073 struct InvokeHelper<true, void, Runnable,
1074 void(A1, A2, A3, A4, A5, A6, A7)> {
1075 static void MakeItSo(Runnable runnable, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5,
1076 A6 a6, A7 a7) {
1077 if (!a1.get()) {
1078 return;
1081 runnable.Run(CallbackForward(a1), CallbackForward(a2), CallbackForward(a3),
1082 CallbackForward(a4), CallbackForward(a5), CallbackForward(a6),
1083 CallbackForward(a7));
1087 #if !defined(_MSC_VER)
1089 template <typename ReturnType, typename Runnable, typename ArgsType>
1090 struct InvokeHelper<true, ReturnType, Runnable, ArgsType> {
1091 // WeakCalls are only supported for functions with a void return type.
1092 // Otherwise, the function result would be undefined if the the WeakPtr<>
1093 // is invalidated.
1094 COMPILE_ASSERT(is_void<ReturnType>::value,
1095 weak_ptrs_can_only_bind_to_methods_without_return_values);
1098 #endif
1100 // Invoker<>
1102 // See description at the top of the file.
1103 template <int NumBound, typename Storage, typename RunType>
1104 struct Invoker;
1106 // Arity 0 -> 0.
1107 template <typename StorageType, typename R>
1108 struct Invoker<0, StorageType, R()> {
1109 typedef R(RunType)(BindStateBase*);
1111 typedef R(UnboundRunType)();
1113 static R Run(BindStateBase* base) {
1114 StorageType* storage = static_cast<StorageType*>(base);
1116 // Local references to make debugger stepping easier. If in a debugger,
1117 // you really want to warp ahead and step through the
1118 // InvokeHelper<>::MakeItSo() call below.
1120 return InvokeHelper<StorageType::IsWeakCall::value, R,
1121 typename StorageType::RunnableType,
1122 void()>
1123 ::MakeItSo(storage->runnable_);
1127 // Arity 1 -> 1.
1128 template <typename StorageType, typename R,typename X1>
1129 struct Invoker<0, StorageType, R(X1)> {
1130 typedef R(RunType)(BindStateBase*,
1131 typename CallbackParamTraits<X1>::ForwardType);
1133 typedef R(UnboundRunType)(X1);
1135 static R Run(BindStateBase* base,
1136 typename CallbackParamTraits<X1>::ForwardType x1) {
1137 StorageType* storage = static_cast<StorageType*>(base);
1139 // Local references to make debugger stepping easier. If in a debugger,
1140 // you really want to warp ahead and step through the
1141 // InvokeHelper<>::MakeItSo() call below.
1143 return InvokeHelper<StorageType::IsWeakCall::value, R,
1144 typename StorageType::RunnableType,
1145 void(typename CallbackParamTraits<X1>::ForwardType x1)>
1146 ::MakeItSo(storage->runnable_, CallbackForward(x1));
1150 // Arity 1 -> 0.
1151 template <typename StorageType, typename R,typename X1>
1152 struct Invoker<1, StorageType, R(X1)> {
1153 typedef R(RunType)(BindStateBase*);
1155 typedef R(UnboundRunType)();
1157 static R Run(BindStateBase* base) {
1158 StorageType* storage = static_cast<StorageType*>(base);
1160 // Local references to make debugger stepping easier. If in a debugger,
1161 // you really want to warp ahead and step through the
1162 // InvokeHelper<>::MakeItSo() call below.
1163 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
1165 typename Bound1UnwrapTraits::ForwardType x1 =
1166 Bound1UnwrapTraits::Unwrap(storage->p1_);
1167 return InvokeHelper<StorageType::IsWeakCall::value, R,
1168 typename StorageType::RunnableType,
1169 void(typename Bound1UnwrapTraits::ForwardType)>
1170 ::MakeItSo(storage->runnable_, CallbackForward(x1));
1174 // Arity 2 -> 2.
1175 template <typename StorageType, typename R,typename X1, typename X2>
1176 struct Invoker<0, StorageType, R(X1, X2)> {
1177 typedef R(RunType)(BindStateBase*,
1178 typename CallbackParamTraits<X1>::ForwardType,
1179 typename CallbackParamTraits<X2>::ForwardType);
1181 typedef R(UnboundRunType)(X1, X2);
1183 static R Run(BindStateBase* base,
1184 typename CallbackParamTraits<X1>::ForwardType x1,
1185 typename CallbackParamTraits<X2>::ForwardType x2) {
1186 StorageType* storage = static_cast<StorageType*>(base);
1188 // Local references to make debugger stepping easier. If in a debugger,
1189 // you really want to warp ahead and step through the
1190 // InvokeHelper<>::MakeItSo() call below.
1192 return InvokeHelper<StorageType::IsWeakCall::value, R,
1193 typename StorageType::RunnableType,
1194 void(typename CallbackParamTraits<X1>::ForwardType x1,
1195 typename CallbackParamTraits<X2>::ForwardType x2)>
1196 ::MakeItSo(storage->runnable_, CallbackForward(x1),
1197 CallbackForward(x2));
1201 // Arity 2 -> 1.
1202 template <typename StorageType, typename R,typename X1, typename X2>
1203 struct Invoker<1, StorageType, R(X1, X2)> {
1204 typedef R(RunType)(BindStateBase*,
1205 typename CallbackParamTraits<X2>::ForwardType);
1207 typedef R(UnboundRunType)(X2);
1209 static R Run(BindStateBase* base,
1210 typename CallbackParamTraits<X2>::ForwardType x2) {
1211 StorageType* storage = static_cast<StorageType*>(base);
1213 // Local references to make debugger stepping easier. If in a debugger,
1214 // you really want to warp ahead and step through the
1215 // InvokeHelper<>::MakeItSo() call below.
1216 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
1218 typename Bound1UnwrapTraits::ForwardType x1 =
1219 Bound1UnwrapTraits::Unwrap(storage->p1_);
1220 return InvokeHelper<StorageType::IsWeakCall::value, R,
1221 typename StorageType::RunnableType,
1222 void(typename Bound1UnwrapTraits::ForwardType,
1223 typename CallbackParamTraits<X2>::ForwardType x2)>
1224 ::MakeItSo(storage->runnable_, CallbackForward(x1),
1225 CallbackForward(x2));
1229 // Arity 2 -> 0.
1230 template <typename StorageType, typename R,typename X1, typename X2>
1231 struct Invoker<2, StorageType, R(X1, X2)> {
1232 typedef R(RunType)(BindStateBase*);
1234 typedef R(UnboundRunType)();
1236 static R Run(BindStateBase* base) {
1237 StorageType* storage = static_cast<StorageType*>(base);
1239 // Local references to make debugger stepping easier. If in a debugger,
1240 // you really want to warp ahead and step through the
1241 // InvokeHelper<>::MakeItSo() call below.
1242 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
1243 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
1245 typename Bound1UnwrapTraits::ForwardType x1 =
1246 Bound1UnwrapTraits::Unwrap(storage->p1_);
1247 typename Bound2UnwrapTraits::ForwardType x2 =
1248 Bound2UnwrapTraits::Unwrap(storage->p2_);
1249 return InvokeHelper<StorageType::IsWeakCall::value, R,
1250 typename StorageType::RunnableType,
1251 void(typename Bound1UnwrapTraits::ForwardType,
1252 typename Bound2UnwrapTraits::ForwardType)>
1253 ::MakeItSo(storage->runnable_, CallbackForward(x1),
1254 CallbackForward(x2));
1258 // Arity 3 -> 3.
1259 template <typename StorageType, typename R,typename X1, typename X2,
1260 typename X3>
1261 struct Invoker<0, StorageType, R(X1, X2, X3)> {
1262 typedef R(RunType)(BindStateBase*,
1263 typename CallbackParamTraits<X1>::ForwardType,
1264 typename CallbackParamTraits<X2>::ForwardType,
1265 typename CallbackParamTraits<X3>::ForwardType);
1267 typedef R(UnboundRunType)(X1, X2, X3);
1269 static R Run(BindStateBase* base,
1270 typename CallbackParamTraits<X1>::ForwardType x1,
1271 typename CallbackParamTraits<X2>::ForwardType x2,
1272 typename CallbackParamTraits<X3>::ForwardType x3) {
1273 StorageType* storage = static_cast<StorageType*>(base);
1275 // Local references to make debugger stepping easier. If in a debugger,
1276 // you really want to warp ahead and step through the
1277 // InvokeHelper<>::MakeItSo() call below.
1279 return InvokeHelper<StorageType::IsWeakCall::value, R,
1280 typename StorageType::RunnableType,
1281 void(typename CallbackParamTraits<X1>::ForwardType x1,
1282 typename CallbackParamTraits<X2>::ForwardType x2,
1283 typename CallbackParamTraits<X3>::ForwardType x3)>
1284 ::MakeItSo(storage->runnable_, CallbackForward(x1),
1285 CallbackForward(x2), CallbackForward(x3));
1289 // Arity 3 -> 2.
1290 template <typename StorageType, typename R,typename X1, typename X2,
1291 typename X3>
1292 struct Invoker<1, StorageType, R(X1, X2, X3)> {
1293 typedef R(RunType)(BindStateBase*,
1294 typename CallbackParamTraits<X2>::ForwardType,
1295 typename CallbackParamTraits<X3>::ForwardType);
1297 typedef R(UnboundRunType)(X2, X3);
1299 static R Run(BindStateBase* base,
1300 typename CallbackParamTraits<X2>::ForwardType x2,
1301 typename CallbackParamTraits<X3>::ForwardType x3) {
1302 StorageType* storage = static_cast<StorageType*>(base);
1304 // Local references to make debugger stepping easier. If in a debugger,
1305 // you really want to warp ahead and step through the
1306 // InvokeHelper<>::MakeItSo() call below.
1307 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
1309 typename Bound1UnwrapTraits::ForwardType x1 =
1310 Bound1UnwrapTraits::Unwrap(storage->p1_);
1311 return InvokeHelper<StorageType::IsWeakCall::value, R,
1312 typename StorageType::RunnableType,
1313 void(typename Bound1UnwrapTraits::ForwardType,
1314 typename CallbackParamTraits<X2>::ForwardType x2,
1315 typename CallbackParamTraits<X3>::ForwardType x3)>
1316 ::MakeItSo(storage->runnable_, CallbackForward(x1),
1317 CallbackForward(x2), CallbackForward(x3));
1321 // Arity 3 -> 1.
1322 template <typename StorageType, typename R,typename X1, typename X2,
1323 typename X3>
1324 struct Invoker<2, StorageType, R(X1, X2, X3)> {
1325 typedef R(RunType)(BindStateBase*,
1326 typename CallbackParamTraits<X3>::ForwardType);
1328 typedef R(UnboundRunType)(X3);
1330 static R Run(BindStateBase* base,
1331 typename CallbackParamTraits<X3>::ForwardType x3) {
1332 StorageType* storage = static_cast<StorageType*>(base);
1334 // Local references to make debugger stepping easier. If in a debugger,
1335 // you really want to warp ahead and step through the
1336 // InvokeHelper<>::MakeItSo() call below.
1337 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
1338 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
1340 typename Bound1UnwrapTraits::ForwardType x1 =
1341 Bound1UnwrapTraits::Unwrap(storage->p1_);
1342 typename Bound2UnwrapTraits::ForwardType x2 =
1343 Bound2UnwrapTraits::Unwrap(storage->p2_);
1344 return InvokeHelper<StorageType::IsWeakCall::value, R,
1345 typename StorageType::RunnableType,
1346 void(typename Bound1UnwrapTraits::ForwardType,
1347 typename Bound2UnwrapTraits::ForwardType,
1348 typename CallbackParamTraits<X3>::ForwardType x3)>
1349 ::MakeItSo(storage->runnable_, CallbackForward(x1),
1350 CallbackForward(x2), CallbackForward(x3));
1354 // Arity 3 -> 0.
1355 template <typename StorageType, typename R,typename X1, typename X2,
1356 typename X3>
1357 struct Invoker<3, StorageType, R(X1, X2, X3)> {
1358 typedef R(RunType)(BindStateBase*);
1360 typedef R(UnboundRunType)();
1362 static R Run(BindStateBase* base) {
1363 StorageType* storage = static_cast<StorageType*>(base);
1365 // Local references to make debugger stepping easier. If in a debugger,
1366 // you really want to warp ahead and step through the
1367 // InvokeHelper<>::MakeItSo() call below.
1368 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
1369 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
1370 typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits;
1372 typename Bound1UnwrapTraits::ForwardType x1 =
1373 Bound1UnwrapTraits::Unwrap(storage->p1_);
1374 typename Bound2UnwrapTraits::ForwardType x2 =
1375 Bound2UnwrapTraits::Unwrap(storage->p2_);
1376 typename Bound3UnwrapTraits::ForwardType x3 =
1377 Bound3UnwrapTraits::Unwrap(storage->p3_);
1378 return InvokeHelper<StorageType::IsWeakCall::value, R,
1379 typename StorageType::RunnableType,
1380 void(typename Bound1UnwrapTraits::ForwardType,
1381 typename Bound2UnwrapTraits::ForwardType,
1382 typename Bound3UnwrapTraits::ForwardType)>
1383 ::MakeItSo(storage->runnable_, CallbackForward(x1),
1384 CallbackForward(x2), CallbackForward(x3));
1388 // Arity 4 -> 4.
1389 template <typename StorageType, typename R,typename X1, typename X2,
1390 typename X3, typename X4>
1391 struct Invoker<0, StorageType, R(X1, X2, X3, X4)> {
1392 typedef R(RunType)(BindStateBase*,
1393 typename CallbackParamTraits<X1>::ForwardType,
1394 typename CallbackParamTraits<X2>::ForwardType,
1395 typename CallbackParamTraits<X3>::ForwardType,
1396 typename CallbackParamTraits<X4>::ForwardType);
1398 typedef R(UnboundRunType)(X1, X2, X3, X4);
1400 static R Run(BindStateBase* base,
1401 typename CallbackParamTraits<X1>::ForwardType x1,
1402 typename CallbackParamTraits<X2>::ForwardType x2,
1403 typename CallbackParamTraits<X3>::ForwardType x3,
1404 typename CallbackParamTraits<X4>::ForwardType x4) {
1405 StorageType* storage = static_cast<StorageType*>(base);
1407 // Local references to make debugger stepping easier. If in a debugger,
1408 // you really want to warp ahead and step through the
1409 // InvokeHelper<>::MakeItSo() call below.
1411 return InvokeHelper<StorageType::IsWeakCall::value, R,
1412 typename StorageType::RunnableType,
1413 void(typename CallbackParamTraits<X1>::ForwardType x1,
1414 typename CallbackParamTraits<X2>::ForwardType x2,
1415 typename CallbackParamTraits<X3>::ForwardType x3,
1416 typename CallbackParamTraits<X4>::ForwardType x4)>
1417 ::MakeItSo(storage->runnable_, CallbackForward(x1),
1418 CallbackForward(x2), CallbackForward(x3),
1419 CallbackForward(x4));
1423 // Arity 4 -> 3.
1424 template <typename StorageType, typename R,typename X1, typename X2,
1425 typename X3, typename X4>
1426 struct Invoker<1, StorageType, R(X1, X2, X3, X4)> {
1427 typedef R(RunType)(BindStateBase*,
1428 typename CallbackParamTraits<X2>::ForwardType,
1429 typename CallbackParamTraits<X3>::ForwardType,
1430 typename CallbackParamTraits<X4>::ForwardType);
1432 typedef R(UnboundRunType)(X2, X3, X4);
1434 static R Run(BindStateBase* base,
1435 typename CallbackParamTraits<X2>::ForwardType x2,
1436 typename CallbackParamTraits<X3>::ForwardType x3,
1437 typename CallbackParamTraits<X4>::ForwardType x4) {
1438 StorageType* storage = static_cast<StorageType*>(base);
1440 // Local references to make debugger stepping easier. If in a debugger,
1441 // you really want to warp ahead and step through the
1442 // InvokeHelper<>::MakeItSo() call below.
1443 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
1445 typename Bound1UnwrapTraits::ForwardType x1 =
1446 Bound1UnwrapTraits::Unwrap(storage->p1_);
1447 return InvokeHelper<StorageType::IsWeakCall::value, R,
1448 typename StorageType::RunnableType,
1449 void(typename Bound1UnwrapTraits::ForwardType,
1450 typename CallbackParamTraits<X2>::ForwardType x2,
1451 typename CallbackParamTraits<X3>::ForwardType x3,
1452 typename CallbackParamTraits<X4>::ForwardType x4)>
1453 ::MakeItSo(storage->runnable_, CallbackForward(x1),
1454 CallbackForward(x2), CallbackForward(x3),
1455 CallbackForward(x4));
1459 // Arity 4 -> 2.
1460 template <typename StorageType, typename R,typename X1, typename X2,
1461 typename X3, typename X4>
1462 struct Invoker<2, StorageType, R(X1, X2, X3, X4)> {
1463 typedef R(RunType)(BindStateBase*,
1464 typename CallbackParamTraits<X3>::ForwardType,
1465 typename CallbackParamTraits<X4>::ForwardType);
1467 typedef R(UnboundRunType)(X3, X4);
1469 static R Run(BindStateBase* base,
1470 typename CallbackParamTraits<X3>::ForwardType x3,
1471 typename CallbackParamTraits<X4>::ForwardType x4) {
1472 StorageType* storage = static_cast<StorageType*>(base);
1474 // Local references to make debugger stepping easier. If in a debugger,
1475 // you really want to warp ahead and step through the
1476 // InvokeHelper<>::MakeItSo() call below.
1477 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
1478 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
1480 typename Bound1UnwrapTraits::ForwardType x1 =
1481 Bound1UnwrapTraits::Unwrap(storage->p1_);
1482 typename Bound2UnwrapTraits::ForwardType x2 =
1483 Bound2UnwrapTraits::Unwrap(storage->p2_);
1484 return InvokeHelper<StorageType::IsWeakCall::value, R,
1485 typename StorageType::RunnableType,
1486 void(typename Bound1UnwrapTraits::ForwardType,
1487 typename Bound2UnwrapTraits::ForwardType,
1488 typename CallbackParamTraits<X3>::ForwardType x3,
1489 typename CallbackParamTraits<X4>::ForwardType x4)>
1490 ::MakeItSo(storage->runnable_, CallbackForward(x1),
1491 CallbackForward(x2), CallbackForward(x3),
1492 CallbackForward(x4));
1496 // Arity 4 -> 1.
1497 template <typename StorageType, typename R,typename X1, typename X2,
1498 typename X3, typename X4>
1499 struct Invoker<3, StorageType, R(X1, X2, X3, X4)> {
1500 typedef R(RunType)(BindStateBase*,
1501 typename CallbackParamTraits<X4>::ForwardType);
1503 typedef R(UnboundRunType)(X4);
1505 static R Run(BindStateBase* base,
1506 typename CallbackParamTraits<X4>::ForwardType x4) {
1507 StorageType* storage = static_cast<StorageType*>(base);
1509 // Local references to make debugger stepping easier. If in a debugger,
1510 // you really want to warp ahead and step through the
1511 // InvokeHelper<>::MakeItSo() call below.
1512 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
1513 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
1514 typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits;
1516 typename Bound1UnwrapTraits::ForwardType x1 =
1517 Bound1UnwrapTraits::Unwrap(storage->p1_);
1518 typename Bound2UnwrapTraits::ForwardType x2 =
1519 Bound2UnwrapTraits::Unwrap(storage->p2_);
1520 typename Bound3UnwrapTraits::ForwardType x3 =
1521 Bound3UnwrapTraits::Unwrap(storage->p3_);
1522 return InvokeHelper<StorageType::IsWeakCall::value, R,
1523 typename StorageType::RunnableType,
1524 void(typename Bound1UnwrapTraits::ForwardType,
1525 typename Bound2UnwrapTraits::ForwardType,
1526 typename Bound3UnwrapTraits::ForwardType,
1527 typename CallbackParamTraits<X4>::ForwardType x4)>
1528 ::MakeItSo(storage->runnable_, CallbackForward(x1),
1529 CallbackForward(x2), CallbackForward(x3),
1530 CallbackForward(x4));
1534 // Arity 4 -> 0.
1535 template <typename StorageType, typename R,typename X1, typename X2,
1536 typename X3, typename X4>
1537 struct Invoker<4, StorageType, R(X1, X2, X3, X4)> {
1538 typedef R(RunType)(BindStateBase*);
1540 typedef R(UnboundRunType)();
1542 static R Run(BindStateBase* base) {
1543 StorageType* storage = static_cast<StorageType*>(base);
1545 // Local references to make debugger stepping easier. If in a debugger,
1546 // you really want to warp ahead and step through the
1547 // InvokeHelper<>::MakeItSo() call below.
1548 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
1549 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
1550 typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits;
1551 typedef typename StorageType::Bound4UnwrapTraits Bound4UnwrapTraits;
1553 typename Bound1UnwrapTraits::ForwardType x1 =
1554 Bound1UnwrapTraits::Unwrap(storage->p1_);
1555 typename Bound2UnwrapTraits::ForwardType x2 =
1556 Bound2UnwrapTraits::Unwrap(storage->p2_);
1557 typename Bound3UnwrapTraits::ForwardType x3 =
1558 Bound3UnwrapTraits::Unwrap(storage->p3_);
1559 typename Bound4UnwrapTraits::ForwardType x4 =
1560 Bound4UnwrapTraits::Unwrap(storage->p4_);
1561 return InvokeHelper<StorageType::IsWeakCall::value, R,
1562 typename StorageType::RunnableType,
1563 void(typename Bound1UnwrapTraits::ForwardType,
1564 typename Bound2UnwrapTraits::ForwardType,
1565 typename Bound3UnwrapTraits::ForwardType,
1566 typename Bound4UnwrapTraits::ForwardType)>
1567 ::MakeItSo(storage->runnable_, CallbackForward(x1),
1568 CallbackForward(x2), CallbackForward(x3),
1569 CallbackForward(x4));
1573 // Arity 5 -> 5.
1574 template <typename StorageType, typename R,typename X1, typename X2,
1575 typename X3, typename X4, typename X5>
1576 struct Invoker<0, StorageType, R(X1, X2, X3, X4, X5)> {
1577 typedef R(RunType)(BindStateBase*,
1578 typename CallbackParamTraits<X1>::ForwardType,
1579 typename CallbackParamTraits<X2>::ForwardType,
1580 typename CallbackParamTraits<X3>::ForwardType,
1581 typename CallbackParamTraits<X4>::ForwardType,
1582 typename CallbackParamTraits<X5>::ForwardType);
1584 typedef R(UnboundRunType)(X1, X2, X3, X4, X5);
1586 static R Run(BindStateBase* base,
1587 typename CallbackParamTraits<X1>::ForwardType x1,
1588 typename CallbackParamTraits<X2>::ForwardType x2,
1589 typename CallbackParamTraits<X3>::ForwardType x3,
1590 typename CallbackParamTraits<X4>::ForwardType x4,
1591 typename CallbackParamTraits<X5>::ForwardType x5) {
1592 StorageType* storage = static_cast<StorageType*>(base);
1594 // Local references to make debugger stepping easier. If in a debugger,
1595 // you really want to warp ahead and step through the
1596 // InvokeHelper<>::MakeItSo() call below.
1598 return InvokeHelper<StorageType::IsWeakCall::value, R,
1599 typename StorageType::RunnableType,
1600 void(typename CallbackParamTraits<X1>::ForwardType x1,
1601 typename CallbackParamTraits<X2>::ForwardType x2,
1602 typename CallbackParamTraits<X3>::ForwardType x3,
1603 typename CallbackParamTraits<X4>::ForwardType x4,
1604 typename CallbackParamTraits<X5>::ForwardType x5)>
1605 ::MakeItSo(storage->runnable_, CallbackForward(x1),
1606 CallbackForward(x2), CallbackForward(x3),
1607 CallbackForward(x4), CallbackForward(x5));
1611 // Arity 5 -> 4.
1612 template <typename StorageType, typename R,typename X1, typename X2,
1613 typename X3, typename X4, typename X5>
1614 struct Invoker<1, StorageType, R(X1, X2, X3, X4, X5)> {
1615 typedef R(RunType)(BindStateBase*,
1616 typename CallbackParamTraits<X2>::ForwardType,
1617 typename CallbackParamTraits<X3>::ForwardType,
1618 typename CallbackParamTraits<X4>::ForwardType,
1619 typename CallbackParamTraits<X5>::ForwardType);
1621 typedef R(UnboundRunType)(X2, X3, X4, X5);
1623 static R Run(BindStateBase* base,
1624 typename CallbackParamTraits<X2>::ForwardType x2,
1625 typename CallbackParamTraits<X3>::ForwardType x3,
1626 typename CallbackParamTraits<X4>::ForwardType x4,
1627 typename CallbackParamTraits<X5>::ForwardType x5) {
1628 StorageType* storage = static_cast<StorageType*>(base);
1630 // Local references to make debugger stepping easier. If in a debugger,
1631 // you really want to warp ahead and step through the
1632 // InvokeHelper<>::MakeItSo() call below.
1633 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
1635 typename Bound1UnwrapTraits::ForwardType x1 =
1636 Bound1UnwrapTraits::Unwrap(storage->p1_);
1637 return InvokeHelper<StorageType::IsWeakCall::value, R,
1638 typename StorageType::RunnableType,
1639 void(typename Bound1UnwrapTraits::ForwardType,
1640 typename CallbackParamTraits<X2>::ForwardType x2,
1641 typename CallbackParamTraits<X3>::ForwardType x3,
1642 typename CallbackParamTraits<X4>::ForwardType x4,
1643 typename CallbackParamTraits<X5>::ForwardType x5)>
1644 ::MakeItSo(storage->runnable_, CallbackForward(x1),
1645 CallbackForward(x2), CallbackForward(x3),
1646 CallbackForward(x4), CallbackForward(x5));
1650 // Arity 5 -> 3.
1651 template <typename StorageType, typename R,typename X1, typename X2,
1652 typename X3, typename X4, typename X5>
1653 struct Invoker<2, StorageType, R(X1, X2, X3, X4, X5)> {
1654 typedef R(RunType)(BindStateBase*,
1655 typename CallbackParamTraits<X3>::ForwardType,
1656 typename CallbackParamTraits<X4>::ForwardType,
1657 typename CallbackParamTraits<X5>::ForwardType);
1659 typedef R(UnboundRunType)(X3, X4, X5);
1661 static R Run(BindStateBase* base,
1662 typename CallbackParamTraits<X3>::ForwardType x3,
1663 typename CallbackParamTraits<X4>::ForwardType x4,
1664 typename CallbackParamTraits<X5>::ForwardType x5) {
1665 StorageType* storage = static_cast<StorageType*>(base);
1667 // Local references to make debugger stepping easier. If in a debugger,
1668 // you really want to warp ahead and step through the
1669 // InvokeHelper<>::MakeItSo() call below.
1670 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
1671 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
1673 typename Bound1UnwrapTraits::ForwardType x1 =
1674 Bound1UnwrapTraits::Unwrap(storage->p1_);
1675 typename Bound2UnwrapTraits::ForwardType x2 =
1676 Bound2UnwrapTraits::Unwrap(storage->p2_);
1677 return InvokeHelper<StorageType::IsWeakCall::value, R,
1678 typename StorageType::RunnableType,
1679 void(typename Bound1UnwrapTraits::ForwardType,
1680 typename Bound2UnwrapTraits::ForwardType,
1681 typename CallbackParamTraits<X3>::ForwardType x3,
1682 typename CallbackParamTraits<X4>::ForwardType x4,
1683 typename CallbackParamTraits<X5>::ForwardType x5)>
1684 ::MakeItSo(storage->runnable_, CallbackForward(x1),
1685 CallbackForward(x2), CallbackForward(x3),
1686 CallbackForward(x4), CallbackForward(x5));
1690 // Arity 5 -> 2.
1691 template <typename StorageType, typename R,typename X1, typename X2,
1692 typename X3, typename X4, typename X5>
1693 struct Invoker<3, StorageType, R(X1, X2, X3, X4, X5)> {
1694 typedef R(RunType)(BindStateBase*,
1695 typename CallbackParamTraits<X4>::ForwardType,
1696 typename CallbackParamTraits<X5>::ForwardType);
1698 typedef R(UnboundRunType)(X4, X5);
1700 static R Run(BindStateBase* base,
1701 typename CallbackParamTraits<X4>::ForwardType x4,
1702 typename CallbackParamTraits<X5>::ForwardType x5) {
1703 StorageType* storage = static_cast<StorageType*>(base);
1705 // Local references to make debugger stepping easier. If in a debugger,
1706 // you really want to warp ahead and step through the
1707 // InvokeHelper<>::MakeItSo() call below.
1708 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
1709 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
1710 typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits;
1712 typename Bound1UnwrapTraits::ForwardType x1 =
1713 Bound1UnwrapTraits::Unwrap(storage->p1_);
1714 typename Bound2UnwrapTraits::ForwardType x2 =
1715 Bound2UnwrapTraits::Unwrap(storage->p2_);
1716 typename Bound3UnwrapTraits::ForwardType x3 =
1717 Bound3UnwrapTraits::Unwrap(storage->p3_);
1718 return InvokeHelper<StorageType::IsWeakCall::value, R,
1719 typename StorageType::RunnableType,
1720 void(typename Bound1UnwrapTraits::ForwardType,
1721 typename Bound2UnwrapTraits::ForwardType,
1722 typename Bound3UnwrapTraits::ForwardType,
1723 typename CallbackParamTraits<X4>::ForwardType x4,
1724 typename CallbackParamTraits<X5>::ForwardType x5)>
1725 ::MakeItSo(storage->runnable_, CallbackForward(x1),
1726 CallbackForward(x2), CallbackForward(x3),
1727 CallbackForward(x4), CallbackForward(x5));
1731 // Arity 5 -> 1.
1732 template <typename StorageType, typename R,typename X1, typename X2,
1733 typename X3, typename X4, typename X5>
1734 struct Invoker<4, StorageType, R(X1, X2, X3, X4, X5)> {
1735 typedef R(RunType)(BindStateBase*,
1736 typename CallbackParamTraits<X5>::ForwardType);
1738 typedef R(UnboundRunType)(X5);
1740 static R Run(BindStateBase* base,
1741 typename CallbackParamTraits<X5>::ForwardType x5) {
1742 StorageType* storage = static_cast<StorageType*>(base);
1744 // Local references to make debugger stepping easier. If in a debugger,
1745 // you really want to warp ahead and step through the
1746 // InvokeHelper<>::MakeItSo() call below.
1747 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
1748 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
1749 typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits;
1750 typedef typename StorageType::Bound4UnwrapTraits Bound4UnwrapTraits;
1752 typename Bound1UnwrapTraits::ForwardType x1 =
1753 Bound1UnwrapTraits::Unwrap(storage->p1_);
1754 typename Bound2UnwrapTraits::ForwardType x2 =
1755 Bound2UnwrapTraits::Unwrap(storage->p2_);
1756 typename Bound3UnwrapTraits::ForwardType x3 =
1757 Bound3UnwrapTraits::Unwrap(storage->p3_);
1758 typename Bound4UnwrapTraits::ForwardType x4 =
1759 Bound4UnwrapTraits::Unwrap(storage->p4_);
1760 return InvokeHelper<StorageType::IsWeakCall::value, R,
1761 typename StorageType::RunnableType,
1762 void(typename Bound1UnwrapTraits::ForwardType,
1763 typename Bound2UnwrapTraits::ForwardType,
1764 typename Bound3UnwrapTraits::ForwardType,
1765 typename Bound4UnwrapTraits::ForwardType,
1766 typename CallbackParamTraits<X5>::ForwardType x5)>
1767 ::MakeItSo(storage->runnable_, CallbackForward(x1),
1768 CallbackForward(x2), CallbackForward(x3),
1769 CallbackForward(x4), CallbackForward(x5));
1773 // Arity 5 -> 0.
1774 template <typename StorageType, typename R,typename X1, typename X2,
1775 typename X3, typename X4, typename X5>
1776 struct Invoker<5, StorageType, R(X1, X2, X3, X4, X5)> {
1777 typedef R(RunType)(BindStateBase*);
1779 typedef R(UnboundRunType)();
1781 static R Run(BindStateBase* base) {
1782 StorageType* storage = static_cast<StorageType*>(base);
1784 // Local references to make debugger stepping easier. If in a debugger,
1785 // you really want to warp ahead and step through the
1786 // InvokeHelper<>::MakeItSo() call below.
1787 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
1788 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
1789 typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits;
1790 typedef typename StorageType::Bound4UnwrapTraits Bound4UnwrapTraits;
1791 typedef typename StorageType::Bound5UnwrapTraits Bound5UnwrapTraits;
1793 typename Bound1UnwrapTraits::ForwardType x1 =
1794 Bound1UnwrapTraits::Unwrap(storage->p1_);
1795 typename Bound2UnwrapTraits::ForwardType x2 =
1796 Bound2UnwrapTraits::Unwrap(storage->p2_);
1797 typename Bound3UnwrapTraits::ForwardType x3 =
1798 Bound3UnwrapTraits::Unwrap(storage->p3_);
1799 typename Bound4UnwrapTraits::ForwardType x4 =
1800 Bound4UnwrapTraits::Unwrap(storage->p4_);
1801 typename Bound5UnwrapTraits::ForwardType x5 =
1802 Bound5UnwrapTraits::Unwrap(storage->p5_);
1803 return InvokeHelper<StorageType::IsWeakCall::value, R,
1804 typename StorageType::RunnableType,
1805 void(typename Bound1UnwrapTraits::ForwardType,
1806 typename Bound2UnwrapTraits::ForwardType,
1807 typename Bound3UnwrapTraits::ForwardType,
1808 typename Bound4UnwrapTraits::ForwardType,
1809 typename Bound5UnwrapTraits::ForwardType)>
1810 ::MakeItSo(storage->runnable_, CallbackForward(x1),
1811 CallbackForward(x2), CallbackForward(x3),
1812 CallbackForward(x4), CallbackForward(x5));
1816 // Arity 6 -> 6.
1817 template <typename StorageType, typename R,typename X1, typename X2,
1818 typename X3, typename X4, typename X5, typename X6>
1819 struct Invoker<0, StorageType, R(X1, X2, X3, X4, X5, X6)> {
1820 typedef R(RunType)(BindStateBase*,
1821 typename CallbackParamTraits<X1>::ForwardType,
1822 typename CallbackParamTraits<X2>::ForwardType,
1823 typename CallbackParamTraits<X3>::ForwardType,
1824 typename CallbackParamTraits<X4>::ForwardType,
1825 typename CallbackParamTraits<X5>::ForwardType,
1826 typename CallbackParamTraits<X6>::ForwardType);
1828 typedef R(UnboundRunType)(X1, X2, X3, X4, X5, X6);
1830 static R Run(BindStateBase* base,
1831 typename CallbackParamTraits<X1>::ForwardType x1,
1832 typename CallbackParamTraits<X2>::ForwardType x2,
1833 typename CallbackParamTraits<X3>::ForwardType x3,
1834 typename CallbackParamTraits<X4>::ForwardType x4,
1835 typename CallbackParamTraits<X5>::ForwardType x5,
1836 typename CallbackParamTraits<X6>::ForwardType x6) {
1837 StorageType* storage = static_cast<StorageType*>(base);
1839 // Local references to make debugger stepping easier. If in a debugger,
1840 // you really want to warp ahead and step through the
1841 // InvokeHelper<>::MakeItSo() call below.
1843 return InvokeHelper<StorageType::IsWeakCall::value, R,
1844 typename StorageType::RunnableType,
1845 void(typename CallbackParamTraits<X1>::ForwardType x1,
1846 typename CallbackParamTraits<X2>::ForwardType x2,
1847 typename CallbackParamTraits<X3>::ForwardType x3,
1848 typename CallbackParamTraits<X4>::ForwardType x4,
1849 typename CallbackParamTraits<X5>::ForwardType x5,
1850 typename CallbackParamTraits<X6>::ForwardType x6)>
1851 ::MakeItSo(storage->runnable_, CallbackForward(x1),
1852 CallbackForward(x2), CallbackForward(x3),
1853 CallbackForward(x4), CallbackForward(x5),
1854 CallbackForward(x6));
1858 // Arity 6 -> 5.
1859 template <typename StorageType, typename R,typename X1, typename X2,
1860 typename X3, typename X4, typename X5, typename X6>
1861 struct Invoker<1, StorageType, R(X1, X2, X3, X4, X5, X6)> {
1862 typedef R(RunType)(BindStateBase*,
1863 typename CallbackParamTraits<X2>::ForwardType,
1864 typename CallbackParamTraits<X3>::ForwardType,
1865 typename CallbackParamTraits<X4>::ForwardType,
1866 typename CallbackParamTraits<X5>::ForwardType,
1867 typename CallbackParamTraits<X6>::ForwardType);
1869 typedef R(UnboundRunType)(X2, X3, X4, X5, X6);
1871 static R Run(BindStateBase* base,
1872 typename CallbackParamTraits<X2>::ForwardType x2,
1873 typename CallbackParamTraits<X3>::ForwardType x3,
1874 typename CallbackParamTraits<X4>::ForwardType x4,
1875 typename CallbackParamTraits<X5>::ForwardType x5,
1876 typename CallbackParamTraits<X6>::ForwardType x6) {
1877 StorageType* storage = static_cast<StorageType*>(base);
1879 // Local references to make debugger stepping easier. If in a debugger,
1880 // you really want to warp ahead and step through the
1881 // InvokeHelper<>::MakeItSo() call below.
1882 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
1884 typename Bound1UnwrapTraits::ForwardType x1 =
1885 Bound1UnwrapTraits::Unwrap(storage->p1_);
1886 return InvokeHelper<StorageType::IsWeakCall::value, R,
1887 typename StorageType::RunnableType,
1888 void(typename Bound1UnwrapTraits::ForwardType,
1889 typename CallbackParamTraits<X2>::ForwardType x2,
1890 typename CallbackParamTraits<X3>::ForwardType x3,
1891 typename CallbackParamTraits<X4>::ForwardType x4,
1892 typename CallbackParamTraits<X5>::ForwardType x5,
1893 typename CallbackParamTraits<X6>::ForwardType x6)>
1894 ::MakeItSo(storage->runnable_, CallbackForward(x1),
1895 CallbackForward(x2), CallbackForward(x3),
1896 CallbackForward(x4), CallbackForward(x5),
1897 CallbackForward(x6));
1901 // Arity 6 -> 4.
1902 template <typename StorageType, typename R,typename X1, typename X2,
1903 typename X3, typename X4, typename X5, typename X6>
1904 struct Invoker<2, StorageType, R(X1, X2, X3, X4, X5, X6)> {
1905 typedef R(RunType)(BindStateBase*,
1906 typename CallbackParamTraits<X3>::ForwardType,
1907 typename CallbackParamTraits<X4>::ForwardType,
1908 typename CallbackParamTraits<X5>::ForwardType,
1909 typename CallbackParamTraits<X6>::ForwardType);
1911 typedef R(UnboundRunType)(X3, X4, X5, X6);
1913 static R Run(BindStateBase* base,
1914 typename CallbackParamTraits<X3>::ForwardType x3,
1915 typename CallbackParamTraits<X4>::ForwardType x4,
1916 typename CallbackParamTraits<X5>::ForwardType x5,
1917 typename CallbackParamTraits<X6>::ForwardType x6) {
1918 StorageType* storage = static_cast<StorageType*>(base);
1920 // Local references to make debugger stepping easier. If in a debugger,
1921 // you really want to warp ahead and step through the
1922 // InvokeHelper<>::MakeItSo() call below.
1923 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
1924 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
1926 typename Bound1UnwrapTraits::ForwardType x1 =
1927 Bound1UnwrapTraits::Unwrap(storage->p1_);
1928 typename Bound2UnwrapTraits::ForwardType x2 =
1929 Bound2UnwrapTraits::Unwrap(storage->p2_);
1930 return InvokeHelper<StorageType::IsWeakCall::value, R,
1931 typename StorageType::RunnableType,
1932 void(typename Bound1UnwrapTraits::ForwardType,
1933 typename Bound2UnwrapTraits::ForwardType,
1934 typename CallbackParamTraits<X3>::ForwardType x3,
1935 typename CallbackParamTraits<X4>::ForwardType x4,
1936 typename CallbackParamTraits<X5>::ForwardType x5,
1937 typename CallbackParamTraits<X6>::ForwardType x6)>
1938 ::MakeItSo(storage->runnable_, CallbackForward(x1),
1939 CallbackForward(x2), CallbackForward(x3),
1940 CallbackForward(x4), CallbackForward(x5),
1941 CallbackForward(x6));
1945 // Arity 6 -> 3.
1946 template <typename StorageType, typename R,typename X1, typename X2,
1947 typename X3, typename X4, typename X5, typename X6>
1948 struct Invoker<3, StorageType, R(X1, X2, X3, X4, X5, X6)> {
1949 typedef R(RunType)(BindStateBase*,
1950 typename CallbackParamTraits<X4>::ForwardType,
1951 typename CallbackParamTraits<X5>::ForwardType,
1952 typename CallbackParamTraits<X6>::ForwardType);
1954 typedef R(UnboundRunType)(X4, X5, X6);
1956 static R Run(BindStateBase* base,
1957 typename CallbackParamTraits<X4>::ForwardType x4,
1958 typename CallbackParamTraits<X5>::ForwardType x5,
1959 typename CallbackParamTraits<X6>::ForwardType x6) {
1960 StorageType* storage = static_cast<StorageType*>(base);
1962 // Local references to make debugger stepping easier. If in a debugger,
1963 // you really want to warp ahead and step through the
1964 // InvokeHelper<>::MakeItSo() call below.
1965 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
1966 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
1967 typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits;
1969 typename Bound1UnwrapTraits::ForwardType x1 =
1970 Bound1UnwrapTraits::Unwrap(storage->p1_);
1971 typename Bound2UnwrapTraits::ForwardType x2 =
1972 Bound2UnwrapTraits::Unwrap(storage->p2_);
1973 typename Bound3UnwrapTraits::ForwardType x3 =
1974 Bound3UnwrapTraits::Unwrap(storage->p3_);
1975 return InvokeHelper<StorageType::IsWeakCall::value, R,
1976 typename StorageType::RunnableType,
1977 void(typename Bound1UnwrapTraits::ForwardType,
1978 typename Bound2UnwrapTraits::ForwardType,
1979 typename Bound3UnwrapTraits::ForwardType,
1980 typename CallbackParamTraits<X4>::ForwardType x4,
1981 typename CallbackParamTraits<X5>::ForwardType x5,
1982 typename CallbackParamTraits<X6>::ForwardType x6)>
1983 ::MakeItSo(storage->runnable_, CallbackForward(x1),
1984 CallbackForward(x2), CallbackForward(x3),
1985 CallbackForward(x4), CallbackForward(x5),
1986 CallbackForward(x6));
1990 // Arity 6 -> 2.
1991 template <typename StorageType, typename R,typename X1, typename X2,
1992 typename X3, typename X4, typename X5, typename X6>
1993 struct Invoker<4, StorageType, R(X1, X2, X3, X4, X5, X6)> {
1994 typedef R(RunType)(BindStateBase*,
1995 typename CallbackParamTraits<X5>::ForwardType,
1996 typename CallbackParamTraits<X6>::ForwardType);
1998 typedef R(UnboundRunType)(X5, X6);
2000 static R Run(BindStateBase* base,
2001 typename CallbackParamTraits<X5>::ForwardType x5,
2002 typename CallbackParamTraits<X6>::ForwardType x6) {
2003 StorageType* storage = static_cast<StorageType*>(base);
2005 // Local references to make debugger stepping easier. If in a debugger,
2006 // you really want to warp ahead and step through the
2007 // InvokeHelper<>::MakeItSo() call below.
2008 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
2009 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
2010 typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits;
2011 typedef typename StorageType::Bound4UnwrapTraits Bound4UnwrapTraits;
2013 typename Bound1UnwrapTraits::ForwardType x1 =
2014 Bound1UnwrapTraits::Unwrap(storage->p1_);
2015 typename Bound2UnwrapTraits::ForwardType x2 =
2016 Bound2UnwrapTraits::Unwrap(storage->p2_);
2017 typename Bound3UnwrapTraits::ForwardType x3 =
2018 Bound3UnwrapTraits::Unwrap(storage->p3_);
2019 typename Bound4UnwrapTraits::ForwardType x4 =
2020 Bound4UnwrapTraits::Unwrap(storage->p4_);
2021 return InvokeHelper<StorageType::IsWeakCall::value, R,
2022 typename StorageType::RunnableType,
2023 void(typename Bound1UnwrapTraits::ForwardType,
2024 typename Bound2UnwrapTraits::ForwardType,
2025 typename Bound3UnwrapTraits::ForwardType,
2026 typename Bound4UnwrapTraits::ForwardType,
2027 typename CallbackParamTraits<X5>::ForwardType x5,
2028 typename CallbackParamTraits<X6>::ForwardType x6)>
2029 ::MakeItSo(storage->runnable_, CallbackForward(x1),
2030 CallbackForward(x2), CallbackForward(x3),
2031 CallbackForward(x4), CallbackForward(x5),
2032 CallbackForward(x6));
2036 // Arity 6 -> 1.
2037 template <typename StorageType, typename R,typename X1, typename X2,
2038 typename X3, typename X4, typename X5, typename X6>
2039 struct Invoker<5, StorageType, R(X1, X2, X3, X4, X5, X6)> {
2040 typedef R(RunType)(BindStateBase*,
2041 typename CallbackParamTraits<X6>::ForwardType);
2043 typedef R(UnboundRunType)(X6);
2045 static R Run(BindStateBase* base,
2046 typename CallbackParamTraits<X6>::ForwardType x6) {
2047 StorageType* storage = static_cast<StorageType*>(base);
2049 // Local references to make debugger stepping easier. If in a debugger,
2050 // you really want to warp ahead and step through the
2051 // InvokeHelper<>::MakeItSo() call below.
2052 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
2053 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
2054 typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits;
2055 typedef typename StorageType::Bound4UnwrapTraits Bound4UnwrapTraits;
2056 typedef typename StorageType::Bound5UnwrapTraits Bound5UnwrapTraits;
2058 typename Bound1UnwrapTraits::ForwardType x1 =
2059 Bound1UnwrapTraits::Unwrap(storage->p1_);
2060 typename Bound2UnwrapTraits::ForwardType x2 =
2061 Bound2UnwrapTraits::Unwrap(storage->p2_);
2062 typename Bound3UnwrapTraits::ForwardType x3 =
2063 Bound3UnwrapTraits::Unwrap(storage->p3_);
2064 typename Bound4UnwrapTraits::ForwardType x4 =
2065 Bound4UnwrapTraits::Unwrap(storage->p4_);
2066 typename Bound5UnwrapTraits::ForwardType x5 =
2067 Bound5UnwrapTraits::Unwrap(storage->p5_);
2068 return InvokeHelper<StorageType::IsWeakCall::value, R,
2069 typename StorageType::RunnableType,
2070 void(typename Bound1UnwrapTraits::ForwardType,
2071 typename Bound2UnwrapTraits::ForwardType,
2072 typename Bound3UnwrapTraits::ForwardType,
2073 typename Bound4UnwrapTraits::ForwardType,
2074 typename Bound5UnwrapTraits::ForwardType,
2075 typename CallbackParamTraits<X6>::ForwardType x6)>
2076 ::MakeItSo(storage->runnable_, CallbackForward(x1),
2077 CallbackForward(x2), CallbackForward(x3),
2078 CallbackForward(x4), CallbackForward(x5),
2079 CallbackForward(x6));
2083 // Arity 6 -> 0.
2084 template <typename StorageType, typename R,typename X1, typename X2,
2085 typename X3, typename X4, typename X5, typename X6>
2086 struct Invoker<6, StorageType, R(X1, X2, X3, X4, X5, X6)> {
2087 typedef R(RunType)(BindStateBase*);
2089 typedef R(UnboundRunType)();
2091 static R Run(BindStateBase* base) {
2092 StorageType* storage = static_cast<StorageType*>(base);
2094 // Local references to make debugger stepping easier. If in a debugger,
2095 // you really want to warp ahead and step through the
2096 // InvokeHelper<>::MakeItSo() call below.
2097 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
2098 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
2099 typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits;
2100 typedef typename StorageType::Bound4UnwrapTraits Bound4UnwrapTraits;
2101 typedef typename StorageType::Bound5UnwrapTraits Bound5UnwrapTraits;
2102 typedef typename StorageType::Bound6UnwrapTraits Bound6UnwrapTraits;
2104 typename Bound1UnwrapTraits::ForwardType x1 =
2105 Bound1UnwrapTraits::Unwrap(storage->p1_);
2106 typename Bound2UnwrapTraits::ForwardType x2 =
2107 Bound2UnwrapTraits::Unwrap(storage->p2_);
2108 typename Bound3UnwrapTraits::ForwardType x3 =
2109 Bound3UnwrapTraits::Unwrap(storage->p3_);
2110 typename Bound4UnwrapTraits::ForwardType x4 =
2111 Bound4UnwrapTraits::Unwrap(storage->p4_);
2112 typename Bound5UnwrapTraits::ForwardType x5 =
2113 Bound5UnwrapTraits::Unwrap(storage->p5_);
2114 typename Bound6UnwrapTraits::ForwardType x6 =
2115 Bound6UnwrapTraits::Unwrap(storage->p6_);
2116 return InvokeHelper<StorageType::IsWeakCall::value, R,
2117 typename StorageType::RunnableType,
2118 void(typename Bound1UnwrapTraits::ForwardType,
2119 typename Bound2UnwrapTraits::ForwardType,
2120 typename Bound3UnwrapTraits::ForwardType,
2121 typename Bound4UnwrapTraits::ForwardType,
2122 typename Bound5UnwrapTraits::ForwardType,
2123 typename Bound6UnwrapTraits::ForwardType)>
2124 ::MakeItSo(storage->runnable_, CallbackForward(x1),
2125 CallbackForward(x2), CallbackForward(x3),
2126 CallbackForward(x4), CallbackForward(x5),
2127 CallbackForward(x6));
2131 // Arity 7 -> 7.
2132 template <typename StorageType, typename R,typename X1, typename X2,
2133 typename X3, typename X4, typename X5, typename X6, typename X7>
2134 struct Invoker<0, StorageType, R(X1, X2, X3, X4, X5, X6, X7)> {
2135 typedef R(RunType)(BindStateBase*,
2136 typename CallbackParamTraits<X1>::ForwardType,
2137 typename CallbackParamTraits<X2>::ForwardType,
2138 typename CallbackParamTraits<X3>::ForwardType,
2139 typename CallbackParamTraits<X4>::ForwardType,
2140 typename CallbackParamTraits<X5>::ForwardType,
2141 typename CallbackParamTraits<X6>::ForwardType,
2142 typename CallbackParamTraits<X7>::ForwardType);
2144 typedef R(UnboundRunType)(X1, X2, X3, X4, X5, X6, X7);
2146 static R Run(BindStateBase* base,
2147 typename CallbackParamTraits<X1>::ForwardType x1,
2148 typename CallbackParamTraits<X2>::ForwardType x2,
2149 typename CallbackParamTraits<X3>::ForwardType x3,
2150 typename CallbackParamTraits<X4>::ForwardType x4,
2151 typename CallbackParamTraits<X5>::ForwardType x5,
2152 typename CallbackParamTraits<X6>::ForwardType x6,
2153 typename CallbackParamTraits<X7>::ForwardType x7) {
2154 StorageType* storage = static_cast<StorageType*>(base);
2156 // Local references to make debugger stepping easier. If in a debugger,
2157 // you really want to warp ahead and step through the
2158 // InvokeHelper<>::MakeItSo() call below.
2160 return InvokeHelper<StorageType::IsWeakCall::value, R,
2161 typename StorageType::RunnableType,
2162 void(typename CallbackParamTraits<X1>::ForwardType x1,
2163 typename CallbackParamTraits<X2>::ForwardType x2,
2164 typename CallbackParamTraits<X3>::ForwardType x3,
2165 typename CallbackParamTraits<X4>::ForwardType x4,
2166 typename CallbackParamTraits<X5>::ForwardType x5,
2167 typename CallbackParamTraits<X6>::ForwardType x6,
2168 typename CallbackParamTraits<X7>::ForwardType x7)>
2169 ::MakeItSo(storage->runnable_, CallbackForward(x1),
2170 CallbackForward(x2), CallbackForward(x3),
2171 CallbackForward(x4), CallbackForward(x5),
2172 CallbackForward(x6), CallbackForward(x7));
2176 // Arity 7 -> 6.
2177 template <typename StorageType, typename R,typename X1, typename X2,
2178 typename X3, typename X4, typename X5, typename X6, typename X7>
2179 struct Invoker<1, StorageType, R(X1, X2, X3, X4, X5, X6, X7)> {
2180 typedef R(RunType)(BindStateBase*,
2181 typename CallbackParamTraits<X2>::ForwardType,
2182 typename CallbackParamTraits<X3>::ForwardType,
2183 typename CallbackParamTraits<X4>::ForwardType,
2184 typename CallbackParamTraits<X5>::ForwardType,
2185 typename CallbackParamTraits<X6>::ForwardType,
2186 typename CallbackParamTraits<X7>::ForwardType);
2188 typedef R(UnboundRunType)(X2, X3, X4, X5, X6, X7);
2190 static R Run(BindStateBase* base,
2191 typename CallbackParamTraits<X2>::ForwardType x2,
2192 typename CallbackParamTraits<X3>::ForwardType x3,
2193 typename CallbackParamTraits<X4>::ForwardType x4,
2194 typename CallbackParamTraits<X5>::ForwardType x5,
2195 typename CallbackParamTraits<X6>::ForwardType x6,
2196 typename CallbackParamTraits<X7>::ForwardType x7) {
2197 StorageType* storage = static_cast<StorageType*>(base);
2199 // Local references to make debugger stepping easier. If in a debugger,
2200 // you really want to warp ahead and step through the
2201 // InvokeHelper<>::MakeItSo() call below.
2202 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
2204 typename Bound1UnwrapTraits::ForwardType x1 =
2205 Bound1UnwrapTraits::Unwrap(storage->p1_);
2206 return InvokeHelper<StorageType::IsWeakCall::value, R,
2207 typename StorageType::RunnableType,
2208 void(typename Bound1UnwrapTraits::ForwardType,
2209 typename CallbackParamTraits<X2>::ForwardType x2,
2210 typename CallbackParamTraits<X3>::ForwardType x3,
2211 typename CallbackParamTraits<X4>::ForwardType x4,
2212 typename CallbackParamTraits<X5>::ForwardType x5,
2213 typename CallbackParamTraits<X6>::ForwardType x6,
2214 typename CallbackParamTraits<X7>::ForwardType x7)>
2215 ::MakeItSo(storage->runnable_, CallbackForward(x1),
2216 CallbackForward(x2), CallbackForward(x3),
2217 CallbackForward(x4), CallbackForward(x5),
2218 CallbackForward(x6), CallbackForward(x7));
2222 // Arity 7 -> 5.
2223 template <typename StorageType, typename R,typename X1, typename X2,
2224 typename X3, typename X4, typename X5, typename X6, typename X7>
2225 struct Invoker<2, StorageType, R(X1, X2, X3, X4, X5, X6, X7)> {
2226 typedef R(RunType)(BindStateBase*,
2227 typename CallbackParamTraits<X3>::ForwardType,
2228 typename CallbackParamTraits<X4>::ForwardType,
2229 typename CallbackParamTraits<X5>::ForwardType,
2230 typename CallbackParamTraits<X6>::ForwardType,
2231 typename CallbackParamTraits<X7>::ForwardType);
2233 typedef R(UnboundRunType)(X3, X4, X5, X6, X7);
2235 static R Run(BindStateBase* base,
2236 typename CallbackParamTraits<X3>::ForwardType x3,
2237 typename CallbackParamTraits<X4>::ForwardType x4,
2238 typename CallbackParamTraits<X5>::ForwardType x5,
2239 typename CallbackParamTraits<X6>::ForwardType x6,
2240 typename CallbackParamTraits<X7>::ForwardType x7) {
2241 StorageType* storage = static_cast<StorageType*>(base);
2243 // Local references to make debugger stepping easier. If in a debugger,
2244 // you really want to warp ahead and step through the
2245 // InvokeHelper<>::MakeItSo() call below.
2246 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
2247 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
2249 typename Bound1UnwrapTraits::ForwardType x1 =
2250 Bound1UnwrapTraits::Unwrap(storage->p1_);
2251 typename Bound2UnwrapTraits::ForwardType x2 =
2252 Bound2UnwrapTraits::Unwrap(storage->p2_);
2253 return InvokeHelper<StorageType::IsWeakCall::value, R,
2254 typename StorageType::RunnableType,
2255 void(typename Bound1UnwrapTraits::ForwardType,
2256 typename Bound2UnwrapTraits::ForwardType,
2257 typename CallbackParamTraits<X3>::ForwardType x3,
2258 typename CallbackParamTraits<X4>::ForwardType x4,
2259 typename CallbackParamTraits<X5>::ForwardType x5,
2260 typename CallbackParamTraits<X6>::ForwardType x6,
2261 typename CallbackParamTraits<X7>::ForwardType x7)>
2262 ::MakeItSo(storage->runnable_, CallbackForward(x1),
2263 CallbackForward(x2), CallbackForward(x3),
2264 CallbackForward(x4), CallbackForward(x5),
2265 CallbackForward(x6), CallbackForward(x7));
2269 // Arity 7 -> 4.
2270 template <typename StorageType, typename R,typename X1, typename X2,
2271 typename X3, typename X4, typename X5, typename X6, typename X7>
2272 struct Invoker<3, StorageType, R(X1, X2, X3, X4, X5, X6, X7)> {
2273 typedef R(RunType)(BindStateBase*,
2274 typename CallbackParamTraits<X4>::ForwardType,
2275 typename CallbackParamTraits<X5>::ForwardType,
2276 typename CallbackParamTraits<X6>::ForwardType,
2277 typename CallbackParamTraits<X7>::ForwardType);
2279 typedef R(UnboundRunType)(X4, X5, X6, X7);
2281 static R Run(BindStateBase* base,
2282 typename CallbackParamTraits<X4>::ForwardType x4,
2283 typename CallbackParamTraits<X5>::ForwardType x5,
2284 typename CallbackParamTraits<X6>::ForwardType x6,
2285 typename CallbackParamTraits<X7>::ForwardType x7) {
2286 StorageType* storage = static_cast<StorageType*>(base);
2288 // Local references to make debugger stepping easier. If in a debugger,
2289 // you really want to warp ahead and step through the
2290 // InvokeHelper<>::MakeItSo() call below.
2291 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
2292 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
2293 typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits;
2295 typename Bound1UnwrapTraits::ForwardType x1 =
2296 Bound1UnwrapTraits::Unwrap(storage->p1_);
2297 typename Bound2UnwrapTraits::ForwardType x2 =
2298 Bound2UnwrapTraits::Unwrap(storage->p2_);
2299 typename Bound3UnwrapTraits::ForwardType x3 =
2300 Bound3UnwrapTraits::Unwrap(storage->p3_);
2301 return InvokeHelper<StorageType::IsWeakCall::value, R,
2302 typename StorageType::RunnableType,
2303 void(typename Bound1UnwrapTraits::ForwardType,
2304 typename Bound2UnwrapTraits::ForwardType,
2305 typename Bound3UnwrapTraits::ForwardType,
2306 typename CallbackParamTraits<X4>::ForwardType x4,
2307 typename CallbackParamTraits<X5>::ForwardType x5,
2308 typename CallbackParamTraits<X6>::ForwardType x6,
2309 typename CallbackParamTraits<X7>::ForwardType x7)>
2310 ::MakeItSo(storage->runnable_, CallbackForward(x1),
2311 CallbackForward(x2), CallbackForward(x3),
2312 CallbackForward(x4), CallbackForward(x5),
2313 CallbackForward(x6), CallbackForward(x7));
2317 // Arity 7 -> 3.
2318 template <typename StorageType, typename R,typename X1, typename X2,
2319 typename X3, typename X4, typename X5, typename X6, typename X7>
2320 struct Invoker<4, StorageType, R(X1, X2, X3, X4, X5, X6, X7)> {
2321 typedef R(RunType)(BindStateBase*,
2322 typename CallbackParamTraits<X5>::ForwardType,
2323 typename CallbackParamTraits<X6>::ForwardType,
2324 typename CallbackParamTraits<X7>::ForwardType);
2326 typedef R(UnboundRunType)(X5, X6, X7);
2328 static R Run(BindStateBase* base,
2329 typename CallbackParamTraits<X5>::ForwardType x5,
2330 typename CallbackParamTraits<X6>::ForwardType x6,
2331 typename CallbackParamTraits<X7>::ForwardType x7) {
2332 StorageType* storage = static_cast<StorageType*>(base);
2334 // Local references to make debugger stepping easier. If in a debugger,
2335 // you really want to warp ahead and step through the
2336 // InvokeHelper<>::MakeItSo() call below.
2337 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
2338 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
2339 typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits;
2340 typedef typename StorageType::Bound4UnwrapTraits Bound4UnwrapTraits;
2342 typename Bound1UnwrapTraits::ForwardType x1 =
2343 Bound1UnwrapTraits::Unwrap(storage->p1_);
2344 typename Bound2UnwrapTraits::ForwardType x2 =
2345 Bound2UnwrapTraits::Unwrap(storage->p2_);
2346 typename Bound3UnwrapTraits::ForwardType x3 =
2347 Bound3UnwrapTraits::Unwrap(storage->p3_);
2348 typename Bound4UnwrapTraits::ForwardType x4 =
2349 Bound4UnwrapTraits::Unwrap(storage->p4_);
2350 return InvokeHelper<StorageType::IsWeakCall::value, R,
2351 typename StorageType::RunnableType,
2352 void(typename Bound1UnwrapTraits::ForwardType,
2353 typename Bound2UnwrapTraits::ForwardType,
2354 typename Bound3UnwrapTraits::ForwardType,
2355 typename Bound4UnwrapTraits::ForwardType,
2356 typename CallbackParamTraits<X5>::ForwardType x5,
2357 typename CallbackParamTraits<X6>::ForwardType x6,
2358 typename CallbackParamTraits<X7>::ForwardType x7)>
2359 ::MakeItSo(storage->runnable_, CallbackForward(x1),
2360 CallbackForward(x2), CallbackForward(x3),
2361 CallbackForward(x4), CallbackForward(x5),
2362 CallbackForward(x6), CallbackForward(x7));
2366 // Arity 7 -> 2.
2367 template <typename StorageType, typename R,typename X1, typename X2,
2368 typename X3, typename X4, typename X5, typename X6, typename X7>
2369 struct Invoker<5, StorageType, R(X1, X2, X3, X4, X5, X6, X7)> {
2370 typedef R(RunType)(BindStateBase*,
2371 typename CallbackParamTraits<X6>::ForwardType,
2372 typename CallbackParamTraits<X7>::ForwardType);
2374 typedef R(UnboundRunType)(X6, X7);
2376 static R Run(BindStateBase* base,
2377 typename CallbackParamTraits<X6>::ForwardType x6,
2378 typename CallbackParamTraits<X7>::ForwardType x7) {
2379 StorageType* storage = static_cast<StorageType*>(base);
2381 // Local references to make debugger stepping easier. If in a debugger,
2382 // you really want to warp ahead and step through the
2383 // InvokeHelper<>::MakeItSo() call below.
2384 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
2385 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
2386 typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits;
2387 typedef typename StorageType::Bound4UnwrapTraits Bound4UnwrapTraits;
2388 typedef typename StorageType::Bound5UnwrapTraits Bound5UnwrapTraits;
2390 typename Bound1UnwrapTraits::ForwardType x1 =
2391 Bound1UnwrapTraits::Unwrap(storage->p1_);
2392 typename Bound2UnwrapTraits::ForwardType x2 =
2393 Bound2UnwrapTraits::Unwrap(storage->p2_);
2394 typename Bound3UnwrapTraits::ForwardType x3 =
2395 Bound3UnwrapTraits::Unwrap(storage->p3_);
2396 typename Bound4UnwrapTraits::ForwardType x4 =
2397 Bound4UnwrapTraits::Unwrap(storage->p4_);
2398 typename Bound5UnwrapTraits::ForwardType x5 =
2399 Bound5UnwrapTraits::Unwrap(storage->p5_);
2400 return InvokeHelper<StorageType::IsWeakCall::value, R,
2401 typename StorageType::RunnableType,
2402 void(typename Bound1UnwrapTraits::ForwardType,
2403 typename Bound2UnwrapTraits::ForwardType,
2404 typename Bound3UnwrapTraits::ForwardType,
2405 typename Bound4UnwrapTraits::ForwardType,
2406 typename Bound5UnwrapTraits::ForwardType,
2407 typename CallbackParamTraits<X6>::ForwardType x6,
2408 typename CallbackParamTraits<X7>::ForwardType x7)>
2409 ::MakeItSo(storage->runnable_, CallbackForward(x1),
2410 CallbackForward(x2), CallbackForward(x3),
2411 CallbackForward(x4), CallbackForward(x5),
2412 CallbackForward(x6), CallbackForward(x7));
2416 // Arity 7 -> 1.
2417 template <typename StorageType, typename R,typename X1, typename X2,
2418 typename X3, typename X4, typename X5, typename X6, typename X7>
2419 struct Invoker<6, StorageType, R(X1, X2, X3, X4, X5, X6, X7)> {
2420 typedef R(RunType)(BindStateBase*,
2421 typename CallbackParamTraits<X7>::ForwardType);
2423 typedef R(UnboundRunType)(X7);
2425 static R Run(BindStateBase* base,
2426 typename CallbackParamTraits<X7>::ForwardType x7) {
2427 StorageType* storage = static_cast<StorageType*>(base);
2429 // Local references to make debugger stepping easier. If in a debugger,
2430 // you really want to warp ahead and step through the
2431 // InvokeHelper<>::MakeItSo() call below.
2432 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
2433 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
2434 typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits;
2435 typedef typename StorageType::Bound4UnwrapTraits Bound4UnwrapTraits;
2436 typedef typename StorageType::Bound5UnwrapTraits Bound5UnwrapTraits;
2437 typedef typename StorageType::Bound6UnwrapTraits Bound6UnwrapTraits;
2439 typename Bound1UnwrapTraits::ForwardType x1 =
2440 Bound1UnwrapTraits::Unwrap(storage->p1_);
2441 typename Bound2UnwrapTraits::ForwardType x2 =
2442 Bound2UnwrapTraits::Unwrap(storage->p2_);
2443 typename Bound3UnwrapTraits::ForwardType x3 =
2444 Bound3UnwrapTraits::Unwrap(storage->p3_);
2445 typename Bound4UnwrapTraits::ForwardType x4 =
2446 Bound4UnwrapTraits::Unwrap(storage->p4_);
2447 typename Bound5UnwrapTraits::ForwardType x5 =
2448 Bound5UnwrapTraits::Unwrap(storage->p5_);
2449 typename Bound6UnwrapTraits::ForwardType x6 =
2450 Bound6UnwrapTraits::Unwrap(storage->p6_);
2451 return InvokeHelper<StorageType::IsWeakCall::value, R,
2452 typename StorageType::RunnableType,
2453 void(typename Bound1UnwrapTraits::ForwardType,
2454 typename Bound2UnwrapTraits::ForwardType,
2455 typename Bound3UnwrapTraits::ForwardType,
2456 typename Bound4UnwrapTraits::ForwardType,
2457 typename Bound5UnwrapTraits::ForwardType,
2458 typename Bound6UnwrapTraits::ForwardType,
2459 typename CallbackParamTraits<X7>::ForwardType x7)>
2460 ::MakeItSo(storage->runnable_, CallbackForward(x1),
2461 CallbackForward(x2), CallbackForward(x3),
2462 CallbackForward(x4), CallbackForward(x5),
2463 CallbackForward(x6), CallbackForward(x7));
2467 // Arity 7 -> 0.
2468 template <typename StorageType, typename R,typename X1, typename X2,
2469 typename X3, typename X4, typename X5, typename X6, typename X7>
2470 struct Invoker<7, StorageType, R(X1, X2, X3, X4, X5, X6, X7)> {
2471 typedef R(RunType)(BindStateBase*);
2473 typedef R(UnboundRunType)();
2475 static R Run(BindStateBase* base) {
2476 StorageType* storage = static_cast<StorageType*>(base);
2478 // Local references to make debugger stepping easier. If in a debugger,
2479 // you really want to warp ahead and step through the
2480 // InvokeHelper<>::MakeItSo() call below.
2481 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
2482 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
2483 typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits;
2484 typedef typename StorageType::Bound4UnwrapTraits Bound4UnwrapTraits;
2485 typedef typename StorageType::Bound5UnwrapTraits Bound5UnwrapTraits;
2486 typedef typename StorageType::Bound6UnwrapTraits Bound6UnwrapTraits;
2487 typedef typename StorageType::Bound7UnwrapTraits Bound7UnwrapTraits;
2489 typename Bound1UnwrapTraits::ForwardType x1 =
2490 Bound1UnwrapTraits::Unwrap(storage->p1_);
2491 typename Bound2UnwrapTraits::ForwardType x2 =
2492 Bound2UnwrapTraits::Unwrap(storage->p2_);
2493 typename Bound3UnwrapTraits::ForwardType x3 =
2494 Bound3UnwrapTraits::Unwrap(storage->p3_);
2495 typename Bound4UnwrapTraits::ForwardType x4 =
2496 Bound4UnwrapTraits::Unwrap(storage->p4_);
2497 typename Bound5UnwrapTraits::ForwardType x5 =
2498 Bound5UnwrapTraits::Unwrap(storage->p5_);
2499 typename Bound6UnwrapTraits::ForwardType x6 =
2500 Bound6UnwrapTraits::Unwrap(storage->p6_);
2501 typename Bound7UnwrapTraits::ForwardType x7 =
2502 Bound7UnwrapTraits::Unwrap(storage->p7_);
2503 return InvokeHelper<StorageType::IsWeakCall::value, R,
2504 typename StorageType::RunnableType,
2505 void(typename Bound1UnwrapTraits::ForwardType,
2506 typename Bound2UnwrapTraits::ForwardType,
2507 typename Bound3UnwrapTraits::ForwardType,
2508 typename Bound4UnwrapTraits::ForwardType,
2509 typename Bound5UnwrapTraits::ForwardType,
2510 typename Bound6UnwrapTraits::ForwardType,
2511 typename Bound7UnwrapTraits::ForwardType)>
2512 ::MakeItSo(storage->runnable_, CallbackForward(x1),
2513 CallbackForward(x2), CallbackForward(x3),
2514 CallbackForward(x4), CallbackForward(x5),
2515 CallbackForward(x6), CallbackForward(x7));
2520 // BindState<>
2522 // This stores all the state passed into Bind() and is also where most
2523 // of the template resolution magic occurs.
2525 // Runnable is the functor we are binding arguments to.
2526 // RunType is type of the Run() function that the Invoker<> should use.
2527 // Normally, this is the same as the RunType of the Runnable, but it can
2528 // be different if an adapter like IgnoreResult() has been used.
2530 // BoundArgsType contains the storage type for all the bound arguments by
2531 // (ab)using a function type.
2532 template <typename Runnable, typename RunType, typename BoundArgsType>
2533 struct BindState;
2535 template <typename Runnable, typename RunType>
2536 struct BindState<Runnable, RunType, void()> : public BindStateBase {
2537 typedef Runnable RunnableType;
2538 typedef false_type IsWeakCall;
2539 typedef Invoker<0, BindState, RunType> InvokerType;
2540 typedef typename InvokerType::UnboundRunType UnboundRunType;
2541 explicit BindState(const Runnable& runnable)
2542 : runnable_(runnable) {
2545 virtual ~BindState() { }
2547 RunnableType runnable_;
2550 template <typename Runnable, typename RunType, typename P1>
2551 struct BindState<Runnable, RunType, void(P1)> : public BindStateBase {
2552 typedef Runnable RunnableType;
2553 typedef IsWeakMethod<HasIsMethodTag<Runnable>::value, P1> IsWeakCall;
2554 typedef Invoker<1, BindState, RunType> InvokerType;
2555 typedef typename InvokerType::UnboundRunType UnboundRunType;
2557 // Convenience typedefs for bound argument types.
2558 typedef UnwrapTraits<P1> Bound1UnwrapTraits;
2560 BindState(const Runnable& runnable, const P1& p1)
2561 : runnable_(runnable),
2562 p1_(p1) {
2563 MaybeRefcount<HasIsMethodTag<Runnable>::value, P1>::AddRef(p1_);
2566 virtual ~BindState() { MaybeRefcount<HasIsMethodTag<Runnable>::value,
2567 P1>::Release(p1_); }
2569 RunnableType runnable_;
2570 P1 p1_;
2573 template <typename Runnable, typename RunType, typename P1, typename P2>
2574 struct BindState<Runnable, RunType, void(P1, P2)> : public BindStateBase {
2575 typedef Runnable RunnableType;
2576 typedef IsWeakMethod<HasIsMethodTag<Runnable>::value, P1> IsWeakCall;
2577 typedef Invoker<2, BindState, RunType> InvokerType;
2578 typedef typename InvokerType::UnboundRunType UnboundRunType;
2580 // Convenience typedefs for bound argument types.
2581 typedef UnwrapTraits<P1> Bound1UnwrapTraits;
2582 typedef UnwrapTraits<P2> Bound2UnwrapTraits;
2584 BindState(const Runnable& runnable, const P1& p1, const P2& p2)
2585 : runnable_(runnable),
2586 p1_(p1),
2587 p2_(p2) {
2588 MaybeRefcount<HasIsMethodTag<Runnable>::value, P1>::AddRef(p1_);
2591 virtual ~BindState() { MaybeRefcount<HasIsMethodTag<Runnable>::value,
2592 P1>::Release(p1_); }
2594 RunnableType runnable_;
2595 P1 p1_;
2596 P2 p2_;
2599 template <typename Runnable, typename RunType, typename P1, typename P2,
2600 typename P3>
2601 struct BindState<Runnable, RunType, void(P1, P2, P3)> : public BindStateBase {
2602 typedef Runnable RunnableType;
2603 typedef IsWeakMethod<HasIsMethodTag<Runnable>::value, P1> IsWeakCall;
2604 typedef Invoker<3, BindState, RunType> InvokerType;
2605 typedef typename InvokerType::UnboundRunType UnboundRunType;
2607 // Convenience typedefs for bound argument types.
2608 typedef UnwrapTraits<P1> Bound1UnwrapTraits;
2609 typedef UnwrapTraits<P2> Bound2UnwrapTraits;
2610 typedef UnwrapTraits<P3> Bound3UnwrapTraits;
2612 BindState(const Runnable& runnable, const P1& p1, const P2& p2, const P3& p3)
2613 : runnable_(runnable),
2614 p1_(p1),
2615 p2_(p2),
2616 p3_(p3) {
2617 MaybeRefcount<HasIsMethodTag<Runnable>::value, P1>::AddRef(p1_);
2620 virtual ~BindState() { MaybeRefcount<HasIsMethodTag<Runnable>::value,
2621 P1>::Release(p1_); }
2623 RunnableType runnable_;
2624 P1 p1_;
2625 P2 p2_;
2626 P3 p3_;
2629 template <typename Runnable, typename RunType, typename P1, typename P2,
2630 typename P3, typename P4>
2631 struct BindState<Runnable, RunType, void(P1, P2, P3,
2632 P4)> : public BindStateBase {
2633 typedef Runnable RunnableType;
2634 typedef IsWeakMethod<HasIsMethodTag<Runnable>::value, P1> IsWeakCall;
2635 typedef Invoker<4, BindState, RunType> InvokerType;
2636 typedef typename InvokerType::UnboundRunType UnboundRunType;
2638 // Convenience typedefs for bound argument types.
2639 typedef UnwrapTraits<P1> Bound1UnwrapTraits;
2640 typedef UnwrapTraits<P2> Bound2UnwrapTraits;
2641 typedef UnwrapTraits<P3> Bound3UnwrapTraits;
2642 typedef UnwrapTraits<P4> Bound4UnwrapTraits;
2644 BindState(const Runnable& runnable, const P1& p1, const P2& p2, const P3& p3,
2645 const P4& p4)
2646 : runnable_(runnable),
2647 p1_(p1),
2648 p2_(p2),
2649 p3_(p3),
2650 p4_(p4) {
2651 MaybeRefcount<HasIsMethodTag<Runnable>::value, P1>::AddRef(p1_);
2654 virtual ~BindState() { MaybeRefcount<HasIsMethodTag<Runnable>::value,
2655 P1>::Release(p1_); }
2657 RunnableType runnable_;
2658 P1 p1_;
2659 P2 p2_;
2660 P3 p3_;
2661 P4 p4_;
2664 template <typename Runnable, typename RunType, typename P1, typename P2,
2665 typename P3, typename P4, typename P5>
2666 struct BindState<Runnable, RunType, void(P1, P2, P3, P4,
2667 P5)> : public BindStateBase {
2668 typedef Runnable RunnableType;
2669 typedef IsWeakMethod<HasIsMethodTag<Runnable>::value, P1> IsWeakCall;
2670 typedef Invoker<5, BindState, RunType> InvokerType;
2671 typedef typename InvokerType::UnboundRunType UnboundRunType;
2673 // Convenience typedefs for bound argument types.
2674 typedef UnwrapTraits<P1> Bound1UnwrapTraits;
2675 typedef UnwrapTraits<P2> Bound2UnwrapTraits;
2676 typedef UnwrapTraits<P3> Bound3UnwrapTraits;
2677 typedef UnwrapTraits<P4> Bound4UnwrapTraits;
2678 typedef UnwrapTraits<P5> Bound5UnwrapTraits;
2680 BindState(const Runnable& runnable, const P1& p1, const P2& p2, const P3& p3,
2681 const P4& p4, const P5& p5)
2682 : runnable_(runnable),
2683 p1_(p1),
2684 p2_(p2),
2685 p3_(p3),
2686 p4_(p4),
2687 p5_(p5) {
2688 MaybeRefcount<HasIsMethodTag<Runnable>::value, P1>::AddRef(p1_);
2691 virtual ~BindState() { MaybeRefcount<HasIsMethodTag<Runnable>::value,
2692 P1>::Release(p1_); }
2694 RunnableType runnable_;
2695 P1 p1_;
2696 P2 p2_;
2697 P3 p3_;
2698 P4 p4_;
2699 P5 p5_;
2702 template <typename Runnable, typename RunType, typename P1, typename P2,
2703 typename P3, typename P4, typename P5, typename P6>
2704 struct BindState<Runnable, RunType, void(P1, P2, P3, P4, P5,
2705 P6)> : public BindStateBase {
2706 typedef Runnable RunnableType;
2707 typedef IsWeakMethod<HasIsMethodTag<Runnable>::value, P1> IsWeakCall;
2708 typedef Invoker<6, BindState, RunType> InvokerType;
2709 typedef typename InvokerType::UnboundRunType UnboundRunType;
2711 // Convenience typedefs for bound argument types.
2712 typedef UnwrapTraits<P1> Bound1UnwrapTraits;
2713 typedef UnwrapTraits<P2> Bound2UnwrapTraits;
2714 typedef UnwrapTraits<P3> Bound3UnwrapTraits;
2715 typedef UnwrapTraits<P4> Bound4UnwrapTraits;
2716 typedef UnwrapTraits<P5> Bound5UnwrapTraits;
2717 typedef UnwrapTraits<P6> Bound6UnwrapTraits;
2719 BindState(const Runnable& runnable, const P1& p1, const P2& p2, const P3& p3,
2720 const P4& p4, const P5& p5, const P6& p6)
2721 : runnable_(runnable),
2722 p1_(p1),
2723 p2_(p2),
2724 p3_(p3),
2725 p4_(p4),
2726 p5_(p5),
2727 p6_(p6) {
2728 MaybeRefcount<HasIsMethodTag<Runnable>::value, P1>::AddRef(p1_);
2731 virtual ~BindState() { MaybeRefcount<HasIsMethodTag<Runnable>::value,
2732 P1>::Release(p1_); }
2734 RunnableType runnable_;
2735 P1 p1_;
2736 P2 p2_;
2737 P3 p3_;
2738 P4 p4_;
2739 P5 p5_;
2740 P6 p6_;
2743 template <typename Runnable, typename RunType, typename P1, typename P2,
2744 typename P3, typename P4, typename P5, typename P6, typename P7>
2745 struct BindState<Runnable, RunType, void(P1, P2, P3, P4, P5, P6,
2746 P7)> : public BindStateBase {
2747 typedef Runnable RunnableType;
2748 typedef IsWeakMethod<HasIsMethodTag<Runnable>::value, P1> IsWeakCall;
2749 typedef Invoker<7, BindState, RunType> InvokerType;
2750 typedef typename InvokerType::UnboundRunType UnboundRunType;
2752 // Convenience typedefs for bound argument types.
2753 typedef UnwrapTraits<P1> Bound1UnwrapTraits;
2754 typedef UnwrapTraits<P2> Bound2UnwrapTraits;
2755 typedef UnwrapTraits<P3> Bound3UnwrapTraits;
2756 typedef UnwrapTraits<P4> Bound4UnwrapTraits;
2757 typedef UnwrapTraits<P5> Bound5UnwrapTraits;
2758 typedef UnwrapTraits<P6> Bound6UnwrapTraits;
2759 typedef UnwrapTraits<P7> Bound7UnwrapTraits;
2761 BindState(const Runnable& runnable, const P1& p1, const P2& p2, const P3& p3,
2762 const P4& p4, const P5& p5, const P6& p6, const P7& p7)
2763 : runnable_(runnable),
2764 p1_(p1),
2765 p2_(p2),
2766 p3_(p3),
2767 p4_(p4),
2768 p5_(p5),
2769 p6_(p6),
2770 p7_(p7) {
2771 MaybeRefcount<HasIsMethodTag<Runnable>::value, P1>::AddRef(p1_);
2774 virtual ~BindState() { MaybeRefcount<HasIsMethodTag<Runnable>::value,
2775 P1>::Release(p1_); }
2777 RunnableType runnable_;
2778 P1 p1_;
2779 P2 p2_;
2780 P3 p3_;
2781 P4 p4_;
2782 P5 p5_;
2783 P6 p6_;
2784 P7 p7_;
2787 } // namespace internal
2788 } // namespace base
2790 #endif // BASE_BIND_INTERNAL_H_