security/sandbox/chromium/base/bind_internal.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/security/sandbox/chromium/base/bind_internal.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,2789 @@
     1.4 +// This file was GENERATED by command:
     1.5 +//     pump.py bind_internal.h.pump
     1.6 +// DO NOT EDIT BY HAND!!!
     1.7 +
     1.8 +
     1.9 +// Copyright (c) 2011 The Chromium Authors. All rights reserved.
    1.10 +// Use of this source code is governed by a BSD-style license that can be
    1.11 +// found in the LICENSE file.
    1.12 +
    1.13 +#ifndef BASE_BIND_INTERNAL_H_
    1.14 +#define BASE_BIND_INTERNAL_H_
    1.15 +
    1.16 +#include "base/bind_helpers.h"
    1.17 +#include "base/callback_internal.h"
    1.18 +#include "base/memory/raw_scoped_refptr_mismatch_checker.h"
    1.19 +#include "base/memory/weak_ptr.h"
    1.20 +#include "base/template_util.h"
    1.21 +#include "build/build_config.h"
    1.22 +
    1.23 +#if defined(OS_WIN)
    1.24 +#include "base/bind_internal_win.h"
    1.25 +#endif
    1.26 +
    1.27 +namespace base {
    1.28 +namespace internal {
    1.29 +
    1.30 +// See base/callback.h for user documentation.
    1.31 +//
    1.32 +//
    1.33 +// CONCEPTS:
    1.34 +//  Runnable -- A type (really a type class) that has a single Run() method
    1.35 +//              and a RunType typedef that corresponds to the type of Run().
    1.36 +//              A Runnable can declare that it should treated like a method
    1.37 +//              call by including a typedef named IsMethod.  The value of
    1.38 +//              this typedef is NOT inspected, only the existence.  When a
    1.39 +//              Runnable declares itself a method, Bind() will enforce special
    1.40 +//              refcounting + WeakPtr handling semantics for the first
    1.41 +//              parameter which is expected to be an object.
    1.42 +//  Functor -- A copyable type representing something that should be called.
    1.43 +//             All function pointers, Callback<>, and Runnables are functors
    1.44 +//             even if the invocation syntax differs.
    1.45 +//  RunType -- A function type (as opposed to function _pointer_ type) for
    1.46 +//             a Run() function.  Usually just a convenience typedef.
    1.47 +//  (Bound)ArgsType -- A function type that is being (ab)used to store the
    1.48 +//                     types of set of arguments.  The "return" type is always
    1.49 +//                     void here.  We use this hack so that we do not need
    1.50 +//                     a new type name for each arity of type. (eg.,
    1.51 +//                     BindState1, BindState2).  This makes forward
    1.52 +//                     declarations and friending much much easier.
    1.53 +//
    1.54 +// Types:
    1.55 +//  RunnableAdapter<> -- Wraps the various "function" pointer types into an
    1.56 +//                       object that adheres to the Runnable interface.
    1.57 +//                       There are |3*ARITY| RunnableAdapter types.
    1.58 +//  FunctionTraits<> -- Type traits that unwrap a function signature into a
    1.59 +//                      a set of easier to use typedefs.  Used mainly for
    1.60 +//                      compile time asserts.
    1.61 +//                      There are |ARITY| FunctionTraits types.
    1.62 +//  ForceVoidReturn<> -- Helper class for translating function signatures to
    1.63 +//                       equivalent forms with a "void" return type.
    1.64 +//                    There are |ARITY| ForceVoidReturn types.
    1.65 +//  FunctorTraits<> -- Type traits used determine the correct RunType and
    1.66 +//                     RunnableType for a Functor.  This is where function
    1.67 +//                     signature adapters are applied.
    1.68 +//                    There are |ARITY| ForceVoidReturn types.
    1.69 +//  MakeRunnable<> -- Takes a Functor and returns an object in the Runnable
    1.70 +//                    type class that represents the underlying Functor.
    1.71 +//                    There are |O(1)| MakeRunnable types.
    1.72 +//  InvokeHelper<> -- Take a Runnable + arguments and actully invokes it.
    1.73 +// Handle the differing syntaxes needed for WeakPtr<> support,
    1.74 +//                    and for ignoring return values.  This is separate from
    1.75 +//                    Invoker to avoid creating multiple version of Invoker<>
    1.76 +//                    which grows at O(n^2) with the arity.
    1.77 +//                    There are |k*ARITY| InvokeHelper types.
    1.78 +//  Invoker<> -- Unwraps the curried parameters and executes the Runnable.
    1.79 +//               There are |(ARITY^2 + ARITY)/2| Invoketypes.
    1.80 +//  BindState<> -- Stores the curried parameters, and is the main entry point
    1.81 +//                 into the Bind() system, doing most of the type resolution.
    1.82 +//                 There are ARITY BindState types.
    1.83 +
    1.84 +// RunnableAdapter<>
    1.85 +//
    1.86 +// The RunnableAdapter<> templates provide a uniform interface for invoking
    1.87 +// a function pointer, method pointer, or const method pointer. The adapter
    1.88 +// exposes a Run() method with an appropriate signature. Using this wrapper
    1.89 +// allows for writing code that supports all three pointer types without
    1.90 +// undue repetition.  Without it, a lot of code would need to be repeated 3
    1.91 +// times.
    1.92 +//
    1.93 +// For method pointers and const method pointers the first argument to Run()
    1.94 +// is considered to be the received of the method.  This is similar to STL's
    1.95 +// mem_fun().
    1.96 +//
    1.97 +// This class also exposes a RunType typedef that is the function type of the
    1.98 +// Run() function.
    1.99 +//
   1.100 +// If and only if the wrapper contains a method or const method pointer, an
   1.101 +// IsMethod typedef is exposed.  The existence of this typedef (NOT the value)
   1.102 +// marks that the wrapper should be considered a method wrapper.
   1.103 +
   1.104 +template <typename Functor>
   1.105 +class RunnableAdapter;
   1.106 +
   1.107 +// Function: Arity 0.
   1.108 +template <typename R>
   1.109 +class RunnableAdapter<R(*)()> {
   1.110 + public:
   1.111 +  typedef R (RunType)();
   1.112 +
   1.113 +  explicit RunnableAdapter(R(*function)())
   1.114 +      : function_(function) {
   1.115 +  }
   1.116 +
   1.117 +  R Run() {
   1.118 +    return function_();
   1.119 +  }
   1.120 +
   1.121 + private:
   1.122 +  R (*function_)();
   1.123 +};
   1.124 +
   1.125 +// Method: Arity 0.
   1.126 +template <typename R, typename T>
   1.127 +class RunnableAdapter<R(T::*)()> {
   1.128 + public:
   1.129 +  typedef R (RunType)(T*);
   1.130 +  typedef true_type IsMethod;
   1.131 +
   1.132 +  explicit RunnableAdapter(R(T::*method)())
   1.133 +      : method_(method) {
   1.134 +  }
   1.135 +
   1.136 +  R Run(T* object) {
   1.137 +    return (object->*method_)();
   1.138 +  }
   1.139 +
   1.140 + private:
   1.141 +  R (T::*method_)();
   1.142 +};
   1.143 +
   1.144 +// Const Method: Arity 0.
   1.145 +template <typename R, typename T>
   1.146 +class RunnableAdapter<R(T::*)() const> {
   1.147 + public:
   1.148 +  typedef R (RunType)(const T*);
   1.149 +  typedef true_type IsMethod;
   1.150 +
   1.151 +  explicit RunnableAdapter(R(T::*method)() const)
   1.152 +      : method_(method) {
   1.153 +  }
   1.154 +
   1.155 +  R Run(const T* object) {
   1.156 +    return (object->*method_)();
   1.157 +  }
   1.158 +
   1.159 + private:
   1.160 +  R (T::*method_)() const;
   1.161 +};
   1.162 +
   1.163 +// Function: Arity 1.
   1.164 +template <typename R, typename A1>
   1.165 +class RunnableAdapter<R(*)(A1)> {
   1.166 + public:
   1.167 +  typedef R (RunType)(A1);
   1.168 +
   1.169 +  explicit RunnableAdapter(R(*function)(A1))
   1.170 +      : function_(function) {
   1.171 +  }
   1.172 +
   1.173 +  R Run(typename CallbackParamTraits<A1>::ForwardType a1) {
   1.174 +    return function_(CallbackForward(a1));
   1.175 +  }
   1.176 +
   1.177 + private:
   1.178 +  R (*function_)(A1);
   1.179 +};
   1.180 +
   1.181 +// Method: Arity 1.
   1.182 +template <typename R, typename T, typename A1>
   1.183 +class RunnableAdapter<R(T::*)(A1)> {
   1.184 + public:
   1.185 +  typedef R (RunType)(T*, A1);
   1.186 +  typedef true_type IsMethod;
   1.187 +
   1.188 +  explicit RunnableAdapter(R(T::*method)(A1))
   1.189 +      : method_(method) {
   1.190 +  }
   1.191 +
   1.192 +  R Run(T* object, typename CallbackParamTraits<A1>::ForwardType a1) {
   1.193 +    return (object->*method_)(CallbackForward(a1));
   1.194 +  }
   1.195 +
   1.196 + private:
   1.197 +  R (T::*method_)(A1);
   1.198 +};
   1.199 +
   1.200 +// Const Method: Arity 1.
   1.201 +template <typename R, typename T, typename A1>
   1.202 +class RunnableAdapter<R(T::*)(A1) const> {
   1.203 + public:
   1.204 +  typedef R (RunType)(const T*, A1);
   1.205 +  typedef true_type IsMethod;
   1.206 +
   1.207 +  explicit RunnableAdapter(R(T::*method)(A1) const)
   1.208 +      : method_(method) {
   1.209 +  }
   1.210 +
   1.211 +  R Run(const T* object, typename CallbackParamTraits<A1>::ForwardType a1) {
   1.212 +    return (object->*method_)(CallbackForward(a1));
   1.213 +  }
   1.214 +
   1.215 + private:
   1.216 +  R (T::*method_)(A1) const;
   1.217 +};
   1.218 +
   1.219 +// Function: Arity 2.
   1.220 +template <typename R, typename A1, typename A2>
   1.221 +class RunnableAdapter<R(*)(A1, A2)> {
   1.222 + public:
   1.223 +  typedef R (RunType)(A1, A2);
   1.224 +
   1.225 +  explicit RunnableAdapter(R(*function)(A1, A2))
   1.226 +      : function_(function) {
   1.227 +  }
   1.228 +
   1.229 +  R Run(typename CallbackParamTraits<A1>::ForwardType a1,
   1.230 +      typename CallbackParamTraits<A2>::ForwardType a2) {
   1.231 +    return function_(CallbackForward(a1), CallbackForward(a2));
   1.232 +  }
   1.233 +
   1.234 + private:
   1.235 +  R (*function_)(A1, A2);
   1.236 +};
   1.237 +
   1.238 +// Method: Arity 2.
   1.239 +template <typename R, typename T, typename A1, typename A2>
   1.240 +class RunnableAdapter<R(T::*)(A1, A2)> {
   1.241 + public:
   1.242 +  typedef R (RunType)(T*, A1, A2);
   1.243 +  typedef true_type IsMethod;
   1.244 +
   1.245 +  explicit RunnableAdapter(R(T::*method)(A1, A2))
   1.246 +      : method_(method) {
   1.247 +  }
   1.248 +
   1.249 +  R Run(T* object, typename CallbackParamTraits<A1>::ForwardType a1,
   1.250 +      typename CallbackParamTraits<A2>::ForwardType a2) {
   1.251 +    return (object->*method_)(CallbackForward(a1), CallbackForward(a2));
   1.252 +  }
   1.253 +
   1.254 + private:
   1.255 +  R (T::*method_)(A1, A2);
   1.256 +};
   1.257 +
   1.258 +// Const Method: Arity 2.
   1.259 +template <typename R, typename T, typename A1, typename A2>
   1.260 +class RunnableAdapter<R(T::*)(A1, A2) const> {
   1.261 + public:
   1.262 +  typedef R (RunType)(const T*, A1, A2);
   1.263 +  typedef true_type IsMethod;
   1.264 +
   1.265 +  explicit RunnableAdapter(R(T::*method)(A1, A2) const)
   1.266 +      : method_(method) {
   1.267 +  }
   1.268 +
   1.269 +  R Run(const T* object, typename CallbackParamTraits<A1>::ForwardType a1,
   1.270 +      typename CallbackParamTraits<A2>::ForwardType a2) {
   1.271 +    return (object->*method_)(CallbackForward(a1), CallbackForward(a2));
   1.272 +  }
   1.273 +
   1.274 + private:
   1.275 +  R (T::*method_)(A1, A2) const;
   1.276 +};
   1.277 +
   1.278 +// Function: Arity 3.
   1.279 +template <typename R, typename A1, typename A2, typename A3>
   1.280 +class RunnableAdapter<R(*)(A1, A2, A3)> {
   1.281 + public:
   1.282 +  typedef R (RunType)(A1, A2, A3);
   1.283 +
   1.284 +  explicit RunnableAdapter(R(*function)(A1, A2, A3))
   1.285 +      : function_(function) {
   1.286 +  }
   1.287 +
   1.288 +  R Run(typename CallbackParamTraits<A1>::ForwardType a1,
   1.289 +      typename CallbackParamTraits<A2>::ForwardType a2,
   1.290 +      typename CallbackParamTraits<A3>::ForwardType a3) {
   1.291 +    return function_(CallbackForward(a1), CallbackForward(a2),
   1.292 +        CallbackForward(a3));
   1.293 +  }
   1.294 +
   1.295 + private:
   1.296 +  R (*function_)(A1, A2, A3);
   1.297 +};
   1.298 +
   1.299 +// Method: Arity 3.
   1.300 +template <typename R, typename T, typename A1, typename A2, typename A3>
   1.301 +class RunnableAdapter<R(T::*)(A1, A2, A3)> {
   1.302 + public:
   1.303 +  typedef R (RunType)(T*, A1, A2, A3);
   1.304 +  typedef true_type IsMethod;
   1.305 +
   1.306 +  explicit RunnableAdapter(R(T::*method)(A1, A2, A3))
   1.307 +      : method_(method) {
   1.308 +  }
   1.309 +
   1.310 +  R Run(T* object, typename CallbackParamTraits<A1>::ForwardType a1,
   1.311 +      typename CallbackParamTraits<A2>::ForwardType a2,
   1.312 +      typename CallbackParamTraits<A3>::ForwardType a3) {
   1.313 +    return (object->*method_)(CallbackForward(a1), CallbackForward(a2),
   1.314 +        CallbackForward(a3));
   1.315 +  }
   1.316 +
   1.317 + private:
   1.318 +  R (T::*method_)(A1, A2, A3);
   1.319 +};
   1.320 +
   1.321 +// Const Method: Arity 3.
   1.322 +template <typename R, typename T, typename A1, typename A2, typename A3>
   1.323 +class RunnableAdapter<R(T::*)(A1, A2, A3) const> {
   1.324 + public:
   1.325 +  typedef R (RunType)(const T*, A1, A2, A3);
   1.326 +  typedef true_type IsMethod;
   1.327 +
   1.328 +  explicit RunnableAdapter(R(T::*method)(A1, A2, A3) const)
   1.329 +      : method_(method) {
   1.330 +  }
   1.331 +
   1.332 +  R Run(const T* object, typename CallbackParamTraits<A1>::ForwardType a1,
   1.333 +      typename CallbackParamTraits<A2>::ForwardType a2,
   1.334 +      typename CallbackParamTraits<A3>::ForwardType a3) {
   1.335 +    return (object->*method_)(CallbackForward(a1), CallbackForward(a2),
   1.336 +        CallbackForward(a3));
   1.337 +  }
   1.338 +
   1.339 + private:
   1.340 +  R (T::*method_)(A1, A2, A3) const;
   1.341 +};
   1.342 +
   1.343 +// Function: Arity 4.
   1.344 +template <typename R, typename A1, typename A2, typename A3, typename A4>
   1.345 +class RunnableAdapter<R(*)(A1, A2, A3, A4)> {
   1.346 + public:
   1.347 +  typedef R (RunType)(A1, A2, A3, A4);
   1.348 +
   1.349 +  explicit RunnableAdapter(R(*function)(A1, A2, A3, A4))
   1.350 +      : function_(function) {
   1.351 +  }
   1.352 +
   1.353 +  R Run(typename CallbackParamTraits<A1>::ForwardType a1,
   1.354 +      typename CallbackParamTraits<A2>::ForwardType a2,
   1.355 +      typename CallbackParamTraits<A3>::ForwardType a3,
   1.356 +      typename CallbackParamTraits<A4>::ForwardType a4) {
   1.357 +    return function_(CallbackForward(a1), CallbackForward(a2),
   1.358 +        CallbackForward(a3), CallbackForward(a4));
   1.359 +  }
   1.360 +
   1.361 + private:
   1.362 +  R (*function_)(A1, A2, A3, A4);
   1.363 +};
   1.364 +
   1.365 +// Method: Arity 4.
   1.366 +template <typename R, typename T, typename A1, typename A2, typename A3,
   1.367 +    typename A4>
   1.368 +class RunnableAdapter<R(T::*)(A1, A2, A3, A4)> {
   1.369 + public:
   1.370 +  typedef R (RunType)(T*, A1, A2, A3, A4);
   1.371 +  typedef true_type IsMethod;
   1.372 +
   1.373 +  explicit RunnableAdapter(R(T::*method)(A1, A2, A3, A4))
   1.374 +      : method_(method) {
   1.375 +  }
   1.376 +
   1.377 +  R Run(T* object, typename CallbackParamTraits<A1>::ForwardType a1,
   1.378 +      typename CallbackParamTraits<A2>::ForwardType a2,
   1.379 +      typename CallbackParamTraits<A3>::ForwardType a3,
   1.380 +      typename CallbackParamTraits<A4>::ForwardType a4) {
   1.381 +    return (object->*method_)(CallbackForward(a1), CallbackForward(a2),
   1.382 +        CallbackForward(a3), CallbackForward(a4));
   1.383 +  }
   1.384 +
   1.385 + private:
   1.386 +  R (T::*method_)(A1, A2, A3, A4);
   1.387 +};
   1.388 +
   1.389 +// Const Method: Arity 4.
   1.390 +template <typename R, typename T, typename A1, typename A2, typename A3,
   1.391 +    typename A4>
   1.392 +class RunnableAdapter<R(T::*)(A1, A2, A3, A4) const> {
   1.393 + public:
   1.394 +  typedef R (RunType)(const T*, A1, A2, A3, A4);
   1.395 +  typedef true_type IsMethod;
   1.396 +
   1.397 +  explicit RunnableAdapter(R(T::*method)(A1, A2, A3, A4) const)
   1.398 +      : method_(method) {
   1.399 +  }
   1.400 +
   1.401 +  R Run(const T* object, typename CallbackParamTraits<A1>::ForwardType a1,
   1.402 +      typename CallbackParamTraits<A2>::ForwardType a2,
   1.403 +      typename CallbackParamTraits<A3>::ForwardType a3,
   1.404 +      typename CallbackParamTraits<A4>::ForwardType a4) {
   1.405 +    return (object->*method_)(CallbackForward(a1), CallbackForward(a2),
   1.406 +        CallbackForward(a3), CallbackForward(a4));
   1.407 +  }
   1.408 +
   1.409 + private:
   1.410 +  R (T::*method_)(A1, A2, A3, A4) const;
   1.411 +};
   1.412 +
   1.413 +// Function: Arity 5.
   1.414 +template <typename R, typename A1, typename A2, typename A3, typename A4,
   1.415 +    typename A5>
   1.416 +class RunnableAdapter<R(*)(A1, A2, A3, A4, A5)> {
   1.417 + public:
   1.418 +  typedef R (RunType)(A1, A2, A3, A4, A5);
   1.419 +
   1.420 +  explicit RunnableAdapter(R(*function)(A1, A2, A3, A4, A5))
   1.421 +      : function_(function) {
   1.422 +  }
   1.423 +
   1.424 +  R Run(typename CallbackParamTraits<A1>::ForwardType a1,
   1.425 +      typename CallbackParamTraits<A2>::ForwardType a2,
   1.426 +      typename CallbackParamTraits<A3>::ForwardType a3,
   1.427 +      typename CallbackParamTraits<A4>::ForwardType a4,
   1.428 +      typename CallbackParamTraits<A5>::ForwardType a5) {
   1.429 +    return function_(CallbackForward(a1), CallbackForward(a2),
   1.430 +        CallbackForward(a3), CallbackForward(a4), CallbackForward(a5));
   1.431 +  }
   1.432 +
   1.433 + private:
   1.434 +  R (*function_)(A1, A2, A3, A4, A5);
   1.435 +};
   1.436 +
   1.437 +// Method: Arity 5.
   1.438 +template <typename R, typename T, typename A1, typename A2, typename A3,
   1.439 +    typename A4, typename A5>
   1.440 +class RunnableAdapter<R(T::*)(A1, A2, A3, A4, A5)> {
   1.441 + public:
   1.442 +  typedef R (RunType)(T*, A1, A2, A3, A4, A5);
   1.443 +  typedef true_type IsMethod;
   1.444 +
   1.445 +  explicit RunnableAdapter(R(T::*method)(A1, A2, A3, A4, A5))
   1.446 +      : method_(method) {
   1.447 +  }
   1.448 +
   1.449 +  R Run(T* object, typename CallbackParamTraits<A1>::ForwardType a1,
   1.450 +      typename CallbackParamTraits<A2>::ForwardType a2,
   1.451 +      typename CallbackParamTraits<A3>::ForwardType a3,
   1.452 +      typename CallbackParamTraits<A4>::ForwardType a4,
   1.453 +      typename CallbackParamTraits<A5>::ForwardType a5) {
   1.454 +    return (object->*method_)(CallbackForward(a1), CallbackForward(a2),
   1.455 +        CallbackForward(a3), CallbackForward(a4), CallbackForward(a5));
   1.456 +  }
   1.457 +
   1.458 + private:
   1.459 +  R (T::*method_)(A1, A2, A3, A4, A5);
   1.460 +};
   1.461 +
   1.462 +// Const Method: Arity 5.
   1.463 +template <typename R, typename T, typename A1, typename A2, typename A3,
   1.464 +    typename A4, typename A5>
   1.465 +class RunnableAdapter<R(T::*)(A1, A2, A3, A4, A5) const> {
   1.466 + public:
   1.467 +  typedef R (RunType)(const T*, A1, A2, A3, A4, A5);
   1.468 +  typedef true_type IsMethod;
   1.469 +
   1.470 +  explicit RunnableAdapter(R(T::*method)(A1, A2, A3, A4, A5) const)
   1.471 +      : method_(method) {
   1.472 +  }
   1.473 +
   1.474 +  R Run(const T* object, typename CallbackParamTraits<A1>::ForwardType a1,
   1.475 +      typename CallbackParamTraits<A2>::ForwardType a2,
   1.476 +      typename CallbackParamTraits<A3>::ForwardType a3,
   1.477 +      typename CallbackParamTraits<A4>::ForwardType a4,
   1.478 +      typename CallbackParamTraits<A5>::ForwardType a5) {
   1.479 +    return (object->*method_)(CallbackForward(a1), CallbackForward(a2),
   1.480 +        CallbackForward(a3), CallbackForward(a4), CallbackForward(a5));
   1.481 +  }
   1.482 +
   1.483 + private:
   1.484 +  R (T::*method_)(A1, A2, A3, A4, A5) const;
   1.485 +};
   1.486 +
   1.487 +// Function: Arity 6.
   1.488 +template <typename R, typename A1, typename A2, typename A3, typename A4,
   1.489 +    typename A5, typename A6>
   1.490 +class RunnableAdapter<R(*)(A1, A2, A3, A4, A5, A6)> {
   1.491 + public:
   1.492 +  typedef R (RunType)(A1, A2, A3, A4, A5, A6);
   1.493 +
   1.494 +  explicit RunnableAdapter(R(*function)(A1, A2, A3, A4, A5, A6))
   1.495 +      : function_(function) {
   1.496 +  }
   1.497 +
   1.498 +  R Run(typename CallbackParamTraits<A1>::ForwardType a1,
   1.499 +      typename CallbackParamTraits<A2>::ForwardType a2,
   1.500 +      typename CallbackParamTraits<A3>::ForwardType a3,
   1.501 +      typename CallbackParamTraits<A4>::ForwardType a4,
   1.502 +      typename CallbackParamTraits<A5>::ForwardType a5,
   1.503 +      typename CallbackParamTraits<A6>::ForwardType a6) {
   1.504 +    return function_(CallbackForward(a1), CallbackForward(a2),
   1.505 +        CallbackForward(a3), CallbackForward(a4), CallbackForward(a5),
   1.506 +        CallbackForward(a6));
   1.507 +  }
   1.508 +
   1.509 + private:
   1.510 +  R (*function_)(A1, A2, A3, A4, A5, A6);
   1.511 +};
   1.512 +
   1.513 +// Method: Arity 6.
   1.514 +template <typename R, typename T, typename A1, typename A2, typename A3,
   1.515 +    typename A4, typename A5, typename A6>
   1.516 +class RunnableAdapter<R(T::*)(A1, A2, A3, A4, A5, A6)> {
   1.517 + public:
   1.518 +  typedef R (RunType)(T*, A1, A2, A3, A4, A5, A6);
   1.519 +  typedef true_type IsMethod;
   1.520 +
   1.521 +  explicit RunnableAdapter(R(T::*method)(A1, A2, A3, A4, A5, A6))
   1.522 +      : method_(method) {
   1.523 +  }
   1.524 +
   1.525 +  R Run(T* object, typename CallbackParamTraits<A1>::ForwardType a1,
   1.526 +      typename CallbackParamTraits<A2>::ForwardType a2,
   1.527 +      typename CallbackParamTraits<A3>::ForwardType a3,
   1.528 +      typename CallbackParamTraits<A4>::ForwardType a4,
   1.529 +      typename CallbackParamTraits<A5>::ForwardType a5,
   1.530 +      typename CallbackParamTraits<A6>::ForwardType a6) {
   1.531 +    return (object->*method_)(CallbackForward(a1), CallbackForward(a2),
   1.532 +        CallbackForward(a3), CallbackForward(a4), CallbackForward(a5),
   1.533 +        CallbackForward(a6));
   1.534 +  }
   1.535 +
   1.536 + private:
   1.537 +  R (T::*method_)(A1, A2, A3, A4, A5, A6);
   1.538 +};
   1.539 +
   1.540 +// Const Method: Arity 6.
   1.541 +template <typename R, typename T, typename A1, typename A2, typename A3,
   1.542 +    typename A4, typename A5, typename A6>
   1.543 +class RunnableAdapter<R(T::*)(A1, A2, A3, A4, A5, A6) const> {
   1.544 + public:
   1.545 +  typedef R (RunType)(const T*, A1, A2, A3, A4, A5, A6);
   1.546 +  typedef true_type IsMethod;
   1.547 +
   1.548 +  explicit RunnableAdapter(R(T::*method)(A1, A2, A3, A4, A5, A6) const)
   1.549 +      : method_(method) {
   1.550 +  }
   1.551 +
   1.552 +  R Run(const T* object, typename CallbackParamTraits<A1>::ForwardType a1,
   1.553 +      typename CallbackParamTraits<A2>::ForwardType a2,
   1.554 +      typename CallbackParamTraits<A3>::ForwardType a3,
   1.555 +      typename CallbackParamTraits<A4>::ForwardType a4,
   1.556 +      typename CallbackParamTraits<A5>::ForwardType a5,
   1.557 +      typename CallbackParamTraits<A6>::ForwardType a6) {
   1.558 +    return (object->*method_)(CallbackForward(a1), CallbackForward(a2),
   1.559 +        CallbackForward(a3), CallbackForward(a4), CallbackForward(a5),
   1.560 +        CallbackForward(a6));
   1.561 +  }
   1.562 +
   1.563 + private:
   1.564 +  R (T::*method_)(A1, A2, A3, A4, A5, A6) const;
   1.565 +};
   1.566 +
   1.567 +// Function: Arity 7.
   1.568 +template <typename R, typename A1, typename A2, typename A3, typename A4,
   1.569 +    typename A5, typename A6, typename A7>
   1.570 +class RunnableAdapter<R(*)(A1, A2, A3, A4, A5, A6, A7)> {
   1.571 + public:
   1.572 +  typedef R (RunType)(A1, A2, A3, A4, A5, A6, A7);
   1.573 +
   1.574 +  explicit RunnableAdapter(R(*function)(A1, A2, A3, A4, A5, A6, A7))
   1.575 +      : function_(function) {
   1.576 +  }
   1.577 +
   1.578 +  R Run(typename CallbackParamTraits<A1>::ForwardType a1,
   1.579 +      typename CallbackParamTraits<A2>::ForwardType a2,
   1.580 +      typename CallbackParamTraits<A3>::ForwardType a3,
   1.581 +      typename CallbackParamTraits<A4>::ForwardType a4,
   1.582 +      typename CallbackParamTraits<A5>::ForwardType a5,
   1.583 +      typename CallbackParamTraits<A6>::ForwardType a6,
   1.584 +      typename CallbackParamTraits<A7>::ForwardType a7) {
   1.585 +    return function_(CallbackForward(a1), CallbackForward(a2),
   1.586 +        CallbackForward(a3), CallbackForward(a4), CallbackForward(a5),
   1.587 +        CallbackForward(a6), CallbackForward(a7));
   1.588 +  }
   1.589 +
   1.590 + private:
   1.591 +  R (*function_)(A1, A2, A3, A4, A5, A6, A7);
   1.592 +};
   1.593 +
   1.594 +// Method: Arity 7.
   1.595 +template <typename R, typename T, typename A1, typename A2, typename A3,
   1.596 +    typename A4, typename A5, typename A6, typename A7>
   1.597 +class RunnableAdapter<R(T::*)(A1, A2, A3, A4, A5, A6, A7)> {
   1.598 + public:
   1.599 +  typedef R (RunType)(T*, A1, A2, A3, A4, A5, A6, A7);
   1.600 +  typedef true_type IsMethod;
   1.601 +
   1.602 +  explicit RunnableAdapter(R(T::*method)(A1, A2, A3, A4, A5, A6, A7))
   1.603 +      : method_(method) {
   1.604 +  }
   1.605 +
   1.606 +  R Run(T* object, typename CallbackParamTraits<A1>::ForwardType a1,
   1.607 +      typename CallbackParamTraits<A2>::ForwardType a2,
   1.608 +      typename CallbackParamTraits<A3>::ForwardType a3,
   1.609 +      typename CallbackParamTraits<A4>::ForwardType a4,
   1.610 +      typename CallbackParamTraits<A5>::ForwardType a5,
   1.611 +      typename CallbackParamTraits<A6>::ForwardType a6,
   1.612 +      typename CallbackParamTraits<A7>::ForwardType a7) {
   1.613 +    return (object->*method_)(CallbackForward(a1), CallbackForward(a2),
   1.614 +        CallbackForward(a3), CallbackForward(a4), CallbackForward(a5),
   1.615 +        CallbackForward(a6), CallbackForward(a7));
   1.616 +  }
   1.617 +
   1.618 + private:
   1.619 +  R (T::*method_)(A1, A2, A3, A4, A5, A6, A7);
   1.620 +};
   1.621 +
   1.622 +// Const Method: Arity 7.
   1.623 +template <typename R, typename T, typename A1, typename A2, typename A3,
   1.624 +    typename A4, typename A5, typename A6, typename A7>
   1.625 +class RunnableAdapter<R(T::*)(A1, A2, A3, A4, A5, A6, A7) const> {
   1.626 + public:
   1.627 +  typedef R (RunType)(const T*, A1, A2, A3, A4, A5, A6, A7);
   1.628 +  typedef true_type IsMethod;
   1.629 +
   1.630 +  explicit RunnableAdapter(R(T::*method)(A1, A2, A3, A4, A5, A6, A7) const)
   1.631 +      : method_(method) {
   1.632 +  }
   1.633 +
   1.634 +  R Run(const T* object, typename CallbackParamTraits<A1>::ForwardType a1,
   1.635 +      typename CallbackParamTraits<A2>::ForwardType a2,
   1.636 +      typename CallbackParamTraits<A3>::ForwardType a3,
   1.637 +      typename CallbackParamTraits<A4>::ForwardType a4,
   1.638 +      typename CallbackParamTraits<A5>::ForwardType a5,
   1.639 +      typename CallbackParamTraits<A6>::ForwardType a6,
   1.640 +      typename CallbackParamTraits<A7>::ForwardType a7) {
   1.641 +    return (object->*method_)(CallbackForward(a1), CallbackForward(a2),
   1.642 +        CallbackForward(a3), CallbackForward(a4), CallbackForward(a5),
   1.643 +        CallbackForward(a6), CallbackForward(a7));
   1.644 +  }
   1.645 +
   1.646 + private:
   1.647 +  R (T::*method_)(A1, A2, A3, A4, A5, A6, A7) const;
   1.648 +};
   1.649 +
   1.650 +
   1.651 +// FunctionTraits<>
   1.652 +//
   1.653 +// Breaks a function signature apart into typedefs for easier introspection.
   1.654 +template <typename Sig>
   1.655 +struct FunctionTraits;
   1.656 +
   1.657 +template <typename R>
   1.658 +struct FunctionTraits<R()> {
   1.659 +  typedef R ReturnType;
   1.660 +};
   1.661 +
   1.662 +template <typename R, typename A1>
   1.663 +struct FunctionTraits<R(A1)> {
   1.664 +  typedef R ReturnType;
   1.665 +  typedef A1 A1Type;
   1.666 +};
   1.667 +
   1.668 +template <typename R, typename A1, typename A2>
   1.669 +struct FunctionTraits<R(A1, A2)> {
   1.670 +  typedef R ReturnType;
   1.671 +  typedef A1 A1Type;
   1.672 +  typedef A2 A2Type;
   1.673 +};
   1.674 +
   1.675 +template <typename R, typename A1, typename A2, typename A3>
   1.676 +struct FunctionTraits<R(A1, A2, A3)> {
   1.677 +  typedef R ReturnType;
   1.678 +  typedef A1 A1Type;
   1.679 +  typedef A2 A2Type;
   1.680 +  typedef A3 A3Type;
   1.681 +};
   1.682 +
   1.683 +template <typename R, typename A1, typename A2, typename A3, typename A4>
   1.684 +struct FunctionTraits<R(A1, A2, A3, A4)> {
   1.685 +  typedef R ReturnType;
   1.686 +  typedef A1 A1Type;
   1.687 +  typedef A2 A2Type;
   1.688 +  typedef A3 A3Type;
   1.689 +  typedef A4 A4Type;
   1.690 +};
   1.691 +
   1.692 +template <typename R, typename A1, typename A2, typename A3, typename A4,
   1.693 +    typename A5>
   1.694 +struct FunctionTraits<R(A1, A2, A3, A4, A5)> {
   1.695 +  typedef R ReturnType;
   1.696 +  typedef A1 A1Type;
   1.697 +  typedef A2 A2Type;
   1.698 +  typedef A3 A3Type;
   1.699 +  typedef A4 A4Type;
   1.700 +  typedef A5 A5Type;
   1.701 +};
   1.702 +
   1.703 +template <typename R, typename A1, typename A2, typename A3, typename A4,
   1.704 +    typename A5, typename A6>
   1.705 +struct FunctionTraits<R(A1, A2, A3, A4, A5, A6)> {
   1.706 +  typedef R ReturnType;
   1.707 +  typedef A1 A1Type;
   1.708 +  typedef A2 A2Type;
   1.709 +  typedef A3 A3Type;
   1.710 +  typedef A4 A4Type;
   1.711 +  typedef A5 A5Type;
   1.712 +  typedef A6 A6Type;
   1.713 +};
   1.714 +
   1.715 +template <typename R, typename A1, typename A2, typename A3, typename A4,
   1.716 +    typename A5, typename A6, typename A7>
   1.717 +struct FunctionTraits<R(A1, A2, A3, A4, A5, A6, A7)> {
   1.718 +  typedef R ReturnType;
   1.719 +  typedef A1 A1Type;
   1.720 +  typedef A2 A2Type;
   1.721 +  typedef A3 A3Type;
   1.722 +  typedef A4 A4Type;
   1.723 +  typedef A5 A5Type;
   1.724 +  typedef A6 A6Type;
   1.725 +  typedef A7 A7Type;
   1.726 +};
   1.727 +
   1.728 +
   1.729 +// ForceVoidReturn<>
   1.730 +//
   1.731 +// Set of templates that support forcing the function return type to void.
   1.732 +template <typename Sig>
   1.733 +struct ForceVoidReturn;
   1.734 +
   1.735 +template <typename R>
   1.736 +struct ForceVoidReturn<R()> {
   1.737 +  typedef void(RunType)();
   1.738 +};
   1.739 +
   1.740 +template <typename R, typename A1>
   1.741 +struct ForceVoidReturn<R(A1)> {
   1.742 +  typedef void(RunType)(A1);
   1.743 +};
   1.744 +
   1.745 +template <typename R, typename A1, typename A2>
   1.746 +struct ForceVoidReturn<R(A1, A2)> {
   1.747 +  typedef void(RunType)(A1, A2);
   1.748 +};
   1.749 +
   1.750 +template <typename R, typename A1, typename A2, typename A3>
   1.751 +struct ForceVoidReturn<R(A1, A2, A3)> {
   1.752 +  typedef void(RunType)(A1, A2, A3);
   1.753 +};
   1.754 +
   1.755 +template <typename R, typename A1, typename A2, typename A3, typename A4>
   1.756 +struct ForceVoidReturn<R(A1, A2, A3, A4)> {
   1.757 +  typedef void(RunType)(A1, A2, A3, A4);
   1.758 +};
   1.759 +
   1.760 +template <typename R, typename A1, typename A2, typename A3, typename A4,
   1.761 +    typename A5>
   1.762 +struct ForceVoidReturn<R(A1, A2, A3, A4, A5)> {
   1.763 +  typedef void(RunType)(A1, A2, A3, A4, A5);
   1.764 +};
   1.765 +
   1.766 +template <typename R, typename A1, typename A2, typename A3, typename A4,
   1.767 +    typename A5, typename A6>
   1.768 +struct ForceVoidReturn<R(A1, A2, A3, A4, A5, A6)> {
   1.769 +  typedef void(RunType)(A1, A2, A3, A4, A5, A6);
   1.770 +};
   1.771 +
   1.772 +template <typename R, typename A1, typename A2, typename A3, typename A4,
   1.773 +    typename A5, typename A6, typename A7>
   1.774 +struct ForceVoidReturn<R(A1, A2, A3, A4, A5, A6, A7)> {
   1.775 +  typedef void(RunType)(A1, A2, A3, A4, A5, A6, A7);
   1.776 +};
   1.777 +
   1.778 +
   1.779 +// FunctorTraits<>
   1.780 +//
   1.781 +// See description at top of file.
   1.782 +template <typename T>
   1.783 +struct FunctorTraits {
   1.784 +  typedef RunnableAdapter<T> RunnableType;
   1.785 +  typedef typename RunnableType::RunType RunType;
   1.786 +};
   1.787 +
   1.788 +template <typename T>
   1.789 +struct FunctorTraits<IgnoreResultHelper<T> > {
   1.790 +  typedef typename FunctorTraits<T>::RunnableType RunnableType;
   1.791 +  typedef typename ForceVoidReturn<
   1.792 +      typename RunnableType::RunType>::RunType RunType;
   1.793 +};
   1.794 +
   1.795 +template <typename T>
   1.796 +struct FunctorTraits<Callback<T> > {
   1.797 +  typedef Callback<T> RunnableType;
   1.798 +  typedef typename Callback<T>::RunType RunType;
   1.799 +};
   1.800 +
   1.801 +
   1.802 +// MakeRunnable<>
   1.803 +//
   1.804 +// Converts a passed in functor to a RunnableType using type inference.
   1.805 +
   1.806 +template <typename T>
   1.807 +typename FunctorTraits<T>::RunnableType MakeRunnable(const T& t) {
   1.808 +  return RunnableAdapter<T>(t);
   1.809 +}
   1.810 +
   1.811 +template <typename T>
   1.812 +typename FunctorTraits<T>::RunnableType
   1.813 +MakeRunnable(const IgnoreResultHelper<T>& t) {
   1.814 +  return MakeRunnable(t.functor_);
   1.815 +}
   1.816 +
   1.817 +template <typename T>
   1.818 +const typename FunctorTraits<Callback<T> >::RunnableType&
   1.819 +MakeRunnable(const Callback<T>& t) {
   1.820 +  DCHECK(!t.is_null());
   1.821 +  return t;
   1.822 +}
   1.823 +
   1.824 +
   1.825 +// InvokeHelper<>
   1.826 +//
   1.827 +// There are 3 logical InvokeHelper<> specializations: normal, void-return,
   1.828 +// WeakCalls.
   1.829 +//
   1.830 +// The normal type just calls the underlying runnable.
   1.831 +//
   1.832 +// We need a InvokeHelper to handle void return types in order to support
   1.833 +// IgnoreResult().  Normally, if the Runnable's RunType had a void return,
   1.834 +// the template system would just accept "return functor.Run()" ignoring
   1.835 +// the fact that a void function is being used with return. This piece of
   1.836 +// sugar breaks though when the Runnable's RunType is not void.  Thus, we
   1.837 +// need a partial specialization to change the syntax to drop the "return"
   1.838 +// from the invocation call.
   1.839 +//
   1.840 +// WeakCalls similarly need special syntax that is applied to the first
   1.841 +// argument to check if they should no-op themselves.
   1.842 +template <bool IsWeakCall, typename ReturnType, typename Runnable,
   1.843 +          typename ArgsType>
   1.844 +struct InvokeHelper;
   1.845 +
   1.846 +template <typename ReturnType, typename Runnable>
   1.847 +struct InvokeHelper<false, ReturnType, Runnable,
   1.848 +    void()>  {
   1.849 +  static ReturnType MakeItSo(Runnable runnable) {
   1.850 +    return runnable.Run();
   1.851 +  }
   1.852 +};
   1.853 +
   1.854 +template <typename Runnable>
   1.855 +struct InvokeHelper<false, void, Runnable,
   1.856 +    void()>  {
   1.857 +  static void MakeItSo(Runnable runnable) {
   1.858 +    runnable.Run();
   1.859 +  }
   1.860 +};
   1.861 +
   1.862 +template <typename ReturnType, typename Runnable,typename A1>
   1.863 +struct InvokeHelper<false, ReturnType, Runnable,
   1.864 +    void(A1)>  {
   1.865 +  static ReturnType MakeItSo(Runnable runnable, A1 a1) {
   1.866 +    return runnable.Run(CallbackForward(a1));
   1.867 +  }
   1.868 +};
   1.869 +
   1.870 +template <typename Runnable,typename A1>
   1.871 +struct InvokeHelper<false, void, Runnable,
   1.872 +    void(A1)>  {
   1.873 +  static void MakeItSo(Runnable runnable, A1 a1) {
   1.874 +    runnable.Run(CallbackForward(a1));
   1.875 +  }
   1.876 +};
   1.877 +
   1.878 +template <typename Runnable, typename BoundWeakPtr>
   1.879 +struct InvokeHelper<true, void, Runnable,
   1.880 +    void(BoundWeakPtr)>  {
   1.881 +  static void MakeItSo(Runnable runnable, BoundWeakPtr weak_ptr) {
   1.882 +    if (!weak_ptr.get()) {
   1.883 +      return;
   1.884 +    }
   1.885 +    runnable.Run(weak_ptr.get());
   1.886 +  }
   1.887 +};
   1.888 +
   1.889 +template <typename ReturnType, typename Runnable,typename A1, typename A2>
   1.890 +struct InvokeHelper<false, ReturnType, Runnable,
   1.891 +    void(A1, A2)>  {
   1.892 +  static ReturnType MakeItSo(Runnable runnable, A1 a1, A2 a2) {
   1.893 +    return runnable.Run(CallbackForward(a1), CallbackForward(a2));
   1.894 +  }
   1.895 +};
   1.896 +
   1.897 +template <typename Runnable,typename A1, typename A2>
   1.898 +struct InvokeHelper<false, void, Runnable,
   1.899 +    void(A1, A2)>  {
   1.900 +  static void MakeItSo(Runnable runnable, A1 a1, A2 a2) {
   1.901 +    runnable.Run(CallbackForward(a1), CallbackForward(a2));
   1.902 +  }
   1.903 +};
   1.904 +
   1.905 +template <typename Runnable, typename BoundWeakPtr, typename A2>
   1.906 +struct InvokeHelper<true, void, Runnable,
   1.907 +    void(BoundWeakPtr, A2)>  {
   1.908 +  static void MakeItSo(Runnable runnable, BoundWeakPtr weak_ptr, A2 a2) {
   1.909 +    if (!weak_ptr.get()) {
   1.910 +      return;
   1.911 +    }
   1.912 +    runnable.Run(weak_ptr.get(), CallbackForward(a2));
   1.913 +  }
   1.914 +};
   1.915 +
   1.916 +template <typename ReturnType, typename Runnable,typename A1, typename A2,
   1.917 +    typename A3>
   1.918 +struct InvokeHelper<false, ReturnType, Runnable,
   1.919 +    void(A1, A2, A3)>  {
   1.920 +  static ReturnType MakeItSo(Runnable runnable, A1 a1, A2 a2, A3 a3) {
   1.921 +    return runnable.Run(CallbackForward(a1), CallbackForward(a2),
   1.922 +        CallbackForward(a3));
   1.923 +  }
   1.924 +};
   1.925 +
   1.926 +template <typename Runnable,typename A1, typename A2, typename A3>
   1.927 +struct InvokeHelper<false, void, Runnable,
   1.928 +    void(A1, A2, A3)>  {
   1.929 +  static void MakeItSo(Runnable runnable, A1 a1, A2 a2, A3 a3) {
   1.930 +    runnable.Run(CallbackForward(a1), CallbackForward(a2), CallbackForward(a3));
   1.931 +  }
   1.932 +};
   1.933 +
   1.934 +template <typename Runnable, typename BoundWeakPtr, typename A2, typename A3>
   1.935 +struct InvokeHelper<true, void, Runnable,
   1.936 +    void(BoundWeakPtr, A2, A3)>  {
   1.937 +  static void MakeItSo(Runnable runnable, BoundWeakPtr weak_ptr, A2 a2, A3 a3) {
   1.938 +    if (!weak_ptr.get()) {
   1.939 +      return;
   1.940 +    }
   1.941 +    runnable.Run(weak_ptr.get(), CallbackForward(a2), CallbackForward(a3));
   1.942 +  }
   1.943 +};
   1.944 +
   1.945 +template <typename ReturnType, typename Runnable,typename A1, typename A2,
   1.946 +    typename A3, typename A4>
   1.947 +struct InvokeHelper<false, ReturnType, Runnable,
   1.948 +    void(A1, A2, A3, A4)>  {
   1.949 +  static ReturnType MakeItSo(Runnable runnable, A1 a1, A2 a2, A3 a3, A4 a4) {
   1.950 +    return runnable.Run(CallbackForward(a1), CallbackForward(a2),
   1.951 +        CallbackForward(a3), CallbackForward(a4));
   1.952 +  }
   1.953 +};
   1.954 +
   1.955 +template <typename Runnable,typename A1, typename A2, typename A3, typename A4>
   1.956 +struct InvokeHelper<false, void, Runnable,
   1.957 +    void(A1, A2, A3, A4)>  {
   1.958 +  static void MakeItSo(Runnable runnable, A1 a1, A2 a2, A3 a3, A4 a4) {
   1.959 +    runnable.Run(CallbackForward(a1), CallbackForward(a2), CallbackForward(a3),
   1.960 +        CallbackForward(a4));
   1.961 +  }
   1.962 +};
   1.963 +
   1.964 +template <typename Runnable, typename BoundWeakPtr, typename A2, typename A3,
   1.965 +    typename A4>
   1.966 +struct InvokeHelper<true, void, Runnable,
   1.967 +    void(BoundWeakPtr, A2, A3, A4)>  {
   1.968 +  static void MakeItSo(Runnable runnable, BoundWeakPtr weak_ptr, A2 a2, A3 a3,
   1.969 +      A4 a4) {
   1.970 +    if (!weak_ptr.get()) {
   1.971 +      return;
   1.972 +    }
   1.973 +    runnable.Run(weak_ptr.get(), CallbackForward(a2), CallbackForward(a3),
   1.974 +        CallbackForward(a4));
   1.975 +  }
   1.976 +};
   1.977 +
   1.978 +template <typename ReturnType, typename Runnable,typename A1, typename A2,
   1.979 +    typename A3, typename A4, typename A5>
   1.980 +struct InvokeHelper<false, ReturnType, Runnable,
   1.981 +    void(A1, A2, A3, A4, A5)>  {
   1.982 +  static ReturnType MakeItSo(Runnable runnable, A1 a1, A2 a2, A3 a3, A4 a4,
   1.983 +      A5 a5) {
   1.984 +    return runnable.Run(CallbackForward(a1), CallbackForward(a2),
   1.985 +        CallbackForward(a3), CallbackForward(a4), CallbackForward(a5));
   1.986 +  }
   1.987 +};
   1.988 +
   1.989 +template <typename Runnable,typename A1, typename A2, typename A3, typename A4,
   1.990 +    typename A5>
   1.991 +struct InvokeHelper<false, void, Runnable,
   1.992 +    void(A1, A2, A3, A4, A5)>  {
   1.993 +  static void MakeItSo(Runnable runnable, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) {
   1.994 +    runnable.Run(CallbackForward(a1), CallbackForward(a2), CallbackForward(a3),
   1.995 +        CallbackForward(a4), CallbackForward(a5));
   1.996 +  }
   1.997 +};
   1.998 +
   1.999 +template <typename Runnable, typename BoundWeakPtr, typename A2, typename A3,
  1.1000 +    typename A4, typename A5>
  1.1001 +struct InvokeHelper<true, void, Runnable,
  1.1002 +    void(BoundWeakPtr, A2, A3, A4, A5)>  {
  1.1003 +  static void MakeItSo(Runnable runnable, BoundWeakPtr weak_ptr, A2 a2, A3 a3,
  1.1004 +      A4 a4, A5 a5) {
  1.1005 +    if (!weak_ptr.get()) {
  1.1006 +      return;
  1.1007 +    }
  1.1008 +    runnable.Run(weak_ptr.get(), CallbackForward(a2), CallbackForward(a3),
  1.1009 +        CallbackForward(a4), CallbackForward(a5));
  1.1010 +  }
  1.1011 +};
  1.1012 +
  1.1013 +template <typename ReturnType, typename Runnable,typename A1, typename A2,
  1.1014 +    typename A3, typename A4, typename A5, typename A6>
  1.1015 +struct InvokeHelper<false, ReturnType, Runnable,
  1.1016 +    void(A1, A2, A3, A4, A5, A6)>  {
  1.1017 +  static ReturnType MakeItSo(Runnable runnable, A1 a1, A2 a2, A3 a3, A4 a4,
  1.1018 +      A5 a5, A6 a6) {
  1.1019 +    return runnable.Run(CallbackForward(a1), CallbackForward(a2),
  1.1020 +        CallbackForward(a3), CallbackForward(a4), CallbackForward(a5),
  1.1021 +        CallbackForward(a6));
  1.1022 +  }
  1.1023 +};
  1.1024 +
  1.1025 +template <typename Runnable,typename A1, typename A2, typename A3, typename A4,
  1.1026 +    typename A5, typename A6>
  1.1027 +struct InvokeHelper<false, void, Runnable,
  1.1028 +    void(A1, A2, A3, A4, A5, A6)>  {
  1.1029 +  static void MakeItSo(Runnable runnable, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5,
  1.1030 +      A6 a6) {
  1.1031 +    runnable.Run(CallbackForward(a1), CallbackForward(a2), CallbackForward(a3),
  1.1032 +        CallbackForward(a4), CallbackForward(a5), CallbackForward(a6));
  1.1033 +  }
  1.1034 +};
  1.1035 +
  1.1036 +template <typename Runnable, typename BoundWeakPtr, typename A2, typename A3,
  1.1037 +    typename A4, typename A5, typename A6>
  1.1038 +struct InvokeHelper<true, void, Runnable,
  1.1039 +    void(BoundWeakPtr, A2, A3, A4, A5, A6)>  {
  1.1040 +  static void MakeItSo(Runnable runnable, BoundWeakPtr weak_ptr, A2 a2, A3 a3,
  1.1041 +      A4 a4, A5 a5, A6 a6) {
  1.1042 +    if (!weak_ptr.get()) {
  1.1043 +      return;
  1.1044 +    }
  1.1045 +    runnable.Run(weak_ptr.get(), CallbackForward(a2), CallbackForward(a3),
  1.1046 +        CallbackForward(a4), CallbackForward(a5), CallbackForward(a6));
  1.1047 +  }
  1.1048 +};
  1.1049 +
  1.1050 +template <typename ReturnType, typename Runnable,typename A1, typename A2,
  1.1051 +    typename A3, typename A4, typename A5, typename A6, typename A7>
  1.1052 +struct InvokeHelper<false, ReturnType, Runnable,
  1.1053 +    void(A1, A2, A3, A4, A5, A6, A7)>  {
  1.1054 +  static ReturnType MakeItSo(Runnable runnable, A1 a1, A2 a2, A3 a3, A4 a4,
  1.1055 +      A5 a5, A6 a6, A7 a7) {
  1.1056 +    return runnable.Run(CallbackForward(a1), CallbackForward(a2),
  1.1057 +        CallbackForward(a3), CallbackForward(a4), CallbackForward(a5),
  1.1058 +        CallbackForward(a6), CallbackForward(a7));
  1.1059 +  }
  1.1060 +};
  1.1061 +
  1.1062 +template <typename Runnable,typename A1, typename A2, typename A3, typename A4,
  1.1063 +    typename A5, typename A6, typename A7>
  1.1064 +struct InvokeHelper<false, void, Runnable,
  1.1065 +    void(A1, A2, A3, A4, A5, A6, A7)>  {
  1.1066 +  static void MakeItSo(Runnable runnable, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5,
  1.1067 +      A6 a6, A7 a7) {
  1.1068 +    runnable.Run(CallbackForward(a1), CallbackForward(a2), CallbackForward(a3),
  1.1069 +        CallbackForward(a4), CallbackForward(a5), CallbackForward(a6),
  1.1070 +        CallbackForward(a7));
  1.1071 +  }
  1.1072 +};
  1.1073 +
  1.1074 +template <typename Runnable, typename BoundWeakPtr, typename A2, typename A3,
  1.1075 +    typename A4, typename A5, typename A6, typename A7>
  1.1076 +struct InvokeHelper<true, void, Runnable,
  1.1077 +    void(BoundWeakPtr, A2, A3, A4, A5, A6, A7)>  {
  1.1078 +  static void MakeItSo(Runnable runnable, BoundWeakPtr weak_ptr, A2 a2, A3 a3,
  1.1079 +      A4 a4, A5 a5, A6 a6, A7 a7) {
  1.1080 +    if (!weak_ptr.get()) {
  1.1081 +      return;
  1.1082 +    }
  1.1083 +    runnable.Run(weak_ptr.get(), CallbackForward(a2), CallbackForward(a3),
  1.1084 +        CallbackForward(a4), CallbackForward(a5), CallbackForward(a6),
  1.1085 +        CallbackForward(a7));
  1.1086 +  }
  1.1087 +};
  1.1088 +
  1.1089 +#if !defined(_MSC_VER)
  1.1090 +
  1.1091 +template <typename ReturnType, typename Runnable, typename ArgsType>
  1.1092 +struct InvokeHelper<true, ReturnType, Runnable, ArgsType> {
  1.1093 +  // WeakCalls are only supported for functions with a void return type.
  1.1094 +  // Otherwise, the function result would be undefined if the the WeakPtr<>
  1.1095 +  // is invalidated.
  1.1096 +  COMPILE_ASSERT(is_void<ReturnType>::value,
  1.1097 +                 weak_ptrs_can_only_bind_to_methods_without_return_values);
  1.1098 +};
  1.1099 +
  1.1100 +#endif
  1.1101 +
  1.1102 +// Invoker<>
  1.1103 +//
  1.1104 +// See description at the top of the file.
  1.1105 +template <int NumBound, typename Storage, typename RunType>
  1.1106 +struct Invoker;
  1.1107 +
  1.1108 +// Arity 0 -> 0.
  1.1109 +template <typename StorageType, typename R>
  1.1110 +struct Invoker<0, StorageType, R()> {
  1.1111 +  typedef R(RunType)(BindStateBase*);
  1.1112 +
  1.1113 +  typedef R(UnboundRunType)();
  1.1114 +
  1.1115 +  static R Run(BindStateBase* base) {
  1.1116 +    StorageType* storage = static_cast<StorageType*>(base);
  1.1117 +
  1.1118 +    // Local references to make debugger stepping easier. If in a debugger,
  1.1119 +    // you really want to warp ahead and step through the
  1.1120 +    // InvokeHelper<>::MakeItSo() call below.
  1.1121 +
  1.1122 +    return InvokeHelper<StorageType::IsWeakCall::value, R,
  1.1123 +           typename StorageType::RunnableType,
  1.1124 +           void()>
  1.1125 +               ::MakeItSo(storage->runnable_);
  1.1126 +  }
  1.1127 +};
  1.1128 +
  1.1129 +// Arity 1 -> 1.
  1.1130 +template <typename StorageType, typename R,typename X1>
  1.1131 +struct Invoker<0, StorageType, R(X1)> {
  1.1132 +  typedef R(RunType)(BindStateBase*,
  1.1133 +      typename CallbackParamTraits<X1>::ForwardType);
  1.1134 +
  1.1135 +  typedef R(UnboundRunType)(X1);
  1.1136 +
  1.1137 +  static R Run(BindStateBase* base,
  1.1138 +      typename CallbackParamTraits<X1>::ForwardType x1) {
  1.1139 +    StorageType* storage = static_cast<StorageType*>(base);
  1.1140 +
  1.1141 +    // Local references to make debugger stepping easier. If in a debugger,
  1.1142 +    // you really want to warp ahead and step through the
  1.1143 +    // InvokeHelper<>::MakeItSo() call below.
  1.1144 +
  1.1145 +    return InvokeHelper<StorageType::IsWeakCall::value, R,
  1.1146 +           typename StorageType::RunnableType,
  1.1147 +           void(typename CallbackParamTraits<X1>::ForwardType x1)>
  1.1148 +               ::MakeItSo(storage->runnable_, CallbackForward(x1));
  1.1149 +  }
  1.1150 +};
  1.1151 +
  1.1152 +// Arity 1 -> 0.
  1.1153 +template <typename StorageType, typename R,typename X1>
  1.1154 +struct Invoker<1, StorageType, R(X1)> {
  1.1155 +  typedef R(RunType)(BindStateBase*);
  1.1156 +
  1.1157 +  typedef R(UnboundRunType)();
  1.1158 +
  1.1159 +  static R Run(BindStateBase* base) {
  1.1160 +    StorageType* storage = static_cast<StorageType*>(base);
  1.1161 +
  1.1162 +    // Local references to make debugger stepping easier. If in a debugger,
  1.1163 +    // you really want to warp ahead and step through the
  1.1164 +    // InvokeHelper<>::MakeItSo() call below.
  1.1165 +    typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
  1.1166 +
  1.1167 +    typename Bound1UnwrapTraits::ForwardType x1 =
  1.1168 +        Bound1UnwrapTraits::Unwrap(storage->p1_);
  1.1169 +    return InvokeHelper<StorageType::IsWeakCall::value, R,
  1.1170 +           typename StorageType::RunnableType,
  1.1171 +           void(typename Bound1UnwrapTraits::ForwardType)>
  1.1172 +               ::MakeItSo(storage->runnable_, CallbackForward(x1));
  1.1173 +  }
  1.1174 +};
  1.1175 +
  1.1176 +// Arity 2 -> 2.
  1.1177 +template <typename StorageType, typename R,typename X1, typename X2>
  1.1178 +struct Invoker<0, StorageType, R(X1, X2)> {
  1.1179 +  typedef R(RunType)(BindStateBase*,
  1.1180 +      typename CallbackParamTraits<X1>::ForwardType,
  1.1181 +      typename CallbackParamTraits<X2>::ForwardType);
  1.1182 +
  1.1183 +  typedef R(UnboundRunType)(X1, X2);
  1.1184 +
  1.1185 +  static R Run(BindStateBase* base,
  1.1186 +      typename CallbackParamTraits<X1>::ForwardType x1,
  1.1187 +      typename CallbackParamTraits<X2>::ForwardType x2) {
  1.1188 +    StorageType* storage = static_cast<StorageType*>(base);
  1.1189 +
  1.1190 +    // Local references to make debugger stepping easier. If in a debugger,
  1.1191 +    // you really want to warp ahead and step through the
  1.1192 +    // InvokeHelper<>::MakeItSo() call below.
  1.1193 +
  1.1194 +    return InvokeHelper<StorageType::IsWeakCall::value, R,
  1.1195 +           typename StorageType::RunnableType,
  1.1196 +           void(typename CallbackParamTraits<X1>::ForwardType x1,
  1.1197 +               typename CallbackParamTraits<X2>::ForwardType x2)>
  1.1198 +               ::MakeItSo(storage->runnable_, CallbackForward(x1),
  1.1199 +                   CallbackForward(x2));
  1.1200 +  }
  1.1201 +};
  1.1202 +
  1.1203 +// Arity 2 -> 1.
  1.1204 +template <typename StorageType, typename R,typename X1, typename X2>
  1.1205 +struct Invoker<1, StorageType, R(X1, X2)> {
  1.1206 +  typedef R(RunType)(BindStateBase*,
  1.1207 +      typename CallbackParamTraits<X2>::ForwardType);
  1.1208 +
  1.1209 +  typedef R(UnboundRunType)(X2);
  1.1210 +
  1.1211 +  static R Run(BindStateBase* base,
  1.1212 +      typename CallbackParamTraits<X2>::ForwardType x2) {
  1.1213 +    StorageType* storage = static_cast<StorageType*>(base);
  1.1214 +
  1.1215 +    // Local references to make debugger stepping easier. If in a debugger,
  1.1216 +    // you really want to warp ahead and step through the
  1.1217 +    // InvokeHelper<>::MakeItSo() call below.
  1.1218 +    typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
  1.1219 +
  1.1220 +    typename Bound1UnwrapTraits::ForwardType x1 =
  1.1221 +        Bound1UnwrapTraits::Unwrap(storage->p1_);
  1.1222 +    return InvokeHelper<StorageType::IsWeakCall::value, R,
  1.1223 +           typename StorageType::RunnableType,
  1.1224 +           void(typename Bound1UnwrapTraits::ForwardType,
  1.1225 +               typename CallbackParamTraits<X2>::ForwardType x2)>
  1.1226 +               ::MakeItSo(storage->runnable_, CallbackForward(x1),
  1.1227 +                   CallbackForward(x2));
  1.1228 +  }
  1.1229 +};
  1.1230 +
  1.1231 +// Arity 2 -> 0.
  1.1232 +template <typename StorageType, typename R,typename X1, typename X2>
  1.1233 +struct Invoker<2, StorageType, R(X1, X2)> {
  1.1234 +  typedef R(RunType)(BindStateBase*);
  1.1235 +
  1.1236 +  typedef R(UnboundRunType)();
  1.1237 +
  1.1238 +  static R Run(BindStateBase* base) {
  1.1239 +    StorageType* storage = static_cast<StorageType*>(base);
  1.1240 +
  1.1241 +    // Local references to make debugger stepping easier. If in a debugger,
  1.1242 +    // you really want to warp ahead and step through the
  1.1243 +    // InvokeHelper<>::MakeItSo() call below.
  1.1244 +    typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
  1.1245 +    typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
  1.1246 +
  1.1247 +    typename Bound1UnwrapTraits::ForwardType x1 =
  1.1248 +        Bound1UnwrapTraits::Unwrap(storage->p1_);
  1.1249 +    typename Bound2UnwrapTraits::ForwardType x2 =
  1.1250 +        Bound2UnwrapTraits::Unwrap(storage->p2_);
  1.1251 +    return InvokeHelper<StorageType::IsWeakCall::value, R,
  1.1252 +           typename StorageType::RunnableType,
  1.1253 +           void(typename Bound1UnwrapTraits::ForwardType,
  1.1254 +               typename Bound2UnwrapTraits::ForwardType)>
  1.1255 +               ::MakeItSo(storage->runnable_, CallbackForward(x1),
  1.1256 +                   CallbackForward(x2));
  1.1257 +  }
  1.1258 +};
  1.1259 +
  1.1260 +// Arity 3 -> 3.
  1.1261 +template <typename StorageType, typename R,typename X1, typename X2,
  1.1262 +    typename X3>
  1.1263 +struct Invoker<0, StorageType, R(X1, X2, X3)> {
  1.1264 +  typedef R(RunType)(BindStateBase*,
  1.1265 +      typename CallbackParamTraits<X1>::ForwardType,
  1.1266 +      typename CallbackParamTraits<X2>::ForwardType,
  1.1267 +      typename CallbackParamTraits<X3>::ForwardType);
  1.1268 +
  1.1269 +  typedef R(UnboundRunType)(X1, X2, X3);
  1.1270 +
  1.1271 +  static R Run(BindStateBase* base,
  1.1272 +      typename CallbackParamTraits<X1>::ForwardType x1,
  1.1273 +      typename CallbackParamTraits<X2>::ForwardType x2,
  1.1274 +      typename CallbackParamTraits<X3>::ForwardType x3) {
  1.1275 +    StorageType* storage = static_cast<StorageType*>(base);
  1.1276 +
  1.1277 +    // Local references to make debugger stepping easier. If in a debugger,
  1.1278 +    // you really want to warp ahead and step through the
  1.1279 +    // InvokeHelper<>::MakeItSo() call below.
  1.1280 +
  1.1281 +    return InvokeHelper<StorageType::IsWeakCall::value, R,
  1.1282 +           typename StorageType::RunnableType,
  1.1283 +           void(typename CallbackParamTraits<X1>::ForwardType x1,
  1.1284 +               typename CallbackParamTraits<X2>::ForwardType x2,
  1.1285 +               typename CallbackParamTraits<X3>::ForwardType x3)>
  1.1286 +               ::MakeItSo(storage->runnable_, CallbackForward(x1),
  1.1287 +                   CallbackForward(x2), CallbackForward(x3));
  1.1288 +  }
  1.1289 +};
  1.1290 +
  1.1291 +// Arity 3 -> 2.
  1.1292 +template <typename StorageType, typename R,typename X1, typename X2,
  1.1293 +    typename X3>
  1.1294 +struct Invoker<1, StorageType, R(X1, X2, X3)> {
  1.1295 +  typedef R(RunType)(BindStateBase*,
  1.1296 +      typename CallbackParamTraits<X2>::ForwardType,
  1.1297 +      typename CallbackParamTraits<X3>::ForwardType);
  1.1298 +
  1.1299 +  typedef R(UnboundRunType)(X2, X3);
  1.1300 +
  1.1301 +  static R Run(BindStateBase* base,
  1.1302 +      typename CallbackParamTraits<X2>::ForwardType x2,
  1.1303 +      typename CallbackParamTraits<X3>::ForwardType x3) {
  1.1304 +    StorageType* storage = static_cast<StorageType*>(base);
  1.1305 +
  1.1306 +    // Local references to make debugger stepping easier. If in a debugger,
  1.1307 +    // you really want to warp ahead and step through the
  1.1308 +    // InvokeHelper<>::MakeItSo() call below.
  1.1309 +    typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
  1.1310 +
  1.1311 +    typename Bound1UnwrapTraits::ForwardType x1 =
  1.1312 +        Bound1UnwrapTraits::Unwrap(storage->p1_);
  1.1313 +    return InvokeHelper<StorageType::IsWeakCall::value, R,
  1.1314 +           typename StorageType::RunnableType,
  1.1315 +           void(typename Bound1UnwrapTraits::ForwardType,
  1.1316 +               typename CallbackParamTraits<X2>::ForwardType x2,
  1.1317 +               typename CallbackParamTraits<X3>::ForwardType x3)>
  1.1318 +               ::MakeItSo(storage->runnable_, CallbackForward(x1),
  1.1319 +                   CallbackForward(x2), CallbackForward(x3));
  1.1320 +  }
  1.1321 +};
  1.1322 +
  1.1323 +// Arity 3 -> 1.
  1.1324 +template <typename StorageType, typename R,typename X1, typename X2,
  1.1325 +    typename X3>
  1.1326 +struct Invoker<2, StorageType, R(X1, X2, X3)> {
  1.1327 +  typedef R(RunType)(BindStateBase*,
  1.1328 +      typename CallbackParamTraits<X3>::ForwardType);
  1.1329 +
  1.1330 +  typedef R(UnboundRunType)(X3);
  1.1331 +
  1.1332 +  static R Run(BindStateBase* base,
  1.1333 +      typename CallbackParamTraits<X3>::ForwardType x3) {
  1.1334 +    StorageType* storage = static_cast<StorageType*>(base);
  1.1335 +
  1.1336 +    // Local references to make debugger stepping easier. If in a debugger,
  1.1337 +    // you really want to warp ahead and step through the
  1.1338 +    // InvokeHelper<>::MakeItSo() call below.
  1.1339 +    typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
  1.1340 +    typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
  1.1341 +
  1.1342 +    typename Bound1UnwrapTraits::ForwardType x1 =
  1.1343 +        Bound1UnwrapTraits::Unwrap(storage->p1_);
  1.1344 +    typename Bound2UnwrapTraits::ForwardType x2 =
  1.1345 +        Bound2UnwrapTraits::Unwrap(storage->p2_);
  1.1346 +    return InvokeHelper<StorageType::IsWeakCall::value, R,
  1.1347 +           typename StorageType::RunnableType,
  1.1348 +           void(typename Bound1UnwrapTraits::ForwardType,
  1.1349 +               typename Bound2UnwrapTraits::ForwardType,
  1.1350 +               typename CallbackParamTraits<X3>::ForwardType x3)>
  1.1351 +               ::MakeItSo(storage->runnable_, CallbackForward(x1),
  1.1352 +                   CallbackForward(x2), CallbackForward(x3));
  1.1353 +  }
  1.1354 +};
  1.1355 +
  1.1356 +// Arity 3 -> 0.
  1.1357 +template <typename StorageType, typename R,typename X1, typename X2,
  1.1358 +    typename X3>
  1.1359 +struct Invoker<3, StorageType, R(X1, X2, X3)> {
  1.1360 +  typedef R(RunType)(BindStateBase*);
  1.1361 +
  1.1362 +  typedef R(UnboundRunType)();
  1.1363 +
  1.1364 +  static R Run(BindStateBase* base) {
  1.1365 +    StorageType* storage = static_cast<StorageType*>(base);
  1.1366 +
  1.1367 +    // Local references to make debugger stepping easier. If in a debugger,
  1.1368 +    // you really want to warp ahead and step through the
  1.1369 +    // InvokeHelper<>::MakeItSo() call below.
  1.1370 +    typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
  1.1371 +    typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
  1.1372 +    typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits;
  1.1373 +
  1.1374 +    typename Bound1UnwrapTraits::ForwardType x1 =
  1.1375 +        Bound1UnwrapTraits::Unwrap(storage->p1_);
  1.1376 +    typename Bound2UnwrapTraits::ForwardType x2 =
  1.1377 +        Bound2UnwrapTraits::Unwrap(storage->p2_);
  1.1378 +    typename Bound3UnwrapTraits::ForwardType x3 =
  1.1379 +        Bound3UnwrapTraits::Unwrap(storage->p3_);
  1.1380 +    return InvokeHelper<StorageType::IsWeakCall::value, R,
  1.1381 +           typename StorageType::RunnableType,
  1.1382 +           void(typename Bound1UnwrapTraits::ForwardType,
  1.1383 +               typename Bound2UnwrapTraits::ForwardType,
  1.1384 +               typename Bound3UnwrapTraits::ForwardType)>
  1.1385 +               ::MakeItSo(storage->runnable_, CallbackForward(x1),
  1.1386 +                   CallbackForward(x2), CallbackForward(x3));
  1.1387 +  }
  1.1388 +};
  1.1389 +
  1.1390 +// Arity 4 -> 4.
  1.1391 +template <typename StorageType, typename R,typename X1, typename X2,
  1.1392 +    typename X3, typename X4>
  1.1393 +struct Invoker<0, StorageType, R(X1, X2, X3, X4)> {
  1.1394 +  typedef R(RunType)(BindStateBase*,
  1.1395 +      typename CallbackParamTraits<X1>::ForwardType,
  1.1396 +      typename CallbackParamTraits<X2>::ForwardType,
  1.1397 +      typename CallbackParamTraits<X3>::ForwardType,
  1.1398 +      typename CallbackParamTraits<X4>::ForwardType);
  1.1399 +
  1.1400 +  typedef R(UnboundRunType)(X1, X2, X3, X4);
  1.1401 +
  1.1402 +  static R Run(BindStateBase* base,
  1.1403 +      typename CallbackParamTraits<X1>::ForwardType x1,
  1.1404 +      typename CallbackParamTraits<X2>::ForwardType x2,
  1.1405 +      typename CallbackParamTraits<X3>::ForwardType x3,
  1.1406 +      typename CallbackParamTraits<X4>::ForwardType x4) {
  1.1407 +    StorageType* storage = static_cast<StorageType*>(base);
  1.1408 +
  1.1409 +    // Local references to make debugger stepping easier. If in a debugger,
  1.1410 +    // you really want to warp ahead and step through the
  1.1411 +    // InvokeHelper<>::MakeItSo() call below.
  1.1412 +
  1.1413 +    return InvokeHelper<StorageType::IsWeakCall::value, R,
  1.1414 +           typename StorageType::RunnableType,
  1.1415 +           void(typename CallbackParamTraits<X1>::ForwardType x1,
  1.1416 +               typename CallbackParamTraits<X2>::ForwardType x2,
  1.1417 +               typename CallbackParamTraits<X3>::ForwardType x3,
  1.1418 +               typename CallbackParamTraits<X4>::ForwardType x4)>
  1.1419 +               ::MakeItSo(storage->runnable_, CallbackForward(x1),
  1.1420 +                   CallbackForward(x2), CallbackForward(x3),
  1.1421 +                   CallbackForward(x4));
  1.1422 +  }
  1.1423 +};
  1.1424 +
  1.1425 +// Arity 4 -> 3.
  1.1426 +template <typename StorageType, typename R,typename X1, typename X2,
  1.1427 +    typename X3, typename X4>
  1.1428 +struct Invoker<1, StorageType, R(X1, X2, X3, X4)> {
  1.1429 +  typedef R(RunType)(BindStateBase*,
  1.1430 +      typename CallbackParamTraits<X2>::ForwardType,
  1.1431 +      typename CallbackParamTraits<X3>::ForwardType,
  1.1432 +      typename CallbackParamTraits<X4>::ForwardType);
  1.1433 +
  1.1434 +  typedef R(UnboundRunType)(X2, X3, X4);
  1.1435 +
  1.1436 +  static R Run(BindStateBase* base,
  1.1437 +      typename CallbackParamTraits<X2>::ForwardType x2,
  1.1438 +      typename CallbackParamTraits<X3>::ForwardType x3,
  1.1439 +      typename CallbackParamTraits<X4>::ForwardType x4) {
  1.1440 +    StorageType* storage = static_cast<StorageType*>(base);
  1.1441 +
  1.1442 +    // Local references to make debugger stepping easier. If in a debugger,
  1.1443 +    // you really want to warp ahead and step through the
  1.1444 +    // InvokeHelper<>::MakeItSo() call below.
  1.1445 +    typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
  1.1446 +
  1.1447 +    typename Bound1UnwrapTraits::ForwardType x1 =
  1.1448 +        Bound1UnwrapTraits::Unwrap(storage->p1_);
  1.1449 +    return InvokeHelper<StorageType::IsWeakCall::value, R,
  1.1450 +           typename StorageType::RunnableType,
  1.1451 +           void(typename Bound1UnwrapTraits::ForwardType,
  1.1452 +               typename CallbackParamTraits<X2>::ForwardType x2,
  1.1453 +               typename CallbackParamTraits<X3>::ForwardType x3,
  1.1454 +               typename CallbackParamTraits<X4>::ForwardType x4)>
  1.1455 +               ::MakeItSo(storage->runnable_, CallbackForward(x1),
  1.1456 +                   CallbackForward(x2), CallbackForward(x3),
  1.1457 +                   CallbackForward(x4));
  1.1458 +  }
  1.1459 +};
  1.1460 +
  1.1461 +// Arity 4 -> 2.
  1.1462 +template <typename StorageType, typename R,typename X1, typename X2,
  1.1463 +    typename X3, typename X4>
  1.1464 +struct Invoker<2, StorageType, R(X1, X2, X3, X4)> {
  1.1465 +  typedef R(RunType)(BindStateBase*,
  1.1466 +      typename CallbackParamTraits<X3>::ForwardType,
  1.1467 +      typename CallbackParamTraits<X4>::ForwardType);
  1.1468 +
  1.1469 +  typedef R(UnboundRunType)(X3, X4);
  1.1470 +
  1.1471 +  static R Run(BindStateBase* base,
  1.1472 +      typename CallbackParamTraits<X3>::ForwardType x3,
  1.1473 +      typename CallbackParamTraits<X4>::ForwardType x4) {
  1.1474 +    StorageType* storage = static_cast<StorageType*>(base);
  1.1475 +
  1.1476 +    // Local references to make debugger stepping easier. If in a debugger,
  1.1477 +    // you really want to warp ahead and step through the
  1.1478 +    // InvokeHelper<>::MakeItSo() call below.
  1.1479 +    typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
  1.1480 +    typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
  1.1481 +
  1.1482 +    typename Bound1UnwrapTraits::ForwardType x1 =
  1.1483 +        Bound1UnwrapTraits::Unwrap(storage->p1_);
  1.1484 +    typename Bound2UnwrapTraits::ForwardType x2 =
  1.1485 +        Bound2UnwrapTraits::Unwrap(storage->p2_);
  1.1486 +    return InvokeHelper<StorageType::IsWeakCall::value, R,
  1.1487 +           typename StorageType::RunnableType,
  1.1488 +           void(typename Bound1UnwrapTraits::ForwardType,
  1.1489 +               typename Bound2UnwrapTraits::ForwardType,
  1.1490 +               typename CallbackParamTraits<X3>::ForwardType x3,
  1.1491 +               typename CallbackParamTraits<X4>::ForwardType x4)>
  1.1492 +               ::MakeItSo(storage->runnable_, CallbackForward(x1),
  1.1493 +                   CallbackForward(x2), CallbackForward(x3),
  1.1494 +                   CallbackForward(x4));
  1.1495 +  }
  1.1496 +};
  1.1497 +
  1.1498 +// Arity 4 -> 1.
  1.1499 +template <typename StorageType, typename R,typename X1, typename X2,
  1.1500 +    typename X3, typename X4>
  1.1501 +struct Invoker<3, StorageType, R(X1, X2, X3, X4)> {
  1.1502 +  typedef R(RunType)(BindStateBase*,
  1.1503 +      typename CallbackParamTraits<X4>::ForwardType);
  1.1504 +
  1.1505 +  typedef R(UnboundRunType)(X4);
  1.1506 +
  1.1507 +  static R Run(BindStateBase* base,
  1.1508 +      typename CallbackParamTraits<X4>::ForwardType x4) {
  1.1509 +    StorageType* storage = static_cast<StorageType*>(base);
  1.1510 +
  1.1511 +    // Local references to make debugger stepping easier. If in a debugger,
  1.1512 +    // you really want to warp ahead and step through the
  1.1513 +    // InvokeHelper<>::MakeItSo() call below.
  1.1514 +    typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
  1.1515 +    typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
  1.1516 +    typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits;
  1.1517 +
  1.1518 +    typename Bound1UnwrapTraits::ForwardType x1 =
  1.1519 +        Bound1UnwrapTraits::Unwrap(storage->p1_);
  1.1520 +    typename Bound2UnwrapTraits::ForwardType x2 =
  1.1521 +        Bound2UnwrapTraits::Unwrap(storage->p2_);
  1.1522 +    typename Bound3UnwrapTraits::ForwardType x3 =
  1.1523 +        Bound3UnwrapTraits::Unwrap(storage->p3_);
  1.1524 +    return InvokeHelper<StorageType::IsWeakCall::value, R,
  1.1525 +           typename StorageType::RunnableType,
  1.1526 +           void(typename Bound1UnwrapTraits::ForwardType,
  1.1527 +               typename Bound2UnwrapTraits::ForwardType,
  1.1528 +               typename Bound3UnwrapTraits::ForwardType,
  1.1529 +               typename CallbackParamTraits<X4>::ForwardType x4)>
  1.1530 +               ::MakeItSo(storage->runnable_, CallbackForward(x1),
  1.1531 +                   CallbackForward(x2), CallbackForward(x3),
  1.1532 +                   CallbackForward(x4));
  1.1533 +  }
  1.1534 +};
  1.1535 +
  1.1536 +// Arity 4 -> 0.
  1.1537 +template <typename StorageType, typename R,typename X1, typename X2,
  1.1538 +    typename X3, typename X4>
  1.1539 +struct Invoker<4, StorageType, R(X1, X2, X3, X4)> {
  1.1540 +  typedef R(RunType)(BindStateBase*);
  1.1541 +
  1.1542 +  typedef R(UnboundRunType)();
  1.1543 +
  1.1544 +  static R Run(BindStateBase* base) {
  1.1545 +    StorageType* storage = static_cast<StorageType*>(base);
  1.1546 +
  1.1547 +    // Local references to make debugger stepping easier. If in a debugger,
  1.1548 +    // you really want to warp ahead and step through the
  1.1549 +    // InvokeHelper<>::MakeItSo() call below.
  1.1550 +    typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
  1.1551 +    typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
  1.1552 +    typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits;
  1.1553 +    typedef typename StorageType::Bound4UnwrapTraits Bound4UnwrapTraits;
  1.1554 +
  1.1555 +    typename Bound1UnwrapTraits::ForwardType x1 =
  1.1556 +        Bound1UnwrapTraits::Unwrap(storage->p1_);
  1.1557 +    typename Bound2UnwrapTraits::ForwardType x2 =
  1.1558 +        Bound2UnwrapTraits::Unwrap(storage->p2_);
  1.1559 +    typename Bound3UnwrapTraits::ForwardType x3 =
  1.1560 +        Bound3UnwrapTraits::Unwrap(storage->p3_);
  1.1561 +    typename Bound4UnwrapTraits::ForwardType x4 =
  1.1562 +        Bound4UnwrapTraits::Unwrap(storage->p4_);
  1.1563 +    return InvokeHelper<StorageType::IsWeakCall::value, R,
  1.1564 +           typename StorageType::RunnableType,
  1.1565 +           void(typename Bound1UnwrapTraits::ForwardType,
  1.1566 +               typename Bound2UnwrapTraits::ForwardType,
  1.1567 +               typename Bound3UnwrapTraits::ForwardType,
  1.1568 +               typename Bound4UnwrapTraits::ForwardType)>
  1.1569 +               ::MakeItSo(storage->runnable_, CallbackForward(x1),
  1.1570 +                   CallbackForward(x2), CallbackForward(x3),
  1.1571 +                   CallbackForward(x4));
  1.1572 +  }
  1.1573 +};
  1.1574 +
  1.1575 +// Arity 5 -> 5.
  1.1576 +template <typename StorageType, typename R,typename X1, typename X2,
  1.1577 +    typename X3, typename X4, typename X5>
  1.1578 +struct Invoker<0, StorageType, R(X1, X2, X3, X4, X5)> {
  1.1579 +  typedef R(RunType)(BindStateBase*,
  1.1580 +      typename CallbackParamTraits<X1>::ForwardType,
  1.1581 +      typename CallbackParamTraits<X2>::ForwardType,
  1.1582 +      typename CallbackParamTraits<X3>::ForwardType,
  1.1583 +      typename CallbackParamTraits<X4>::ForwardType,
  1.1584 +      typename CallbackParamTraits<X5>::ForwardType);
  1.1585 +
  1.1586 +  typedef R(UnboundRunType)(X1, X2, X3, X4, X5);
  1.1587 +
  1.1588 +  static R Run(BindStateBase* base,
  1.1589 +      typename CallbackParamTraits<X1>::ForwardType x1,
  1.1590 +      typename CallbackParamTraits<X2>::ForwardType x2,
  1.1591 +      typename CallbackParamTraits<X3>::ForwardType x3,
  1.1592 +      typename CallbackParamTraits<X4>::ForwardType x4,
  1.1593 +      typename CallbackParamTraits<X5>::ForwardType x5) {
  1.1594 +    StorageType* storage = static_cast<StorageType*>(base);
  1.1595 +
  1.1596 +    // Local references to make debugger stepping easier. If in a debugger,
  1.1597 +    // you really want to warp ahead and step through the
  1.1598 +    // InvokeHelper<>::MakeItSo() call below.
  1.1599 +
  1.1600 +    return InvokeHelper<StorageType::IsWeakCall::value, R,
  1.1601 +           typename StorageType::RunnableType,
  1.1602 +           void(typename CallbackParamTraits<X1>::ForwardType x1,
  1.1603 +               typename CallbackParamTraits<X2>::ForwardType x2,
  1.1604 +               typename CallbackParamTraits<X3>::ForwardType x3,
  1.1605 +               typename CallbackParamTraits<X4>::ForwardType x4,
  1.1606 +               typename CallbackParamTraits<X5>::ForwardType x5)>
  1.1607 +               ::MakeItSo(storage->runnable_, CallbackForward(x1),
  1.1608 +                   CallbackForward(x2), CallbackForward(x3),
  1.1609 +                   CallbackForward(x4), CallbackForward(x5));
  1.1610 +  }
  1.1611 +};
  1.1612 +
  1.1613 +// Arity 5 -> 4.
  1.1614 +template <typename StorageType, typename R,typename X1, typename X2,
  1.1615 +    typename X3, typename X4, typename X5>
  1.1616 +struct Invoker<1, StorageType, R(X1, X2, X3, X4, X5)> {
  1.1617 +  typedef R(RunType)(BindStateBase*,
  1.1618 +      typename CallbackParamTraits<X2>::ForwardType,
  1.1619 +      typename CallbackParamTraits<X3>::ForwardType,
  1.1620 +      typename CallbackParamTraits<X4>::ForwardType,
  1.1621 +      typename CallbackParamTraits<X5>::ForwardType);
  1.1622 +
  1.1623 +  typedef R(UnboundRunType)(X2, X3, X4, X5);
  1.1624 +
  1.1625 +  static R Run(BindStateBase* base,
  1.1626 +      typename CallbackParamTraits<X2>::ForwardType x2,
  1.1627 +      typename CallbackParamTraits<X3>::ForwardType x3,
  1.1628 +      typename CallbackParamTraits<X4>::ForwardType x4,
  1.1629 +      typename CallbackParamTraits<X5>::ForwardType x5) {
  1.1630 +    StorageType* storage = static_cast<StorageType*>(base);
  1.1631 +
  1.1632 +    // Local references to make debugger stepping easier. If in a debugger,
  1.1633 +    // you really want to warp ahead and step through the
  1.1634 +    // InvokeHelper<>::MakeItSo() call below.
  1.1635 +    typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
  1.1636 +
  1.1637 +    typename Bound1UnwrapTraits::ForwardType x1 =
  1.1638 +        Bound1UnwrapTraits::Unwrap(storage->p1_);
  1.1639 +    return InvokeHelper<StorageType::IsWeakCall::value, R,
  1.1640 +           typename StorageType::RunnableType,
  1.1641 +           void(typename Bound1UnwrapTraits::ForwardType,
  1.1642 +               typename CallbackParamTraits<X2>::ForwardType x2,
  1.1643 +               typename CallbackParamTraits<X3>::ForwardType x3,
  1.1644 +               typename CallbackParamTraits<X4>::ForwardType x4,
  1.1645 +               typename CallbackParamTraits<X5>::ForwardType x5)>
  1.1646 +               ::MakeItSo(storage->runnable_, CallbackForward(x1),
  1.1647 +                   CallbackForward(x2), CallbackForward(x3),
  1.1648 +                   CallbackForward(x4), CallbackForward(x5));
  1.1649 +  }
  1.1650 +};
  1.1651 +
  1.1652 +// Arity 5 -> 3.
  1.1653 +template <typename StorageType, typename R,typename X1, typename X2,
  1.1654 +    typename X3, typename X4, typename X5>
  1.1655 +struct Invoker<2, StorageType, R(X1, X2, X3, X4, X5)> {
  1.1656 +  typedef R(RunType)(BindStateBase*,
  1.1657 +      typename CallbackParamTraits<X3>::ForwardType,
  1.1658 +      typename CallbackParamTraits<X4>::ForwardType,
  1.1659 +      typename CallbackParamTraits<X5>::ForwardType);
  1.1660 +
  1.1661 +  typedef R(UnboundRunType)(X3, X4, X5);
  1.1662 +
  1.1663 +  static R Run(BindStateBase* base,
  1.1664 +      typename CallbackParamTraits<X3>::ForwardType x3,
  1.1665 +      typename CallbackParamTraits<X4>::ForwardType x4,
  1.1666 +      typename CallbackParamTraits<X5>::ForwardType x5) {
  1.1667 +    StorageType* storage = static_cast<StorageType*>(base);
  1.1668 +
  1.1669 +    // Local references to make debugger stepping easier. If in a debugger,
  1.1670 +    // you really want to warp ahead and step through the
  1.1671 +    // InvokeHelper<>::MakeItSo() call below.
  1.1672 +    typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
  1.1673 +    typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
  1.1674 +
  1.1675 +    typename Bound1UnwrapTraits::ForwardType x1 =
  1.1676 +        Bound1UnwrapTraits::Unwrap(storage->p1_);
  1.1677 +    typename Bound2UnwrapTraits::ForwardType x2 =
  1.1678 +        Bound2UnwrapTraits::Unwrap(storage->p2_);
  1.1679 +    return InvokeHelper<StorageType::IsWeakCall::value, R,
  1.1680 +           typename StorageType::RunnableType,
  1.1681 +           void(typename Bound1UnwrapTraits::ForwardType,
  1.1682 +               typename Bound2UnwrapTraits::ForwardType,
  1.1683 +               typename CallbackParamTraits<X3>::ForwardType x3,
  1.1684 +               typename CallbackParamTraits<X4>::ForwardType x4,
  1.1685 +               typename CallbackParamTraits<X5>::ForwardType x5)>
  1.1686 +               ::MakeItSo(storage->runnable_, CallbackForward(x1),
  1.1687 +                   CallbackForward(x2), CallbackForward(x3),
  1.1688 +                   CallbackForward(x4), CallbackForward(x5));
  1.1689 +  }
  1.1690 +};
  1.1691 +
  1.1692 +// Arity 5 -> 2.
  1.1693 +template <typename StorageType, typename R,typename X1, typename X2,
  1.1694 +    typename X3, typename X4, typename X5>
  1.1695 +struct Invoker<3, StorageType, R(X1, X2, X3, X4, X5)> {
  1.1696 +  typedef R(RunType)(BindStateBase*,
  1.1697 +      typename CallbackParamTraits<X4>::ForwardType,
  1.1698 +      typename CallbackParamTraits<X5>::ForwardType);
  1.1699 +
  1.1700 +  typedef R(UnboundRunType)(X4, X5);
  1.1701 +
  1.1702 +  static R Run(BindStateBase* base,
  1.1703 +      typename CallbackParamTraits<X4>::ForwardType x4,
  1.1704 +      typename CallbackParamTraits<X5>::ForwardType x5) {
  1.1705 +    StorageType* storage = static_cast<StorageType*>(base);
  1.1706 +
  1.1707 +    // Local references to make debugger stepping easier. If in a debugger,
  1.1708 +    // you really want to warp ahead and step through the
  1.1709 +    // InvokeHelper<>::MakeItSo() call below.
  1.1710 +    typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
  1.1711 +    typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
  1.1712 +    typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits;
  1.1713 +
  1.1714 +    typename Bound1UnwrapTraits::ForwardType x1 =
  1.1715 +        Bound1UnwrapTraits::Unwrap(storage->p1_);
  1.1716 +    typename Bound2UnwrapTraits::ForwardType x2 =
  1.1717 +        Bound2UnwrapTraits::Unwrap(storage->p2_);
  1.1718 +    typename Bound3UnwrapTraits::ForwardType x3 =
  1.1719 +        Bound3UnwrapTraits::Unwrap(storage->p3_);
  1.1720 +    return InvokeHelper<StorageType::IsWeakCall::value, R,
  1.1721 +           typename StorageType::RunnableType,
  1.1722 +           void(typename Bound1UnwrapTraits::ForwardType,
  1.1723 +               typename Bound2UnwrapTraits::ForwardType,
  1.1724 +               typename Bound3UnwrapTraits::ForwardType,
  1.1725 +               typename CallbackParamTraits<X4>::ForwardType x4,
  1.1726 +               typename CallbackParamTraits<X5>::ForwardType x5)>
  1.1727 +               ::MakeItSo(storage->runnable_, CallbackForward(x1),
  1.1728 +                   CallbackForward(x2), CallbackForward(x3),
  1.1729 +                   CallbackForward(x4), CallbackForward(x5));
  1.1730 +  }
  1.1731 +};
  1.1732 +
  1.1733 +// Arity 5 -> 1.
  1.1734 +template <typename StorageType, typename R,typename X1, typename X2,
  1.1735 +    typename X3, typename X4, typename X5>
  1.1736 +struct Invoker<4, StorageType, R(X1, X2, X3, X4, X5)> {
  1.1737 +  typedef R(RunType)(BindStateBase*,
  1.1738 +      typename CallbackParamTraits<X5>::ForwardType);
  1.1739 +
  1.1740 +  typedef R(UnboundRunType)(X5);
  1.1741 +
  1.1742 +  static R Run(BindStateBase* base,
  1.1743 +      typename CallbackParamTraits<X5>::ForwardType x5) {
  1.1744 +    StorageType* storage = static_cast<StorageType*>(base);
  1.1745 +
  1.1746 +    // Local references to make debugger stepping easier. If in a debugger,
  1.1747 +    // you really want to warp ahead and step through the
  1.1748 +    // InvokeHelper<>::MakeItSo() call below.
  1.1749 +    typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
  1.1750 +    typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
  1.1751 +    typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits;
  1.1752 +    typedef typename StorageType::Bound4UnwrapTraits Bound4UnwrapTraits;
  1.1753 +
  1.1754 +    typename Bound1UnwrapTraits::ForwardType x1 =
  1.1755 +        Bound1UnwrapTraits::Unwrap(storage->p1_);
  1.1756 +    typename Bound2UnwrapTraits::ForwardType x2 =
  1.1757 +        Bound2UnwrapTraits::Unwrap(storage->p2_);
  1.1758 +    typename Bound3UnwrapTraits::ForwardType x3 =
  1.1759 +        Bound3UnwrapTraits::Unwrap(storage->p3_);
  1.1760 +    typename Bound4UnwrapTraits::ForwardType x4 =
  1.1761 +        Bound4UnwrapTraits::Unwrap(storage->p4_);
  1.1762 +    return InvokeHelper<StorageType::IsWeakCall::value, R,
  1.1763 +           typename StorageType::RunnableType,
  1.1764 +           void(typename Bound1UnwrapTraits::ForwardType,
  1.1765 +               typename Bound2UnwrapTraits::ForwardType,
  1.1766 +               typename Bound3UnwrapTraits::ForwardType,
  1.1767 +               typename Bound4UnwrapTraits::ForwardType,
  1.1768 +               typename CallbackParamTraits<X5>::ForwardType x5)>
  1.1769 +               ::MakeItSo(storage->runnable_, CallbackForward(x1),
  1.1770 +                   CallbackForward(x2), CallbackForward(x3),
  1.1771 +                   CallbackForward(x4), CallbackForward(x5));
  1.1772 +  }
  1.1773 +};
  1.1774 +
  1.1775 +// Arity 5 -> 0.
  1.1776 +template <typename StorageType, typename R,typename X1, typename X2,
  1.1777 +    typename X3, typename X4, typename X5>
  1.1778 +struct Invoker<5, StorageType, R(X1, X2, X3, X4, X5)> {
  1.1779 +  typedef R(RunType)(BindStateBase*);
  1.1780 +
  1.1781 +  typedef R(UnboundRunType)();
  1.1782 +
  1.1783 +  static R Run(BindStateBase* base) {
  1.1784 +    StorageType* storage = static_cast<StorageType*>(base);
  1.1785 +
  1.1786 +    // Local references to make debugger stepping easier. If in a debugger,
  1.1787 +    // you really want to warp ahead and step through the
  1.1788 +    // InvokeHelper<>::MakeItSo() call below.
  1.1789 +    typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
  1.1790 +    typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
  1.1791 +    typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits;
  1.1792 +    typedef typename StorageType::Bound4UnwrapTraits Bound4UnwrapTraits;
  1.1793 +    typedef typename StorageType::Bound5UnwrapTraits Bound5UnwrapTraits;
  1.1794 +
  1.1795 +    typename Bound1UnwrapTraits::ForwardType x1 =
  1.1796 +        Bound1UnwrapTraits::Unwrap(storage->p1_);
  1.1797 +    typename Bound2UnwrapTraits::ForwardType x2 =
  1.1798 +        Bound2UnwrapTraits::Unwrap(storage->p2_);
  1.1799 +    typename Bound3UnwrapTraits::ForwardType x3 =
  1.1800 +        Bound3UnwrapTraits::Unwrap(storage->p3_);
  1.1801 +    typename Bound4UnwrapTraits::ForwardType x4 =
  1.1802 +        Bound4UnwrapTraits::Unwrap(storage->p4_);
  1.1803 +    typename Bound5UnwrapTraits::ForwardType x5 =
  1.1804 +        Bound5UnwrapTraits::Unwrap(storage->p5_);
  1.1805 +    return InvokeHelper<StorageType::IsWeakCall::value, R,
  1.1806 +           typename StorageType::RunnableType,
  1.1807 +           void(typename Bound1UnwrapTraits::ForwardType,
  1.1808 +               typename Bound2UnwrapTraits::ForwardType,
  1.1809 +               typename Bound3UnwrapTraits::ForwardType,
  1.1810 +               typename Bound4UnwrapTraits::ForwardType,
  1.1811 +               typename Bound5UnwrapTraits::ForwardType)>
  1.1812 +               ::MakeItSo(storage->runnable_, CallbackForward(x1),
  1.1813 +                   CallbackForward(x2), CallbackForward(x3),
  1.1814 +                   CallbackForward(x4), CallbackForward(x5));
  1.1815 +  }
  1.1816 +};
  1.1817 +
  1.1818 +// Arity 6 -> 6.
  1.1819 +template <typename StorageType, typename R,typename X1, typename X2,
  1.1820 +    typename X3, typename X4, typename X5, typename X6>
  1.1821 +struct Invoker<0, StorageType, R(X1, X2, X3, X4, X5, X6)> {
  1.1822 +  typedef R(RunType)(BindStateBase*,
  1.1823 +      typename CallbackParamTraits<X1>::ForwardType,
  1.1824 +      typename CallbackParamTraits<X2>::ForwardType,
  1.1825 +      typename CallbackParamTraits<X3>::ForwardType,
  1.1826 +      typename CallbackParamTraits<X4>::ForwardType,
  1.1827 +      typename CallbackParamTraits<X5>::ForwardType,
  1.1828 +      typename CallbackParamTraits<X6>::ForwardType);
  1.1829 +
  1.1830 +  typedef R(UnboundRunType)(X1, X2, X3, X4, X5, X6);
  1.1831 +
  1.1832 +  static R Run(BindStateBase* base,
  1.1833 +      typename CallbackParamTraits<X1>::ForwardType x1,
  1.1834 +      typename CallbackParamTraits<X2>::ForwardType x2,
  1.1835 +      typename CallbackParamTraits<X3>::ForwardType x3,
  1.1836 +      typename CallbackParamTraits<X4>::ForwardType x4,
  1.1837 +      typename CallbackParamTraits<X5>::ForwardType x5,
  1.1838 +      typename CallbackParamTraits<X6>::ForwardType x6) {
  1.1839 +    StorageType* storage = static_cast<StorageType*>(base);
  1.1840 +
  1.1841 +    // Local references to make debugger stepping easier. If in a debugger,
  1.1842 +    // you really want to warp ahead and step through the
  1.1843 +    // InvokeHelper<>::MakeItSo() call below.
  1.1844 +
  1.1845 +    return InvokeHelper<StorageType::IsWeakCall::value, R,
  1.1846 +           typename StorageType::RunnableType,
  1.1847 +           void(typename CallbackParamTraits<X1>::ForwardType x1,
  1.1848 +               typename CallbackParamTraits<X2>::ForwardType x2,
  1.1849 +               typename CallbackParamTraits<X3>::ForwardType x3,
  1.1850 +               typename CallbackParamTraits<X4>::ForwardType x4,
  1.1851 +               typename CallbackParamTraits<X5>::ForwardType x5,
  1.1852 +               typename CallbackParamTraits<X6>::ForwardType x6)>
  1.1853 +               ::MakeItSo(storage->runnable_, CallbackForward(x1),
  1.1854 +                   CallbackForward(x2), CallbackForward(x3),
  1.1855 +                   CallbackForward(x4), CallbackForward(x5),
  1.1856 +                   CallbackForward(x6));
  1.1857 +  }
  1.1858 +};
  1.1859 +
  1.1860 +// Arity 6 -> 5.
  1.1861 +template <typename StorageType, typename R,typename X1, typename X2,
  1.1862 +    typename X3, typename X4, typename X5, typename X6>
  1.1863 +struct Invoker<1, StorageType, R(X1, X2, X3, X4, X5, X6)> {
  1.1864 +  typedef R(RunType)(BindStateBase*,
  1.1865 +      typename CallbackParamTraits<X2>::ForwardType,
  1.1866 +      typename CallbackParamTraits<X3>::ForwardType,
  1.1867 +      typename CallbackParamTraits<X4>::ForwardType,
  1.1868 +      typename CallbackParamTraits<X5>::ForwardType,
  1.1869 +      typename CallbackParamTraits<X6>::ForwardType);
  1.1870 +
  1.1871 +  typedef R(UnboundRunType)(X2, X3, X4, X5, X6);
  1.1872 +
  1.1873 +  static R Run(BindStateBase* base,
  1.1874 +      typename CallbackParamTraits<X2>::ForwardType x2,
  1.1875 +      typename CallbackParamTraits<X3>::ForwardType x3,
  1.1876 +      typename CallbackParamTraits<X4>::ForwardType x4,
  1.1877 +      typename CallbackParamTraits<X5>::ForwardType x5,
  1.1878 +      typename CallbackParamTraits<X6>::ForwardType x6) {
  1.1879 +    StorageType* storage = static_cast<StorageType*>(base);
  1.1880 +
  1.1881 +    // Local references to make debugger stepping easier. If in a debugger,
  1.1882 +    // you really want to warp ahead and step through the
  1.1883 +    // InvokeHelper<>::MakeItSo() call below.
  1.1884 +    typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
  1.1885 +
  1.1886 +    typename Bound1UnwrapTraits::ForwardType x1 =
  1.1887 +        Bound1UnwrapTraits::Unwrap(storage->p1_);
  1.1888 +    return InvokeHelper<StorageType::IsWeakCall::value, R,
  1.1889 +           typename StorageType::RunnableType,
  1.1890 +           void(typename Bound1UnwrapTraits::ForwardType,
  1.1891 +               typename CallbackParamTraits<X2>::ForwardType x2,
  1.1892 +               typename CallbackParamTraits<X3>::ForwardType x3,
  1.1893 +               typename CallbackParamTraits<X4>::ForwardType x4,
  1.1894 +               typename CallbackParamTraits<X5>::ForwardType x5,
  1.1895 +               typename CallbackParamTraits<X6>::ForwardType x6)>
  1.1896 +               ::MakeItSo(storage->runnable_, CallbackForward(x1),
  1.1897 +                   CallbackForward(x2), CallbackForward(x3),
  1.1898 +                   CallbackForward(x4), CallbackForward(x5),
  1.1899 +                   CallbackForward(x6));
  1.1900 +  }
  1.1901 +};
  1.1902 +
  1.1903 +// Arity 6 -> 4.
  1.1904 +template <typename StorageType, typename R,typename X1, typename X2,
  1.1905 +    typename X3, typename X4, typename X5, typename X6>
  1.1906 +struct Invoker<2, StorageType, R(X1, X2, X3, X4, X5, X6)> {
  1.1907 +  typedef R(RunType)(BindStateBase*,
  1.1908 +      typename CallbackParamTraits<X3>::ForwardType,
  1.1909 +      typename CallbackParamTraits<X4>::ForwardType,
  1.1910 +      typename CallbackParamTraits<X5>::ForwardType,
  1.1911 +      typename CallbackParamTraits<X6>::ForwardType);
  1.1912 +
  1.1913 +  typedef R(UnboundRunType)(X3, X4, X5, X6);
  1.1914 +
  1.1915 +  static R Run(BindStateBase* base,
  1.1916 +      typename CallbackParamTraits<X3>::ForwardType x3,
  1.1917 +      typename CallbackParamTraits<X4>::ForwardType x4,
  1.1918 +      typename CallbackParamTraits<X5>::ForwardType x5,
  1.1919 +      typename CallbackParamTraits<X6>::ForwardType x6) {
  1.1920 +    StorageType* storage = static_cast<StorageType*>(base);
  1.1921 +
  1.1922 +    // Local references to make debugger stepping easier. If in a debugger,
  1.1923 +    // you really want to warp ahead and step through the
  1.1924 +    // InvokeHelper<>::MakeItSo() call below.
  1.1925 +    typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
  1.1926 +    typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
  1.1927 +
  1.1928 +    typename Bound1UnwrapTraits::ForwardType x1 =
  1.1929 +        Bound1UnwrapTraits::Unwrap(storage->p1_);
  1.1930 +    typename Bound2UnwrapTraits::ForwardType x2 =
  1.1931 +        Bound2UnwrapTraits::Unwrap(storage->p2_);
  1.1932 +    return InvokeHelper<StorageType::IsWeakCall::value, R,
  1.1933 +           typename StorageType::RunnableType,
  1.1934 +           void(typename Bound1UnwrapTraits::ForwardType,
  1.1935 +               typename Bound2UnwrapTraits::ForwardType,
  1.1936 +               typename CallbackParamTraits<X3>::ForwardType x3,
  1.1937 +               typename CallbackParamTraits<X4>::ForwardType x4,
  1.1938 +               typename CallbackParamTraits<X5>::ForwardType x5,
  1.1939 +               typename CallbackParamTraits<X6>::ForwardType x6)>
  1.1940 +               ::MakeItSo(storage->runnable_, CallbackForward(x1),
  1.1941 +                   CallbackForward(x2), CallbackForward(x3),
  1.1942 +                   CallbackForward(x4), CallbackForward(x5),
  1.1943 +                   CallbackForward(x6));
  1.1944 +  }
  1.1945 +};
  1.1946 +
  1.1947 +// Arity 6 -> 3.
  1.1948 +template <typename StorageType, typename R,typename X1, typename X2,
  1.1949 +    typename X3, typename X4, typename X5, typename X6>
  1.1950 +struct Invoker<3, StorageType, R(X1, X2, X3, X4, X5, X6)> {
  1.1951 +  typedef R(RunType)(BindStateBase*,
  1.1952 +      typename CallbackParamTraits<X4>::ForwardType,
  1.1953 +      typename CallbackParamTraits<X5>::ForwardType,
  1.1954 +      typename CallbackParamTraits<X6>::ForwardType);
  1.1955 +
  1.1956 +  typedef R(UnboundRunType)(X4, X5, X6);
  1.1957 +
  1.1958 +  static R Run(BindStateBase* base,
  1.1959 +      typename CallbackParamTraits<X4>::ForwardType x4,
  1.1960 +      typename CallbackParamTraits<X5>::ForwardType x5,
  1.1961 +      typename CallbackParamTraits<X6>::ForwardType x6) {
  1.1962 +    StorageType* storage = static_cast<StorageType*>(base);
  1.1963 +
  1.1964 +    // Local references to make debugger stepping easier. If in a debugger,
  1.1965 +    // you really want to warp ahead and step through the
  1.1966 +    // InvokeHelper<>::MakeItSo() call below.
  1.1967 +    typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
  1.1968 +    typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
  1.1969 +    typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits;
  1.1970 +
  1.1971 +    typename Bound1UnwrapTraits::ForwardType x1 =
  1.1972 +        Bound1UnwrapTraits::Unwrap(storage->p1_);
  1.1973 +    typename Bound2UnwrapTraits::ForwardType x2 =
  1.1974 +        Bound2UnwrapTraits::Unwrap(storage->p2_);
  1.1975 +    typename Bound3UnwrapTraits::ForwardType x3 =
  1.1976 +        Bound3UnwrapTraits::Unwrap(storage->p3_);
  1.1977 +    return InvokeHelper<StorageType::IsWeakCall::value, R,
  1.1978 +           typename StorageType::RunnableType,
  1.1979 +           void(typename Bound1UnwrapTraits::ForwardType,
  1.1980 +               typename Bound2UnwrapTraits::ForwardType,
  1.1981 +               typename Bound3UnwrapTraits::ForwardType,
  1.1982 +               typename CallbackParamTraits<X4>::ForwardType x4,
  1.1983 +               typename CallbackParamTraits<X5>::ForwardType x5,
  1.1984 +               typename CallbackParamTraits<X6>::ForwardType x6)>
  1.1985 +               ::MakeItSo(storage->runnable_, CallbackForward(x1),
  1.1986 +                   CallbackForward(x2), CallbackForward(x3),
  1.1987 +                   CallbackForward(x4), CallbackForward(x5),
  1.1988 +                   CallbackForward(x6));
  1.1989 +  }
  1.1990 +};
  1.1991 +
  1.1992 +// Arity 6 -> 2.
  1.1993 +template <typename StorageType, typename R,typename X1, typename X2,
  1.1994 +    typename X3, typename X4, typename X5, typename X6>
  1.1995 +struct Invoker<4, StorageType, R(X1, X2, X3, X4, X5, X6)> {
  1.1996 +  typedef R(RunType)(BindStateBase*,
  1.1997 +      typename CallbackParamTraits<X5>::ForwardType,
  1.1998 +      typename CallbackParamTraits<X6>::ForwardType);
  1.1999 +
  1.2000 +  typedef R(UnboundRunType)(X5, X6);
  1.2001 +
  1.2002 +  static R Run(BindStateBase* base,
  1.2003 +      typename CallbackParamTraits<X5>::ForwardType x5,
  1.2004 +      typename CallbackParamTraits<X6>::ForwardType x6) {
  1.2005 +    StorageType* storage = static_cast<StorageType*>(base);
  1.2006 +
  1.2007 +    // Local references to make debugger stepping easier. If in a debugger,
  1.2008 +    // you really want to warp ahead and step through the
  1.2009 +    // InvokeHelper<>::MakeItSo() call below.
  1.2010 +    typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
  1.2011 +    typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
  1.2012 +    typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits;
  1.2013 +    typedef typename StorageType::Bound4UnwrapTraits Bound4UnwrapTraits;
  1.2014 +
  1.2015 +    typename Bound1UnwrapTraits::ForwardType x1 =
  1.2016 +        Bound1UnwrapTraits::Unwrap(storage->p1_);
  1.2017 +    typename Bound2UnwrapTraits::ForwardType x2 =
  1.2018 +        Bound2UnwrapTraits::Unwrap(storage->p2_);
  1.2019 +    typename Bound3UnwrapTraits::ForwardType x3 =
  1.2020 +        Bound3UnwrapTraits::Unwrap(storage->p3_);
  1.2021 +    typename Bound4UnwrapTraits::ForwardType x4 =
  1.2022 +        Bound4UnwrapTraits::Unwrap(storage->p4_);
  1.2023 +    return InvokeHelper<StorageType::IsWeakCall::value, R,
  1.2024 +           typename StorageType::RunnableType,
  1.2025 +           void(typename Bound1UnwrapTraits::ForwardType,
  1.2026 +               typename Bound2UnwrapTraits::ForwardType,
  1.2027 +               typename Bound3UnwrapTraits::ForwardType,
  1.2028 +               typename Bound4UnwrapTraits::ForwardType,
  1.2029 +               typename CallbackParamTraits<X5>::ForwardType x5,
  1.2030 +               typename CallbackParamTraits<X6>::ForwardType x6)>
  1.2031 +               ::MakeItSo(storage->runnable_, CallbackForward(x1),
  1.2032 +                   CallbackForward(x2), CallbackForward(x3),
  1.2033 +                   CallbackForward(x4), CallbackForward(x5),
  1.2034 +                   CallbackForward(x6));
  1.2035 +  }
  1.2036 +};
  1.2037 +
  1.2038 +// Arity 6 -> 1.
  1.2039 +template <typename StorageType, typename R,typename X1, typename X2,
  1.2040 +    typename X3, typename X4, typename X5, typename X6>
  1.2041 +struct Invoker<5, StorageType, R(X1, X2, X3, X4, X5, X6)> {
  1.2042 +  typedef R(RunType)(BindStateBase*,
  1.2043 +      typename CallbackParamTraits<X6>::ForwardType);
  1.2044 +
  1.2045 +  typedef R(UnboundRunType)(X6);
  1.2046 +
  1.2047 +  static R Run(BindStateBase* base,
  1.2048 +      typename CallbackParamTraits<X6>::ForwardType x6) {
  1.2049 +    StorageType* storage = static_cast<StorageType*>(base);
  1.2050 +
  1.2051 +    // Local references to make debugger stepping easier. If in a debugger,
  1.2052 +    // you really want to warp ahead and step through the
  1.2053 +    // InvokeHelper<>::MakeItSo() call below.
  1.2054 +    typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
  1.2055 +    typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
  1.2056 +    typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits;
  1.2057 +    typedef typename StorageType::Bound4UnwrapTraits Bound4UnwrapTraits;
  1.2058 +    typedef typename StorageType::Bound5UnwrapTraits Bound5UnwrapTraits;
  1.2059 +
  1.2060 +    typename Bound1UnwrapTraits::ForwardType x1 =
  1.2061 +        Bound1UnwrapTraits::Unwrap(storage->p1_);
  1.2062 +    typename Bound2UnwrapTraits::ForwardType x2 =
  1.2063 +        Bound2UnwrapTraits::Unwrap(storage->p2_);
  1.2064 +    typename Bound3UnwrapTraits::ForwardType x3 =
  1.2065 +        Bound3UnwrapTraits::Unwrap(storage->p3_);
  1.2066 +    typename Bound4UnwrapTraits::ForwardType x4 =
  1.2067 +        Bound4UnwrapTraits::Unwrap(storage->p4_);
  1.2068 +    typename Bound5UnwrapTraits::ForwardType x5 =
  1.2069 +        Bound5UnwrapTraits::Unwrap(storage->p5_);
  1.2070 +    return InvokeHelper<StorageType::IsWeakCall::value, R,
  1.2071 +           typename StorageType::RunnableType,
  1.2072 +           void(typename Bound1UnwrapTraits::ForwardType,
  1.2073 +               typename Bound2UnwrapTraits::ForwardType,
  1.2074 +               typename Bound3UnwrapTraits::ForwardType,
  1.2075 +               typename Bound4UnwrapTraits::ForwardType,
  1.2076 +               typename Bound5UnwrapTraits::ForwardType,
  1.2077 +               typename CallbackParamTraits<X6>::ForwardType x6)>
  1.2078 +               ::MakeItSo(storage->runnable_, CallbackForward(x1),
  1.2079 +                   CallbackForward(x2), CallbackForward(x3),
  1.2080 +                   CallbackForward(x4), CallbackForward(x5),
  1.2081 +                   CallbackForward(x6));
  1.2082 +  }
  1.2083 +};
  1.2084 +
  1.2085 +// Arity 6 -> 0.
  1.2086 +template <typename StorageType, typename R,typename X1, typename X2,
  1.2087 +    typename X3, typename X4, typename X5, typename X6>
  1.2088 +struct Invoker<6, StorageType, R(X1, X2, X3, X4, X5, X6)> {
  1.2089 +  typedef R(RunType)(BindStateBase*);
  1.2090 +
  1.2091 +  typedef R(UnboundRunType)();
  1.2092 +
  1.2093 +  static R Run(BindStateBase* base) {
  1.2094 +    StorageType* storage = static_cast<StorageType*>(base);
  1.2095 +
  1.2096 +    // Local references to make debugger stepping easier. If in a debugger,
  1.2097 +    // you really want to warp ahead and step through the
  1.2098 +    // InvokeHelper<>::MakeItSo() call below.
  1.2099 +    typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
  1.2100 +    typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
  1.2101 +    typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits;
  1.2102 +    typedef typename StorageType::Bound4UnwrapTraits Bound4UnwrapTraits;
  1.2103 +    typedef typename StorageType::Bound5UnwrapTraits Bound5UnwrapTraits;
  1.2104 +    typedef typename StorageType::Bound6UnwrapTraits Bound6UnwrapTraits;
  1.2105 +
  1.2106 +    typename Bound1UnwrapTraits::ForwardType x1 =
  1.2107 +        Bound1UnwrapTraits::Unwrap(storage->p1_);
  1.2108 +    typename Bound2UnwrapTraits::ForwardType x2 =
  1.2109 +        Bound2UnwrapTraits::Unwrap(storage->p2_);
  1.2110 +    typename Bound3UnwrapTraits::ForwardType x3 =
  1.2111 +        Bound3UnwrapTraits::Unwrap(storage->p3_);
  1.2112 +    typename Bound4UnwrapTraits::ForwardType x4 =
  1.2113 +        Bound4UnwrapTraits::Unwrap(storage->p4_);
  1.2114 +    typename Bound5UnwrapTraits::ForwardType x5 =
  1.2115 +        Bound5UnwrapTraits::Unwrap(storage->p5_);
  1.2116 +    typename Bound6UnwrapTraits::ForwardType x6 =
  1.2117 +        Bound6UnwrapTraits::Unwrap(storage->p6_);
  1.2118 +    return InvokeHelper<StorageType::IsWeakCall::value, R,
  1.2119 +           typename StorageType::RunnableType,
  1.2120 +           void(typename Bound1UnwrapTraits::ForwardType,
  1.2121 +               typename Bound2UnwrapTraits::ForwardType,
  1.2122 +               typename Bound3UnwrapTraits::ForwardType,
  1.2123 +               typename Bound4UnwrapTraits::ForwardType,
  1.2124 +               typename Bound5UnwrapTraits::ForwardType,
  1.2125 +               typename Bound6UnwrapTraits::ForwardType)>
  1.2126 +               ::MakeItSo(storage->runnable_, CallbackForward(x1),
  1.2127 +                   CallbackForward(x2), CallbackForward(x3),
  1.2128 +                   CallbackForward(x4), CallbackForward(x5),
  1.2129 +                   CallbackForward(x6));
  1.2130 +  }
  1.2131 +};
  1.2132 +
  1.2133 +// Arity 7 -> 7.
  1.2134 +template <typename StorageType, typename R,typename X1, typename X2,
  1.2135 +    typename X3, typename X4, typename X5, typename X6, typename X7>
  1.2136 +struct Invoker<0, StorageType, R(X1, X2, X3, X4, X5, X6, X7)> {
  1.2137 +  typedef R(RunType)(BindStateBase*,
  1.2138 +      typename CallbackParamTraits<X1>::ForwardType,
  1.2139 +      typename CallbackParamTraits<X2>::ForwardType,
  1.2140 +      typename CallbackParamTraits<X3>::ForwardType,
  1.2141 +      typename CallbackParamTraits<X4>::ForwardType,
  1.2142 +      typename CallbackParamTraits<X5>::ForwardType,
  1.2143 +      typename CallbackParamTraits<X6>::ForwardType,
  1.2144 +      typename CallbackParamTraits<X7>::ForwardType);
  1.2145 +
  1.2146 +  typedef R(UnboundRunType)(X1, X2, X3, X4, X5, X6, X7);
  1.2147 +
  1.2148 +  static R Run(BindStateBase* base,
  1.2149 +      typename CallbackParamTraits<X1>::ForwardType x1,
  1.2150 +      typename CallbackParamTraits<X2>::ForwardType x2,
  1.2151 +      typename CallbackParamTraits<X3>::ForwardType x3,
  1.2152 +      typename CallbackParamTraits<X4>::ForwardType x4,
  1.2153 +      typename CallbackParamTraits<X5>::ForwardType x5,
  1.2154 +      typename CallbackParamTraits<X6>::ForwardType x6,
  1.2155 +      typename CallbackParamTraits<X7>::ForwardType x7) {
  1.2156 +    StorageType* storage = static_cast<StorageType*>(base);
  1.2157 +
  1.2158 +    // Local references to make debugger stepping easier. If in a debugger,
  1.2159 +    // you really want to warp ahead and step through the
  1.2160 +    // InvokeHelper<>::MakeItSo() call below.
  1.2161 +
  1.2162 +    return InvokeHelper<StorageType::IsWeakCall::value, R,
  1.2163 +           typename StorageType::RunnableType,
  1.2164 +           void(typename CallbackParamTraits<X1>::ForwardType x1,
  1.2165 +               typename CallbackParamTraits<X2>::ForwardType x2,
  1.2166 +               typename CallbackParamTraits<X3>::ForwardType x3,
  1.2167 +               typename CallbackParamTraits<X4>::ForwardType x4,
  1.2168 +               typename CallbackParamTraits<X5>::ForwardType x5,
  1.2169 +               typename CallbackParamTraits<X6>::ForwardType x6,
  1.2170 +               typename CallbackParamTraits<X7>::ForwardType x7)>
  1.2171 +               ::MakeItSo(storage->runnable_, CallbackForward(x1),
  1.2172 +                   CallbackForward(x2), CallbackForward(x3),
  1.2173 +                   CallbackForward(x4), CallbackForward(x5),
  1.2174 +                   CallbackForward(x6), CallbackForward(x7));
  1.2175 +  }
  1.2176 +};
  1.2177 +
  1.2178 +// Arity 7 -> 6.
  1.2179 +template <typename StorageType, typename R,typename X1, typename X2,
  1.2180 +    typename X3, typename X4, typename X5, typename X6, typename X7>
  1.2181 +struct Invoker<1, StorageType, R(X1, X2, X3, X4, X5, X6, X7)> {
  1.2182 +  typedef R(RunType)(BindStateBase*,
  1.2183 +      typename CallbackParamTraits<X2>::ForwardType,
  1.2184 +      typename CallbackParamTraits<X3>::ForwardType,
  1.2185 +      typename CallbackParamTraits<X4>::ForwardType,
  1.2186 +      typename CallbackParamTraits<X5>::ForwardType,
  1.2187 +      typename CallbackParamTraits<X6>::ForwardType,
  1.2188 +      typename CallbackParamTraits<X7>::ForwardType);
  1.2189 +
  1.2190 +  typedef R(UnboundRunType)(X2, X3, X4, X5, X6, X7);
  1.2191 +
  1.2192 +  static R Run(BindStateBase* base,
  1.2193 +      typename CallbackParamTraits<X2>::ForwardType x2,
  1.2194 +      typename CallbackParamTraits<X3>::ForwardType x3,
  1.2195 +      typename CallbackParamTraits<X4>::ForwardType x4,
  1.2196 +      typename CallbackParamTraits<X5>::ForwardType x5,
  1.2197 +      typename CallbackParamTraits<X6>::ForwardType x6,
  1.2198 +      typename CallbackParamTraits<X7>::ForwardType x7) {
  1.2199 +    StorageType* storage = static_cast<StorageType*>(base);
  1.2200 +
  1.2201 +    // Local references to make debugger stepping easier. If in a debugger,
  1.2202 +    // you really want to warp ahead and step through the
  1.2203 +    // InvokeHelper<>::MakeItSo() call below.
  1.2204 +    typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
  1.2205 +
  1.2206 +    typename Bound1UnwrapTraits::ForwardType x1 =
  1.2207 +        Bound1UnwrapTraits::Unwrap(storage->p1_);
  1.2208 +    return InvokeHelper<StorageType::IsWeakCall::value, R,
  1.2209 +           typename StorageType::RunnableType,
  1.2210 +           void(typename Bound1UnwrapTraits::ForwardType,
  1.2211 +               typename CallbackParamTraits<X2>::ForwardType x2,
  1.2212 +               typename CallbackParamTraits<X3>::ForwardType x3,
  1.2213 +               typename CallbackParamTraits<X4>::ForwardType x4,
  1.2214 +               typename CallbackParamTraits<X5>::ForwardType x5,
  1.2215 +               typename CallbackParamTraits<X6>::ForwardType x6,
  1.2216 +               typename CallbackParamTraits<X7>::ForwardType x7)>
  1.2217 +               ::MakeItSo(storage->runnable_, CallbackForward(x1),
  1.2218 +                   CallbackForward(x2), CallbackForward(x3),
  1.2219 +                   CallbackForward(x4), CallbackForward(x5),
  1.2220 +                   CallbackForward(x6), CallbackForward(x7));
  1.2221 +  }
  1.2222 +};
  1.2223 +
  1.2224 +// Arity 7 -> 5.
  1.2225 +template <typename StorageType, typename R,typename X1, typename X2,
  1.2226 +    typename X3, typename X4, typename X5, typename X6, typename X7>
  1.2227 +struct Invoker<2, StorageType, R(X1, X2, X3, X4, X5, X6, X7)> {
  1.2228 +  typedef R(RunType)(BindStateBase*,
  1.2229 +      typename CallbackParamTraits<X3>::ForwardType,
  1.2230 +      typename CallbackParamTraits<X4>::ForwardType,
  1.2231 +      typename CallbackParamTraits<X5>::ForwardType,
  1.2232 +      typename CallbackParamTraits<X6>::ForwardType,
  1.2233 +      typename CallbackParamTraits<X7>::ForwardType);
  1.2234 +
  1.2235 +  typedef R(UnboundRunType)(X3, X4, X5, X6, X7);
  1.2236 +
  1.2237 +  static R Run(BindStateBase* base,
  1.2238 +      typename CallbackParamTraits<X3>::ForwardType x3,
  1.2239 +      typename CallbackParamTraits<X4>::ForwardType x4,
  1.2240 +      typename CallbackParamTraits<X5>::ForwardType x5,
  1.2241 +      typename CallbackParamTraits<X6>::ForwardType x6,
  1.2242 +      typename CallbackParamTraits<X7>::ForwardType x7) {
  1.2243 +    StorageType* storage = static_cast<StorageType*>(base);
  1.2244 +
  1.2245 +    // Local references to make debugger stepping easier. If in a debugger,
  1.2246 +    // you really want to warp ahead and step through the
  1.2247 +    // InvokeHelper<>::MakeItSo() call below.
  1.2248 +    typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
  1.2249 +    typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
  1.2250 +
  1.2251 +    typename Bound1UnwrapTraits::ForwardType x1 =
  1.2252 +        Bound1UnwrapTraits::Unwrap(storage->p1_);
  1.2253 +    typename Bound2UnwrapTraits::ForwardType x2 =
  1.2254 +        Bound2UnwrapTraits::Unwrap(storage->p2_);
  1.2255 +    return InvokeHelper<StorageType::IsWeakCall::value, R,
  1.2256 +           typename StorageType::RunnableType,
  1.2257 +           void(typename Bound1UnwrapTraits::ForwardType,
  1.2258 +               typename Bound2UnwrapTraits::ForwardType,
  1.2259 +               typename CallbackParamTraits<X3>::ForwardType x3,
  1.2260 +               typename CallbackParamTraits<X4>::ForwardType x4,
  1.2261 +               typename CallbackParamTraits<X5>::ForwardType x5,
  1.2262 +               typename CallbackParamTraits<X6>::ForwardType x6,
  1.2263 +               typename CallbackParamTraits<X7>::ForwardType x7)>
  1.2264 +               ::MakeItSo(storage->runnable_, CallbackForward(x1),
  1.2265 +                   CallbackForward(x2), CallbackForward(x3),
  1.2266 +                   CallbackForward(x4), CallbackForward(x5),
  1.2267 +                   CallbackForward(x6), CallbackForward(x7));
  1.2268 +  }
  1.2269 +};
  1.2270 +
  1.2271 +// Arity 7 -> 4.
  1.2272 +template <typename StorageType, typename R,typename X1, typename X2,
  1.2273 +    typename X3, typename X4, typename X5, typename X6, typename X7>
  1.2274 +struct Invoker<3, StorageType, R(X1, X2, X3, X4, X5, X6, X7)> {
  1.2275 +  typedef R(RunType)(BindStateBase*,
  1.2276 +      typename CallbackParamTraits<X4>::ForwardType,
  1.2277 +      typename CallbackParamTraits<X5>::ForwardType,
  1.2278 +      typename CallbackParamTraits<X6>::ForwardType,
  1.2279 +      typename CallbackParamTraits<X7>::ForwardType);
  1.2280 +
  1.2281 +  typedef R(UnboundRunType)(X4, X5, X6, X7);
  1.2282 +
  1.2283 +  static R Run(BindStateBase* base,
  1.2284 +      typename CallbackParamTraits<X4>::ForwardType x4,
  1.2285 +      typename CallbackParamTraits<X5>::ForwardType x5,
  1.2286 +      typename CallbackParamTraits<X6>::ForwardType x6,
  1.2287 +      typename CallbackParamTraits<X7>::ForwardType x7) {
  1.2288 +    StorageType* storage = static_cast<StorageType*>(base);
  1.2289 +
  1.2290 +    // Local references to make debugger stepping easier. If in a debugger,
  1.2291 +    // you really want to warp ahead and step through the
  1.2292 +    // InvokeHelper<>::MakeItSo() call below.
  1.2293 +    typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
  1.2294 +    typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
  1.2295 +    typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits;
  1.2296 +
  1.2297 +    typename Bound1UnwrapTraits::ForwardType x1 =
  1.2298 +        Bound1UnwrapTraits::Unwrap(storage->p1_);
  1.2299 +    typename Bound2UnwrapTraits::ForwardType x2 =
  1.2300 +        Bound2UnwrapTraits::Unwrap(storage->p2_);
  1.2301 +    typename Bound3UnwrapTraits::ForwardType x3 =
  1.2302 +        Bound3UnwrapTraits::Unwrap(storage->p3_);
  1.2303 +    return InvokeHelper<StorageType::IsWeakCall::value, R,
  1.2304 +           typename StorageType::RunnableType,
  1.2305 +           void(typename Bound1UnwrapTraits::ForwardType,
  1.2306 +               typename Bound2UnwrapTraits::ForwardType,
  1.2307 +               typename Bound3UnwrapTraits::ForwardType,
  1.2308 +               typename CallbackParamTraits<X4>::ForwardType x4,
  1.2309 +               typename CallbackParamTraits<X5>::ForwardType x5,
  1.2310 +               typename CallbackParamTraits<X6>::ForwardType x6,
  1.2311 +               typename CallbackParamTraits<X7>::ForwardType x7)>
  1.2312 +               ::MakeItSo(storage->runnable_, CallbackForward(x1),
  1.2313 +                   CallbackForward(x2), CallbackForward(x3),
  1.2314 +                   CallbackForward(x4), CallbackForward(x5),
  1.2315 +                   CallbackForward(x6), CallbackForward(x7));
  1.2316 +  }
  1.2317 +};
  1.2318 +
  1.2319 +// Arity 7 -> 3.
  1.2320 +template <typename StorageType, typename R,typename X1, typename X2,
  1.2321 +    typename X3, typename X4, typename X5, typename X6, typename X7>
  1.2322 +struct Invoker<4, StorageType, R(X1, X2, X3, X4, X5, X6, X7)> {
  1.2323 +  typedef R(RunType)(BindStateBase*,
  1.2324 +      typename CallbackParamTraits<X5>::ForwardType,
  1.2325 +      typename CallbackParamTraits<X6>::ForwardType,
  1.2326 +      typename CallbackParamTraits<X7>::ForwardType);
  1.2327 +
  1.2328 +  typedef R(UnboundRunType)(X5, X6, X7);
  1.2329 +
  1.2330 +  static R Run(BindStateBase* base,
  1.2331 +      typename CallbackParamTraits<X5>::ForwardType x5,
  1.2332 +      typename CallbackParamTraits<X6>::ForwardType x6,
  1.2333 +      typename CallbackParamTraits<X7>::ForwardType x7) {
  1.2334 +    StorageType* storage = static_cast<StorageType*>(base);
  1.2335 +
  1.2336 +    // Local references to make debugger stepping easier. If in a debugger,
  1.2337 +    // you really want to warp ahead and step through the
  1.2338 +    // InvokeHelper<>::MakeItSo() call below.
  1.2339 +    typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
  1.2340 +    typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
  1.2341 +    typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits;
  1.2342 +    typedef typename StorageType::Bound4UnwrapTraits Bound4UnwrapTraits;
  1.2343 +
  1.2344 +    typename Bound1UnwrapTraits::ForwardType x1 =
  1.2345 +        Bound1UnwrapTraits::Unwrap(storage->p1_);
  1.2346 +    typename Bound2UnwrapTraits::ForwardType x2 =
  1.2347 +        Bound2UnwrapTraits::Unwrap(storage->p2_);
  1.2348 +    typename Bound3UnwrapTraits::ForwardType x3 =
  1.2349 +        Bound3UnwrapTraits::Unwrap(storage->p3_);
  1.2350 +    typename Bound4UnwrapTraits::ForwardType x4 =
  1.2351 +        Bound4UnwrapTraits::Unwrap(storage->p4_);
  1.2352 +    return InvokeHelper<StorageType::IsWeakCall::value, R,
  1.2353 +           typename StorageType::RunnableType,
  1.2354 +           void(typename Bound1UnwrapTraits::ForwardType,
  1.2355 +               typename Bound2UnwrapTraits::ForwardType,
  1.2356 +               typename Bound3UnwrapTraits::ForwardType,
  1.2357 +               typename Bound4UnwrapTraits::ForwardType,
  1.2358 +               typename CallbackParamTraits<X5>::ForwardType x5,
  1.2359 +               typename CallbackParamTraits<X6>::ForwardType x6,
  1.2360 +               typename CallbackParamTraits<X7>::ForwardType x7)>
  1.2361 +               ::MakeItSo(storage->runnable_, CallbackForward(x1),
  1.2362 +                   CallbackForward(x2), CallbackForward(x3),
  1.2363 +                   CallbackForward(x4), CallbackForward(x5),
  1.2364 +                   CallbackForward(x6), CallbackForward(x7));
  1.2365 +  }
  1.2366 +};
  1.2367 +
  1.2368 +// Arity 7 -> 2.
  1.2369 +template <typename StorageType, typename R,typename X1, typename X2,
  1.2370 +    typename X3, typename X4, typename X5, typename X6, typename X7>
  1.2371 +struct Invoker<5, StorageType, R(X1, X2, X3, X4, X5, X6, X7)> {
  1.2372 +  typedef R(RunType)(BindStateBase*,
  1.2373 +      typename CallbackParamTraits<X6>::ForwardType,
  1.2374 +      typename CallbackParamTraits<X7>::ForwardType);
  1.2375 +
  1.2376 +  typedef R(UnboundRunType)(X6, X7);
  1.2377 +
  1.2378 +  static R Run(BindStateBase* base,
  1.2379 +      typename CallbackParamTraits<X6>::ForwardType x6,
  1.2380 +      typename CallbackParamTraits<X7>::ForwardType x7) {
  1.2381 +    StorageType* storage = static_cast<StorageType*>(base);
  1.2382 +
  1.2383 +    // Local references to make debugger stepping easier. If in a debugger,
  1.2384 +    // you really want to warp ahead and step through the
  1.2385 +    // InvokeHelper<>::MakeItSo() call below.
  1.2386 +    typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
  1.2387 +    typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
  1.2388 +    typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits;
  1.2389 +    typedef typename StorageType::Bound4UnwrapTraits Bound4UnwrapTraits;
  1.2390 +    typedef typename StorageType::Bound5UnwrapTraits Bound5UnwrapTraits;
  1.2391 +
  1.2392 +    typename Bound1UnwrapTraits::ForwardType x1 =
  1.2393 +        Bound1UnwrapTraits::Unwrap(storage->p1_);
  1.2394 +    typename Bound2UnwrapTraits::ForwardType x2 =
  1.2395 +        Bound2UnwrapTraits::Unwrap(storage->p2_);
  1.2396 +    typename Bound3UnwrapTraits::ForwardType x3 =
  1.2397 +        Bound3UnwrapTraits::Unwrap(storage->p3_);
  1.2398 +    typename Bound4UnwrapTraits::ForwardType x4 =
  1.2399 +        Bound4UnwrapTraits::Unwrap(storage->p4_);
  1.2400 +    typename Bound5UnwrapTraits::ForwardType x5 =
  1.2401 +        Bound5UnwrapTraits::Unwrap(storage->p5_);
  1.2402 +    return InvokeHelper<StorageType::IsWeakCall::value, R,
  1.2403 +           typename StorageType::RunnableType,
  1.2404 +           void(typename Bound1UnwrapTraits::ForwardType,
  1.2405 +               typename Bound2UnwrapTraits::ForwardType,
  1.2406 +               typename Bound3UnwrapTraits::ForwardType,
  1.2407 +               typename Bound4UnwrapTraits::ForwardType,
  1.2408 +               typename Bound5UnwrapTraits::ForwardType,
  1.2409 +               typename CallbackParamTraits<X6>::ForwardType x6,
  1.2410 +               typename CallbackParamTraits<X7>::ForwardType x7)>
  1.2411 +               ::MakeItSo(storage->runnable_, CallbackForward(x1),
  1.2412 +                   CallbackForward(x2), CallbackForward(x3),
  1.2413 +                   CallbackForward(x4), CallbackForward(x5),
  1.2414 +                   CallbackForward(x6), CallbackForward(x7));
  1.2415 +  }
  1.2416 +};
  1.2417 +
  1.2418 +// Arity 7 -> 1.
  1.2419 +template <typename StorageType, typename R,typename X1, typename X2,
  1.2420 +    typename X3, typename X4, typename X5, typename X6, typename X7>
  1.2421 +struct Invoker<6, StorageType, R(X1, X2, X3, X4, X5, X6, X7)> {
  1.2422 +  typedef R(RunType)(BindStateBase*,
  1.2423 +      typename CallbackParamTraits<X7>::ForwardType);
  1.2424 +
  1.2425 +  typedef R(UnboundRunType)(X7);
  1.2426 +
  1.2427 +  static R Run(BindStateBase* base,
  1.2428 +      typename CallbackParamTraits<X7>::ForwardType x7) {
  1.2429 +    StorageType* storage = static_cast<StorageType*>(base);
  1.2430 +
  1.2431 +    // Local references to make debugger stepping easier. If in a debugger,
  1.2432 +    // you really want to warp ahead and step through the
  1.2433 +    // InvokeHelper<>::MakeItSo() call below.
  1.2434 +    typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
  1.2435 +    typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
  1.2436 +    typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits;
  1.2437 +    typedef typename StorageType::Bound4UnwrapTraits Bound4UnwrapTraits;
  1.2438 +    typedef typename StorageType::Bound5UnwrapTraits Bound5UnwrapTraits;
  1.2439 +    typedef typename StorageType::Bound6UnwrapTraits Bound6UnwrapTraits;
  1.2440 +
  1.2441 +    typename Bound1UnwrapTraits::ForwardType x1 =
  1.2442 +        Bound1UnwrapTraits::Unwrap(storage->p1_);
  1.2443 +    typename Bound2UnwrapTraits::ForwardType x2 =
  1.2444 +        Bound2UnwrapTraits::Unwrap(storage->p2_);
  1.2445 +    typename Bound3UnwrapTraits::ForwardType x3 =
  1.2446 +        Bound3UnwrapTraits::Unwrap(storage->p3_);
  1.2447 +    typename Bound4UnwrapTraits::ForwardType x4 =
  1.2448 +        Bound4UnwrapTraits::Unwrap(storage->p4_);
  1.2449 +    typename Bound5UnwrapTraits::ForwardType x5 =
  1.2450 +        Bound5UnwrapTraits::Unwrap(storage->p5_);
  1.2451 +    typename Bound6UnwrapTraits::ForwardType x6 =
  1.2452 +        Bound6UnwrapTraits::Unwrap(storage->p6_);
  1.2453 +    return InvokeHelper<StorageType::IsWeakCall::value, R,
  1.2454 +           typename StorageType::RunnableType,
  1.2455 +           void(typename Bound1UnwrapTraits::ForwardType,
  1.2456 +               typename Bound2UnwrapTraits::ForwardType,
  1.2457 +               typename Bound3UnwrapTraits::ForwardType,
  1.2458 +               typename Bound4UnwrapTraits::ForwardType,
  1.2459 +               typename Bound5UnwrapTraits::ForwardType,
  1.2460 +               typename Bound6UnwrapTraits::ForwardType,
  1.2461 +               typename CallbackParamTraits<X7>::ForwardType x7)>
  1.2462 +               ::MakeItSo(storage->runnable_, CallbackForward(x1),
  1.2463 +                   CallbackForward(x2), CallbackForward(x3),
  1.2464 +                   CallbackForward(x4), CallbackForward(x5),
  1.2465 +                   CallbackForward(x6), CallbackForward(x7));
  1.2466 +  }
  1.2467 +};
  1.2468 +
  1.2469 +// Arity 7 -> 0.
  1.2470 +template <typename StorageType, typename R,typename X1, typename X2,
  1.2471 +    typename X3, typename X4, typename X5, typename X6, typename X7>
  1.2472 +struct Invoker<7, StorageType, R(X1, X2, X3, X4, X5, X6, X7)> {
  1.2473 +  typedef R(RunType)(BindStateBase*);
  1.2474 +
  1.2475 +  typedef R(UnboundRunType)();
  1.2476 +
  1.2477 +  static R Run(BindStateBase* base) {
  1.2478 +    StorageType* storage = static_cast<StorageType*>(base);
  1.2479 +
  1.2480 +    // Local references to make debugger stepping easier. If in a debugger,
  1.2481 +    // you really want to warp ahead and step through the
  1.2482 +    // InvokeHelper<>::MakeItSo() call below.
  1.2483 +    typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
  1.2484 +    typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
  1.2485 +    typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits;
  1.2486 +    typedef typename StorageType::Bound4UnwrapTraits Bound4UnwrapTraits;
  1.2487 +    typedef typename StorageType::Bound5UnwrapTraits Bound5UnwrapTraits;
  1.2488 +    typedef typename StorageType::Bound6UnwrapTraits Bound6UnwrapTraits;
  1.2489 +    typedef typename StorageType::Bound7UnwrapTraits Bound7UnwrapTraits;
  1.2490 +
  1.2491 +    typename Bound1UnwrapTraits::ForwardType x1 =
  1.2492 +        Bound1UnwrapTraits::Unwrap(storage->p1_);
  1.2493 +    typename Bound2UnwrapTraits::ForwardType x2 =
  1.2494 +        Bound2UnwrapTraits::Unwrap(storage->p2_);
  1.2495 +    typename Bound3UnwrapTraits::ForwardType x3 =
  1.2496 +        Bound3UnwrapTraits::Unwrap(storage->p3_);
  1.2497 +    typename Bound4UnwrapTraits::ForwardType x4 =
  1.2498 +        Bound4UnwrapTraits::Unwrap(storage->p4_);
  1.2499 +    typename Bound5UnwrapTraits::ForwardType x5 =
  1.2500 +        Bound5UnwrapTraits::Unwrap(storage->p5_);
  1.2501 +    typename Bound6UnwrapTraits::ForwardType x6 =
  1.2502 +        Bound6UnwrapTraits::Unwrap(storage->p6_);
  1.2503 +    typename Bound7UnwrapTraits::ForwardType x7 =
  1.2504 +        Bound7UnwrapTraits::Unwrap(storage->p7_);
  1.2505 +    return InvokeHelper<StorageType::IsWeakCall::value, R,
  1.2506 +           typename StorageType::RunnableType,
  1.2507 +           void(typename Bound1UnwrapTraits::ForwardType,
  1.2508 +               typename Bound2UnwrapTraits::ForwardType,
  1.2509 +               typename Bound3UnwrapTraits::ForwardType,
  1.2510 +               typename Bound4UnwrapTraits::ForwardType,
  1.2511 +               typename Bound5UnwrapTraits::ForwardType,
  1.2512 +               typename Bound6UnwrapTraits::ForwardType,
  1.2513 +               typename Bound7UnwrapTraits::ForwardType)>
  1.2514 +               ::MakeItSo(storage->runnable_, CallbackForward(x1),
  1.2515 +                   CallbackForward(x2), CallbackForward(x3),
  1.2516 +                   CallbackForward(x4), CallbackForward(x5),
  1.2517 +                   CallbackForward(x6), CallbackForward(x7));
  1.2518 +  }
  1.2519 +};
  1.2520 +
  1.2521 +
  1.2522 +// BindState<>
  1.2523 +//
  1.2524 +// This stores all the state passed into Bind() and is also where most
  1.2525 +// of the template resolution magic occurs.
  1.2526 +//
  1.2527 +// Runnable is the functor we are binding arguments to.
  1.2528 +// RunType is type of the Run() function that the Invoker<> should use.
  1.2529 +// Normally, this is the same as the RunType of the Runnable, but it can
  1.2530 +// be different if an adapter like IgnoreResult() has been used.
  1.2531 +//
  1.2532 +// BoundArgsType contains the storage type for all the bound arguments by
  1.2533 +// (ab)using a function type.
  1.2534 +template <typename Runnable, typename RunType, typename BoundArgsType>
  1.2535 +struct BindState;
  1.2536 +
  1.2537 +template <typename Runnable, typename RunType>
  1.2538 +struct BindState<Runnable, RunType, void()> : public BindStateBase {
  1.2539 +  typedef Runnable RunnableType;
  1.2540 +  typedef false_type IsWeakCall;
  1.2541 +  typedef Invoker<0, BindState, RunType> InvokerType;
  1.2542 +  typedef typename InvokerType::UnboundRunType UnboundRunType;
  1.2543 +  explicit BindState(const Runnable& runnable)
  1.2544 +      : runnable_(runnable) {
  1.2545 +  }
  1.2546 +
  1.2547 +  virtual ~BindState() {  }
  1.2548 +
  1.2549 +  RunnableType runnable_;
  1.2550 +};
  1.2551 +
  1.2552 +template <typename Runnable, typename RunType, typename P1>
  1.2553 +struct BindState<Runnable, RunType, void(P1)> : public BindStateBase {
  1.2554 +  typedef Runnable RunnableType;
  1.2555 +  typedef IsWeakMethod<HasIsMethodTag<Runnable>::value, P1> IsWeakCall;
  1.2556 +  typedef Invoker<1, BindState, RunType> InvokerType;
  1.2557 +  typedef typename InvokerType::UnboundRunType UnboundRunType;
  1.2558 +
  1.2559 +  // Convenience typedefs for bound argument types.
  1.2560 +  typedef UnwrapTraits<P1> Bound1UnwrapTraits;
  1.2561 +
  1.2562 +  BindState(const Runnable& runnable, const P1& p1)
  1.2563 +      : runnable_(runnable),
  1.2564 +        p1_(p1) {
  1.2565 +    MaybeRefcount<HasIsMethodTag<Runnable>::value, P1>::AddRef(p1_);
  1.2566 +  }
  1.2567 +
  1.2568 +  virtual ~BindState() {    MaybeRefcount<HasIsMethodTag<Runnable>::value,
  1.2569 +      P1>::Release(p1_);  }
  1.2570 +
  1.2571 +  RunnableType runnable_;
  1.2572 +  P1 p1_;
  1.2573 +};
  1.2574 +
  1.2575 +template <typename Runnable, typename RunType, typename P1, typename P2>
  1.2576 +struct BindState<Runnable, RunType, void(P1, P2)> : public BindStateBase {
  1.2577 +  typedef Runnable RunnableType;
  1.2578 +  typedef IsWeakMethod<HasIsMethodTag<Runnable>::value, P1> IsWeakCall;
  1.2579 +  typedef Invoker<2, BindState, RunType> InvokerType;
  1.2580 +  typedef typename InvokerType::UnboundRunType UnboundRunType;
  1.2581 +
  1.2582 +  // Convenience typedefs for bound argument types.
  1.2583 +  typedef UnwrapTraits<P1> Bound1UnwrapTraits;
  1.2584 +  typedef UnwrapTraits<P2> Bound2UnwrapTraits;
  1.2585 +
  1.2586 +  BindState(const Runnable& runnable, const P1& p1, const P2& p2)
  1.2587 +      : runnable_(runnable),
  1.2588 +        p1_(p1),
  1.2589 +        p2_(p2) {
  1.2590 +    MaybeRefcount<HasIsMethodTag<Runnable>::value, P1>::AddRef(p1_);
  1.2591 +  }
  1.2592 +
  1.2593 +  virtual ~BindState() {    MaybeRefcount<HasIsMethodTag<Runnable>::value,
  1.2594 +      P1>::Release(p1_);  }
  1.2595 +
  1.2596 +  RunnableType runnable_;
  1.2597 +  P1 p1_;
  1.2598 +  P2 p2_;
  1.2599 +};
  1.2600 +
  1.2601 +template <typename Runnable, typename RunType, typename P1, typename P2,
  1.2602 +    typename P3>
  1.2603 +struct BindState<Runnable, RunType, void(P1, P2, P3)> : public BindStateBase {
  1.2604 +  typedef Runnable RunnableType;
  1.2605 +  typedef IsWeakMethod<HasIsMethodTag<Runnable>::value, P1> IsWeakCall;
  1.2606 +  typedef Invoker<3, BindState, RunType> InvokerType;
  1.2607 +  typedef typename InvokerType::UnboundRunType UnboundRunType;
  1.2608 +
  1.2609 +  // Convenience typedefs for bound argument types.
  1.2610 +  typedef UnwrapTraits<P1> Bound1UnwrapTraits;
  1.2611 +  typedef UnwrapTraits<P2> Bound2UnwrapTraits;
  1.2612 +  typedef UnwrapTraits<P3> Bound3UnwrapTraits;
  1.2613 +
  1.2614 +  BindState(const Runnable& runnable, const P1& p1, const P2& p2, const P3& p3)
  1.2615 +      : runnable_(runnable),
  1.2616 +        p1_(p1),
  1.2617 +        p2_(p2),
  1.2618 +        p3_(p3) {
  1.2619 +    MaybeRefcount<HasIsMethodTag<Runnable>::value, P1>::AddRef(p1_);
  1.2620 +  }
  1.2621 +
  1.2622 +  virtual ~BindState() {    MaybeRefcount<HasIsMethodTag<Runnable>::value,
  1.2623 +      P1>::Release(p1_);  }
  1.2624 +
  1.2625 +  RunnableType runnable_;
  1.2626 +  P1 p1_;
  1.2627 +  P2 p2_;
  1.2628 +  P3 p3_;
  1.2629 +};
  1.2630 +
  1.2631 +template <typename Runnable, typename RunType, typename P1, typename P2,
  1.2632 +    typename P3, typename P4>
  1.2633 +struct BindState<Runnable, RunType, void(P1, P2, P3,
  1.2634 +    P4)> : public BindStateBase {
  1.2635 +  typedef Runnable RunnableType;
  1.2636 +  typedef IsWeakMethod<HasIsMethodTag<Runnable>::value, P1> IsWeakCall;
  1.2637 +  typedef Invoker<4, BindState, RunType> InvokerType;
  1.2638 +  typedef typename InvokerType::UnboundRunType UnboundRunType;
  1.2639 +
  1.2640 +  // Convenience typedefs for bound argument types.
  1.2641 +  typedef UnwrapTraits<P1> Bound1UnwrapTraits;
  1.2642 +  typedef UnwrapTraits<P2> Bound2UnwrapTraits;
  1.2643 +  typedef UnwrapTraits<P3> Bound3UnwrapTraits;
  1.2644 +  typedef UnwrapTraits<P4> Bound4UnwrapTraits;
  1.2645 +
  1.2646 +  BindState(const Runnable& runnable, const P1& p1, const P2& p2, const P3& p3,
  1.2647 +      const P4& p4)
  1.2648 +      : runnable_(runnable),
  1.2649 +        p1_(p1),
  1.2650 +        p2_(p2),
  1.2651 +        p3_(p3),
  1.2652 +        p4_(p4) {
  1.2653 +    MaybeRefcount<HasIsMethodTag<Runnable>::value, P1>::AddRef(p1_);
  1.2654 +  }
  1.2655 +
  1.2656 +  virtual ~BindState() {    MaybeRefcount<HasIsMethodTag<Runnable>::value,
  1.2657 +      P1>::Release(p1_);  }
  1.2658 +
  1.2659 +  RunnableType runnable_;
  1.2660 +  P1 p1_;
  1.2661 +  P2 p2_;
  1.2662 +  P3 p3_;
  1.2663 +  P4 p4_;
  1.2664 +};
  1.2665 +
  1.2666 +template <typename Runnable, typename RunType, typename P1, typename P2,
  1.2667 +    typename P3, typename P4, typename P5>
  1.2668 +struct BindState<Runnable, RunType, void(P1, P2, P3, P4,
  1.2669 +    P5)> : public BindStateBase {
  1.2670 +  typedef Runnable RunnableType;
  1.2671 +  typedef IsWeakMethod<HasIsMethodTag<Runnable>::value, P1> IsWeakCall;
  1.2672 +  typedef Invoker<5, BindState, RunType> InvokerType;
  1.2673 +  typedef typename InvokerType::UnboundRunType UnboundRunType;
  1.2674 +
  1.2675 +  // Convenience typedefs for bound argument types.
  1.2676 +  typedef UnwrapTraits<P1> Bound1UnwrapTraits;
  1.2677 +  typedef UnwrapTraits<P2> Bound2UnwrapTraits;
  1.2678 +  typedef UnwrapTraits<P3> Bound3UnwrapTraits;
  1.2679 +  typedef UnwrapTraits<P4> Bound4UnwrapTraits;
  1.2680 +  typedef UnwrapTraits<P5> Bound5UnwrapTraits;
  1.2681 +
  1.2682 +  BindState(const Runnable& runnable, const P1& p1, const P2& p2, const P3& p3,
  1.2683 +      const P4& p4, const P5& p5)
  1.2684 +      : runnable_(runnable),
  1.2685 +        p1_(p1),
  1.2686 +        p2_(p2),
  1.2687 +        p3_(p3),
  1.2688 +        p4_(p4),
  1.2689 +        p5_(p5) {
  1.2690 +    MaybeRefcount<HasIsMethodTag<Runnable>::value, P1>::AddRef(p1_);
  1.2691 +  }
  1.2692 +
  1.2693 +  virtual ~BindState() {    MaybeRefcount<HasIsMethodTag<Runnable>::value,
  1.2694 +      P1>::Release(p1_);  }
  1.2695 +
  1.2696 +  RunnableType runnable_;
  1.2697 +  P1 p1_;
  1.2698 +  P2 p2_;
  1.2699 +  P3 p3_;
  1.2700 +  P4 p4_;
  1.2701 +  P5 p5_;
  1.2702 +};
  1.2703 +
  1.2704 +template <typename Runnable, typename RunType, typename P1, typename P2,
  1.2705 +    typename P3, typename P4, typename P5, typename P6>
  1.2706 +struct BindState<Runnable, RunType, void(P1, P2, P3, P4, P5,
  1.2707 +    P6)> : public BindStateBase {
  1.2708 +  typedef Runnable RunnableType;
  1.2709 +  typedef IsWeakMethod<HasIsMethodTag<Runnable>::value, P1> IsWeakCall;
  1.2710 +  typedef Invoker<6, BindState, RunType> InvokerType;
  1.2711 +  typedef typename InvokerType::UnboundRunType UnboundRunType;
  1.2712 +
  1.2713 +  // Convenience typedefs for bound argument types.
  1.2714 +  typedef UnwrapTraits<P1> Bound1UnwrapTraits;
  1.2715 +  typedef UnwrapTraits<P2> Bound2UnwrapTraits;
  1.2716 +  typedef UnwrapTraits<P3> Bound3UnwrapTraits;
  1.2717 +  typedef UnwrapTraits<P4> Bound4UnwrapTraits;
  1.2718 +  typedef UnwrapTraits<P5> Bound5UnwrapTraits;
  1.2719 +  typedef UnwrapTraits<P6> Bound6UnwrapTraits;
  1.2720 +
  1.2721 +  BindState(const Runnable& runnable, const P1& p1, const P2& p2, const P3& p3,
  1.2722 +      const P4& p4, const P5& p5, const P6& p6)
  1.2723 +      : runnable_(runnable),
  1.2724 +        p1_(p1),
  1.2725 +        p2_(p2),
  1.2726 +        p3_(p3),
  1.2727 +        p4_(p4),
  1.2728 +        p5_(p5),
  1.2729 +        p6_(p6) {
  1.2730 +    MaybeRefcount<HasIsMethodTag<Runnable>::value, P1>::AddRef(p1_);
  1.2731 +  }
  1.2732 +
  1.2733 +  virtual ~BindState() {    MaybeRefcount<HasIsMethodTag<Runnable>::value,
  1.2734 +      P1>::Release(p1_);  }
  1.2735 +
  1.2736 +  RunnableType runnable_;
  1.2737 +  P1 p1_;
  1.2738 +  P2 p2_;
  1.2739 +  P3 p3_;
  1.2740 +  P4 p4_;
  1.2741 +  P5 p5_;
  1.2742 +  P6 p6_;
  1.2743 +};
  1.2744 +
  1.2745 +template <typename Runnable, typename RunType, typename P1, typename P2,
  1.2746 +    typename P3, typename P4, typename P5, typename P6, typename P7>
  1.2747 +struct BindState<Runnable, RunType, void(P1, P2, P3, P4, P5, P6,
  1.2748 +    P7)> : public BindStateBase {
  1.2749 +  typedef Runnable RunnableType;
  1.2750 +  typedef IsWeakMethod<HasIsMethodTag<Runnable>::value, P1> IsWeakCall;
  1.2751 +  typedef Invoker<7, BindState, RunType> InvokerType;
  1.2752 +  typedef typename InvokerType::UnboundRunType UnboundRunType;
  1.2753 +
  1.2754 +  // Convenience typedefs for bound argument types.
  1.2755 +  typedef UnwrapTraits<P1> Bound1UnwrapTraits;
  1.2756 +  typedef UnwrapTraits<P2> Bound2UnwrapTraits;
  1.2757 +  typedef UnwrapTraits<P3> Bound3UnwrapTraits;
  1.2758 +  typedef UnwrapTraits<P4> Bound4UnwrapTraits;
  1.2759 +  typedef UnwrapTraits<P5> Bound5UnwrapTraits;
  1.2760 +  typedef UnwrapTraits<P6> Bound6UnwrapTraits;
  1.2761 +  typedef UnwrapTraits<P7> Bound7UnwrapTraits;
  1.2762 +
  1.2763 +  BindState(const Runnable& runnable, const P1& p1, const P2& p2, const P3& p3,
  1.2764 +      const P4& p4, const P5& p5, const P6& p6, const P7& p7)
  1.2765 +      : runnable_(runnable),
  1.2766 +        p1_(p1),
  1.2767 +        p2_(p2),
  1.2768 +        p3_(p3),
  1.2769 +        p4_(p4),
  1.2770 +        p5_(p5),
  1.2771 +        p6_(p6),
  1.2772 +        p7_(p7) {
  1.2773 +    MaybeRefcount<HasIsMethodTag<Runnable>::value, P1>::AddRef(p1_);
  1.2774 +  }
  1.2775 +
  1.2776 +  virtual ~BindState() {    MaybeRefcount<HasIsMethodTag<Runnable>::value,
  1.2777 +      P1>::Release(p1_);  }
  1.2778 +
  1.2779 +  RunnableType runnable_;
  1.2780 +  P1 p1_;
  1.2781 +  P2 p2_;
  1.2782 +  P3 p3_;
  1.2783 +  P4 p4_;
  1.2784 +  P5 p5_;
  1.2785 +  P6 p6_;
  1.2786 +  P7 p7_;
  1.2787 +};
  1.2788 +
  1.2789 +}  // namespace internal
  1.2790 +}  // namespace base
  1.2791 +
  1.2792 +#endif  // BASE_BIND_INTERNAL_H_

mercurial