Retires ui::TranslatedKeyEvent and replaces it with KeyEvent.
[chromium-blink-merge.git] / base / bind_internal.h
blobae17ebf86c1a6c17f3a6cb5108a10d690ad4be61
1 // This file was GENERATED by command:
2 // pump.py bind_internal.h.pump
3 // DO NOT EDIT BY HAND!!!
6 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
7 // Use of this source code is governed by a BSD-style license that can be
8 // found in the LICENSE file.
10 #ifndef BASE_BIND_INTERNAL_H_
11 #define BASE_BIND_INTERNAL_H_
13 #include "base/bind_helpers.h"
14 #include "base/callback_internal.h"
15 #include "base/memory/raw_scoped_refptr_mismatch_checker.h"
16 #include "base/memory/weak_ptr.h"
17 #include "base/template_util.h"
18 #include "build/build_config.h"
20 #if defined(OS_WIN)
21 #include "base/bind_internal_win.h"
22 #endif
24 namespace base {
25 namespace internal {
27 // See base/callback.h for user documentation.
30 // CONCEPTS:
31 // Runnable -- A type (really a type class) that has a single Run() method
32 // and a RunType typedef that corresponds to the type of Run().
33 // A Runnable can declare that it should treated like a method
34 // call by including a typedef named IsMethod. The value of
35 // this typedef is NOT inspected, only the existence. When a
36 // Runnable declares itself a method, Bind() will enforce special
37 // refcounting + WeakPtr handling semantics for the first
38 // parameter which is expected to be an object.
39 // Functor -- A copyable type representing something that should be called.
40 // All function pointers, Callback<>, and Runnables are functors
41 // even if the invocation syntax differs.
42 // RunType -- A function type (as opposed to function _pointer_ type) for
43 // a Run() function. Usually just a convenience typedef.
44 // (Bound)ArgsType -- A function type that is being (ab)used to store the
45 // types of set of arguments. The "return" type is always
46 // void here. We use this hack so that we do not need
47 // a new type name for each arity of type. (eg.,
48 // BindState1, BindState2). This makes forward
49 // declarations and friending much much easier.
51 // Types:
52 // RunnableAdapter<> -- Wraps the various "function" pointer types into an
53 // object that adheres to the Runnable interface.
54 // There are |3*ARITY| RunnableAdapter types.
55 // FunctionTraits<> -- Type traits that unwrap a function signature into a
56 // a set of easier to use typedefs. Used mainly for
57 // compile time asserts.
58 // There are |ARITY| FunctionTraits types.
59 // ForceVoidReturn<> -- Helper class for translating function signatures to
60 // equivalent forms with a "void" return type.
61 // There are |ARITY| ForceVoidReturn types.
62 // FunctorTraits<> -- Type traits used determine the correct RunType and
63 // RunnableType for a Functor. This is where function
64 // signature adapters are applied.
65 // There are |ARITY| ForceVoidReturn types.
66 // MakeRunnable<> -- Takes a Functor and returns an object in the Runnable
67 // type class that represents the underlying Functor.
68 // There are |O(1)| MakeRunnable types.
69 // InvokeHelper<> -- Take a Runnable + arguments and actully invokes it.
70 // Handle the differing syntaxes needed for WeakPtr<> support,
71 // and for ignoring return values. This is separate from
72 // Invoker to avoid creating multiple version of Invoker<>
73 // which grows at O(n^2) with the arity.
74 // There are |k*ARITY| InvokeHelper types.
75 // Invoker<> -- Unwraps the curried parameters and executes the Runnable.
76 // There are |(ARITY^2 + ARITY)/2| Invoketypes.
77 // BindState<> -- Stores the curried parameters, and is the main entry point
78 // into the Bind() system, doing most of the type resolution.
79 // There are ARITY BindState types.
81 // RunnableAdapter<>
83 // The RunnableAdapter<> templates provide a uniform interface for invoking
84 // a function pointer, method pointer, or const method pointer. The adapter
85 // exposes a Run() method with an appropriate signature. Using this wrapper
86 // allows for writing code that supports all three pointer types without
87 // undue repetition. Without it, a lot of code would need to be repeated 3
88 // times.
90 // For method pointers and const method pointers the first argument to Run()
91 // is considered to be the received of the method. This is similar to STL's
92 // mem_fun().
94 // This class also exposes a RunType typedef that is the function type of the
95 // Run() function.
97 // If and only if the wrapper contains a method or const method pointer, an
98 // IsMethod typedef is exposed. The existence of this typedef (NOT the value)
99 // marks that the wrapper should be considered a method wrapper.
101 template <typename Functor>
102 class RunnableAdapter;
104 // Function: Arity 0.
105 template <typename R>
106 class RunnableAdapter<R(*)()> {
107 public:
108 typedef R (RunType)();
110 explicit RunnableAdapter(R(*function)())
111 : function_(function) {
114 R Run() {
115 return function_();
118 private:
119 R (*function_)();
122 // Method: Arity 0.
123 template <typename R, typename T>
124 class RunnableAdapter<R(T::*)()> {
125 public:
126 typedef R (RunType)(T*);
127 typedef true_type IsMethod;
129 explicit RunnableAdapter(R(T::*method)())
130 : method_(method) {
133 R Run(T* object) {
134 return (object->*method_)();
137 private:
138 R (T::*method_)();
141 // Const Method: Arity 0.
142 template <typename R, typename T>
143 class RunnableAdapter<R(T::*)() const> {
144 public:
145 typedef R (RunType)(const T*);
146 typedef true_type IsMethod;
148 explicit RunnableAdapter(R(T::*method)() const)
149 : method_(method) {
152 R Run(const T* object) {
153 return (object->*method_)();
156 private:
157 R (T::*method_)() const;
160 // Function: Arity 1.
161 template <typename R, typename A1>
162 class RunnableAdapter<R(*)(A1)> {
163 public:
164 typedef R (RunType)(A1);
166 explicit RunnableAdapter(R(*function)(A1))
167 : function_(function) {
170 R Run(typename CallbackParamTraits<A1>::ForwardType a1) {
171 return function_(CallbackForward(a1));
174 private:
175 R (*function_)(A1);
178 // Method: Arity 1.
179 template <typename R, typename T, typename A1>
180 class RunnableAdapter<R(T::*)(A1)> {
181 public:
182 typedef R (RunType)(T*, A1);
183 typedef true_type IsMethod;
185 explicit RunnableAdapter(R(T::*method)(A1))
186 : method_(method) {
189 R Run(T* object, typename CallbackParamTraits<A1>::ForwardType a1) {
190 return (object->*method_)(CallbackForward(a1));
193 private:
194 R (T::*method_)(A1);
197 // Const Method: Arity 1.
198 template <typename R, typename T, typename A1>
199 class RunnableAdapter<R(T::*)(A1) const> {
200 public:
201 typedef R (RunType)(const T*, A1);
202 typedef true_type IsMethod;
204 explicit RunnableAdapter(R(T::*method)(A1) const)
205 : method_(method) {
208 R Run(const T* object, typename CallbackParamTraits<A1>::ForwardType a1) {
209 return (object->*method_)(CallbackForward(a1));
212 private:
213 R (T::*method_)(A1) const;
216 // Function: Arity 2.
217 template <typename R, typename A1, typename A2>
218 class RunnableAdapter<R(*)(A1, A2)> {
219 public:
220 typedef R (RunType)(A1, A2);
222 explicit RunnableAdapter(R(*function)(A1, A2))
223 : function_(function) {
226 R Run(typename CallbackParamTraits<A1>::ForwardType a1,
227 typename CallbackParamTraits<A2>::ForwardType a2) {
228 return function_(CallbackForward(a1), CallbackForward(a2));
231 private:
232 R (*function_)(A1, A2);
235 // Method: Arity 2.
236 template <typename R, typename T, typename A1, typename A2>
237 class RunnableAdapter<R(T::*)(A1, A2)> {
238 public:
239 typedef R (RunType)(T*, A1, A2);
240 typedef true_type IsMethod;
242 explicit RunnableAdapter(R(T::*method)(A1, A2))
243 : method_(method) {
246 R Run(T* object, typename CallbackParamTraits<A1>::ForwardType a1,
247 typename CallbackParamTraits<A2>::ForwardType a2) {
248 return (object->*method_)(CallbackForward(a1), CallbackForward(a2));
251 private:
252 R (T::*method_)(A1, A2);
255 // Const Method: Arity 2.
256 template <typename R, typename T, typename A1, typename A2>
257 class RunnableAdapter<R(T::*)(A1, A2) const> {
258 public:
259 typedef R (RunType)(const T*, A1, A2);
260 typedef true_type IsMethod;
262 explicit RunnableAdapter(R(T::*method)(A1, A2) const)
263 : method_(method) {
266 R Run(const T* object, typename CallbackParamTraits<A1>::ForwardType a1,
267 typename CallbackParamTraits<A2>::ForwardType a2) {
268 return (object->*method_)(CallbackForward(a1), CallbackForward(a2));
271 private:
272 R (T::*method_)(A1, A2) const;
275 // Function: Arity 3.
276 template <typename R, typename A1, typename A2, typename A3>
277 class RunnableAdapter<R(*)(A1, A2, A3)> {
278 public:
279 typedef R (RunType)(A1, A2, A3);
281 explicit RunnableAdapter(R(*function)(A1, A2, A3))
282 : function_(function) {
285 R Run(typename CallbackParamTraits<A1>::ForwardType a1,
286 typename CallbackParamTraits<A2>::ForwardType a2,
287 typename CallbackParamTraits<A3>::ForwardType a3) {
288 return function_(CallbackForward(a1), CallbackForward(a2),
289 CallbackForward(a3));
292 private:
293 R (*function_)(A1, A2, A3);
296 // Method: Arity 3.
297 template <typename R, typename T, typename A1, typename A2, typename A3>
298 class RunnableAdapter<R(T::*)(A1, A2, A3)> {
299 public:
300 typedef R (RunType)(T*, A1, A2, A3);
301 typedef true_type IsMethod;
303 explicit RunnableAdapter(R(T::*method)(A1, A2, A3))
304 : method_(method) {
307 R Run(T* object, typename CallbackParamTraits<A1>::ForwardType a1,
308 typename CallbackParamTraits<A2>::ForwardType a2,
309 typename CallbackParamTraits<A3>::ForwardType a3) {
310 return (object->*method_)(CallbackForward(a1), CallbackForward(a2),
311 CallbackForward(a3));
314 private:
315 R (T::*method_)(A1, A2, A3);
318 // Const Method: Arity 3.
319 template <typename R, typename T, typename A1, typename A2, typename A3>
320 class RunnableAdapter<R(T::*)(A1, A2, A3) const> {
321 public:
322 typedef R (RunType)(const T*, A1, A2, A3);
323 typedef true_type IsMethod;
325 explicit RunnableAdapter(R(T::*method)(A1, A2, A3) const)
326 : method_(method) {
329 R Run(const T* object, typename CallbackParamTraits<A1>::ForwardType a1,
330 typename CallbackParamTraits<A2>::ForwardType a2,
331 typename CallbackParamTraits<A3>::ForwardType a3) {
332 return (object->*method_)(CallbackForward(a1), CallbackForward(a2),
333 CallbackForward(a3));
336 private:
337 R (T::*method_)(A1, A2, A3) const;
340 // Function: Arity 4.
341 template <typename R, typename A1, typename A2, typename A3, typename A4>
342 class RunnableAdapter<R(*)(A1, A2, A3, A4)> {
343 public:
344 typedef R (RunType)(A1, A2, A3, A4);
346 explicit RunnableAdapter(R(*function)(A1, A2, A3, A4))
347 : function_(function) {
350 R Run(typename CallbackParamTraits<A1>::ForwardType a1,
351 typename CallbackParamTraits<A2>::ForwardType a2,
352 typename CallbackParamTraits<A3>::ForwardType a3,
353 typename CallbackParamTraits<A4>::ForwardType a4) {
354 return function_(CallbackForward(a1), CallbackForward(a2),
355 CallbackForward(a3), CallbackForward(a4));
358 private:
359 R (*function_)(A1, A2, A3, A4);
362 // Method: Arity 4.
363 template <typename R, typename T, typename A1, typename A2, typename A3,
364 typename A4>
365 class RunnableAdapter<R(T::*)(A1, A2, A3, A4)> {
366 public:
367 typedef R (RunType)(T*, A1, A2, A3, A4);
368 typedef true_type IsMethod;
370 explicit RunnableAdapter(R(T::*method)(A1, A2, A3, A4))
371 : method_(method) {
374 R Run(T* object, typename CallbackParamTraits<A1>::ForwardType a1,
375 typename CallbackParamTraits<A2>::ForwardType a2,
376 typename CallbackParamTraits<A3>::ForwardType a3,
377 typename CallbackParamTraits<A4>::ForwardType a4) {
378 return (object->*method_)(CallbackForward(a1), CallbackForward(a2),
379 CallbackForward(a3), CallbackForward(a4));
382 private:
383 R (T::*method_)(A1, A2, A3, A4);
386 // Const Method: Arity 4.
387 template <typename R, typename T, typename A1, typename A2, typename A3,
388 typename A4>
389 class RunnableAdapter<R(T::*)(A1, A2, A3, A4) const> {
390 public:
391 typedef R (RunType)(const T*, A1, A2, A3, A4);
392 typedef true_type IsMethod;
394 explicit RunnableAdapter(R(T::*method)(A1, A2, A3, A4) const)
395 : method_(method) {
398 R Run(const T* object, typename CallbackParamTraits<A1>::ForwardType a1,
399 typename CallbackParamTraits<A2>::ForwardType a2,
400 typename CallbackParamTraits<A3>::ForwardType a3,
401 typename CallbackParamTraits<A4>::ForwardType a4) {
402 return (object->*method_)(CallbackForward(a1), CallbackForward(a2),
403 CallbackForward(a3), CallbackForward(a4));
406 private:
407 R (T::*method_)(A1, A2, A3, A4) const;
410 // Function: Arity 5.
411 template <typename R, typename A1, typename A2, typename A3, typename A4,
412 typename A5>
413 class RunnableAdapter<R(*)(A1, A2, A3, A4, A5)> {
414 public:
415 typedef R (RunType)(A1, A2, A3, A4, A5);
417 explicit RunnableAdapter(R(*function)(A1, A2, A3, A4, A5))
418 : function_(function) {
421 R Run(typename CallbackParamTraits<A1>::ForwardType a1,
422 typename CallbackParamTraits<A2>::ForwardType a2,
423 typename CallbackParamTraits<A3>::ForwardType a3,
424 typename CallbackParamTraits<A4>::ForwardType a4,
425 typename CallbackParamTraits<A5>::ForwardType a5) {
426 return function_(CallbackForward(a1), CallbackForward(a2),
427 CallbackForward(a3), CallbackForward(a4), CallbackForward(a5));
430 private:
431 R (*function_)(A1, A2, A3, A4, A5);
434 // Method: Arity 5.
435 template <typename R, typename T, typename A1, typename A2, typename A3,
436 typename A4, typename A5>
437 class RunnableAdapter<R(T::*)(A1, A2, A3, A4, A5)> {
438 public:
439 typedef R (RunType)(T*, A1, A2, A3, A4, A5);
440 typedef true_type IsMethod;
442 explicit RunnableAdapter(R(T::*method)(A1, A2, A3, A4, A5))
443 : method_(method) {
446 R Run(T* object, typename CallbackParamTraits<A1>::ForwardType a1,
447 typename CallbackParamTraits<A2>::ForwardType a2,
448 typename CallbackParamTraits<A3>::ForwardType a3,
449 typename CallbackParamTraits<A4>::ForwardType a4,
450 typename CallbackParamTraits<A5>::ForwardType a5) {
451 return (object->*method_)(CallbackForward(a1), CallbackForward(a2),
452 CallbackForward(a3), CallbackForward(a4), CallbackForward(a5));
455 private:
456 R (T::*method_)(A1, A2, A3, A4, A5);
459 // Const Method: Arity 5.
460 template <typename R, typename T, typename A1, typename A2, typename A3,
461 typename A4, typename A5>
462 class RunnableAdapter<R(T::*)(A1, A2, A3, A4, A5) const> {
463 public:
464 typedef R (RunType)(const T*, A1, A2, A3, A4, A5);
465 typedef true_type IsMethod;
467 explicit RunnableAdapter(R(T::*method)(A1, A2, A3, A4, A5) const)
468 : method_(method) {
471 R Run(const T* object, typename CallbackParamTraits<A1>::ForwardType a1,
472 typename CallbackParamTraits<A2>::ForwardType a2,
473 typename CallbackParamTraits<A3>::ForwardType a3,
474 typename CallbackParamTraits<A4>::ForwardType a4,
475 typename CallbackParamTraits<A5>::ForwardType a5) {
476 return (object->*method_)(CallbackForward(a1), CallbackForward(a2),
477 CallbackForward(a3), CallbackForward(a4), CallbackForward(a5));
480 private:
481 R (T::*method_)(A1, A2, A3, A4, A5) const;
484 // Function: Arity 6.
485 template <typename R, typename A1, typename A2, typename A3, typename A4,
486 typename A5, typename A6>
487 class RunnableAdapter<R(*)(A1, A2, A3, A4, A5, A6)> {
488 public:
489 typedef R (RunType)(A1, A2, A3, A4, A5, A6);
491 explicit RunnableAdapter(R(*function)(A1, A2, A3, A4, A5, A6))
492 : function_(function) {
495 R Run(typename CallbackParamTraits<A1>::ForwardType a1,
496 typename CallbackParamTraits<A2>::ForwardType a2,
497 typename CallbackParamTraits<A3>::ForwardType a3,
498 typename CallbackParamTraits<A4>::ForwardType a4,
499 typename CallbackParamTraits<A5>::ForwardType a5,
500 typename CallbackParamTraits<A6>::ForwardType a6) {
501 return function_(CallbackForward(a1), CallbackForward(a2),
502 CallbackForward(a3), CallbackForward(a4), CallbackForward(a5),
503 CallbackForward(a6));
506 private:
507 R (*function_)(A1, A2, A3, A4, A5, A6);
510 // Method: Arity 6.
511 template <typename R, typename T, typename A1, typename A2, typename A3,
512 typename A4, typename A5, typename A6>
513 class RunnableAdapter<R(T::*)(A1, A2, A3, A4, A5, A6)> {
514 public:
515 typedef R (RunType)(T*, A1, A2, A3, A4, A5, A6);
516 typedef true_type IsMethod;
518 explicit RunnableAdapter(R(T::*method)(A1, A2, A3, A4, A5, A6))
519 : method_(method) {
522 R Run(T* object, typename CallbackParamTraits<A1>::ForwardType a1,
523 typename CallbackParamTraits<A2>::ForwardType a2,
524 typename CallbackParamTraits<A3>::ForwardType a3,
525 typename CallbackParamTraits<A4>::ForwardType a4,
526 typename CallbackParamTraits<A5>::ForwardType a5,
527 typename CallbackParamTraits<A6>::ForwardType a6) {
528 return (object->*method_)(CallbackForward(a1), CallbackForward(a2),
529 CallbackForward(a3), CallbackForward(a4), CallbackForward(a5),
530 CallbackForward(a6));
533 private:
534 R (T::*method_)(A1, A2, A3, A4, A5, A6);
537 // Const Method: Arity 6.
538 template <typename R, typename T, typename A1, typename A2, typename A3,
539 typename A4, typename A5, typename A6>
540 class RunnableAdapter<R(T::*)(A1, A2, A3, A4, A5, A6) const> {
541 public:
542 typedef R (RunType)(const T*, A1, A2, A3, A4, A5, A6);
543 typedef true_type IsMethod;
545 explicit RunnableAdapter(R(T::*method)(A1, A2, A3, A4, A5, A6) const)
546 : method_(method) {
549 R Run(const T* object, typename CallbackParamTraits<A1>::ForwardType a1,
550 typename CallbackParamTraits<A2>::ForwardType a2,
551 typename CallbackParamTraits<A3>::ForwardType a3,
552 typename CallbackParamTraits<A4>::ForwardType a4,
553 typename CallbackParamTraits<A5>::ForwardType a5,
554 typename CallbackParamTraits<A6>::ForwardType a6) {
555 return (object->*method_)(CallbackForward(a1), CallbackForward(a2),
556 CallbackForward(a3), CallbackForward(a4), CallbackForward(a5),
557 CallbackForward(a6));
560 private:
561 R (T::*method_)(A1, A2, A3, A4, A5, A6) const;
564 // Function: Arity 7.
565 template <typename R, typename A1, typename A2, typename A3, typename A4,
566 typename A5, typename A6, typename A7>
567 class RunnableAdapter<R(*)(A1, A2, A3, A4, A5, A6, A7)> {
568 public:
569 typedef R (RunType)(A1, A2, A3, A4, A5, A6, A7);
571 explicit RunnableAdapter(R(*function)(A1, A2, A3, A4, A5, A6, A7))
572 : function_(function) {
575 R Run(typename CallbackParamTraits<A1>::ForwardType a1,
576 typename CallbackParamTraits<A2>::ForwardType a2,
577 typename CallbackParamTraits<A3>::ForwardType a3,
578 typename CallbackParamTraits<A4>::ForwardType a4,
579 typename CallbackParamTraits<A5>::ForwardType a5,
580 typename CallbackParamTraits<A6>::ForwardType a6,
581 typename CallbackParamTraits<A7>::ForwardType a7) {
582 return function_(CallbackForward(a1), CallbackForward(a2),
583 CallbackForward(a3), CallbackForward(a4), CallbackForward(a5),
584 CallbackForward(a6), CallbackForward(a7));
587 private:
588 R (*function_)(A1, A2, A3, A4, A5, A6, A7);
591 // Method: Arity 7.
592 template <typename R, typename T, typename A1, typename A2, typename A3,
593 typename A4, typename A5, typename A6, typename A7>
594 class RunnableAdapter<R(T::*)(A1, A2, A3, A4, A5, A6, A7)> {
595 public:
596 typedef R (RunType)(T*, A1, A2, A3, A4, A5, A6, A7);
597 typedef true_type IsMethod;
599 explicit RunnableAdapter(R(T::*method)(A1, A2, A3, A4, A5, A6, A7))
600 : method_(method) {
603 R Run(T* object, typename CallbackParamTraits<A1>::ForwardType a1,
604 typename CallbackParamTraits<A2>::ForwardType a2,
605 typename CallbackParamTraits<A3>::ForwardType a3,
606 typename CallbackParamTraits<A4>::ForwardType a4,
607 typename CallbackParamTraits<A5>::ForwardType a5,
608 typename CallbackParamTraits<A6>::ForwardType a6,
609 typename CallbackParamTraits<A7>::ForwardType a7) {
610 return (object->*method_)(CallbackForward(a1), CallbackForward(a2),
611 CallbackForward(a3), CallbackForward(a4), CallbackForward(a5),
612 CallbackForward(a6), CallbackForward(a7));
615 private:
616 R (T::*method_)(A1, A2, A3, A4, A5, A6, A7);
619 // Const Method: Arity 7.
620 template <typename R, typename T, typename A1, typename A2, typename A3,
621 typename A4, typename A5, typename A6, typename A7>
622 class RunnableAdapter<R(T::*)(A1, A2, A3, A4, A5, A6, A7) const> {
623 public:
624 typedef R (RunType)(const T*, A1, A2, A3, A4, A5, A6, A7);
625 typedef true_type IsMethod;
627 explicit RunnableAdapter(R(T::*method)(A1, A2, A3, A4, A5, A6, A7) const)
628 : method_(method) {
631 R Run(const T* object, typename CallbackParamTraits<A1>::ForwardType a1,
632 typename CallbackParamTraits<A2>::ForwardType a2,
633 typename CallbackParamTraits<A3>::ForwardType a3,
634 typename CallbackParamTraits<A4>::ForwardType a4,
635 typename CallbackParamTraits<A5>::ForwardType a5,
636 typename CallbackParamTraits<A6>::ForwardType a6,
637 typename CallbackParamTraits<A7>::ForwardType a7) {
638 return (object->*method_)(CallbackForward(a1), CallbackForward(a2),
639 CallbackForward(a3), CallbackForward(a4), CallbackForward(a5),
640 CallbackForward(a6), CallbackForward(a7));
643 private:
644 R (T::*method_)(A1, A2, A3, A4, A5, A6, A7) const;
648 // FunctionTraits<>
650 // Breaks a function signature apart into typedefs for easier introspection.
651 template <typename Sig>
652 struct FunctionTraits;
654 template <typename R>
655 struct FunctionTraits<R()> {
656 typedef R ReturnType;
659 template <typename R, typename A1>
660 struct FunctionTraits<R(A1)> {
661 typedef R ReturnType;
662 typedef A1 A1Type;
665 template <typename R, typename A1, typename A2>
666 struct FunctionTraits<R(A1, A2)> {
667 typedef R ReturnType;
668 typedef A1 A1Type;
669 typedef A2 A2Type;
672 template <typename R, typename A1, typename A2, typename A3>
673 struct FunctionTraits<R(A1, A2, A3)> {
674 typedef R ReturnType;
675 typedef A1 A1Type;
676 typedef A2 A2Type;
677 typedef A3 A3Type;
680 template <typename R, typename A1, typename A2, typename A3, typename A4>
681 struct FunctionTraits<R(A1, A2, A3, A4)> {
682 typedef R ReturnType;
683 typedef A1 A1Type;
684 typedef A2 A2Type;
685 typedef A3 A3Type;
686 typedef A4 A4Type;
689 template <typename R, typename A1, typename A2, typename A3, typename A4,
690 typename A5>
691 struct FunctionTraits<R(A1, A2, A3, A4, A5)> {
692 typedef R ReturnType;
693 typedef A1 A1Type;
694 typedef A2 A2Type;
695 typedef A3 A3Type;
696 typedef A4 A4Type;
697 typedef A5 A5Type;
700 template <typename R, typename A1, typename A2, typename A3, typename A4,
701 typename A5, typename A6>
702 struct FunctionTraits<R(A1, A2, A3, A4, A5, A6)> {
703 typedef R ReturnType;
704 typedef A1 A1Type;
705 typedef A2 A2Type;
706 typedef A3 A3Type;
707 typedef A4 A4Type;
708 typedef A5 A5Type;
709 typedef A6 A6Type;
712 template <typename R, typename A1, typename A2, typename A3, typename A4,
713 typename A5, typename A6, typename A7>
714 struct FunctionTraits<R(A1, A2, A3, A4, A5, A6, A7)> {
715 typedef R ReturnType;
716 typedef A1 A1Type;
717 typedef A2 A2Type;
718 typedef A3 A3Type;
719 typedef A4 A4Type;
720 typedef A5 A5Type;
721 typedef A6 A6Type;
722 typedef A7 A7Type;
726 // ForceVoidReturn<>
728 // Set of templates that support forcing the function return type to void.
729 template <typename Sig>
730 struct ForceVoidReturn;
732 template <typename R>
733 struct ForceVoidReturn<R()> {
734 typedef void(RunType)();
737 template <typename R, typename A1>
738 struct ForceVoidReturn<R(A1)> {
739 typedef void(RunType)(A1);
742 template <typename R, typename A1, typename A2>
743 struct ForceVoidReturn<R(A1, A2)> {
744 typedef void(RunType)(A1, A2);
747 template <typename R, typename A1, typename A2, typename A3>
748 struct ForceVoidReturn<R(A1, A2, A3)> {
749 typedef void(RunType)(A1, A2, A3);
752 template <typename R, typename A1, typename A2, typename A3, typename A4>
753 struct ForceVoidReturn<R(A1, A2, A3, A4)> {
754 typedef void(RunType)(A1, A2, A3, A4);
757 template <typename R, typename A1, typename A2, typename A3, typename A4,
758 typename A5>
759 struct ForceVoidReturn<R(A1, A2, A3, A4, A5)> {
760 typedef void(RunType)(A1, A2, A3, A4, A5);
763 template <typename R, typename A1, typename A2, typename A3, typename A4,
764 typename A5, typename A6>
765 struct ForceVoidReturn<R(A1, A2, A3, A4, A5, A6)> {
766 typedef void(RunType)(A1, A2, A3, A4, A5, A6);
769 template <typename R, typename A1, typename A2, typename A3, typename A4,
770 typename A5, typename A6, typename A7>
771 struct ForceVoidReturn<R(A1, A2, A3, A4, A5, A6, A7)> {
772 typedef void(RunType)(A1, A2, A3, A4, A5, A6, A7);
776 // FunctorTraits<>
778 // See description at top of file.
779 template <typename T>
780 struct FunctorTraits {
781 typedef RunnableAdapter<T> RunnableType;
782 typedef typename RunnableType::RunType RunType;
785 template <typename T>
786 struct FunctorTraits<IgnoreResultHelper<T> > {
787 typedef typename FunctorTraits<T>::RunnableType RunnableType;
788 typedef typename ForceVoidReturn<
789 typename RunnableType::RunType>::RunType RunType;
792 template <typename T>
793 struct FunctorTraits<Callback<T> > {
794 typedef Callback<T> RunnableType;
795 typedef typename Callback<T>::RunType RunType;
799 // MakeRunnable<>
801 // Converts a passed in functor to a RunnableType using type inference.
803 template <typename T>
804 typename FunctorTraits<T>::RunnableType MakeRunnable(const T& t) {
805 return RunnableAdapter<T>(t);
808 template <typename T>
809 typename FunctorTraits<T>::RunnableType
810 MakeRunnable(const IgnoreResultHelper<T>& t) {
811 return MakeRunnable(t.functor_);
814 template <typename T>
815 const typename FunctorTraits<Callback<T> >::RunnableType&
816 MakeRunnable(const Callback<T>& t) {
817 DCHECK(!t.is_null());
818 return t;
822 // InvokeHelper<>
824 // There are 3 logical InvokeHelper<> specializations: normal, void-return,
825 // WeakCalls.
827 // The normal type just calls the underlying runnable.
829 // We need a InvokeHelper to handle void return types in order to support
830 // IgnoreResult(). Normally, if the Runnable's RunType had a void return,
831 // the template system would just accept "return functor.Run()" ignoring
832 // the fact that a void function is being used with return. This piece of
833 // sugar breaks though when the Runnable's RunType is not void. Thus, we
834 // need a partial specialization to change the syntax to drop the "return"
835 // from the invocation call.
837 // WeakCalls similarly need special syntax that is applied to the first
838 // argument to check if they should no-op themselves.
839 template <bool IsWeakCall, typename ReturnType, typename Runnable,
840 typename ArgsType>
841 struct InvokeHelper;
843 template <typename ReturnType, typename Runnable>
844 struct InvokeHelper<false, ReturnType, Runnable,
845 void()> {
846 static ReturnType MakeItSo(Runnable runnable) {
847 return runnable.Run();
851 template <typename Runnable>
852 struct InvokeHelper<false, void, Runnable,
853 void()> {
854 static void MakeItSo(Runnable runnable) {
855 runnable.Run();
859 template <typename ReturnType, typename Runnable,typename A1>
860 struct InvokeHelper<false, ReturnType, Runnable,
861 void(A1)> {
862 static ReturnType MakeItSo(Runnable runnable, A1 a1) {
863 return runnable.Run(CallbackForward(a1));
867 template <typename Runnable,typename A1>
868 struct InvokeHelper<false, void, Runnable,
869 void(A1)> {
870 static void MakeItSo(Runnable runnable, A1 a1) {
871 runnable.Run(CallbackForward(a1));
875 template <typename Runnable, typename BoundWeakPtr>
876 struct InvokeHelper<true, void, Runnable,
877 void(BoundWeakPtr)> {
878 static void MakeItSo(Runnable runnable, BoundWeakPtr weak_ptr) {
879 if (!weak_ptr.get()) {
880 return;
882 runnable.Run(weak_ptr.get());
886 template <typename ReturnType, typename Runnable,typename A1, typename A2>
887 struct InvokeHelper<false, ReturnType, Runnable,
888 void(A1, A2)> {
889 static ReturnType MakeItSo(Runnable runnable, A1 a1, A2 a2) {
890 return runnable.Run(CallbackForward(a1), CallbackForward(a2));
894 template <typename Runnable,typename A1, typename A2>
895 struct InvokeHelper<false, void, Runnable,
896 void(A1, A2)> {
897 static void MakeItSo(Runnable runnable, A1 a1, A2 a2) {
898 runnable.Run(CallbackForward(a1), CallbackForward(a2));
902 template <typename Runnable, typename BoundWeakPtr, typename A2>
903 struct InvokeHelper<true, void, Runnable,
904 void(BoundWeakPtr, A2)> {
905 static void MakeItSo(Runnable runnable, BoundWeakPtr weak_ptr, A2 a2) {
906 if (!weak_ptr.get()) {
907 return;
909 runnable.Run(weak_ptr.get(), CallbackForward(a2));
913 template <typename ReturnType, typename Runnable,typename A1, typename A2,
914 typename A3>
915 struct InvokeHelper<false, ReturnType, Runnable,
916 void(A1, A2, A3)> {
917 static ReturnType MakeItSo(Runnable runnable, A1 a1, A2 a2, A3 a3) {
918 return runnable.Run(CallbackForward(a1), CallbackForward(a2),
919 CallbackForward(a3));
923 template <typename Runnable,typename A1, typename A2, typename A3>
924 struct InvokeHelper<false, void, Runnable,
925 void(A1, A2, A3)> {
926 static void MakeItSo(Runnable runnable, A1 a1, A2 a2, A3 a3) {
927 runnable.Run(CallbackForward(a1), CallbackForward(a2), CallbackForward(a3));
931 template <typename Runnable, typename BoundWeakPtr, typename A2, typename A3>
932 struct InvokeHelper<true, void, Runnable,
933 void(BoundWeakPtr, A2, A3)> {
934 static void MakeItSo(Runnable runnable, BoundWeakPtr weak_ptr, A2 a2, A3 a3) {
935 if (!weak_ptr.get()) {
936 return;
938 runnable.Run(weak_ptr.get(), 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 BoundWeakPtr, typename A2, typename A3,
962 typename A4>
963 struct InvokeHelper<true, void, Runnable,
964 void(BoundWeakPtr, A2, A3, A4)> {
965 static void MakeItSo(Runnable runnable, BoundWeakPtr weak_ptr, A2 a2, A3 a3,
966 A4 a4) {
967 if (!weak_ptr.get()) {
968 return;
970 runnable.Run(weak_ptr.get(), CallbackForward(a2), CallbackForward(a3),
971 CallbackForward(a4));
975 template <typename ReturnType, typename Runnable,typename A1, typename A2,
976 typename A3, typename A4, typename A5>
977 struct InvokeHelper<false, ReturnType, Runnable,
978 void(A1, A2, A3, A4, A5)> {
979 static ReturnType MakeItSo(Runnable runnable, A1 a1, A2 a2, A3 a3, A4 a4,
980 A5 a5) {
981 return runnable.Run(CallbackForward(a1), CallbackForward(a2),
982 CallbackForward(a3), CallbackForward(a4), CallbackForward(a5));
986 template <typename Runnable,typename A1, typename A2, typename A3, typename A4,
987 typename A5>
988 struct InvokeHelper<false, void, Runnable,
989 void(A1, A2, A3, A4, A5)> {
990 static void MakeItSo(Runnable runnable, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) {
991 runnable.Run(CallbackForward(a1), CallbackForward(a2), CallbackForward(a3),
992 CallbackForward(a4), CallbackForward(a5));
996 template <typename Runnable, typename BoundWeakPtr, typename A2, typename A3,
997 typename A4, typename A5>
998 struct InvokeHelper<true, void, Runnable,
999 void(BoundWeakPtr, A2, A3, A4, A5)> {
1000 static void MakeItSo(Runnable runnable, BoundWeakPtr weak_ptr, A2 a2, A3 a3,
1001 A4 a4, A5 a5) {
1002 if (!weak_ptr.get()) {
1003 return;
1005 runnable.Run(weak_ptr.get(), CallbackForward(a2), CallbackForward(a3),
1006 CallbackForward(a4), CallbackForward(a5));
1010 template <typename ReturnType, typename Runnable,typename A1, typename A2,
1011 typename A3, typename A4, typename A5, typename A6>
1012 struct InvokeHelper<false, ReturnType, Runnable,
1013 void(A1, A2, A3, A4, A5, A6)> {
1014 static ReturnType MakeItSo(Runnable runnable, A1 a1, A2 a2, A3 a3, A4 a4,
1015 A5 a5, A6 a6) {
1016 return runnable.Run(CallbackForward(a1), CallbackForward(a2),
1017 CallbackForward(a3), CallbackForward(a4), CallbackForward(a5),
1018 CallbackForward(a6));
1022 template <typename Runnable,typename A1, typename A2, typename A3, typename A4,
1023 typename A5, typename A6>
1024 struct InvokeHelper<false, void, Runnable,
1025 void(A1, A2, A3, A4, A5, A6)> {
1026 static void MakeItSo(Runnable runnable, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5,
1027 A6 a6) {
1028 runnable.Run(CallbackForward(a1), CallbackForward(a2), CallbackForward(a3),
1029 CallbackForward(a4), CallbackForward(a5), CallbackForward(a6));
1033 template <typename Runnable, typename BoundWeakPtr, typename A2, typename A3,
1034 typename A4, typename A5, typename A6>
1035 struct InvokeHelper<true, void, Runnable,
1036 void(BoundWeakPtr, A2, A3, A4, A5, A6)> {
1037 static void MakeItSo(Runnable runnable, BoundWeakPtr weak_ptr, A2 a2, A3 a3,
1038 A4 a4, A5 a5, A6 a6) {
1039 if (!weak_ptr.get()) {
1040 return;
1042 runnable.Run(weak_ptr.get(), 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 BoundWeakPtr, typename A2, typename A3,
1072 typename A4, typename A5, typename A6, typename A7>
1073 struct InvokeHelper<true, void, Runnable,
1074 void(BoundWeakPtr, A2, A3, A4, A5, A6, A7)> {
1075 static void MakeItSo(Runnable runnable, BoundWeakPtr weak_ptr, A2 a2, A3 a3,
1076 A4 a4, A5 a5, A6 a6, A7 a7) {
1077 if (!weak_ptr.get()) {
1078 return;
1080 runnable.Run(weak_ptr.get(), CallbackForward(a2), CallbackForward(a3),
1081 CallbackForward(a4), CallbackForward(a5), CallbackForward(a6),
1082 CallbackForward(a7));
1086 #if !defined(_MSC_VER)
1088 template <typename ReturnType, typename Runnable, typename ArgsType>
1089 struct InvokeHelper<true, ReturnType, Runnable, ArgsType> {
1090 // WeakCalls are only supported for functions with a void return type.
1091 // Otherwise, the function result would be undefined if the the WeakPtr<>
1092 // is invalidated.
1093 COMPILE_ASSERT(is_void<ReturnType>::value,
1094 weak_ptrs_can_only_bind_to_methods_without_return_values);
1097 #endif
1099 // Invoker<>
1101 // See description at the top of the file.
1102 template <int NumBound, typename Storage, typename RunType>
1103 struct Invoker;
1105 // Arity 0 -> 0.
1106 template <typename StorageType, typename R>
1107 struct Invoker<0, StorageType, R()> {
1108 typedef R(RunType)(BindStateBase*);
1110 typedef R(UnboundRunType)();
1112 static R Run(BindStateBase* base) {
1113 StorageType* storage = static_cast<StorageType*>(base);
1115 // Local references to make debugger stepping easier. If in a debugger,
1116 // you really want to warp ahead and step through the
1117 // InvokeHelper<>::MakeItSo() call below.
1119 return InvokeHelper<StorageType::IsWeakCall::value, R,
1120 typename StorageType::RunnableType,
1121 void()>
1122 ::MakeItSo(storage->runnable_);
1126 // Arity 1 -> 1.
1127 template <typename StorageType, typename R,typename X1>
1128 struct Invoker<0, StorageType, R(X1)> {
1129 typedef R(RunType)(BindStateBase*,
1130 typename CallbackParamTraits<X1>::ForwardType);
1132 typedef R(UnboundRunType)(X1);
1134 static R Run(BindStateBase* base,
1135 typename CallbackParamTraits<X1>::ForwardType x1) {
1136 StorageType* storage = static_cast<StorageType*>(base);
1138 // Local references to make debugger stepping easier. If in a debugger,
1139 // you really want to warp ahead and step through the
1140 // InvokeHelper<>::MakeItSo() call below.
1142 return InvokeHelper<StorageType::IsWeakCall::value, R,
1143 typename StorageType::RunnableType,
1144 void(typename CallbackParamTraits<X1>::ForwardType x1)>
1145 ::MakeItSo(storage->runnable_, CallbackForward(x1));
1149 // Arity 1 -> 0.
1150 template <typename StorageType, typename R,typename X1>
1151 struct Invoker<1, StorageType, R(X1)> {
1152 typedef R(RunType)(BindStateBase*);
1154 typedef R(UnboundRunType)();
1156 static R Run(BindStateBase* base) {
1157 StorageType* storage = static_cast<StorageType*>(base);
1159 // Local references to make debugger stepping easier. If in a debugger,
1160 // you really want to warp ahead and step through the
1161 // InvokeHelper<>::MakeItSo() call below.
1162 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
1164 typename Bound1UnwrapTraits::ForwardType x1 =
1165 Bound1UnwrapTraits::Unwrap(storage->p1_);
1166 return InvokeHelper<StorageType::IsWeakCall::value, R,
1167 typename StorageType::RunnableType,
1168 void(typename Bound1UnwrapTraits::ForwardType)>
1169 ::MakeItSo(storage->runnable_, CallbackForward(x1));
1173 // Arity 2 -> 2.
1174 template <typename StorageType, typename R,typename X1, typename X2>
1175 struct Invoker<0, StorageType, R(X1, X2)> {
1176 typedef R(RunType)(BindStateBase*,
1177 typename CallbackParamTraits<X1>::ForwardType,
1178 typename CallbackParamTraits<X2>::ForwardType);
1180 typedef R(UnboundRunType)(X1, X2);
1182 static R Run(BindStateBase* base,
1183 typename CallbackParamTraits<X1>::ForwardType x1,
1184 typename CallbackParamTraits<X2>::ForwardType x2) {
1185 StorageType* storage = static_cast<StorageType*>(base);
1187 // Local references to make debugger stepping easier. If in a debugger,
1188 // you really want to warp ahead and step through the
1189 // InvokeHelper<>::MakeItSo() call below.
1191 return InvokeHelper<StorageType::IsWeakCall::value, R,
1192 typename StorageType::RunnableType,
1193 void(typename CallbackParamTraits<X1>::ForwardType x1,
1194 typename CallbackParamTraits<X2>::ForwardType x2)>
1195 ::MakeItSo(storage->runnable_, CallbackForward(x1),
1196 CallbackForward(x2));
1200 // Arity 2 -> 1.
1201 template <typename StorageType, typename R,typename X1, typename X2>
1202 struct Invoker<1, StorageType, R(X1, X2)> {
1203 typedef R(RunType)(BindStateBase*,
1204 typename CallbackParamTraits<X2>::ForwardType);
1206 typedef R(UnboundRunType)(X2);
1208 static R Run(BindStateBase* base,
1209 typename CallbackParamTraits<X2>::ForwardType x2) {
1210 StorageType* storage = static_cast<StorageType*>(base);
1212 // Local references to make debugger stepping easier. If in a debugger,
1213 // you really want to warp ahead and step through the
1214 // InvokeHelper<>::MakeItSo() call below.
1215 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
1217 typename Bound1UnwrapTraits::ForwardType x1 =
1218 Bound1UnwrapTraits::Unwrap(storage->p1_);
1219 return InvokeHelper<StorageType::IsWeakCall::value, R,
1220 typename StorageType::RunnableType,
1221 void(typename Bound1UnwrapTraits::ForwardType,
1222 typename CallbackParamTraits<X2>::ForwardType x2)>
1223 ::MakeItSo(storage->runnable_, CallbackForward(x1),
1224 CallbackForward(x2));
1228 // Arity 2 -> 0.
1229 template <typename StorageType, typename R,typename X1, typename X2>
1230 struct Invoker<2, StorageType, R(X1, X2)> {
1231 typedef R(RunType)(BindStateBase*);
1233 typedef R(UnboundRunType)();
1235 static R Run(BindStateBase* base) {
1236 StorageType* storage = static_cast<StorageType*>(base);
1238 // Local references to make debugger stepping easier. If in a debugger,
1239 // you really want to warp ahead and step through the
1240 // InvokeHelper<>::MakeItSo() call below.
1241 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
1242 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
1244 typename Bound1UnwrapTraits::ForwardType x1 =
1245 Bound1UnwrapTraits::Unwrap(storage->p1_);
1246 typename Bound2UnwrapTraits::ForwardType x2 =
1247 Bound2UnwrapTraits::Unwrap(storage->p2_);
1248 return InvokeHelper<StorageType::IsWeakCall::value, R,
1249 typename StorageType::RunnableType,
1250 void(typename Bound1UnwrapTraits::ForwardType,
1251 typename Bound2UnwrapTraits::ForwardType)>
1252 ::MakeItSo(storage->runnable_, CallbackForward(x1),
1253 CallbackForward(x2));
1257 // Arity 3 -> 3.
1258 template <typename StorageType, typename R,typename X1, typename X2,
1259 typename X3>
1260 struct Invoker<0, StorageType, R(X1, X2, X3)> {
1261 typedef R(RunType)(BindStateBase*,
1262 typename CallbackParamTraits<X1>::ForwardType,
1263 typename CallbackParamTraits<X2>::ForwardType,
1264 typename CallbackParamTraits<X3>::ForwardType);
1266 typedef R(UnboundRunType)(X1, X2, X3);
1268 static R Run(BindStateBase* base,
1269 typename CallbackParamTraits<X1>::ForwardType x1,
1270 typename CallbackParamTraits<X2>::ForwardType x2,
1271 typename CallbackParamTraits<X3>::ForwardType x3) {
1272 StorageType* storage = static_cast<StorageType*>(base);
1274 // Local references to make debugger stepping easier. If in a debugger,
1275 // you really want to warp ahead and step through the
1276 // InvokeHelper<>::MakeItSo() call below.
1278 return InvokeHelper<StorageType::IsWeakCall::value, R,
1279 typename StorageType::RunnableType,
1280 void(typename CallbackParamTraits<X1>::ForwardType x1,
1281 typename CallbackParamTraits<X2>::ForwardType x2,
1282 typename CallbackParamTraits<X3>::ForwardType x3)>
1283 ::MakeItSo(storage->runnable_, CallbackForward(x1),
1284 CallbackForward(x2), CallbackForward(x3));
1288 // Arity 3 -> 2.
1289 template <typename StorageType, typename R,typename X1, typename X2,
1290 typename X3>
1291 struct Invoker<1, StorageType, R(X1, X2, X3)> {
1292 typedef R(RunType)(BindStateBase*,
1293 typename CallbackParamTraits<X2>::ForwardType,
1294 typename CallbackParamTraits<X3>::ForwardType);
1296 typedef R(UnboundRunType)(X2, X3);
1298 static R Run(BindStateBase* base,
1299 typename CallbackParamTraits<X2>::ForwardType x2,
1300 typename CallbackParamTraits<X3>::ForwardType x3) {
1301 StorageType* storage = static_cast<StorageType*>(base);
1303 // Local references to make debugger stepping easier. If in a debugger,
1304 // you really want to warp ahead and step through the
1305 // InvokeHelper<>::MakeItSo() call below.
1306 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
1308 typename Bound1UnwrapTraits::ForwardType x1 =
1309 Bound1UnwrapTraits::Unwrap(storage->p1_);
1310 return InvokeHelper<StorageType::IsWeakCall::value, R,
1311 typename StorageType::RunnableType,
1312 void(typename Bound1UnwrapTraits::ForwardType,
1313 typename CallbackParamTraits<X2>::ForwardType x2,
1314 typename CallbackParamTraits<X3>::ForwardType x3)>
1315 ::MakeItSo(storage->runnable_, CallbackForward(x1),
1316 CallbackForward(x2), CallbackForward(x3));
1320 // Arity 3 -> 1.
1321 template <typename StorageType, typename R,typename X1, typename X2,
1322 typename X3>
1323 struct Invoker<2, StorageType, R(X1, X2, X3)> {
1324 typedef R(RunType)(BindStateBase*,
1325 typename CallbackParamTraits<X3>::ForwardType);
1327 typedef R(UnboundRunType)(X3);
1329 static R Run(BindStateBase* base,
1330 typename CallbackParamTraits<X3>::ForwardType x3) {
1331 StorageType* storage = static_cast<StorageType*>(base);
1333 // Local references to make debugger stepping easier. If in a debugger,
1334 // you really want to warp ahead and step through the
1335 // InvokeHelper<>::MakeItSo() call below.
1336 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
1337 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
1339 typename Bound1UnwrapTraits::ForwardType x1 =
1340 Bound1UnwrapTraits::Unwrap(storage->p1_);
1341 typename Bound2UnwrapTraits::ForwardType x2 =
1342 Bound2UnwrapTraits::Unwrap(storage->p2_);
1343 return InvokeHelper<StorageType::IsWeakCall::value, R,
1344 typename StorageType::RunnableType,
1345 void(typename Bound1UnwrapTraits::ForwardType,
1346 typename Bound2UnwrapTraits::ForwardType,
1347 typename CallbackParamTraits<X3>::ForwardType x3)>
1348 ::MakeItSo(storage->runnable_, CallbackForward(x1),
1349 CallbackForward(x2), CallbackForward(x3));
1353 // Arity 3 -> 0.
1354 template <typename StorageType, typename R,typename X1, typename X2,
1355 typename X3>
1356 struct Invoker<3, StorageType, R(X1, X2, X3)> {
1357 typedef R(RunType)(BindStateBase*);
1359 typedef R(UnboundRunType)();
1361 static R Run(BindStateBase* base) {
1362 StorageType* storage = static_cast<StorageType*>(base);
1364 // Local references to make debugger stepping easier. If in a debugger,
1365 // you really want to warp ahead and step through the
1366 // InvokeHelper<>::MakeItSo() call below.
1367 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
1368 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
1369 typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits;
1371 typename Bound1UnwrapTraits::ForwardType x1 =
1372 Bound1UnwrapTraits::Unwrap(storage->p1_);
1373 typename Bound2UnwrapTraits::ForwardType x2 =
1374 Bound2UnwrapTraits::Unwrap(storage->p2_);
1375 typename Bound3UnwrapTraits::ForwardType x3 =
1376 Bound3UnwrapTraits::Unwrap(storage->p3_);
1377 return InvokeHelper<StorageType::IsWeakCall::value, R,
1378 typename StorageType::RunnableType,
1379 void(typename Bound1UnwrapTraits::ForwardType,
1380 typename Bound2UnwrapTraits::ForwardType,
1381 typename Bound3UnwrapTraits::ForwardType)>
1382 ::MakeItSo(storage->runnable_, CallbackForward(x1),
1383 CallbackForward(x2), CallbackForward(x3));
1387 // Arity 4 -> 4.
1388 template <typename StorageType, typename R,typename X1, typename X2,
1389 typename X3, typename X4>
1390 struct Invoker<0, StorageType, R(X1, X2, X3, X4)> {
1391 typedef R(RunType)(BindStateBase*,
1392 typename CallbackParamTraits<X1>::ForwardType,
1393 typename CallbackParamTraits<X2>::ForwardType,
1394 typename CallbackParamTraits<X3>::ForwardType,
1395 typename CallbackParamTraits<X4>::ForwardType);
1397 typedef R(UnboundRunType)(X1, X2, X3, X4);
1399 static R Run(BindStateBase* base,
1400 typename CallbackParamTraits<X1>::ForwardType x1,
1401 typename CallbackParamTraits<X2>::ForwardType x2,
1402 typename CallbackParamTraits<X3>::ForwardType x3,
1403 typename CallbackParamTraits<X4>::ForwardType x4) {
1404 StorageType* storage = static_cast<StorageType*>(base);
1406 // Local references to make debugger stepping easier. If in a debugger,
1407 // you really want to warp ahead and step through the
1408 // InvokeHelper<>::MakeItSo() call below.
1410 return InvokeHelper<StorageType::IsWeakCall::value, R,
1411 typename StorageType::RunnableType,
1412 void(typename CallbackParamTraits<X1>::ForwardType x1,
1413 typename CallbackParamTraits<X2>::ForwardType x2,
1414 typename CallbackParamTraits<X3>::ForwardType x3,
1415 typename CallbackParamTraits<X4>::ForwardType x4)>
1416 ::MakeItSo(storage->runnable_, CallbackForward(x1),
1417 CallbackForward(x2), CallbackForward(x3),
1418 CallbackForward(x4));
1422 // Arity 4 -> 3.
1423 template <typename StorageType, typename R,typename X1, typename X2,
1424 typename X3, typename X4>
1425 struct Invoker<1, StorageType, R(X1, X2, X3, X4)> {
1426 typedef R(RunType)(BindStateBase*,
1427 typename CallbackParamTraits<X2>::ForwardType,
1428 typename CallbackParamTraits<X3>::ForwardType,
1429 typename CallbackParamTraits<X4>::ForwardType);
1431 typedef R(UnboundRunType)(X2, X3, X4);
1433 static R Run(BindStateBase* base,
1434 typename CallbackParamTraits<X2>::ForwardType x2,
1435 typename CallbackParamTraits<X3>::ForwardType x3,
1436 typename CallbackParamTraits<X4>::ForwardType x4) {
1437 StorageType* storage = static_cast<StorageType*>(base);
1439 // Local references to make debugger stepping easier. If in a debugger,
1440 // you really want to warp ahead and step through the
1441 // InvokeHelper<>::MakeItSo() call below.
1442 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
1444 typename Bound1UnwrapTraits::ForwardType x1 =
1445 Bound1UnwrapTraits::Unwrap(storage->p1_);
1446 return InvokeHelper<StorageType::IsWeakCall::value, R,
1447 typename StorageType::RunnableType,
1448 void(typename Bound1UnwrapTraits::ForwardType,
1449 typename CallbackParamTraits<X2>::ForwardType x2,
1450 typename CallbackParamTraits<X3>::ForwardType x3,
1451 typename CallbackParamTraits<X4>::ForwardType x4)>
1452 ::MakeItSo(storage->runnable_, CallbackForward(x1),
1453 CallbackForward(x2), CallbackForward(x3),
1454 CallbackForward(x4));
1458 // Arity 4 -> 2.
1459 template <typename StorageType, typename R,typename X1, typename X2,
1460 typename X3, typename X4>
1461 struct Invoker<2, StorageType, R(X1, X2, X3, X4)> {
1462 typedef R(RunType)(BindStateBase*,
1463 typename CallbackParamTraits<X3>::ForwardType,
1464 typename CallbackParamTraits<X4>::ForwardType);
1466 typedef R(UnboundRunType)(X3, X4);
1468 static R Run(BindStateBase* base,
1469 typename CallbackParamTraits<X3>::ForwardType x3,
1470 typename CallbackParamTraits<X4>::ForwardType x4) {
1471 StorageType* storage = static_cast<StorageType*>(base);
1473 // Local references to make debugger stepping easier. If in a debugger,
1474 // you really want to warp ahead and step through the
1475 // InvokeHelper<>::MakeItSo() call below.
1476 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
1477 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
1479 typename Bound1UnwrapTraits::ForwardType x1 =
1480 Bound1UnwrapTraits::Unwrap(storage->p1_);
1481 typename Bound2UnwrapTraits::ForwardType x2 =
1482 Bound2UnwrapTraits::Unwrap(storage->p2_);
1483 return InvokeHelper<StorageType::IsWeakCall::value, R,
1484 typename StorageType::RunnableType,
1485 void(typename Bound1UnwrapTraits::ForwardType,
1486 typename Bound2UnwrapTraits::ForwardType,
1487 typename CallbackParamTraits<X3>::ForwardType x3,
1488 typename CallbackParamTraits<X4>::ForwardType x4)>
1489 ::MakeItSo(storage->runnable_, CallbackForward(x1),
1490 CallbackForward(x2), CallbackForward(x3),
1491 CallbackForward(x4));
1495 // Arity 4 -> 1.
1496 template <typename StorageType, typename R,typename X1, typename X2,
1497 typename X3, typename X4>
1498 struct Invoker<3, StorageType, R(X1, X2, X3, X4)> {
1499 typedef R(RunType)(BindStateBase*,
1500 typename CallbackParamTraits<X4>::ForwardType);
1502 typedef R(UnboundRunType)(X4);
1504 static R Run(BindStateBase* base,
1505 typename CallbackParamTraits<X4>::ForwardType x4) {
1506 StorageType* storage = static_cast<StorageType*>(base);
1508 // Local references to make debugger stepping easier. If in a debugger,
1509 // you really want to warp ahead and step through the
1510 // InvokeHelper<>::MakeItSo() call below.
1511 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
1512 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
1513 typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits;
1515 typename Bound1UnwrapTraits::ForwardType x1 =
1516 Bound1UnwrapTraits::Unwrap(storage->p1_);
1517 typename Bound2UnwrapTraits::ForwardType x2 =
1518 Bound2UnwrapTraits::Unwrap(storage->p2_);
1519 typename Bound3UnwrapTraits::ForwardType x3 =
1520 Bound3UnwrapTraits::Unwrap(storage->p3_);
1521 return InvokeHelper<StorageType::IsWeakCall::value, R,
1522 typename StorageType::RunnableType,
1523 void(typename Bound1UnwrapTraits::ForwardType,
1524 typename Bound2UnwrapTraits::ForwardType,
1525 typename Bound3UnwrapTraits::ForwardType,
1526 typename CallbackParamTraits<X4>::ForwardType x4)>
1527 ::MakeItSo(storage->runnable_, CallbackForward(x1),
1528 CallbackForward(x2), CallbackForward(x3),
1529 CallbackForward(x4));
1533 // Arity 4 -> 0.
1534 template <typename StorageType, typename R,typename X1, typename X2,
1535 typename X3, typename X4>
1536 struct Invoker<4, StorageType, R(X1, X2, X3, X4)> {
1537 typedef R(RunType)(BindStateBase*);
1539 typedef R(UnboundRunType)();
1541 static R Run(BindStateBase* base) {
1542 StorageType* storage = static_cast<StorageType*>(base);
1544 // Local references to make debugger stepping easier. If in a debugger,
1545 // you really want to warp ahead and step through the
1546 // InvokeHelper<>::MakeItSo() call below.
1547 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
1548 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
1549 typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits;
1550 typedef typename StorageType::Bound4UnwrapTraits Bound4UnwrapTraits;
1552 typename Bound1UnwrapTraits::ForwardType x1 =
1553 Bound1UnwrapTraits::Unwrap(storage->p1_);
1554 typename Bound2UnwrapTraits::ForwardType x2 =
1555 Bound2UnwrapTraits::Unwrap(storage->p2_);
1556 typename Bound3UnwrapTraits::ForwardType x3 =
1557 Bound3UnwrapTraits::Unwrap(storage->p3_);
1558 typename Bound4UnwrapTraits::ForwardType x4 =
1559 Bound4UnwrapTraits::Unwrap(storage->p4_);
1560 return InvokeHelper<StorageType::IsWeakCall::value, R,
1561 typename StorageType::RunnableType,
1562 void(typename Bound1UnwrapTraits::ForwardType,
1563 typename Bound2UnwrapTraits::ForwardType,
1564 typename Bound3UnwrapTraits::ForwardType,
1565 typename Bound4UnwrapTraits::ForwardType)>
1566 ::MakeItSo(storage->runnable_, CallbackForward(x1),
1567 CallbackForward(x2), CallbackForward(x3),
1568 CallbackForward(x4));
1572 // Arity 5 -> 5.
1573 template <typename StorageType, typename R,typename X1, typename X2,
1574 typename X3, typename X4, typename X5>
1575 struct Invoker<0, StorageType, R(X1, X2, X3, X4, X5)> {
1576 typedef R(RunType)(BindStateBase*,
1577 typename CallbackParamTraits<X1>::ForwardType,
1578 typename CallbackParamTraits<X2>::ForwardType,
1579 typename CallbackParamTraits<X3>::ForwardType,
1580 typename CallbackParamTraits<X4>::ForwardType,
1581 typename CallbackParamTraits<X5>::ForwardType);
1583 typedef R(UnboundRunType)(X1, X2, X3, X4, X5);
1585 static R Run(BindStateBase* base,
1586 typename CallbackParamTraits<X1>::ForwardType x1,
1587 typename CallbackParamTraits<X2>::ForwardType x2,
1588 typename CallbackParamTraits<X3>::ForwardType x3,
1589 typename CallbackParamTraits<X4>::ForwardType x4,
1590 typename CallbackParamTraits<X5>::ForwardType x5) {
1591 StorageType* storage = static_cast<StorageType*>(base);
1593 // Local references to make debugger stepping easier. If in a debugger,
1594 // you really want to warp ahead and step through the
1595 // InvokeHelper<>::MakeItSo() call below.
1597 return InvokeHelper<StorageType::IsWeakCall::value, R,
1598 typename StorageType::RunnableType,
1599 void(typename CallbackParamTraits<X1>::ForwardType x1,
1600 typename CallbackParamTraits<X2>::ForwardType x2,
1601 typename CallbackParamTraits<X3>::ForwardType x3,
1602 typename CallbackParamTraits<X4>::ForwardType x4,
1603 typename CallbackParamTraits<X5>::ForwardType x5)>
1604 ::MakeItSo(storage->runnable_, CallbackForward(x1),
1605 CallbackForward(x2), CallbackForward(x3),
1606 CallbackForward(x4), CallbackForward(x5));
1610 // Arity 5 -> 4.
1611 template <typename StorageType, typename R,typename X1, typename X2,
1612 typename X3, typename X4, typename X5>
1613 struct Invoker<1, StorageType, R(X1, X2, X3, X4, X5)> {
1614 typedef R(RunType)(BindStateBase*,
1615 typename CallbackParamTraits<X2>::ForwardType,
1616 typename CallbackParamTraits<X3>::ForwardType,
1617 typename CallbackParamTraits<X4>::ForwardType,
1618 typename CallbackParamTraits<X5>::ForwardType);
1620 typedef R(UnboundRunType)(X2, X3, X4, X5);
1622 static R Run(BindStateBase* base,
1623 typename CallbackParamTraits<X2>::ForwardType x2,
1624 typename CallbackParamTraits<X3>::ForwardType x3,
1625 typename CallbackParamTraits<X4>::ForwardType x4,
1626 typename CallbackParamTraits<X5>::ForwardType x5) {
1627 StorageType* storage = static_cast<StorageType*>(base);
1629 // Local references to make debugger stepping easier. If in a debugger,
1630 // you really want to warp ahead and step through the
1631 // InvokeHelper<>::MakeItSo() call below.
1632 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
1634 typename Bound1UnwrapTraits::ForwardType x1 =
1635 Bound1UnwrapTraits::Unwrap(storage->p1_);
1636 return InvokeHelper<StorageType::IsWeakCall::value, R,
1637 typename StorageType::RunnableType,
1638 void(typename Bound1UnwrapTraits::ForwardType,
1639 typename CallbackParamTraits<X2>::ForwardType x2,
1640 typename CallbackParamTraits<X3>::ForwardType x3,
1641 typename CallbackParamTraits<X4>::ForwardType x4,
1642 typename CallbackParamTraits<X5>::ForwardType x5)>
1643 ::MakeItSo(storage->runnable_, CallbackForward(x1),
1644 CallbackForward(x2), CallbackForward(x3),
1645 CallbackForward(x4), CallbackForward(x5));
1649 // Arity 5 -> 3.
1650 template <typename StorageType, typename R,typename X1, typename X2,
1651 typename X3, typename X4, typename X5>
1652 struct Invoker<2, StorageType, R(X1, X2, X3, X4, X5)> {
1653 typedef R(RunType)(BindStateBase*,
1654 typename CallbackParamTraits<X3>::ForwardType,
1655 typename CallbackParamTraits<X4>::ForwardType,
1656 typename CallbackParamTraits<X5>::ForwardType);
1658 typedef R(UnboundRunType)(X3, X4, X5);
1660 static R Run(BindStateBase* base,
1661 typename CallbackParamTraits<X3>::ForwardType x3,
1662 typename CallbackParamTraits<X4>::ForwardType x4,
1663 typename CallbackParamTraits<X5>::ForwardType x5) {
1664 StorageType* storage = static_cast<StorageType*>(base);
1666 // Local references to make debugger stepping easier. If in a debugger,
1667 // you really want to warp ahead and step through the
1668 // InvokeHelper<>::MakeItSo() call below.
1669 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
1670 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
1672 typename Bound1UnwrapTraits::ForwardType x1 =
1673 Bound1UnwrapTraits::Unwrap(storage->p1_);
1674 typename Bound2UnwrapTraits::ForwardType x2 =
1675 Bound2UnwrapTraits::Unwrap(storage->p2_);
1676 return InvokeHelper<StorageType::IsWeakCall::value, R,
1677 typename StorageType::RunnableType,
1678 void(typename Bound1UnwrapTraits::ForwardType,
1679 typename Bound2UnwrapTraits::ForwardType,
1680 typename CallbackParamTraits<X3>::ForwardType x3,
1681 typename CallbackParamTraits<X4>::ForwardType x4,
1682 typename CallbackParamTraits<X5>::ForwardType x5)>
1683 ::MakeItSo(storage->runnable_, CallbackForward(x1),
1684 CallbackForward(x2), CallbackForward(x3),
1685 CallbackForward(x4), CallbackForward(x5));
1689 // Arity 5 -> 2.
1690 template <typename StorageType, typename R,typename X1, typename X2,
1691 typename X3, typename X4, typename X5>
1692 struct Invoker<3, StorageType, R(X1, X2, X3, X4, X5)> {
1693 typedef R(RunType)(BindStateBase*,
1694 typename CallbackParamTraits<X4>::ForwardType,
1695 typename CallbackParamTraits<X5>::ForwardType);
1697 typedef R(UnboundRunType)(X4, X5);
1699 static R Run(BindStateBase* base,
1700 typename CallbackParamTraits<X4>::ForwardType x4,
1701 typename CallbackParamTraits<X5>::ForwardType x5) {
1702 StorageType* storage = static_cast<StorageType*>(base);
1704 // Local references to make debugger stepping easier. If in a debugger,
1705 // you really want to warp ahead and step through the
1706 // InvokeHelper<>::MakeItSo() call below.
1707 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
1708 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
1709 typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits;
1711 typename Bound1UnwrapTraits::ForwardType x1 =
1712 Bound1UnwrapTraits::Unwrap(storage->p1_);
1713 typename Bound2UnwrapTraits::ForwardType x2 =
1714 Bound2UnwrapTraits::Unwrap(storage->p2_);
1715 typename Bound3UnwrapTraits::ForwardType x3 =
1716 Bound3UnwrapTraits::Unwrap(storage->p3_);
1717 return InvokeHelper<StorageType::IsWeakCall::value, R,
1718 typename StorageType::RunnableType,
1719 void(typename Bound1UnwrapTraits::ForwardType,
1720 typename Bound2UnwrapTraits::ForwardType,
1721 typename Bound3UnwrapTraits::ForwardType,
1722 typename CallbackParamTraits<X4>::ForwardType x4,
1723 typename CallbackParamTraits<X5>::ForwardType x5)>
1724 ::MakeItSo(storage->runnable_, CallbackForward(x1),
1725 CallbackForward(x2), CallbackForward(x3),
1726 CallbackForward(x4), CallbackForward(x5));
1730 // Arity 5 -> 1.
1731 template <typename StorageType, typename R,typename X1, typename X2,
1732 typename X3, typename X4, typename X5>
1733 struct Invoker<4, StorageType, R(X1, X2, X3, X4, X5)> {
1734 typedef R(RunType)(BindStateBase*,
1735 typename CallbackParamTraits<X5>::ForwardType);
1737 typedef R(UnboundRunType)(X5);
1739 static R Run(BindStateBase* base,
1740 typename CallbackParamTraits<X5>::ForwardType x5) {
1741 StorageType* storage = static_cast<StorageType*>(base);
1743 // Local references to make debugger stepping easier. If in a debugger,
1744 // you really want to warp ahead and step through the
1745 // InvokeHelper<>::MakeItSo() call below.
1746 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
1747 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
1748 typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits;
1749 typedef typename StorageType::Bound4UnwrapTraits Bound4UnwrapTraits;
1751 typename Bound1UnwrapTraits::ForwardType x1 =
1752 Bound1UnwrapTraits::Unwrap(storage->p1_);
1753 typename Bound2UnwrapTraits::ForwardType x2 =
1754 Bound2UnwrapTraits::Unwrap(storage->p2_);
1755 typename Bound3UnwrapTraits::ForwardType x3 =
1756 Bound3UnwrapTraits::Unwrap(storage->p3_);
1757 typename Bound4UnwrapTraits::ForwardType x4 =
1758 Bound4UnwrapTraits::Unwrap(storage->p4_);
1759 return InvokeHelper<StorageType::IsWeakCall::value, R,
1760 typename StorageType::RunnableType,
1761 void(typename Bound1UnwrapTraits::ForwardType,
1762 typename Bound2UnwrapTraits::ForwardType,
1763 typename Bound3UnwrapTraits::ForwardType,
1764 typename Bound4UnwrapTraits::ForwardType,
1765 typename CallbackParamTraits<X5>::ForwardType x5)>
1766 ::MakeItSo(storage->runnable_, CallbackForward(x1),
1767 CallbackForward(x2), CallbackForward(x3),
1768 CallbackForward(x4), CallbackForward(x5));
1772 // Arity 5 -> 0.
1773 template <typename StorageType, typename R,typename X1, typename X2,
1774 typename X3, typename X4, typename X5>
1775 struct Invoker<5, StorageType, R(X1, X2, X3, X4, X5)> {
1776 typedef R(RunType)(BindStateBase*);
1778 typedef R(UnboundRunType)();
1780 static R Run(BindStateBase* base) {
1781 StorageType* storage = static_cast<StorageType*>(base);
1783 // Local references to make debugger stepping easier. If in a debugger,
1784 // you really want to warp ahead and step through the
1785 // InvokeHelper<>::MakeItSo() call below.
1786 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
1787 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
1788 typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits;
1789 typedef typename StorageType::Bound4UnwrapTraits Bound4UnwrapTraits;
1790 typedef typename StorageType::Bound5UnwrapTraits Bound5UnwrapTraits;
1792 typename Bound1UnwrapTraits::ForwardType x1 =
1793 Bound1UnwrapTraits::Unwrap(storage->p1_);
1794 typename Bound2UnwrapTraits::ForwardType x2 =
1795 Bound2UnwrapTraits::Unwrap(storage->p2_);
1796 typename Bound3UnwrapTraits::ForwardType x3 =
1797 Bound3UnwrapTraits::Unwrap(storage->p3_);
1798 typename Bound4UnwrapTraits::ForwardType x4 =
1799 Bound4UnwrapTraits::Unwrap(storage->p4_);
1800 typename Bound5UnwrapTraits::ForwardType x5 =
1801 Bound5UnwrapTraits::Unwrap(storage->p5_);
1802 return InvokeHelper<StorageType::IsWeakCall::value, R,
1803 typename StorageType::RunnableType,
1804 void(typename Bound1UnwrapTraits::ForwardType,
1805 typename Bound2UnwrapTraits::ForwardType,
1806 typename Bound3UnwrapTraits::ForwardType,
1807 typename Bound4UnwrapTraits::ForwardType,
1808 typename Bound5UnwrapTraits::ForwardType)>
1809 ::MakeItSo(storage->runnable_, CallbackForward(x1),
1810 CallbackForward(x2), CallbackForward(x3),
1811 CallbackForward(x4), CallbackForward(x5));
1815 // Arity 6 -> 6.
1816 template <typename StorageType, typename R,typename X1, typename X2,
1817 typename X3, typename X4, typename X5, typename X6>
1818 struct Invoker<0, StorageType, R(X1, X2, X3, X4, X5, X6)> {
1819 typedef R(RunType)(BindStateBase*,
1820 typename CallbackParamTraits<X1>::ForwardType,
1821 typename CallbackParamTraits<X2>::ForwardType,
1822 typename CallbackParamTraits<X3>::ForwardType,
1823 typename CallbackParamTraits<X4>::ForwardType,
1824 typename CallbackParamTraits<X5>::ForwardType,
1825 typename CallbackParamTraits<X6>::ForwardType);
1827 typedef R(UnboundRunType)(X1, X2, X3, X4, X5, X6);
1829 static R Run(BindStateBase* base,
1830 typename CallbackParamTraits<X1>::ForwardType x1,
1831 typename CallbackParamTraits<X2>::ForwardType x2,
1832 typename CallbackParamTraits<X3>::ForwardType x3,
1833 typename CallbackParamTraits<X4>::ForwardType x4,
1834 typename CallbackParamTraits<X5>::ForwardType x5,
1835 typename CallbackParamTraits<X6>::ForwardType x6) {
1836 StorageType* storage = static_cast<StorageType*>(base);
1838 // Local references to make debugger stepping easier. If in a debugger,
1839 // you really want to warp ahead and step through the
1840 // InvokeHelper<>::MakeItSo() call below.
1842 return InvokeHelper<StorageType::IsWeakCall::value, R,
1843 typename StorageType::RunnableType,
1844 void(typename CallbackParamTraits<X1>::ForwardType x1,
1845 typename CallbackParamTraits<X2>::ForwardType x2,
1846 typename CallbackParamTraits<X3>::ForwardType x3,
1847 typename CallbackParamTraits<X4>::ForwardType x4,
1848 typename CallbackParamTraits<X5>::ForwardType x5,
1849 typename CallbackParamTraits<X6>::ForwardType x6)>
1850 ::MakeItSo(storage->runnable_, CallbackForward(x1),
1851 CallbackForward(x2), CallbackForward(x3),
1852 CallbackForward(x4), CallbackForward(x5),
1853 CallbackForward(x6));
1857 // Arity 6 -> 5.
1858 template <typename StorageType, typename R,typename X1, typename X2,
1859 typename X3, typename X4, typename X5, typename X6>
1860 struct Invoker<1, StorageType, R(X1, X2, X3, X4, X5, X6)> {
1861 typedef R(RunType)(BindStateBase*,
1862 typename CallbackParamTraits<X2>::ForwardType,
1863 typename CallbackParamTraits<X3>::ForwardType,
1864 typename CallbackParamTraits<X4>::ForwardType,
1865 typename CallbackParamTraits<X5>::ForwardType,
1866 typename CallbackParamTraits<X6>::ForwardType);
1868 typedef R(UnboundRunType)(X2, X3, X4, X5, X6);
1870 static R Run(BindStateBase* base,
1871 typename CallbackParamTraits<X2>::ForwardType x2,
1872 typename CallbackParamTraits<X3>::ForwardType x3,
1873 typename CallbackParamTraits<X4>::ForwardType x4,
1874 typename CallbackParamTraits<X5>::ForwardType x5,
1875 typename CallbackParamTraits<X6>::ForwardType x6) {
1876 StorageType* storage = static_cast<StorageType*>(base);
1878 // Local references to make debugger stepping easier. If in a debugger,
1879 // you really want to warp ahead and step through the
1880 // InvokeHelper<>::MakeItSo() call below.
1881 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
1883 typename Bound1UnwrapTraits::ForwardType x1 =
1884 Bound1UnwrapTraits::Unwrap(storage->p1_);
1885 return InvokeHelper<StorageType::IsWeakCall::value, R,
1886 typename StorageType::RunnableType,
1887 void(typename Bound1UnwrapTraits::ForwardType,
1888 typename CallbackParamTraits<X2>::ForwardType x2,
1889 typename CallbackParamTraits<X3>::ForwardType x3,
1890 typename CallbackParamTraits<X4>::ForwardType x4,
1891 typename CallbackParamTraits<X5>::ForwardType x5,
1892 typename CallbackParamTraits<X6>::ForwardType x6)>
1893 ::MakeItSo(storage->runnable_, CallbackForward(x1),
1894 CallbackForward(x2), CallbackForward(x3),
1895 CallbackForward(x4), CallbackForward(x5),
1896 CallbackForward(x6));
1900 // Arity 6 -> 4.
1901 template <typename StorageType, typename R,typename X1, typename X2,
1902 typename X3, typename X4, typename X5, typename X6>
1903 struct Invoker<2, StorageType, R(X1, X2, X3, X4, X5, X6)> {
1904 typedef R(RunType)(BindStateBase*,
1905 typename CallbackParamTraits<X3>::ForwardType,
1906 typename CallbackParamTraits<X4>::ForwardType,
1907 typename CallbackParamTraits<X5>::ForwardType,
1908 typename CallbackParamTraits<X6>::ForwardType);
1910 typedef R(UnboundRunType)(X3, X4, X5, X6);
1912 static R Run(BindStateBase* base,
1913 typename CallbackParamTraits<X3>::ForwardType x3,
1914 typename CallbackParamTraits<X4>::ForwardType x4,
1915 typename CallbackParamTraits<X5>::ForwardType x5,
1916 typename CallbackParamTraits<X6>::ForwardType x6) {
1917 StorageType* storage = static_cast<StorageType*>(base);
1919 // Local references to make debugger stepping easier. If in a debugger,
1920 // you really want to warp ahead and step through the
1921 // InvokeHelper<>::MakeItSo() call below.
1922 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
1923 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
1925 typename Bound1UnwrapTraits::ForwardType x1 =
1926 Bound1UnwrapTraits::Unwrap(storage->p1_);
1927 typename Bound2UnwrapTraits::ForwardType x2 =
1928 Bound2UnwrapTraits::Unwrap(storage->p2_);
1929 return InvokeHelper<StorageType::IsWeakCall::value, R,
1930 typename StorageType::RunnableType,
1931 void(typename Bound1UnwrapTraits::ForwardType,
1932 typename Bound2UnwrapTraits::ForwardType,
1933 typename CallbackParamTraits<X3>::ForwardType x3,
1934 typename CallbackParamTraits<X4>::ForwardType x4,
1935 typename CallbackParamTraits<X5>::ForwardType x5,
1936 typename CallbackParamTraits<X6>::ForwardType x6)>
1937 ::MakeItSo(storage->runnable_, CallbackForward(x1),
1938 CallbackForward(x2), CallbackForward(x3),
1939 CallbackForward(x4), CallbackForward(x5),
1940 CallbackForward(x6));
1944 // Arity 6 -> 3.
1945 template <typename StorageType, typename R,typename X1, typename X2,
1946 typename X3, typename X4, typename X5, typename X6>
1947 struct Invoker<3, StorageType, R(X1, X2, X3, X4, X5, X6)> {
1948 typedef R(RunType)(BindStateBase*,
1949 typename CallbackParamTraits<X4>::ForwardType,
1950 typename CallbackParamTraits<X5>::ForwardType,
1951 typename CallbackParamTraits<X6>::ForwardType);
1953 typedef R(UnboundRunType)(X4, X5, X6);
1955 static R Run(BindStateBase* base,
1956 typename CallbackParamTraits<X4>::ForwardType x4,
1957 typename CallbackParamTraits<X5>::ForwardType x5,
1958 typename CallbackParamTraits<X6>::ForwardType x6) {
1959 StorageType* storage = static_cast<StorageType*>(base);
1961 // Local references to make debugger stepping easier. If in a debugger,
1962 // you really want to warp ahead and step through the
1963 // InvokeHelper<>::MakeItSo() call below.
1964 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
1965 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
1966 typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits;
1968 typename Bound1UnwrapTraits::ForwardType x1 =
1969 Bound1UnwrapTraits::Unwrap(storage->p1_);
1970 typename Bound2UnwrapTraits::ForwardType x2 =
1971 Bound2UnwrapTraits::Unwrap(storage->p2_);
1972 typename Bound3UnwrapTraits::ForwardType x3 =
1973 Bound3UnwrapTraits::Unwrap(storage->p3_);
1974 return InvokeHelper<StorageType::IsWeakCall::value, R,
1975 typename StorageType::RunnableType,
1976 void(typename Bound1UnwrapTraits::ForwardType,
1977 typename Bound2UnwrapTraits::ForwardType,
1978 typename Bound3UnwrapTraits::ForwardType,
1979 typename CallbackParamTraits<X4>::ForwardType x4,
1980 typename CallbackParamTraits<X5>::ForwardType x5,
1981 typename CallbackParamTraits<X6>::ForwardType x6)>
1982 ::MakeItSo(storage->runnable_, CallbackForward(x1),
1983 CallbackForward(x2), CallbackForward(x3),
1984 CallbackForward(x4), CallbackForward(x5),
1985 CallbackForward(x6));
1989 // Arity 6 -> 2.
1990 template <typename StorageType, typename R,typename X1, typename X2,
1991 typename X3, typename X4, typename X5, typename X6>
1992 struct Invoker<4, StorageType, R(X1, X2, X3, X4, X5, X6)> {
1993 typedef R(RunType)(BindStateBase*,
1994 typename CallbackParamTraits<X5>::ForwardType,
1995 typename CallbackParamTraits<X6>::ForwardType);
1997 typedef R(UnboundRunType)(X5, X6);
1999 static R Run(BindStateBase* base,
2000 typename CallbackParamTraits<X5>::ForwardType x5,
2001 typename CallbackParamTraits<X6>::ForwardType x6) {
2002 StorageType* storage = static_cast<StorageType*>(base);
2004 // Local references to make debugger stepping easier. If in a debugger,
2005 // you really want to warp ahead and step through the
2006 // InvokeHelper<>::MakeItSo() call below.
2007 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
2008 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
2009 typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits;
2010 typedef typename StorageType::Bound4UnwrapTraits Bound4UnwrapTraits;
2012 typename Bound1UnwrapTraits::ForwardType x1 =
2013 Bound1UnwrapTraits::Unwrap(storage->p1_);
2014 typename Bound2UnwrapTraits::ForwardType x2 =
2015 Bound2UnwrapTraits::Unwrap(storage->p2_);
2016 typename Bound3UnwrapTraits::ForwardType x3 =
2017 Bound3UnwrapTraits::Unwrap(storage->p3_);
2018 typename Bound4UnwrapTraits::ForwardType x4 =
2019 Bound4UnwrapTraits::Unwrap(storage->p4_);
2020 return InvokeHelper<StorageType::IsWeakCall::value, R,
2021 typename StorageType::RunnableType,
2022 void(typename Bound1UnwrapTraits::ForwardType,
2023 typename Bound2UnwrapTraits::ForwardType,
2024 typename Bound3UnwrapTraits::ForwardType,
2025 typename Bound4UnwrapTraits::ForwardType,
2026 typename CallbackParamTraits<X5>::ForwardType x5,
2027 typename CallbackParamTraits<X6>::ForwardType x6)>
2028 ::MakeItSo(storage->runnable_, CallbackForward(x1),
2029 CallbackForward(x2), CallbackForward(x3),
2030 CallbackForward(x4), CallbackForward(x5),
2031 CallbackForward(x6));
2035 // Arity 6 -> 1.
2036 template <typename StorageType, typename R,typename X1, typename X2,
2037 typename X3, typename X4, typename X5, typename X6>
2038 struct Invoker<5, StorageType, R(X1, X2, X3, X4, X5, X6)> {
2039 typedef R(RunType)(BindStateBase*,
2040 typename CallbackParamTraits<X6>::ForwardType);
2042 typedef R(UnboundRunType)(X6);
2044 static R Run(BindStateBase* base,
2045 typename CallbackParamTraits<X6>::ForwardType x6) {
2046 StorageType* storage = static_cast<StorageType*>(base);
2048 // Local references to make debugger stepping easier. If in a debugger,
2049 // you really want to warp ahead and step through the
2050 // InvokeHelper<>::MakeItSo() call below.
2051 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
2052 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
2053 typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits;
2054 typedef typename StorageType::Bound4UnwrapTraits Bound4UnwrapTraits;
2055 typedef typename StorageType::Bound5UnwrapTraits Bound5UnwrapTraits;
2057 typename Bound1UnwrapTraits::ForwardType x1 =
2058 Bound1UnwrapTraits::Unwrap(storage->p1_);
2059 typename Bound2UnwrapTraits::ForwardType x2 =
2060 Bound2UnwrapTraits::Unwrap(storage->p2_);
2061 typename Bound3UnwrapTraits::ForwardType x3 =
2062 Bound3UnwrapTraits::Unwrap(storage->p3_);
2063 typename Bound4UnwrapTraits::ForwardType x4 =
2064 Bound4UnwrapTraits::Unwrap(storage->p4_);
2065 typename Bound5UnwrapTraits::ForwardType x5 =
2066 Bound5UnwrapTraits::Unwrap(storage->p5_);
2067 return InvokeHelper<StorageType::IsWeakCall::value, R,
2068 typename StorageType::RunnableType,
2069 void(typename Bound1UnwrapTraits::ForwardType,
2070 typename Bound2UnwrapTraits::ForwardType,
2071 typename Bound3UnwrapTraits::ForwardType,
2072 typename Bound4UnwrapTraits::ForwardType,
2073 typename Bound5UnwrapTraits::ForwardType,
2074 typename CallbackParamTraits<X6>::ForwardType x6)>
2075 ::MakeItSo(storage->runnable_, CallbackForward(x1),
2076 CallbackForward(x2), CallbackForward(x3),
2077 CallbackForward(x4), CallbackForward(x5),
2078 CallbackForward(x6));
2082 // Arity 6 -> 0.
2083 template <typename StorageType, typename R,typename X1, typename X2,
2084 typename X3, typename X4, typename X5, typename X6>
2085 struct Invoker<6, StorageType, R(X1, X2, X3, X4, X5, X6)> {
2086 typedef R(RunType)(BindStateBase*);
2088 typedef R(UnboundRunType)();
2090 static R Run(BindStateBase* base) {
2091 StorageType* storage = static_cast<StorageType*>(base);
2093 // Local references to make debugger stepping easier. If in a debugger,
2094 // you really want to warp ahead and step through the
2095 // InvokeHelper<>::MakeItSo() call below.
2096 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
2097 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
2098 typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits;
2099 typedef typename StorageType::Bound4UnwrapTraits Bound4UnwrapTraits;
2100 typedef typename StorageType::Bound5UnwrapTraits Bound5UnwrapTraits;
2101 typedef typename StorageType::Bound6UnwrapTraits Bound6UnwrapTraits;
2103 typename Bound1UnwrapTraits::ForwardType x1 =
2104 Bound1UnwrapTraits::Unwrap(storage->p1_);
2105 typename Bound2UnwrapTraits::ForwardType x2 =
2106 Bound2UnwrapTraits::Unwrap(storage->p2_);
2107 typename Bound3UnwrapTraits::ForwardType x3 =
2108 Bound3UnwrapTraits::Unwrap(storage->p3_);
2109 typename Bound4UnwrapTraits::ForwardType x4 =
2110 Bound4UnwrapTraits::Unwrap(storage->p4_);
2111 typename Bound5UnwrapTraits::ForwardType x5 =
2112 Bound5UnwrapTraits::Unwrap(storage->p5_);
2113 typename Bound6UnwrapTraits::ForwardType x6 =
2114 Bound6UnwrapTraits::Unwrap(storage->p6_);
2115 return InvokeHelper<StorageType::IsWeakCall::value, R,
2116 typename StorageType::RunnableType,
2117 void(typename Bound1UnwrapTraits::ForwardType,
2118 typename Bound2UnwrapTraits::ForwardType,
2119 typename Bound3UnwrapTraits::ForwardType,
2120 typename Bound4UnwrapTraits::ForwardType,
2121 typename Bound5UnwrapTraits::ForwardType,
2122 typename Bound6UnwrapTraits::ForwardType)>
2123 ::MakeItSo(storage->runnable_, CallbackForward(x1),
2124 CallbackForward(x2), CallbackForward(x3),
2125 CallbackForward(x4), CallbackForward(x5),
2126 CallbackForward(x6));
2130 // Arity 7 -> 7.
2131 template <typename StorageType, typename R,typename X1, typename X2,
2132 typename X3, typename X4, typename X5, typename X6, typename X7>
2133 struct Invoker<0, StorageType, R(X1, X2, X3, X4, X5, X6, X7)> {
2134 typedef R(RunType)(BindStateBase*,
2135 typename CallbackParamTraits<X1>::ForwardType,
2136 typename CallbackParamTraits<X2>::ForwardType,
2137 typename CallbackParamTraits<X3>::ForwardType,
2138 typename CallbackParamTraits<X4>::ForwardType,
2139 typename CallbackParamTraits<X5>::ForwardType,
2140 typename CallbackParamTraits<X6>::ForwardType,
2141 typename CallbackParamTraits<X7>::ForwardType);
2143 typedef R(UnboundRunType)(X1, X2, X3, X4, X5, X6, X7);
2145 static R Run(BindStateBase* base,
2146 typename CallbackParamTraits<X1>::ForwardType x1,
2147 typename CallbackParamTraits<X2>::ForwardType x2,
2148 typename CallbackParamTraits<X3>::ForwardType x3,
2149 typename CallbackParamTraits<X4>::ForwardType x4,
2150 typename CallbackParamTraits<X5>::ForwardType x5,
2151 typename CallbackParamTraits<X6>::ForwardType x6,
2152 typename CallbackParamTraits<X7>::ForwardType x7) {
2153 StorageType* storage = static_cast<StorageType*>(base);
2155 // Local references to make debugger stepping easier. If in a debugger,
2156 // you really want to warp ahead and step through the
2157 // InvokeHelper<>::MakeItSo() call below.
2159 return InvokeHelper<StorageType::IsWeakCall::value, R,
2160 typename StorageType::RunnableType,
2161 void(typename CallbackParamTraits<X1>::ForwardType x1,
2162 typename CallbackParamTraits<X2>::ForwardType x2,
2163 typename CallbackParamTraits<X3>::ForwardType x3,
2164 typename CallbackParamTraits<X4>::ForwardType x4,
2165 typename CallbackParamTraits<X5>::ForwardType x5,
2166 typename CallbackParamTraits<X6>::ForwardType x6,
2167 typename CallbackParamTraits<X7>::ForwardType x7)>
2168 ::MakeItSo(storage->runnable_, CallbackForward(x1),
2169 CallbackForward(x2), CallbackForward(x3),
2170 CallbackForward(x4), CallbackForward(x5),
2171 CallbackForward(x6), CallbackForward(x7));
2175 // Arity 7 -> 6.
2176 template <typename StorageType, typename R,typename X1, typename X2,
2177 typename X3, typename X4, typename X5, typename X6, typename X7>
2178 struct Invoker<1, StorageType, R(X1, X2, X3, X4, X5, X6, X7)> {
2179 typedef R(RunType)(BindStateBase*,
2180 typename CallbackParamTraits<X2>::ForwardType,
2181 typename CallbackParamTraits<X3>::ForwardType,
2182 typename CallbackParamTraits<X4>::ForwardType,
2183 typename CallbackParamTraits<X5>::ForwardType,
2184 typename CallbackParamTraits<X6>::ForwardType,
2185 typename CallbackParamTraits<X7>::ForwardType);
2187 typedef R(UnboundRunType)(X2, X3, X4, X5, X6, X7);
2189 static R Run(BindStateBase* base,
2190 typename CallbackParamTraits<X2>::ForwardType x2,
2191 typename CallbackParamTraits<X3>::ForwardType x3,
2192 typename CallbackParamTraits<X4>::ForwardType x4,
2193 typename CallbackParamTraits<X5>::ForwardType x5,
2194 typename CallbackParamTraits<X6>::ForwardType x6,
2195 typename CallbackParamTraits<X7>::ForwardType x7) {
2196 StorageType* storage = static_cast<StorageType*>(base);
2198 // Local references to make debugger stepping easier. If in a debugger,
2199 // you really want to warp ahead and step through the
2200 // InvokeHelper<>::MakeItSo() call below.
2201 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
2203 typename Bound1UnwrapTraits::ForwardType x1 =
2204 Bound1UnwrapTraits::Unwrap(storage->p1_);
2205 return InvokeHelper<StorageType::IsWeakCall::value, R,
2206 typename StorageType::RunnableType,
2207 void(typename Bound1UnwrapTraits::ForwardType,
2208 typename CallbackParamTraits<X2>::ForwardType x2,
2209 typename CallbackParamTraits<X3>::ForwardType x3,
2210 typename CallbackParamTraits<X4>::ForwardType x4,
2211 typename CallbackParamTraits<X5>::ForwardType x5,
2212 typename CallbackParamTraits<X6>::ForwardType x6,
2213 typename CallbackParamTraits<X7>::ForwardType x7)>
2214 ::MakeItSo(storage->runnable_, CallbackForward(x1),
2215 CallbackForward(x2), CallbackForward(x3),
2216 CallbackForward(x4), CallbackForward(x5),
2217 CallbackForward(x6), CallbackForward(x7));
2221 // Arity 7 -> 5.
2222 template <typename StorageType, typename R,typename X1, typename X2,
2223 typename X3, typename X4, typename X5, typename X6, typename X7>
2224 struct Invoker<2, StorageType, R(X1, X2, X3, X4, X5, X6, X7)> {
2225 typedef R(RunType)(BindStateBase*,
2226 typename CallbackParamTraits<X3>::ForwardType,
2227 typename CallbackParamTraits<X4>::ForwardType,
2228 typename CallbackParamTraits<X5>::ForwardType,
2229 typename CallbackParamTraits<X6>::ForwardType,
2230 typename CallbackParamTraits<X7>::ForwardType);
2232 typedef R(UnboundRunType)(X3, X4, X5, X6, X7);
2234 static R Run(BindStateBase* base,
2235 typename CallbackParamTraits<X3>::ForwardType x3,
2236 typename CallbackParamTraits<X4>::ForwardType x4,
2237 typename CallbackParamTraits<X5>::ForwardType x5,
2238 typename CallbackParamTraits<X6>::ForwardType x6,
2239 typename CallbackParamTraits<X7>::ForwardType x7) {
2240 StorageType* storage = static_cast<StorageType*>(base);
2242 // Local references to make debugger stepping easier. If in a debugger,
2243 // you really want to warp ahead and step through the
2244 // InvokeHelper<>::MakeItSo() call below.
2245 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
2246 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
2248 typename Bound1UnwrapTraits::ForwardType x1 =
2249 Bound1UnwrapTraits::Unwrap(storage->p1_);
2250 typename Bound2UnwrapTraits::ForwardType x2 =
2251 Bound2UnwrapTraits::Unwrap(storage->p2_);
2252 return InvokeHelper<StorageType::IsWeakCall::value, R,
2253 typename StorageType::RunnableType,
2254 void(typename Bound1UnwrapTraits::ForwardType,
2255 typename Bound2UnwrapTraits::ForwardType,
2256 typename CallbackParamTraits<X3>::ForwardType x3,
2257 typename CallbackParamTraits<X4>::ForwardType x4,
2258 typename CallbackParamTraits<X5>::ForwardType x5,
2259 typename CallbackParamTraits<X6>::ForwardType x6,
2260 typename CallbackParamTraits<X7>::ForwardType x7)>
2261 ::MakeItSo(storage->runnable_, CallbackForward(x1),
2262 CallbackForward(x2), CallbackForward(x3),
2263 CallbackForward(x4), CallbackForward(x5),
2264 CallbackForward(x6), CallbackForward(x7));
2268 // Arity 7 -> 4.
2269 template <typename StorageType, typename R,typename X1, typename X2,
2270 typename X3, typename X4, typename X5, typename X6, typename X7>
2271 struct Invoker<3, StorageType, R(X1, X2, X3, X4, X5, X6, X7)> {
2272 typedef R(RunType)(BindStateBase*,
2273 typename CallbackParamTraits<X4>::ForwardType,
2274 typename CallbackParamTraits<X5>::ForwardType,
2275 typename CallbackParamTraits<X6>::ForwardType,
2276 typename CallbackParamTraits<X7>::ForwardType);
2278 typedef R(UnboundRunType)(X4, X5, X6, X7);
2280 static R Run(BindStateBase* base,
2281 typename CallbackParamTraits<X4>::ForwardType x4,
2282 typename CallbackParamTraits<X5>::ForwardType x5,
2283 typename CallbackParamTraits<X6>::ForwardType x6,
2284 typename CallbackParamTraits<X7>::ForwardType x7) {
2285 StorageType* storage = static_cast<StorageType*>(base);
2287 // Local references to make debugger stepping easier. If in a debugger,
2288 // you really want to warp ahead and step through the
2289 // InvokeHelper<>::MakeItSo() call below.
2290 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
2291 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
2292 typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits;
2294 typename Bound1UnwrapTraits::ForwardType x1 =
2295 Bound1UnwrapTraits::Unwrap(storage->p1_);
2296 typename Bound2UnwrapTraits::ForwardType x2 =
2297 Bound2UnwrapTraits::Unwrap(storage->p2_);
2298 typename Bound3UnwrapTraits::ForwardType x3 =
2299 Bound3UnwrapTraits::Unwrap(storage->p3_);
2300 return InvokeHelper<StorageType::IsWeakCall::value, R,
2301 typename StorageType::RunnableType,
2302 void(typename Bound1UnwrapTraits::ForwardType,
2303 typename Bound2UnwrapTraits::ForwardType,
2304 typename Bound3UnwrapTraits::ForwardType,
2305 typename CallbackParamTraits<X4>::ForwardType x4,
2306 typename CallbackParamTraits<X5>::ForwardType x5,
2307 typename CallbackParamTraits<X6>::ForwardType x6,
2308 typename CallbackParamTraits<X7>::ForwardType x7)>
2309 ::MakeItSo(storage->runnable_, CallbackForward(x1),
2310 CallbackForward(x2), CallbackForward(x3),
2311 CallbackForward(x4), CallbackForward(x5),
2312 CallbackForward(x6), CallbackForward(x7));
2316 // Arity 7 -> 3.
2317 template <typename StorageType, typename R,typename X1, typename X2,
2318 typename X3, typename X4, typename X5, typename X6, typename X7>
2319 struct Invoker<4, StorageType, R(X1, X2, X3, X4, X5, X6, X7)> {
2320 typedef R(RunType)(BindStateBase*,
2321 typename CallbackParamTraits<X5>::ForwardType,
2322 typename CallbackParamTraits<X6>::ForwardType,
2323 typename CallbackParamTraits<X7>::ForwardType);
2325 typedef R(UnboundRunType)(X5, X6, X7);
2327 static R Run(BindStateBase* base,
2328 typename CallbackParamTraits<X5>::ForwardType x5,
2329 typename CallbackParamTraits<X6>::ForwardType x6,
2330 typename CallbackParamTraits<X7>::ForwardType x7) {
2331 StorageType* storage = static_cast<StorageType*>(base);
2333 // Local references to make debugger stepping easier. If in a debugger,
2334 // you really want to warp ahead and step through the
2335 // InvokeHelper<>::MakeItSo() call below.
2336 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
2337 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
2338 typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits;
2339 typedef typename StorageType::Bound4UnwrapTraits Bound4UnwrapTraits;
2341 typename Bound1UnwrapTraits::ForwardType x1 =
2342 Bound1UnwrapTraits::Unwrap(storage->p1_);
2343 typename Bound2UnwrapTraits::ForwardType x2 =
2344 Bound2UnwrapTraits::Unwrap(storage->p2_);
2345 typename Bound3UnwrapTraits::ForwardType x3 =
2346 Bound3UnwrapTraits::Unwrap(storage->p3_);
2347 typename Bound4UnwrapTraits::ForwardType x4 =
2348 Bound4UnwrapTraits::Unwrap(storage->p4_);
2349 return InvokeHelper<StorageType::IsWeakCall::value, R,
2350 typename StorageType::RunnableType,
2351 void(typename Bound1UnwrapTraits::ForwardType,
2352 typename Bound2UnwrapTraits::ForwardType,
2353 typename Bound3UnwrapTraits::ForwardType,
2354 typename Bound4UnwrapTraits::ForwardType,
2355 typename CallbackParamTraits<X5>::ForwardType x5,
2356 typename CallbackParamTraits<X6>::ForwardType x6,
2357 typename CallbackParamTraits<X7>::ForwardType x7)>
2358 ::MakeItSo(storage->runnable_, CallbackForward(x1),
2359 CallbackForward(x2), CallbackForward(x3),
2360 CallbackForward(x4), CallbackForward(x5),
2361 CallbackForward(x6), CallbackForward(x7));
2365 // Arity 7 -> 2.
2366 template <typename StorageType, typename R,typename X1, typename X2,
2367 typename X3, typename X4, typename X5, typename X6, typename X7>
2368 struct Invoker<5, StorageType, R(X1, X2, X3, X4, X5, X6, X7)> {
2369 typedef R(RunType)(BindStateBase*,
2370 typename CallbackParamTraits<X6>::ForwardType,
2371 typename CallbackParamTraits<X7>::ForwardType);
2373 typedef R(UnboundRunType)(X6, X7);
2375 static R Run(BindStateBase* base,
2376 typename CallbackParamTraits<X6>::ForwardType x6,
2377 typename CallbackParamTraits<X7>::ForwardType x7) {
2378 StorageType* storage = static_cast<StorageType*>(base);
2380 // Local references to make debugger stepping easier. If in a debugger,
2381 // you really want to warp ahead and step through the
2382 // InvokeHelper<>::MakeItSo() call below.
2383 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
2384 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
2385 typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits;
2386 typedef typename StorageType::Bound4UnwrapTraits Bound4UnwrapTraits;
2387 typedef typename StorageType::Bound5UnwrapTraits Bound5UnwrapTraits;
2389 typename Bound1UnwrapTraits::ForwardType x1 =
2390 Bound1UnwrapTraits::Unwrap(storage->p1_);
2391 typename Bound2UnwrapTraits::ForwardType x2 =
2392 Bound2UnwrapTraits::Unwrap(storage->p2_);
2393 typename Bound3UnwrapTraits::ForwardType x3 =
2394 Bound3UnwrapTraits::Unwrap(storage->p3_);
2395 typename Bound4UnwrapTraits::ForwardType x4 =
2396 Bound4UnwrapTraits::Unwrap(storage->p4_);
2397 typename Bound5UnwrapTraits::ForwardType x5 =
2398 Bound5UnwrapTraits::Unwrap(storage->p5_);
2399 return InvokeHelper<StorageType::IsWeakCall::value, R,
2400 typename StorageType::RunnableType,
2401 void(typename Bound1UnwrapTraits::ForwardType,
2402 typename Bound2UnwrapTraits::ForwardType,
2403 typename Bound3UnwrapTraits::ForwardType,
2404 typename Bound4UnwrapTraits::ForwardType,
2405 typename Bound5UnwrapTraits::ForwardType,
2406 typename CallbackParamTraits<X6>::ForwardType x6,
2407 typename CallbackParamTraits<X7>::ForwardType x7)>
2408 ::MakeItSo(storage->runnable_, CallbackForward(x1),
2409 CallbackForward(x2), CallbackForward(x3),
2410 CallbackForward(x4), CallbackForward(x5),
2411 CallbackForward(x6), CallbackForward(x7));
2415 // Arity 7 -> 1.
2416 template <typename StorageType, typename R,typename X1, typename X2,
2417 typename X3, typename X4, typename X5, typename X6, typename X7>
2418 struct Invoker<6, StorageType, R(X1, X2, X3, X4, X5, X6, X7)> {
2419 typedef R(RunType)(BindStateBase*,
2420 typename CallbackParamTraits<X7>::ForwardType);
2422 typedef R(UnboundRunType)(X7);
2424 static R Run(BindStateBase* base,
2425 typename CallbackParamTraits<X7>::ForwardType x7) {
2426 StorageType* storage = static_cast<StorageType*>(base);
2428 // Local references to make debugger stepping easier. If in a debugger,
2429 // you really want to warp ahead and step through the
2430 // InvokeHelper<>::MakeItSo() call below.
2431 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
2432 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
2433 typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits;
2434 typedef typename StorageType::Bound4UnwrapTraits Bound4UnwrapTraits;
2435 typedef typename StorageType::Bound5UnwrapTraits Bound5UnwrapTraits;
2436 typedef typename StorageType::Bound6UnwrapTraits Bound6UnwrapTraits;
2438 typename Bound1UnwrapTraits::ForwardType x1 =
2439 Bound1UnwrapTraits::Unwrap(storage->p1_);
2440 typename Bound2UnwrapTraits::ForwardType x2 =
2441 Bound2UnwrapTraits::Unwrap(storage->p2_);
2442 typename Bound3UnwrapTraits::ForwardType x3 =
2443 Bound3UnwrapTraits::Unwrap(storage->p3_);
2444 typename Bound4UnwrapTraits::ForwardType x4 =
2445 Bound4UnwrapTraits::Unwrap(storage->p4_);
2446 typename Bound5UnwrapTraits::ForwardType x5 =
2447 Bound5UnwrapTraits::Unwrap(storage->p5_);
2448 typename Bound6UnwrapTraits::ForwardType x6 =
2449 Bound6UnwrapTraits::Unwrap(storage->p6_);
2450 return InvokeHelper<StorageType::IsWeakCall::value, R,
2451 typename StorageType::RunnableType,
2452 void(typename Bound1UnwrapTraits::ForwardType,
2453 typename Bound2UnwrapTraits::ForwardType,
2454 typename Bound3UnwrapTraits::ForwardType,
2455 typename Bound4UnwrapTraits::ForwardType,
2456 typename Bound5UnwrapTraits::ForwardType,
2457 typename Bound6UnwrapTraits::ForwardType,
2458 typename CallbackParamTraits<X7>::ForwardType x7)>
2459 ::MakeItSo(storage->runnable_, CallbackForward(x1),
2460 CallbackForward(x2), CallbackForward(x3),
2461 CallbackForward(x4), CallbackForward(x5),
2462 CallbackForward(x6), CallbackForward(x7));
2466 // Arity 7 -> 0.
2467 template <typename StorageType, typename R,typename X1, typename X2,
2468 typename X3, typename X4, typename X5, typename X6, typename X7>
2469 struct Invoker<7, StorageType, R(X1, X2, X3, X4, X5, X6, X7)> {
2470 typedef R(RunType)(BindStateBase*);
2472 typedef R(UnboundRunType)();
2474 static R Run(BindStateBase* base) {
2475 StorageType* storage = static_cast<StorageType*>(base);
2477 // Local references to make debugger stepping easier. If in a debugger,
2478 // you really want to warp ahead and step through the
2479 // InvokeHelper<>::MakeItSo() call below.
2480 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
2481 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
2482 typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits;
2483 typedef typename StorageType::Bound4UnwrapTraits Bound4UnwrapTraits;
2484 typedef typename StorageType::Bound5UnwrapTraits Bound5UnwrapTraits;
2485 typedef typename StorageType::Bound6UnwrapTraits Bound6UnwrapTraits;
2486 typedef typename StorageType::Bound7UnwrapTraits Bound7UnwrapTraits;
2488 typename Bound1UnwrapTraits::ForwardType x1 =
2489 Bound1UnwrapTraits::Unwrap(storage->p1_);
2490 typename Bound2UnwrapTraits::ForwardType x2 =
2491 Bound2UnwrapTraits::Unwrap(storage->p2_);
2492 typename Bound3UnwrapTraits::ForwardType x3 =
2493 Bound3UnwrapTraits::Unwrap(storage->p3_);
2494 typename Bound4UnwrapTraits::ForwardType x4 =
2495 Bound4UnwrapTraits::Unwrap(storage->p4_);
2496 typename Bound5UnwrapTraits::ForwardType x5 =
2497 Bound5UnwrapTraits::Unwrap(storage->p5_);
2498 typename Bound6UnwrapTraits::ForwardType x6 =
2499 Bound6UnwrapTraits::Unwrap(storage->p6_);
2500 typename Bound7UnwrapTraits::ForwardType x7 =
2501 Bound7UnwrapTraits::Unwrap(storage->p7_);
2502 return InvokeHelper<StorageType::IsWeakCall::value, R,
2503 typename StorageType::RunnableType,
2504 void(typename Bound1UnwrapTraits::ForwardType,
2505 typename Bound2UnwrapTraits::ForwardType,
2506 typename Bound3UnwrapTraits::ForwardType,
2507 typename Bound4UnwrapTraits::ForwardType,
2508 typename Bound5UnwrapTraits::ForwardType,
2509 typename Bound6UnwrapTraits::ForwardType,
2510 typename Bound7UnwrapTraits::ForwardType)>
2511 ::MakeItSo(storage->runnable_, CallbackForward(x1),
2512 CallbackForward(x2), CallbackForward(x3),
2513 CallbackForward(x4), CallbackForward(x5),
2514 CallbackForward(x6), CallbackForward(x7));
2519 // BindState<>
2521 // This stores all the state passed into Bind() and is also where most
2522 // of the template resolution magic occurs.
2524 // Runnable is the functor we are binding arguments to.
2525 // RunType is type of the Run() function that the Invoker<> should use.
2526 // Normally, this is the same as the RunType of the Runnable, but it can
2527 // be different if an adapter like IgnoreResult() has been used.
2529 // BoundArgsType contains the storage type for all the bound arguments by
2530 // (ab)using a function type.
2531 template <typename Runnable, typename RunType, typename BoundArgsType>
2532 struct BindState;
2534 template <typename Runnable, typename RunType>
2535 struct BindState<Runnable, RunType, void()> : public BindStateBase {
2536 typedef Runnable RunnableType;
2537 typedef false_type IsWeakCall;
2538 typedef Invoker<0, BindState, RunType> InvokerType;
2539 typedef typename InvokerType::UnboundRunType UnboundRunType;
2540 explicit BindState(const Runnable& runnable)
2541 : runnable_(runnable) {
2544 virtual ~BindState() { }
2546 RunnableType runnable_;
2549 template <typename Runnable, typename RunType, typename P1>
2550 struct BindState<Runnable, RunType, void(P1)> : public BindStateBase {
2551 typedef Runnable RunnableType;
2552 typedef IsWeakMethod<HasIsMethodTag<Runnable>::value, P1> IsWeakCall;
2553 typedef Invoker<1, BindState, RunType> InvokerType;
2554 typedef typename InvokerType::UnboundRunType UnboundRunType;
2556 // Convenience typedefs for bound argument types.
2557 typedef UnwrapTraits<P1> Bound1UnwrapTraits;
2559 BindState(const Runnable& runnable, const P1& p1)
2560 : runnable_(runnable),
2561 p1_(p1) {
2562 MaybeRefcount<HasIsMethodTag<Runnable>::value, P1>::AddRef(p1_);
2565 virtual ~BindState() { MaybeRefcount<HasIsMethodTag<Runnable>::value,
2566 P1>::Release(p1_); }
2568 RunnableType runnable_;
2569 P1 p1_;
2572 template <typename Runnable, typename RunType, typename P1, typename P2>
2573 struct BindState<Runnable, RunType, void(P1, P2)> : public BindStateBase {
2574 typedef Runnable RunnableType;
2575 typedef IsWeakMethod<HasIsMethodTag<Runnable>::value, P1> IsWeakCall;
2576 typedef Invoker<2, BindState, RunType> InvokerType;
2577 typedef typename InvokerType::UnboundRunType UnboundRunType;
2579 // Convenience typedefs for bound argument types.
2580 typedef UnwrapTraits<P1> Bound1UnwrapTraits;
2581 typedef UnwrapTraits<P2> Bound2UnwrapTraits;
2583 BindState(const Runnable& runnable, const P1& p1, const P2& p2)
2584 : runnable_(runnable),
2585 p1_(p1),
2586 p2_(p2) {
2587 MaybeRefcount<HasIsMethodTag<Runnable>::value, P1>::AddRef(p1_);
2590 virtual ~BindState() { MaybeRefcount<HasIsMethodTag<Runnable>::value,
2591 P1>::Release(p1_); }
2593 RunnableType runnable_;
2594 P1 p1_;
2595 P2 p2_;
2598 template <typename Runnable, typename RunType, typename P1, typename P2,
2599 typename P3>
2600 struct BindState<Runnable, RunType, void(P1, P2, P3)> : public BindStateBase {
2601 typedef Runnable RunnableType;
2602 typedef IsWeakMethod<HasIsMethodTag<Runnable>::value, P1> IsWeakCall;
2603 typedef Invoker<3, BindState, RunType> InvokerType;
2604 typedef typename InvokerType::UnboundRunType UnboundRunType;
2606 // Convenience typedefs for bound argument types.
2607 typedef UnwrapTraits<P1> Bound1UnwrapTraits;
2608 typedef UnwrapTraits<P2> Bound2UnwrapTraits;
2609 typedef UnwrapTraits<P3> Bound3UnwrapTraits;
2611 BindState(const Runnable& runnable, const P1& p1, const P2& p2, const P3& p3)
2612 : runnable_(runnable),
2613 p1_(p1),
2614 p2_(p2),
2615 p3_(p3) {
2616 MaybeRefcount<HasIsMethodTag<Runnable>::value, P1>::AddRef(p1_);
2619 virtual ~BindState() { MaybeRefcount<HasIsMethodTag<Runnable>::value,
2620 P1>::Release(p1_); }
2622 RunnableType runnable_;
2623 P1 p1_;
2624 P2 p2_;
2625 P3 p3_;
2628 template <typename Runnable, typename RunType, typename P1, typename P2,
2629 typename P3, typename P4>
2630 struct BindState<Runnable, RunType, void(P1, P2, P3,
2631 P4)> : public BindStateBase {
2632 typedef Runnable RunnableType;
2633 typedef IsWeakMethod<HasIsMethodTag<Runnable>::value, P1> IsWeakCall;
2634 typedef Invoker<4, BindState, RunType> InvokerType;
2635 typedef typename InvokerType::UnboundRunType UnboundRunType;
2637 // Convenience typedefs for bound argument types.
2638 typedef UnwrapTraits<P1> Bound1UnwrapTraits;
2639 typedef UnwrapTraits<P2> Bound2UnwrapTraits;
2640 typedef UnwrapTraits<P3> Bound3UnwrapTraits;
2641 typedef UnwrapTraits<P4> Bound4UnwrapTraits;
2643 BindState(const Runnable& runnable, const P1& p1, const P2& p2, const P3& p3,
2644 const P4& p4)
2645 : runnable_(runnable),
2646 p1_(p1),
2647 p2_(p2),
2648 p3_(p3),
2649 p4_(p4) {
2650 MaybeRefcount<HasIsMethodTag<Runnable>::value, P1>::AddRef(p1_);
2653 virtual ~BindState() { MaybeRefcount<HasIsMethodTag<Runnable>::value,
2654 P1>::Release(p1_); }
2656 RunnableType runnable_;
2657 P1 p1_;
2658 P2 p2_;
2659 P3 p3_;
2660 P4 p4_;
2663 template <typename Runnable, typename RunType, typename P1, typename P2,
2664 typename P3, typename P4, typename P5>
2665 struct BindState<Runnable, RunType, void(P1, P2, P3, P4,
2666 P5)> : public BindStateBase {
2667 typedef Runnable RunnableType;
2668 typedef IsWeakMethod<HasIsMethodTag<Runnable>::value, P1> IsWeakCall;
2669 typedef Invoker<5, BindState, RunType> InvokerType;
2670 typedef typename InvokerType::UnboundRunType UnboundRunType;
2672 // Convenience typedefs for bound argument types.
2673 typedef UnwrapTraits<P1> Bound1UnwrapTraits;
2674 typedef UnwrapTraits<P2> Bound2UnwrapTraits;
2675 typedef UnwrapTraits<P3> Bound3UnwrapTraits;
2676 typedef UnwrapTraits<P4> Bound4UnwrapTraits;
2677 typedef UnwrapTraits<P5> Bound5UnwrapTraits;
2679 BindState(const Runnable& runnable, const P1& p1, const P2& p2, const P3& p3,
2680 const P4& p4, const P5& p5)
2681 : runnable_(runnable),
2682 p1_(p1),
2683 p2_(p2),
2684 p3_(p3),
2685 p4_(p4),
2686 p5_(p5) {
2687 MaybeRefcount<HasIsMethodTag<Runnable>::value, P1>::AddRef(p1_);
2690 virtual ~BindState() { MaybeRefcount<HasIsMethodTag<Runnable>::value,
2691 P1>::Release(p1_); }
2693 RunnableType runnable_;
2694 P1 p1_;
2695 P2 p2_;
2696 P3 p3_;
2697 P4 p4_;
2698 P5 p5_;
2701 template <typename Runnable, typename RunType, typename P1, typename P2,
2702 typename P3, typename P4, typename P5, typename P6>
2703 struct BindState<Runnable, RunType, void(P1, P2, P3, P4, P5,
2704 P6)> : public BindStateBase {
2705 typedef Runnable RunnableType;
2706 typedef IsWeakMethod<HasIsMethodTag<Runnable>::value, P1> IsWeakCall;
2707 typedef Invoker<6, BindState, RunType> InvokerType;
2708 typedef typename InvokerType::UnboundRunType UnboundRunType;
2710 // Convenience typedefs for bound argument types.
2711 typedef UnwrapTraits<P1> Bound1UnwrapTraits;
2712 typedef UnwrapTraits<P2> Bound2UnwrapTraits;
2713 typedef UnwrapTraits<P3> Bound3UnwrapTraits;
2714 typedef UnwrapTraits<P4> Bound4UnwrapTraits;
2715 typedef UnwrapTraits<P5> Bound5UnwrapTraits;
2716 typedef UnwrapTraits<P6> Bound6UnwrapTraits;
2718 BindState(const Runnable& runnable, const P1& p1, const P2& p2, const P3& p3,
2719 const P4& p4, const P5& p5, const P6& p6)
2720 : runnable_(runnable),
2721 p1_(p1),
2722 p2_(p2),
2723 p3_(p3),
2724 p4_(p4),
2725 p5_(p5),
2726 p6_(p6) {
2727 MaybeRefcount<HasIsMethodTag<Runnable>::value, P1>::AddRef(p1_);
2730 virtual ~BindState() { MaybeRefcount<HasIsMethodTag<Runnable>::value,
2731 P1>::Release(p1_); }
2733 RunnableType runnable_;
2734 P1 p1_;
2735 P2 p2_;
2736 P3 p3_;
2737 P4 p4_;
2738 P5 p5_;
2739 P6 p6_;
2742 template <typename Runnable, typename RunType, typename P1, typename P2,
2743 typename P3, typename P4, typename P5, typename P6, typename P7>
2744 struct BindState<Runnable, RunType, void(P1, P2, P3, P4, P5, P6,
2745 P7)> : public BindStateBase {
2746 typedef Runnable RunnableType;
2747 typedef IsWeakMethod<HasIsMethodTag<Runnable>::value, P1> IsWeakCall;
2748 typedef Invoker<7, BindState, RunType> InvokerType;
2749 typedef typename InvokerType::UnboundRunType UnboundRunType;
2751 // Convenience typedefs for bound argument types.
2752 typedef UnwrapTraits<P1> Bound1UnwrapTraits;
2753 typedef UnwrapTraits<P2> Bound2UnwrapTraits;
2754 typedef UnwrapTraits<P3> Bound3UnwrapTraits;
2755 typedef UnwrapTraits<P4> Bound4UnwrapTraits;
2756 typedef UnwrapTraits<P5> Bound5UnwrapTraits;
2757 typedef UnwrapTraits<P6> Bound6UnwrapTraits;
2758 typedef UnwrapTraits<P7> Bound7UnwrapTraits;
2760 BindState(const Runnable& runnable, const P1& p1, const P2& p2, const P3& p3,
2761 const P4& p4, const P5& p5, const P6& p6, const P7& p7)
2762 : runnable_(runnable),
2763 p1_(p1),
2764 p2_(p2),
2765 p3_(p3),
2766 p4_(p4),
2767 p5_(p5),
2768 p6_(p6),
2769 p7_(p7) {
2770 MaybeRefcount<HasIsMethodTag<Runnable>::value, P1>::AddRef(p1_);
2773 virtual ~BindState() { MaybeRefcount<HasIsMethodTag<Runnable>::value,
2774 P1>::Release(p1_); }
2776 RunnableType runnable_;
2777 P1 p1_;
2778 P2 p2_;
2779 P3 p3_;
2780 P4 p4_;
2781 P5 p5_;
2782 P6 p6_;
2783 P7 p7_;
2786 } // namespace internal
2787 } // namespace base
2789 #endif // BASE_BIND_INTERNAL_H_