| OLD | NEW |
| 1 // This file was GENERATED by command: | |
| 2 // pump.py bind_internal.h.pump | |
| 3 // DO NOT EDIT BY HAND!!! | |
| 4 | |
| 5 | |
| 6 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 7 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 8 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 9 | 4 |
| 10 #ifndef BASE_BIND_INTERNAL_H_ | 5 #ifndef BASE_BIND_INTERNAL_H_ |
| 11 #define BASE_BIND_INTERNAL_H_ | 6 #define BASE_BIND_INTERNAL_H_ |
| 12 | 7 |
| 13 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 14 #include "base/callback_internal.h" | 9 #include "base/callback_internal.h" |
| 15 #include "base/memory/raw_scoped_refptr_mismatch_checker.h" | 10 #include "base/memory/raw_scoped_refptr_mismatch_checker.h" |
| 16 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
| 17 #include "base/template_util.h" | 12 #include "base/template_util.h" |
| 13 #include "base/tuple.h" |
| 18 #include "build/build_config.h" | 14 #include "build/build_config.h" |
| 19 | 15 |
| 20 #if defined(OS_WIN) | 16 #if defined(OS_WIN) |
| 21 #include "base/bind_internal_win.h" | 17 #include "base/bind_internal_win.h" |
| 22 #endif | 18 #endif |
| 23 | 19 |
| 24 namespace base { | 20 namespace base { |
| 25 namespace internal { | 21 namespace internal { |
| 26 | 22 |
| 27 // See base/callback.h for user documentation. | 23 // See base/callback.h for user documentation. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 44 // (Bound)ArgsType -- A function type that is being (ab)used to store the | 40 // (Bound)ArgsType -- A function type that is being (ab)used to store the |
| 45 // types of set of arguments. The "return" type is always | 41 // types of set of arguments. The "return" type is always |
| 46 // void here. We use this hack so that we do not need | 42 // void here. We use this hack so that we do not need |
| 47 // a new type name for each arity of type. (eg., | 43 // a new type name for each arity of type. (eg., |
| 48 // BindState1, BindState2). This makes forward | 44 // BindState1, BindState2). This makes forward |
| 49 // declarations and friending much much easier. | 45 // declarations and friending much much easier. |
| 50 // | 46 // |
| 51 // Types: | 47 // Types: |
| 52 // RunnableAdapter<> -- Wraps the various "function" pointer types into an | 48 // RunnableAdapter<> -- Wraps the various "function" pointer types into an |
| 53 // object that adheres to the Runnable interface. | 49 // object that adheres to the Runnable interface. |
| 54 // FunctionTraits<> -- Type traits that unwrap a function signature into a | |
| 55 // a set of easier to use typedefs. Used mainly for | |
| 56 // compile time asserts. | |
| 57 // There are |ARITY| FunctionTraits types. | |
| 58 // ForceVoidReturn<> -- Helper class for translating function signatures to | 50 // ForceVoidReturn<> -- Helper class for translating function signatures to |
| 59 // equivalent forms with a "void" return type. | 51 // equivalent forms with a "void" return type. |
| 60 // FunctorTraits<> -- Type traits used determine the correct RunType and | 52 // FunctorTraits<> -- Type traits used determine the correct RunType and |
| 61 // RunnableType for a Functor. This is where function | 53 // RunnableType for a Functor. This is where function |
| 62 // signature adapters are applied. | 54 // signature adapters are applied. |
| 63 // MakeRunnable<> -- Takes a Functor and returns an object in the Runnable | 55 // MakeRunnable<> -- Takes a Functor and returns an object in the Runnable |
| 64 // type class that represents the underlying Functor. | 56 // type class that represents the underlying Functor. |
| 65 // There are |O(1)| MakeRunnable types. | 57 // There are |O(1)| MakeRunnable types. |
| 66 // InvokeHelper<> -- Take a Runnable + arguments and actully invokes it. | 58 // InvokeHelper<> -- Take a Runnable + arguments and actully invokes it. |
| 67 // Handle the differing syntaxes needed for WeakPtr<> support, | 59 // Handle the differing syntaxes needed for WeakPtr<> |
| 68 // and for ignoring return values. This is separate from | 60 // support, and for ignoring return values. This is separate |
| 69 // Invoker to avoid creating multiple version of Invoker<> | 61 // from Invoker to avoid creating multiple version of |
| 70 // which grows at O(n^2) with the arity. | 62 // Invoker<>. |
| 71 // Invoker<> -- Unwraps the curried parameters and executes the Runnable. | 63 // Invoker<> -- Unwraps the curried parameters and executes the Runnable. |
| 72 // There are |(ARITY^2 + ARITY)/2| Invoketypes. | |
| 73 // BindState<> -- Stores the curried parameters, and is the main entry point | 64 // BindState<> -- Stores the curried parameters, and is the main entry point |
| 74 // into the Bind() system, doing most of the type resolution. | 65 // into the Bind() system, doing most of the type resolution. |
| 75 // There are ARITY BindState types. | 66 // There are ARITY BindState types. |
| 76 | 67 |
| 77 // HasNonConstReferenceParam selects true_type when any of the parameters in | 68 // HasNonConstReferenceParam selects true_type when any of the parameters in |
| 78 // |Sig| is a non-const reference. | 69 // |Sig| is a non-const reference. |
| 79 // Implementation note: This non-specialized case handles zero-arity case only. | 70 // Implementation note: This non-specialized case handles zero-arity case only. |
| 80 // Non-zero-arity cases should be handled by the specialization below. | 71 // Non-zero-arity cases should be handled by the specialization below. |
| 81 template <typename Sig> | 72 template <typename Sig> |
| 82 struct HasNonConstReferenceParam : false_type {}; | 73 struct HasNonConstReferenceParam : false_type {}; |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 | 193 |
| 203 R Run(const T* object, | 194 R Run(const T* object, |
| 204 typename CallbackParamTraits<Args>::ForwardType... args) { | 195 typename CallbackParamTraits<Args>::ForwardType... args) { |
| 205 return (object->*method_)(CallbackForward(args)...); | 196 return (object->*method_)(CallbackForward(args)...); |
| 206 } | 197 } |
| 207 | 198 |
| 208 private: | 199 private: |
| 209 R (T::*method_)(Args...) const; | 200 R (T::*method_)(Args...) const; |
| 210 }; | 201 }; |
| 211 | 202 |
| 212 // TODO(tzik): Remove FunctionTraits after we finish removing bind.pump. | |
| 213 // FunctionTraits<> | |
| 214 // | |
| 215 // Breaks a function signature apart into typedefs for easier introspection. | |
| 216 template <typename Sig> | |
| 217 struct FunctionTraits; | |
| 218 | |
| 219 template <typename R> | |
| 220 struct FunctionTraits<R()> { | |
| 221 typedef R ReturnType; | |
| 222 }; | |
| 223 | |
| 224 template <typename R, typename A1> | |
| 225 struct FunctionTraits<R(A1)> { | |
| 226 typedef R ReturnType; | |
| 227 typedef A1 A1Type; | |
| 228 }; | |
| 229 | |
| 230 template <typename R, typename A1, typename A2> | |
| 231 struct FunctionTraits<R(A1, A2)> { | |
| 232 typedef R ReturnType; | |
| 233 typedef A1 A1Type; | |
| 234 typedef A2 A2Type; | |
| 235 }; | |
| 236 | |
| 237 template <typename R, typename A1, typename A2, typename A3> | |
| 238 struct FunctionTraits<R(A1, A2, A3)> { | |
| 239 typedef R ReturnType; | |
| 240 typedef A1 A1Type; | |
| 241 typedef A2 A2Type; | |
| 242 typedef A3 A3Type; | |
| 243 }; | |
| 244 | |
| 245 template <typename R, typename A1, typename A2, typename A3, typename A4> | |
| 246 struct FunctionTraits<R(A1, A2, A3, A4)> { | |
| 247 typedef R ReturnType; | |
| 248 typedef A1 A1Type; | |
| 249 typedef A2 A2Type; | |
| 250 typedef A3 A3Type; | |
| 251 typedef A4 A4Type; | |
| 252 }; | |
| 253 | |
| 254 template <typename R, typename A1, typename A2, typename A3, typename A4, | |
| 255 typename A5> | |
| 256 struct FunctionTraits<R(A1, A2, A3, A4, A5)> { | |
| 257 typedef R ReturnType; | |
| 258 typedef A1 A1Type; | |
| 259 typedef A2 A2Type; | |
| 260 typedef A3 A3Type; | |
| 261 typedef A4 A4Type; | |
| 262 typedef A5 A5Type; | |
| 263 }; | |
| 264 | |
| 265 template <typename R, typename A1, typename A2, typename A3, typename A4, | |
| 266 typename A5, typename A6> | |
| 267 struct FunctionTraits<R(A1, A2, A3, A4, A5, A6)> { | |
| 268 typedef R ReturnType; | |
| 269 typedef A1 A1Type; | |
| 270 typedef A2 A2Type; | |
| 271 typedef A3 A3Type; | |
| 272 typedef A4 A4Type; | |
| 273 typedef A5 A5Type; | |
| 274 typedef A6 A6Type; | |
| 275 }; | |
| 276 | |
| 277 template <typename R, typename A1, typename A2, typename A3, typename A4, | |
| 278 typename A5, typename A6, typename A7> | |
| 279 struct FunctionTraits<R(A1, A2, A3, A4, A5, A6, A7)> { | |
| 280 typedef R ReturnType; | |
| 281 typedef A1 A1Type; | |
| 282 typedef A2 A2Type; | |
| 283 typedef A3 A3Type; | |
| 284 typedef A4 A4Type; | |
| 285 typedef A5 A5Type; | |
| 286 typedef A6 A6Type; | |
| 287 typedef A7 A7Type; | |
| 288 }; | |
| 289 | |
| 290 | 203 |
| 291 // ForceVoidReturn<> | 204 // ForceVoidReturn<> |
| 292 // | 205 // |
| 293 // Set of templates that support forcing the function return type to void. | 206 // Set of templates that support forcing the function return type to void. |
| 294 template <typename Sig> | 207 template <typename Sig> |
| 295 struct ForceVoidReturn; | 208 struct ForceVoidReturn; |
| 296 | 209 |
| 297 template <typename R, typename... Args> | 210 template <typename R, typename... Args> |
| 298 struct ForceVoidReturn<R(Args...)> { | 211 struct ForceVoidReturn<R(Args...)> { |
| 299 typedef void(RunType)(Args...); | 212 typedef void(RunType)(Args...); |
| 300 }; | 213 }; |
| 301 | 214 |
| 302 | 215 |
| 303 // FunctorTraits<> | 216 // FunctorTraits<> |
| 304 // | 217 // |
| 305 // See description at top of file. | 218 // See description at top of file. |
| 306 template <typename T> | 219 template <typename T> |
| 307 struct FunctorTraits { | 220 struct FunctorTraits { |
| 308 typedef RunnableAdapter<T> RunnableType; | 221 typedef RunnableAdapter<T> RunnableType; |
| 309 typedef typename RunnableType::RunType RunType; | 222 typedef typename RunnableType::RunType RunType; |
| 310 }; | 223 }; |
| 311 | 224 |
| 312 template <typename T> | 225 template <typename T> |
| 313 struct FunctorTraits<IgnoreResultHelper<T> > { | 226 struct FunctorTraits<IgnoreResultHelper<T>> { |
| 314 typedef typename FunctorTraits<T>::RunnableType RunnableType; | 227 typedef typename FunctorTraits<T>::RunnableType RunnableType; |
| 315 typedef typename ForceVoidReturn< | 228 typedef typename ForceVoidReturn< |
| 316 typename RunnableType::RunType>::RunType RunType; | 229 typename RunnableType::RunType>::RunType RunType; |
| 317 }; | 230 }; |
| 318 | 231 |
| 319 template <typename T> | 232 template <typename T> |
| 320 struct FunctorTraits<Callback<T> > { | 233 struct FunctorTraits<Callback<T>> { |
| 321 typedef Callback<T> RunnableType; | 234 typedef Callback<T> RunnableType; |
| 322 typedef typename Callback<T>::RunType RunType; | 235 typedef typename Callback<T>::RunType RunType; |
| 323 }; | 236 }; |
| 324 | 237 |
| 325 | 238 |
| 326 // MakeRunnable<> | 239 // MakeRunnable<> |
| 327 // | 240 // |
| 328 // Converts a passed in functor to a RunnableType using type inference. | 241 // Converts a passed in functor to a RunnableType using type inference. |
| 329 | 242 |
| 330 template <typename T> | 243 template <typename T> |
| 331 typename FunctorTraits<T>::RunnableType MakeRunnable(const T& t) { | 244 typename FunctorTraits<T>::RunnableType MakeRunnable(const T& t) { |
| 332 return RunnableAdapter<T>(t); | 245 return RunnableAdapter<T>(t); |
| 333 } | 246 } |
| 334 | 247 |
| 335 template <typename T> | 248 template <typename T> |
| 336 typename FunctorTraits<T>::RunnableType | 249 typename FunctorTraits<T>::RunnableType |
| 337 MakeRunnable(const IgnoreResultHelper<T>& t) { | 250 MakeRunnable(const IgnoreResultHelper<T>& t) { |
| 338 return MakeRunnable(t.functor_); | 251 return MakeRunnable(t.functor_); |
| 339 } | 252 } |
| 340 | 253 |
| 341 template <typename T> | 254 template <typename T> |
| 342 const typename FunctorTraits<Callback<T> >::RunnableType& | 255 const typename FunctorTraits<Callback<T>>::RunnableType& |
| 343 MakeRunnable(const Callback<T>& t) { | 256 MakeRunnable(const Callback<T>& t) { |
| 344 DCHECK(!t.is_null()); | 257 DCHECK(!t.is_null()); |
| 345 return t; | 258 return t; |
| 346 } | 259 } |
| 347 | 260 |
| 348 | 261 |
| 349 // InvokeHelper<> | 262 // InvokeHelper<> |
| 350 // | 263 // |
| 351 // There are 3 logical InvokeHelper<> specializations: normal, void-return, | 264 // There are 3 logical InvokeHelper<> specializations: normal, void-return, |
| 352 // WeakCalls. | 265 // WeakCalls. |
| 353 // | 266 // |
| 354 // The normal type just calls the underlying runnable. | 267 // The normal type just calls the underlying runnable. |
| 355 // | 268 // |
| 356 // We need a InvokeHelper to handle void return types in order to support | 269 // We need a InvokeHelper to handle void return types in order to support |
| 357 // IgnoreResult(). Normally, if the Runnable's RunType had a void return, | 270 // IgnoreResult(). Normally, if the Runnable's RunType had a void return, |
| 358 // the template system would just accept "return functor.Run()" ignoring | 271 // the template system would just accept "return functor.Run()" ignoring |
| 359 // the fact that a void function is being used with return. This piece of | 272 // the fact that a void function is being used with return. This piece of |
| 360 // sugar breaks though when the Runnable's RunType is not void. Thus, we | 273 // sugar breaks though when the Runnable's RunType is not void. Thus, we |
| 361 // need a partial specialization to change the syntax to drop the "return" | 274 // need a partial specialization to change the syntax to drop the "return" |
| 362 // from the invocation call. | 275 // from the invocation call. |
| 363 // | 276 // |
| 364 // WeakCalls similarly need special syntax that is applied to the first | 277 // WeakCalls similarly need special syntax that is applied to the first |
| 365 // argument to check if they should no-op themselves. | 278 // argument to check if they should no-op themselves. |
| 366 template <bool IsWeakCall, typename ReturnType, typename Runnable, | 279 template <bool IsWeakCall, typename ReturnType, typename Runnable, |
| 367 typename ArgsType> | 280 typename ArgsType> |
| 368 struct InvokeHelper; | 281 struct InvokeHelper; |
| 369 | 282 |
| 370 template <typename ReturnType, typename Runnable, typename... Args> | 283 template <typename ReturnType, typename Runnable, typename... Args> |
| 371 struct InvokeHelper<false, ReturnType, Runnable, | 284 struct InvokeHelper<false, ReturnType, Runnable, TypeList<Args...>> { |
| 372 void(Args...)> { | |
| 373 static ReturnType MakeItSo(Runnable runnable, Args... args) { | 285 static ReturnType MakeItSo(Runnable runnable, Args... args) { |
| 374 return runnable.Run(CallbackForward(args)...); | 286 return runnable.Run(CallbackForward(args)...); |
| 375 } | 287 } |
| 376 }; | 288 }; |
| 377 | 289 |
| 378 template <typename Runnable, typename... Args> | 290 template <typename Runnable, typename... Args> |
| 379 struct InvokeHelper<false, void, Runnable, void(Args...)> { | 291 struct InvokeHelper<false, void, Runnable, TypeList<Args...>> { |
| 380 static void MakeItSo(Runnable runnable, Args... args) { | 292 static void MakeItSo(Runnable runnable, Args... args) { |
| 381 runnable.Run(CallbackForward(args)...); | 293 runnable.Run(CallbackForward(args)...); |
| 382 } | 294 } |
| 383 }; | 295 }; |
| 384 | 296 |
| 385 template <typename Runnable, typename BoundWeakPtr, typename... Args> | 297 template <typename Runnable, typename BoundWeakPtr, typename... Args> |
| 386 struct InvokeHelper<true, void, Runnable, void(BoundWeakPtr, Args...)> { | 298 struct InvokeHelper<true, void, Runnable, TypeList<BoundWeakPtr, Args...>> { |
| 387 static void MakeItSo(Runnable runnable, BoundWeakPtr weak_ptr, Args... args) { | 299 static void MakeItSo(Runnable runnable, BoundWeakPtr weak_ptr, Args... args) { |
| 388 if (!weak_ptr.get()) { | 300 if (!weak_ptr.get()) { |
| 389 return; | 301 return; |
| 390 } | 302 } |
| 391 runnable.Run(weak_ptr.get(), CallbackForward(args)...); | 303 runnable.Run(weak_ptr.get(), CallbackForward(args)...); |
| 392 } | 304 } |
| 393 }; | 305 }; |
| 394 | 306 |
| 395 #if !defined(_MSC_VER) | 307 #if !defined(_MSC_VER) |
| 396 | 308 |
| 397 template <typename ReturnType, typename Runnable, typename ArgsType> | 309 template <typename ReturnType, typename Runnable, typename ArgsType> |
| 398 struct InvokeHelper<true, ReturnType, Runnable, ArgsType> { | 310 struct InvokeHelper<true, ReturnType, Runnable, ArgsType> { |
| 399 // WeakCalls are only supported for functions with a void return type. | 311 // WeakCalls are only supported for functions with a void return type. |
| 400 // Otherwise, the function result would be undefined if the the WeakPtr<> | 312 // Otherwise, the function result would be undefined if the the WeakPtr<> |
| 401 // is invalidated. | 313 // is invalidated. |
| 402 COMPILE_ASSERT(is_void<ReturnType>::value, | 314 COMPILE_ASSERT(is_void<ReturnType>::value, |
| 403 weak_ptrs_can_only_bind_to_methods_without_return_values); | 315 weak_ptrs_can_only_bind_to_methods_without_return_values); |
| 404 }; | 316 }; |
| 405 | 317 |
| 406 #endif | 318 #endif |
| 407 | 319 |
| 408 // Invoker<> | 320 // Invoker<> |
| 409 // | 321 // |
| 410 // See description at the top of the file. | 322 // See description at the top of the file. |
| 411 template <int NumBound, typename Storage, typename RunType> | 323 template <typename BoundIndices, |
| 324 typename StorageType, typename Unwrappers, |
| 325 typename InvokeHelperType, typename UnboundForwardRunType> |
| 412 struct Invoker; | 326 struct Invoker; |
| 413 | 327 |
| 414 // Arity 0 -> 0. | 328 template <size_t... bound_indices, |
| 415 template <typename StorageType, typename R> | 329 typename StorageType, |
| 416 struct Invoker<0, StorageType, R()> { | 330 typename... Unwrappers, |
| 417 typedef R(RunType)(BindStateBase*); | 331 typename InvokeHelperType, |
| 418 | 332 typename R, |
| 419 typedef R(UnboundRunType)(); | 333 typename... UnboundForwardArgs> |
| 420 | 334 struct Invoker<IndexSequence<bound_indices...>, |
| 421 static R Run(BindStateBase* base) { | 335 StorageType, TypeList<Unwrappers...>, |
| 336 InvokeHelperType, R(UnboundForwardArgs...)> { |
| 337 static R Run(BindStateBase* base, |
| 338 UnboundForwardArgs... unbound_args) { |
| 422 StorageType* storage = static_cast<StorageType*>(base); | 339 StorageType* storage = static_cast<StorageType*>(base); |
| 423 | |
| 424 // Local references to make debugger stepping easier. If in a debugger, | 340 // Local references to make debugger stepping easier. If in a debugger, |
| 425 // you really want to warp ahead and step through the | 341 // you really want to warp ahead and step through the |
| 426 // InvokeHelper<>::MakeItSo() call below. | 342 // InvokeHelper<>::MakeItSo() call below. |
| 427 | 343 return InvokeHelperType::MakeItSo( |
| 428 return InvokeHelper<StorageType::IsWeakCall::value, R, | 344 storage->runnable_, |
| 429 typename StorageType::RunnableType, | 345 Unwrappers::Unwrap(get<bound_indices>(storage->bound_args_))..., |
| 430 void()> | 346 CallbackForward(unbound_args)...); |
| 431 ::MakeItSo(storage->runnable_); | |
| 432 } | 347 } |
| 433 }; | 348 }; |
| 434 | 349 |
| 435 // Arity 1 -> 1. | |
| 436 template <typename StorageType, typename R,typename X1> | |
| 437 struct Invoker<0, StorageType, R(X1)> { | |
| 438 typedef R(RunType)(BindStateBase*, | |
| 439 typename CallbackParamTraits<X1>::ForwardType); | |
| 440 | |
| 441 typedef R(UnboundRunType)(X1); | |
| 442 | |
| 443 static R Run(BindStateBase* base, | |
| 444 typename CallbackParamTraits<X1>::ForwardType x1) { | |
| 445 StorageType* storage = static_cast<StorageType*>(base); | |
| 446 | |
| 447 // Local references to make debugger stepping easier. If in a debugger, | |
| 448 // you really want to warp ahead and step through the | |
| 449 // InvokeHelper<>::MakeItSo() call below. | |
| 450 | |
| 451 return InvokeHelper<StorageType::IsWeakCall::value, R, | |
| 452 typename StorageType::RunnableType, | |
| 453 void(typename CallbackParamTraits<X1>::ForwardType x1)> | |
| 454 ::MakeItSo(storage->runnable_, CallbackForward(x1)); | |
| 455 } | |
| 456 }; | |
| 457 | |
| 458 // Arity 1 -> 0. | |
| 459 template <typename StorageType, typename R,typename X1> | |
| 460 struct Invoker<1, StorageType, R(X1)> { | |
| 461 typedef R(RunType)(BindStateBase*); | |
| 462 | |
| 463 typedef R(UnboundRunType)(); | |
| 464 | |
| 465 static R Run(BindStateBase* base) { | |
| 466 StorageType* storage = static_cast<StorageType*>(base); | |
| 467 | |
| 468 // Local references to make debugger stepping easier. If in a debugger, | |
| 469 // you really want to warp ahead and step through the | |
| 470 // InvokeHelper<>::MakeItSo() call below. | |
| 471 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits; | |
| 472 | |
| 473 typename Bound1UnwrapTraits::ForwardType x1 = | |
| 474 Bound1UnwrapTraits::Unwrap(storage->p1_); | |
| 475 return InvokeHelper<StorageType::IsWeakCall::value, R, | |
| 476 typename StorageType::RunnableType, | |
| 477 void(typename Bound1UnwrapTraits::ForwardType)> | |
| 478 ::MakeItSo(storage->runnable_, CallbackForward(x1)); | |
| 479 } | |
| 480 }; | |
| 481 | |
| 482 // Arity 2 -> 2. | |
| 483 template <typename StorageType, typename R,typename X1, typename X2> | |
| 484 struct Invoker<0, StorageType, R(X1, X2)> { | |
| 485 typedef R(RunType)(BindStateBase*, | |
| 486 typename CallbackParamTraits<X1>::ForwardType, | |
| 487 typename CallbackParamTraits<X2>::ForwardType); | |
| 488 | |
| 489 typedef R(UnboundRunType)(X1, X2); | |
| 490 | |
| 491 static R Run(BindStateBase* base, | |
| 492 typename CallbackParamTraits<X1>::ForwardType x1, | |
| 493 typename CallbackParamTraits<X2>::ForwardType x2) { | |
| 494 StorageType* storage = static_cast<StorageType*>(base); | |
| 495 | |
| 496 // Local references to make debugger stepping easier. If in a debugger, | |
| 497 // you really want to warp ahead and step through the | |
| 498 // InvokeHelper<>::MakeItSo() call below. | |
| 499 | |
| 500 return InvokeHelper<StorageType::IsWeakCall::value, R, | |
| 501 typename StorageType::RunnableType, | |
| 502 void(typename CallbackParamTraits<X1>::ForwardType x1, | |
| 503 typename CallbackParamTraits<X2>::ForwardType x2)> | |
| 504 ::MakeItSo(storage->runnable_, CallbackForward(x1), | |
| 505 CallbackForward(x2)); | |
| 506 } | |
| 507 }; | |
| 508 | |
| 509 // Arity 2 -> 1. | |
| 510 template <typename StorageType, typename R,typename X1, typename X2> | |
| 511 struct Invoker<1, StorageType, R(X1, X2)> { | |
| 512 typedef R(RunType)(BindStateBase*, | |
| 513 typename CallbackParamTraits<X2>::ForwardType); | |
| 514 | |
| 515 typedef R(UnboundRunType)(X2); | |
| 516 | |
| 517 static R Run(BindStateBase* base, | |
| 518 typename CallbackParamTraits<X2>::ForwardType x2) { | |
| 519 StorageType* storage = static_cast<StorageType*>(base); | |
| 520 | |
| 521 // Local references to make debugger stepping easier. If in a debugger, | |
| 522 // you really want to warp ahead and step through the | |
| 523 // InvokeHelper<>::MakeItSo() call below. | |
| 524 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits; | |
| 525 | |
| 526 typename Bound1UnwrapTraits::ForwardType x1 = | |
| 527 Bound1UnwrapTraits::Unwrap(storage->p1_); | |
| 528 return InvokeHelper<StorageType::IsWeakCall::value, R, | |
| 529 typename StorageType::RunnableType, | |
| 530 void(typename Bound1UnwrapTraits::ForwardType, | |
| 531 typename CallbackParamTraits<X2>::ForwardType x2)> | |
| 532 ::MakeItSo(storage->runnable_, CallbackForward(x1), | |
| 533 CallbackForward(x2)); | |
| 534 } | |
| 535 }; | |
| 536 | |
| 537 // Arity 2 -> 0. | |
| 538 template <typename StorageType, typename R,typename X1, typename X2> | |
| 539 struct Invoker<2, StorageType, R(X1, X2)> { | |
| 540 typedef R(RunType)(BindStateBase*); | |
| 541 | |
| 542 typedef R(UnboundRunType)(); | |
| 543 | |
| 544 static R Run(BindStateBase* base) { | |
| 545 StorageType* storage = static_cast<StorageType*>(base); | |
| 546 | |
| 547 // Local references to make debugger stepping easier. If in a debugger, | |
| 548 // you really want to warp ahead and step through the | |
| 549 // InvokeHelper<>::MakeItSo() call below. | |
| 550 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits; | |
| 551 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits; | |
| 552 | |
| 553 typename Bound1UnwrapTraits::ForwardType x1 = | |
| 554 Bound1UnwrapTraits::Unwrap(storage->p1_); | |
| 555 typename Bound2UnwrapTraits::ForwardType x2 = | |
| 556 Bound2UnwrapTraits::Unwrap(storage->p2_); | |
| 557 return InvokeHelper<StorageType::IsWeakCall::value, R, | |
| 558 typename StorageType::RunnableType, | |
| 559 void(typename Bound1UnwrapTraits::ForwardType, | |
| 560 typename Bound2UnwrapTraits::ForwardType)> | |
| 561 ::MakeItSo(storage->runnable_, CallbackForward(x1), | |
| 562 CallbackForward(x2)); | |
| 563 } | |
| 564 }; | |
| 565 | |
| 566 // Arity 3 -> 3. | |
| 567 template <typename StorageType, typename R,typename X1, typename X2, | |
| 568 typename X3> | |
| 569 struct Invoker<0, StorageType, R(X1, X2, X3)> { | |
| 570 typedef R(RunType)(BindStateBase*, | |
| 571 typename CallbackParamTraits<X1>::ForwardType, | |
| 572 typename CallbackParamTraits<X2>::ForwardType, | |
| 573 typename CallbackParamTraits<X3>::ForwardType); | |
| 574 | |
| 575 typedef R(UnboundRunType)(X1, X2, X3); | |
| 576 | |
| 577 static R Run(BindStateBase* base, | |
| 578 typename CallbackParamTraits<X1>::ForwardType x1, | |
| 579 typename CallbackParamTraits<X2>::ForwardType x2, | |
| 580 typename CallbackParamTraits<X3>::ForwardType x3) { | |
| 581 StorageType* storage = static_cast<StorageType*>(base); | |
| 582 | |
| 583 // Local references to make debugger stepping easier. If in a debugger, | |
| 584 // you really want to warp ahead and step through the | |
| 585 // InvokeHelper<>::MakeItSo() call below. | |
| 586 | |
| 587 return InvokeHelper<StorageType::IsWeakCall::value, R, | |
| 588 typename StorageType::RunnableType, | |
| 589 void(typename CallbackParamTraits<X1>::ForwardType x1, | |
| 590 typename CallbackParamTraits<X2>::ForwardType x2, | |
| 591 typename CallbackParamTraits<X3>::ForwardType x3)> | |
| 592 ::MakeItSo(storage->runnable_, CallbackForward(x1), | |
| 593 CallbackForward(x2), CallbackForward(x3)); | |
| 594 } | |
| 595 }; | |
| 596 | |
| 597 // Arity 3 -> 2. | |
| 598 template <typename StorageType, typename R,typename X1, typename X2, | |
| 599 typename X3> | |
| 600 struct Invoker<1, StorageType, R(X1, X2, X3)> { | |
| 601 typedef R(RunType)(BindStateBase*, | |
| 602 typename CallbackParamTraits<X2>::ForwardType, | |
| 603 typename CallbackParamTraits<X3>::ForwardType); | |
| 604 | |
| 605 typedef R(UnboundRunType)(X2, X3); | |
| 606 | |
| 607 static R Run(BindStateBase* base, | |
| 608 typename CallbackParamTraits<X2>::ForwardType x2, | |
| 609 typename CallbackParamTraits<X3>::ForwardType x3) { | |
| 610 StorageType* storage = static_cast<StorageType*>(base); | |
| 611 | |
| 612 // Local references to make debugger stepping easier. If in a debugger, | |
| 613 // you really want to warp ahead and step through the | |
| 614 // InvokeHelper<>::MakeItSo() call below. | |
| 615 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits; | |
| 616 | |
| 617 typename Bound1UnwrapTraits::ForwardType x1 = | |
| 618 Bound1UnwrapTraits::Unwrap(storage->p1_); | |
| 619 return InvokeHelper<StorageType::IsWeakCall::value, R, | |
| 620 typename StorageType::RunnableType, | |
| 621 void(typename Bound1UnwrapTraits::ForwardType, | |
| 622 typename CallbackParamTraits<X2>::ForwardType x2, | |
| 623 typename CallbackParamTraits<X3>::ForwardType x3)> | |
| 624 ::MakeItSo(storage->runnable_, CallbackForward(x1), | |
| 625 CallbackForward(x2), CallbackForward(x3)); | |
| 626 } | |
| 627 }; | |
| 628 | |
| 629 // Arity 3 -> 1. | |
| 630 template <typename StorageType, typename R,typename X1, typename X2, | |
| 631 typename X3> | |
| 632 struct Invoker<2, StorageType, R(X1, X2, X3)> { | |
| 633 typedef R(RunType)(BindStateBase*, | |
| 634 typename CallbackParamTraits<X3>::ForwardType); | |
| 635 | |
| 636 typedef R(UnboundRunType)(X3); | |
| 637 | |
| 638 static R Run(BindStateBase* base, | |
| 639 typename CallbackParamTraits<X3>::ForwardType x3) { | |
| 640 StorageType* storage = static_cast<StorageType*>(base); | |
| 641 | |
| 642 // Local references to make debugger stepping easier. If in a debugger, | |
| 643 // you really want to warp ahead and step through the | |
| 644 // InvokeHelper<>::MakeItSo() call below. | |
| 645 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits; | |
| 646 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits; | |
| 647 | |
| 648 typename Bound1UnwrapTraits::ForwardType x1 = | |
| 649 Bound1UnwrapTraits::Unwrap(storage->p1_); | |
| 650 typename Bound2UnwrapTraits::ForwardType x2 = | |
| 651 Bound2UnwrapTraits::Unwrap(storage->p2_); | |
| 652 return InvokeHelper<StorageType::IsWeakCall::value, R, | |
| 653 typename StorageType::RunnableType, | |
| 654 void(typename Bound1UnwrapTraits::ForwardType, | |
| 655 typename Bound2UnwrapTraits::ForwardType, | |
| 656 typename CallbackParamTraits<X3>::ForwardType x3)> | |
| 657 ::MakeItSo(storage->runnable_, CallbackForward(x1), | |
| 658 CallbackForward(x2), CallbackForward(x3)); | |
| 659 } | |
| 660 }; | |
| 661 | |
| 662 // Arity 3 -> 0. | |
| 663 template <typename StorageType, typename R,typename X1, typename X2, | |
| 664 typename X3> | |
| 665 struct Invoker<3, StorageType, R(X1, X2, X3)> { | |
| 666 typedef R(RunType)(BindStateBase*); | |
| 667 | |
| 668 typedef R(UnboundRunType)(); | |
| 669 | |
| 670 static R Run(BindStateBase* base) { | |
| 671 StorageType* storage = static_cast<StorageType*>(base); | |
| 672 | |
| 673 // Local references to make debugger stepping easier. If in a debugger, | |
| 674 // you really want to warp ahead and step through the | |
| 675 // InvokeHelper<>::MakeItSo() call below. | |
| 676 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits; | |
| 677 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits; | |
| 678 typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits; | |
| 679 | |
| 680 typename Bound1UnwrapTraits::ForwardType x1 = | |
| 681 Bound1UnwrapTraits::Unwrap(storage->p1_); | |
| 682 typename Bound2UnwrapTraits::ForwardType x2 = | |
| 683 Bound2UnwrapTraits::Unwrap(storage->p2_); | |
| 684 typename Bound3UnwrapTraits::ForwardType x3 = | |
| 685 Bound3UnwrapTraits::Unwrap(storage->p3_); | |
| 686 return InvokeHelper<StorageType::IsWeakCall::value, R, | |
| 687 typename StorageType::RunnableType, | |
| 688 void(typename Bound1UnwrapTraits::ForwardType, | |
| 689 typename Bound2UnwrapTraits::ForwardType, | |
| 690 typename Bound3UnwrapTraits::ForwardType)> | |
| 691 ::MakeItSo(storage->runnable_, CallbackForward(x1), | |
| 692 CallbackForward(x2), CallbackForward(x3)); | |
| 693 } | |
| 694 }; | |
| 695 | |
| 696 // Arity 4 -> 4. | |
| 697 template <typename StorageType, typename R,typename X1, typename X2, | |
| 698 typename X3, typename X4> | |
| 699 struct Invoker<0, StorageType, R(X1, X2, X3, X4)> { | |
| 700 typedef R(RunType)(BindStateBase*, | |
| 701 typename CallbackParamTraits<X1>::ForwardType, | |
| 702 typename CallbackParamTraits<X2>::ForwardType, | |
| 703 typename CallbackParamTraits<X3>::ForwardType, | |
| 704 typename CallbackParamTraits<X4>::ForwardType); | |
| 705 | |
| 706 typedef R(UnboundRunType)(X1, X2, X3, X4); | |
| 707 | |
| 708 static R Run(BindStateBase* base, | |
| 709 typename CallbackParamTraits<X1>::ForwardType x1, | |
| 710 typename CallbackParamTraits<X2>::ForwardType x2, | |
| 711 typename CallbackParamTraits<X3>::ForwardType x3, | |
| 712 typename CallbackParamTraits<X4>::ForwardType x4) { | |
| 713 StorageType* storage = static_cast<StorageType*>(base); | |
| 714 | |
| 715 // Local references to make debugger stepping easier. If in a debugger, | |
| 716 // you really want to warp ahead and step through the | |
| 717 // InvokeHelper<>::MakeItSo() call below. | |
| 718 | |
| 719 return InvokeHelper<StorageType::IsWeakCall::value, R, | |
| 720 typename StorageType::RunnableType, | |
| 721 void(typename CallbackParamTraits<X1>::ForwardType x1, | |
| 722 typename CallbackParamTraits<X2>::ForwardType x2, | |
| 723 typename CallbackParamTraits<X3>::ForwardType x3, | |
| 724 typename CallbackParamTraits<X4>::ForwardType x4)> | |
| 725 ::MakeItSo(storage->runnable_, CallbackForward(x1), | |
| 726 CallbackForward(x2), CallbackForward(x3), | |
| 727 CallbackForward(x4)); | |
| 728 } | |
| 729 }; | |
| 730 | |
| 731 // Arity 4 -> 3. | |
| 732 template <typename StorageType, typename R,typename X1, typename X2, | |
| 733 typename X3, typename X4> | |
| 734 struct Invoker<1, StorageType, R(X1, X2, X3, X4)> { | |
| 735 typedef R(RunType)(BindStateBase*, | |
| 736 typename CallbackParamTraits<X2>::ForwardType, | |
| 737 typename CallbackParamTraits<X3>::ForwardType, | |
| 738 typename CallbackParamTraits<X4>::ForwardType); | |
| 739 | |
| 740 typedef R(UnboundRunType)(X2, X3, X4); | |
| 741 | |
| 742 static R Run(BindStateBase* base, | |
| 743 typename CallbackParamTraits<X2>::ForwardType x2, | |
| 744 typename CallbackParamTraits<X3>::ForwardType x3, | |
| 745 typename CallbackParamTraits<X4>::ForwardType x4) { | |
| 746 StorageType* storage = static_cast<StorageType*>(base); | |
| 747 | |
| 748 // Local references to make debugger stepping easier. If in a debugger, | |
| 749 // you really want to warp ahead and step through the | |
| 750 // InvokeHelper<>::MakeItSo() call below. | |
| 751 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits; | |
| 752 | |
| 753 typename Bound1UnwrapTraits::ForwardType x1 = | |
| 754 Bound1UnwrapTraits::Unwrap(storage->p1_); | |
| 755 return InvokeHelper<StorageType::IsWeakCall::value, R, | |
| 756 typename StorageType::RunnableType, | |
| 757 void(typename Bound1UnwrapTraits::ForwardType, | |
| 758 typename CallbackParamTraits<X2>::ForwardType x2, | |
| 759 typename CallbackParamTraits<X3>::ForwardType x3, | |
| 760 typename CallbackParamTraits<X4>::ForwardType x4)> | |
| 761 ::MakeItSo(storage->runnable_, CallbackForward(x1), | |
| 762 CallbackForward(x2), CallbackForward(x3), | |
| 763 CallbackForward(x4)); | |
| 764 } | |
| 765 }; | |
| 766 | |
| 767 // Arity 4 -> 2. | |
| 768 template <typename StorageType, typename R,typename X1, typename X2, | |
| 769 typename X3, typename X4> | |
| 770 struct Invoker<2, StorageType, R(X1, X2, X3, X4)> { | |
| 771 typedef R(RunType)(BindStateBase*, | |
| 772 typename CallbackParamTraits<X3>::ForwardType, | |
| 773 typename CallbackParamTraits<X4>::ForwardType); | |
| 774 | |
| 775 typedef R(UnboundRunType)(X3, X4); | |
| 776 | |
| 777 static R Run(BindStateBase* base, | |
| 778 typename CallbackParamTraits<X3>::ForwardType x3, | |
| 779 typename CallbackParamTraits<X4>::ForwardType x4) { | |
| 780 StorageType* storage = static_cast<StorageType*>(base); | |
| 781 | |
| 782 // Local references to make debugger stepping easier. If in a debugger, | |
| 783 // you really want to warp ahead and step through the | |
| 784 // InvokeHelper<>::MakeItSo() call below. | |
| 785 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits; | |
| 786 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits; | |
| 787 | |
| 788 typename Bound1UnwrapTraits::ForwardType x1 = | |
| 789 Bound1UnwrapTraits::Unwrap(storage->p1_); | |
| 790 typename Bound2UnwrapTraits::ForwardType x2 = | |
| 791 Bound2UnwrapTraits::Unwrap(storage->p2_); | |
| 792 return InvokeHelper<StorageType::IsWeakCall::value, R, | |
| 793 typename StorageType::RunnableType, | |
| 794 void(typename Bound1UnwrapTraits::ForwardType, | |
| 795 typename Bound2UnwrapTraits::ForwardType, | |
| 796 typename CallbackParamTraits<X3>::ForwardType x3, | |
| 797 typename CallbackParamTraits<X4>::ForwardType x4)> | |
| 798 ::MakeItSo(storage->runnable_, CallbackForward(x1), | |
| 799 CallbackForward(x2), CallbackForward(x3), | |
| 800 CallbackForward(x4)); | |
| 801 } | |
| 802 }; | |
| 803 | |
| 804 // Arity 4 -> 1. | |
| 805 template <typename StorageType, typename R,typename X1, typename X2, | |
| 806 typename X3, typename X4> | |
| 807 struct Invoker<3, StorageType, R(X1, X2, X3, X4)> { | |
| 808 typedef R(RunType)(BindStateBase*, | |
| 809 typename CallbackParamTraits<X4>::ForwardType); | |
| 810 | |
| 811 typedef R(UnboundRunType)(X4); | |
| 812 | |
| 813 static R Run(BindStateBase* base, | |
| 814 typename CallbackParamTraits<X4>::ForwardType x4) { | |
| 815 StorageType* storage = static_cast<StorageType*>(base); | |
| 816 | |
| 817 // Local references to make debugger stepping easier. If in a debugger, | |
| 818 // you really want to warp ahead and step through the | |
| 819 // InvokeHelper<>::MakeItSo() call below. | |
| 820 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits; | |
| 821 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits; | |
| 822 typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits; | |
| 823 | |
| 824 typename Bound1UnwrapTraits::ForwardType x1 = | |
| 825 Bound1UnwrapTraits::Unwrap(storage->p1_); | |
| 826 typename Bound2UnwrapTraits::ForwardType x2 = | |
| 827 Bound2UnwrapTraits::Unwrap(storage->p2_); | |
| 828 typename Bound3UnwrapTraits::ForwardType x3 = | |
| 829 Bound3UnwrapTraits::Unwrap(storage->p3_); | |
| 830 return InvokeHelper<StorageType::IsWeakCall::value, R, | |
| 831 typename StorageType::RunnableType, | |
| 832 void(typename Bound1UnwrapTraits::ForwardType, | |
| 833 typename Bound2UnwrapTraits::ForwardType, | |
| 834 typename Bound3UnwrapTraits::ForwardType, | |
| 835 typename CallbackParamTraits<X4>::ForwardType x4)> | |
| 836 ::MakeItSo(storage->runnable_, CallbackForward(x1), | |
| 837 CallbackForward(x2), CallbackForward(x3), | |
| 838 CallbackForward(x4)); | |
| 839 } | |
| 840 }; | |
| 841 | |
| 842 // Arity 4 -> 0. | |
| 843 template <typename StorageType, typename R,typename X1, typename X2, | |
| 844 typename X3, typename X4> | |
| 845 struct Invoker<4, StorageType, R(X1, X2, X3, X4)> { | |
| 846 typedef R(RunType)(BindStateBase*); | |
| 847 | |
| 848 typedef R(UnboundRunType)(); | |
| 849 | |
| 850 static R Run(BindStateBase* base) { | |
| 851 StorageType* storage = static_cast<StorageType*>(base); | |
| 852 | |
| 853 // Local references to make debugger stepping easier. If in a debugger, | |
| 854 // you really want to warp ahead and step through the | |
| 855 // InvokeHelper<>::MakeItSo() call below. | |
| 856 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits; | |
| 857 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits; | |
| 858 typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits; | |
| 859 typedef typename StorageType::Bound4UnwrapTraits Bound4UnwrapTraits; | |
| 860 | |
| 861 typename Bound1UnwrapTraits::ForwardType x1 = | |
| 862 Bound1UnwrapTraits::Unwrap(storage->p1_); | |
| 863 typename Bound2UnwrapTraits::ForwardType x2 = | |
| 864 Bound2UnwrapTraits::Unwrap(storage->p2_); | |
| 865 typename Bound3UnwrapTraits::ForwardType x3 = | |
| 866 Bound3UnwrapTraits::Unwrap(storage->p3_); | |
| 867 typename Bound4UnwrapTraits::ForwardType x4 = | |
| 868 Bound4UnwrapTraits::Unwrap(storage->p4_); | |
| 869 return InvokeHelper<StorageType::IsWeakCall::value, R, | |
| 870 typename StorageType::RunnableType, | |
| 871 void(typename Bound1UnwrapTraits::ForwardType, | |
| 872 typename Bound2UnwrapTraits::ForwardType, | |
| 873 typename Bound3UnwrapTraits::ForwardType, | |
| 874 typename Bound4UnwrapTraits::ForwardType)> | |
| 875 ::MakeItSo(storage->runnable_, CallbackForward(x1), | |
| 876 CallbackForward(x2), CallbackForward(x3), | |
| 877 CallbackForward(x4)); | |
| 878 } | |
| 879 }; | |
| 880 | |
| 881 // Arity 5 -> 5. | |
| 882 template <typename StorageType, typename R,typename X1, typename X2, | |
| 883 typename X3, typename X4, typename X5> | |
| 884 struct Invoker<0, StorageType, R(X1, X2, X3, X4, X5)> { | |
| 885 typedef R(RunType)(BindStateBase*, | |
| 886 typename CallbackParamTraits<X1>::ForwardType, | |
| 887 typename CallbackParamTraits<X2>::ForwardType, | |
| 888 typename CallbackParamTraits<X3>::ForwardType, | |
| 889 typename CallbackParamTraits<X4>::ForwardType, | |
| 890 typename CallbackParamTraits<X5>::ForwardType); | |
| 891 | |
| 892 typedef R(UnboundRunType)(X1, X2, X3, X4, X5); | |
| 893 | |
| 894 static R Run(BindStateBase* base, | |
| 895 typename CallbackParamTraits<X1>::ForwardType x1, | |
| 896 typename CallbackParamTraits<X2>::ForwardType x2, | |
| 897 typename CallbackParamTraits<X3>::ForwardType x3, | |
| 898 typename CallbackParamTraits<X4>::ForwardType x4, | |
| 899 typename CallbackParamTraits<X5>::ForwardType x5) { | |
| 900 StorageType* storage = static_cast<StorageType*>(base); | |
| 901 | |
| 902 // Local references to make debugger stepping easier. If in a debugger, | |
| 903 // you really want to warp ahead and step through the | |
| 904 // InvokeHelper<>::MakeItSo() call below. | |
| 905 | |
| 906 return InvokeHelper<StorageType::IsWeakCall::value, R, | |
| 907 typename StorageType::RunnableType, | |
| 908 void(typename CallbackParamTraits<X1>::ForwardType x1, | |
| 909 typename CallbackParamTraits<X2>::ForwardType x2, | |
| 910 typename CallbackParamTraits<X3>::ForwardType x3, | |
| 911 typename CallbackParamTraits<X4>::ForwardType x4, | |
| 912 typename CallbackParamTraits<X5>::ForwardType x5)> | |
| 913 ::MakeItSo(storage->runnable_, CallbackForward(x1), | |
| 914 CallbackForward(x2), CallbackForward(x3), | |
| 915 CallbackForward(x4), CallbackForward(x5)); | |
| 916 } | |
| 917 }; | |
| 918 | |
| 919 // Arity 5 -> 4. | |
| 920 template <typename StorageType, typename R,typename X1, typename X2, | |
| 921 typename X3, typename X4, typename X5> | |
| 922 struct Invoker<1, StorageType, R(X1, X2, X3, X4, X5)> { | |
| 923 typedef R(RunType)(BindStateBase*, | |
| 924 typename CallbackParamTraits<X2>::ForwardType, | |
| 925 typename CallbackParamTraits<X3>::ForwardType, | |
| 926 typename CallbackParamTraits<X4>::ForwardType, | |
| 927 typename CallbackParamTraits<X5>::ForwardType); | |
| 928 | |
| 929 typedef R(UnboundRunType)(X2, X3, X4, X5); | |
| 930 | |
| 931 static R Run(BindStateBase* base, | |
| 932 typename CallbackParamTraits<X2>::ForwardType x2, | |
| 933 typename CallbackParamTraits<X3>::ForwardType x3, | |
| 934 typename CallbackParamTraits<X4>::ForwardType x4, | |
| 935 typename CallbackParamTraits<X5>::ForwardType x5) { | |
| 936 StorageType* storage = static_cast<StorageType*>(base); | |
| 937 | |
| 938 // Local references to make debugger stepping easier. If in a debugger, | |
| 939 // you really want to warp ahead and step through the | |
| 940 // InvokeHelper<>::MakeItSo() call below. | |
| 941 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits; | |
| 942 | |
| 943 typename Bound1UnwrapTraits::ForwardType x1 = | |
| 944 Bound1UnwrapTraits::Unwrap(storage->p1_); | |
| 945 return InvokeHelper<StorageType::IsWeakCall::value, R, | |
| 946 typename StorageType::RunnableType, | |
| 947 void(typename Bound1UnwrapTraits::ForwardType, | |
| 948 typename CallbackParamTraits<X2>::ForwardType x2, | |
| 949 typename CallbackParamTraits<X3>::ForwardType x3, | |
| 950 typename CallbackParamTraits<X4>::ForwardType x4, | |
| 951 typename CallbackParamTraits<X5>::ForwardType x5)> | |
| 952 ::MakeItSo(storage->runnable_, CallbackForward(x1), | |
| 953 CallbackForward(x2), CallbackForward(x3), | |
| 954 CallbackForward(x4), CallbackForward(x5)); | |
| 955 } | |
| 956 }; | |
| 957 | |
| 958 // Arity 5 -> 3. | |
| 959 template <typename StorageType, typename R,typename X1, typename X2, | |
| 960 typename X3, typename X4, typename X5> | |
| 961 struct Invoker<2, StorageType, R(X1, X2, X3, X4, X5)> { | |
| 962 typedef R(RunType)(BindStateBase*, | |
| 963 typename CallbackParamTraits<X3>::ForwardType, | |
| 964 typename CallbackParamTraits<X4>::ForwardType, | |
| 965 typename CallbackParamTraits<X5>::ForwardType); | |
| 966 | |
| 967 typedef R(UnboundRunType)(X3, X4, X5); | |
| 968 | |
| 969 static R Run(BindStateBase* base, | |
| 970 typename CallbackParamTraits<X3>::ForwardType x3, | |
| 971 typename CallbackParamTraits<X4>::ForwardType x4, | |
| 972 typename CallbackParamTraits<X5>::ForwardType x5) { | |
| 973 StorageType* storage = static_cast<StorageType*>(base); | |
| 974 | |
| 975 // Local references to make debugger stepping easier. If in a debugger, | |
| 976 // you really want to warp ahead and step through the | |
| 977 // InvokeHelper<>::MakeItSo() call below. | |
| 978 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits; | |
| 979 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits; | |
| 980 | |
| 981 typename Bound1UnwrapTraits::ForwardType x1 = | |
| 982 Bound1UnwrapTraits::Unwrap(storage->p1_); | |
| 983 typename Bound2UnwrapTraits::ForwardType x2 = | |
| 984 Bound2UnwrapTraits::Unwrap(storage->p2_); | |
| 985 return InvokeHelper<StorageType::IsWeakCall::value, R, | |
| 986 typename StorageType::RunnableType, | |
| 987 void(typename Bound1UnwrapTraits::ForwardType, | |
| 988 typename Bound2UnwrapTraits::ForwardType, | |
| 989 typename CallbackParamTraits<X3>::ForwardType x3, | |
| 990 typename CallbackParamTraits<X4>::ForwardType x4, | |
| 991 typename CallbackParamTraits<X5>::ForwardType x5)> | |
| 992 ::MakeItSo(storage->runnable_, CallbackForward(x1), | |
| 993 CallbackForward(x2), CallbackForward(x3), | |
| 994 CallbackForward(x4), CallbackForward(x5)); | |
| 995 } | |
| 996 }; | |
| 997 | |
| 998 // Arity 5 -> 2. | |
| 999 template <typename StorageType, typename R,typename X1, typename X2, | |
| 1000 typename X3, typename X4, typename X5> | |
| 1001 struct Invoker<3, StorageType, R(X1, X2, X3, X4, X5)> { | |
| 1002 typedef R(RunType)(BindStateBase*, | |
| 1003 typename CallbackParamTraits<X4>::ForwardType, | |
| 1004 typename CallbackParamTraits<X5>::ForwardType); | |
| 1005 | |
| 1006 typedef R(UnboundRunType)(X4, X5); | |
| 1007 | |
| 1008 static R Run(BindStateBase* base, | |
| 1009 typename CallbackParamTraits<X4>::ForwardType x4, | |
| 1010 typename CallbackParamTraits<X5>::ForwardType x5) { | |
| 1011 StorageType* storage = static_cast<StorageType*>(base); | |
| 1012 | |
| 1013 // Local references to make debugger stepping easier. If in a debugger, | |
| 1014 // you really want to warp ahead and step through the | |
| 1015 // InvokeHelper<>::MakeItSo() call below. | |
| 1016 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits; | |
| 1017 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits; | |
| 1018 typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits; | |
| 1019 | |
| 1020 typename Bound1UnwrapTraits::ForwardType x1 = | |
| 1021 Bound1UnwrapTraits::Unwrap(storage->p1_); | |
| 1022 typename Bound2UnwrapTraits::ForwardType x2 = | |
| 1023 Bound2UnwrapTraits::Unwrap(storage->p2_); | |
| 1024 typename Bound3UnwrapTraits::ForwardType x3 = | |
| 1025 Bound3UnwrapTraits::Unwrap(storage->p3_); | |
| 1026 return InvokeHelper<StorageType::IsWeakCall::value, R, | |
| 1027 typename StorageType::RunnableType, | |
| 1028 void(typename Bound1UnwrapTraits::ForwardType, | |
| 1029 typename Bound2UnwrapTraits::ForwardType, | |
| 1030 typename Bound3UnwrapTraits::ForwardType, | |
| 1031 typename CallbackParamTraits<X4>::ForwardType x4, | |
| 1032 typename CallbackParamTraits<X5>::ForwardType x5)> | |
| 1033 ::MakeItSo(storage->runnable_, CallbackForward(x1), | |
| 1034 CallbackForward(x2), CallbackForward(x3), | |
| 1035 CallbackForward(x4), CallbackForward(x5)); | |
| 1036 } | |
| 1037 }; | |
| 1038 | |
| 1039 // Arity 5 -> 1. | |
| 1040 template <typename StorageType, typename R,typename X1, typename X2, | |
| 1041 typename X3, typename X4, typename X5> | |
| 1042 struct Invoker<4, StorageType, R(X1, X2, X3, X4, X5)> { | |
| 1043 typedef R(RunType)(BindStateBase*, | |
| 1044 typename CallbackParamTraits<X5>::ForwardType); | |
| 1045 | |
| 1046 typedef R(UnboundRunType)(X5); | |
| 1047 | |
| 1048 static R Run(BindStateBase* base, | |
| 1049 typename CallbackParamTraits<X5>::ForwardType x5) { | |
| 1050 StorageType* storage = static_cast<StorageType*>(base); | |
| 1051 | |
| 1052 // Local references to make debugger stepping easier. If in a debugger, | |
| 1053 // you really want to warp ahead and step through the | |
| 1054 // InvokeHelper<>::MakeItSo() call below. | |
| 1055 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits; | |
| 1056 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits; | |
| 1057 typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits; | |
| 1058 typedef typename StorageType::Bound4UnwrapTraits Bound4UnwrapTraits; | |
| 1059 | |
| 1060 typename Bound1UnwrapTraits::ForwardType x1 = | |
| 1061 Bound1UnwrapTraits::Unwrap(storage->p1_); | |
| 1062 typename Bound2UnwrapTraits::ForwardType x2 = | |
| 1063 Bound2UnwrapTraits::Unwrap(storage->p2_); | |
| 1064 typename Bound3UnwrapTraits::ForwardType x3 = | |
| 1065 Bound3UnwrapTraits::Unwrap(storage->p3_); | |
| 1066 typename Bound4UnwrapTraits::ForwardType x4 = | |
| 1067 Bound4UnwrapTraits::Unwrap(storage->p4_); | |
| 1068 return InvokeHelper<StorageType::IsWeakCall::value, R, | |
| 1069 typename StorageType::RunnableType, | |
| 1070 void(typename Bound1UnwrapTraits::ForwardType, | |
| 1071 typename Bound2UnwrapTraits::ForwardType, | |
| 1072 typename Bound3UnwrapTraits::ForwardType, | |
| 1073 typename Bound4UnwrapTraits::ForwardType, | |
| 1074 typename CallbackParamTraits<X5>::ForwardType x5)> | |
| 1075 ::MakeItSo(storage->runnable_, CallbackForward(x1), | |
| 1076 CallbackForward(x2), CallbackForward(x3), | |
| 1077 CallbackForward(x4), CallbackForward(x5)); | |
| 1078 } | |
| 1079 }; | |
| 1080 | |
| 1081 // Arity 5 -> 0. | |
| 1082 template <typename StorageType, typename R,typename X1, typename X2, | |
| 1083 typename X3, typename X4, typename X5> | |
| 1084 struct Invoker<5, StorageType, R(X1, X2, X3, X4, X5)> { | |
| 1085 typedef R(RunType)(BindStateBase*); | |
| 1086 | |
| 1087 typedef R(UnboundRunType)(); | |
| 1088 | |
| 1089 static R Run(BindStateBase* base) { | |
| 1090 StorageType* storage = static_cast<StorageType*>(base); | |
| 1091 | |
| 1092 // Local references to make debugger stepping easier. If in a debugger, | |
| 1093 // you really want to warp ahead and step through the | |
| 1094 // InvokeHelper<>::MakeItSo() call below. | |
| 1095 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits; | |
| 1096 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits; | |
| 1097 typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits; | |
| 1098 typedef typename StorageType::Bound4UnwrapTraits Bound4UnwrapTraits; | |
| 1099 typedef typename StorageType::Bound5UnwrapTraits Bound5UnwrapTraits; | |
| 1100 | |
| 1101 typename Bound1UnwrapTraits::ForwardType x1 = | |
| 1102 Bound1UnwrapTraits::Unwrap(storage->p1_); | |
| 1103 typename Bound2UnwrapTraits::ForwardType x2 = | |
| 1104 Bound2UnwrapTraits::Unwrap(storage->p2_); | |
| 1105 typename Bound3UnwrapTraits::ForwardType x3 = | |
| 1106 Bound3UnwrapTraits::Unwrap(storage->p3_); | |
| 1107 typename Bound4UnwrapTraits::ForwardType x4 = | |
| 1108 Bound4UnwrapTraits::Unwrap(storage->p4_); | |
| 1109 typename Bound5UnwrapTraits::ForwardType x5 = | |
| 1110 Bound5UnwrapTraits::Unwrap(storage->p5_); | |
| 1111 return InvokeHelper<StorageType::IsWeakCall::value, R, | |
| 1112 typename StorageType::RunnableType, | |
| 1113 void(typename Bound1UnwrapTraits::ForwardType, | |
| 1114 typename Bound2UnwrapTraits::ForwardType, | |
| 1115 typename Bound3UnwrapTraits::ForwardType, | |
| 1116 typename Bound4UnwrapTraits::ForwardType, | |
| 1117 typename Bound5UnwrapTraits::ForwardType)> | |
| 1118 ::MakeItSo(storage->runnable_, CallbackForward(x1), | |
| 1119 CallbackForward(x2), CallbackForward(x3), | |
| 1120 CallbackForward(x4), CallbackForward(x5)); | |
| 1121 } | |
| 1122 }; | |
| 1123 | |
| 1124 // Arity 6 -> 6. | |
| 1125 template <typename StorageType, typename R,typename X1, typename X2, | |
| 1126 typename X3, typename X4, typename X5, typename X6> | |
| 1127 struct Invoker<0, StorageType, R(X1, X2, X3, X4, X5, X6)> { | |
| 1128 typedef R(RunType)(BindStateBase*, | |
| 1129 typename CallbackParamTraits<X1>::ForwardType, | |
| 1130 typename CallbackParamTraits<X2>::ForwardType, | |
| 1131 typename CallbackParamTraits<X3>::ForwardType, | |
| 1132 typename CallbackParamTraits<X4>::ForwardType, | |
| 1133 typename CallbackParamTraits<X5>::ForwardType, | |
| 1134 typename CallbackParamTraits<X6>::ForwardType); | |
| 1135 | |
| 1136 typedef R(UnboundRunType)(X1, X2, X3, X4, X5, X6); | |
| 1137 | |
| 1138 static R Run(BindStateBase* base, | |
| 1139 typename CallbackParamTraits<X1>::ForwardType x1, | |
| 1140 typename CallbackParamTraits<X2>::ForwardType x2, | |
| 1141 typename CallbackParamTraits<X3>::ForwardType x3, | |
| 1142 typename CallbackParamTraits<X4>::ForwardType x4, | |
| 1143 typename CallbackParamTraits<X5>::ForwardType x5, | |
| 1144 typename CallbackParamTraits<X6>::ForwardType x6) { | |
| 1145 StorageType* storage = static_cast<StorageType*>(base); | |
| 1146 | |
| 1147 // Local references to make debugger stepping easier. If in a debugger, | |
| 1148 // you really want to warp ahead and step through the | |
| 1149 // InvokeHelper<>::MakeItSo() call below. | |
| 1150 | |
| 1151 return InvokeHelper<StorageType::IsWeakCall::value, R, | |
| 1152 typename StorageType::RunnableType, | |
| 1153 void(typename CallbackParamTraits<X1>::ForwardType x1, | |
| 1154 typename CallbackParamTraits<X2>::ForwardType x2, | |
| 1155 typename CallbackParamTraits<X3>::ForwardType x3, | |
| 1156 typename CallbackParamTraits<X4>::ForwardType x4, | |
| 1157 typename CallbackParamTraits<X5>::ForwardType x5, | |
| 1158 typename CallbackParamTraits<X6>::ForwardType x6)> | |
| 1159 ::MakeItSo(storage->runnable_, CallbackForward(x1), | |
| 1160 CallbackForward(x2), CallbackForward(x3), | |
| 1161 CallbackForward(x4), CallbackForward(x5), | |
| 1162 CallbackForward(x6)); | |
| 1163 } | |
| 1164 }; | |
| 1165 | |
| 1166 // Arity 6 -> 5. | |
| 1167 template <typename StorageType, typename R,typename X1, typename X2, | |
| 1168 typename X3, typename X4, typename X5, typename X6> | |
| 1169 struct Invoker<1, StorageType, R(X1, X2, X3, X4, X5, X6)> { | |
| 1170 typedef R(RunType)(BindStateBase*, | |
| 1171 typename CallbackParamTraits<X2>::ForwardType, | |
| 1172 typename CallbackParamTraits<X3>::ForwardType, | |
| 1173 typename CallbackParamTraits<X4>::ForwardType, | |
| 1174 typename CallbackParamTraits<X5>::ForwardType, | |
| 1175 typename CallbackParamTraits<X6>::ForwardType); | |
| 1176 | |
| 1177 typedef R(UnboundRunType)(X2, X3, X4, X5, X6); | |
| 1178 | |
| 1179 static R Run(BindStateBase* base, | |
| 1180 typename CallbackParamTraits<X2>::ForwardType x2, | |
| 1181 typename CallbackParamTraits<X3>::ForwardType x3, | |
| 1182 typename CallbackParamTraits<X4>::ForwardType x4, | |
| 1183 typename CallbackParamTraits<X5>::ForwardType x5, | |
| 1184 typename CallbackParamTraits<X6>::ForwardType x6) { | |
| 1185 StorageType* storage = static_cast<StorageType*>(base); | |
| 1186 | |
| 1187 // Local references to make debugger stepping easier. If in a debugger, | |
| 1188 // you really want to warp ahead and step through the | |
| 1189 // InvokeHelper<>::MakeItSo() call below. | |
| 1190 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits; | |
| 1191 | |
| 1192 typename Bound1UnwrapTraits::ForwardType x1 = | |
| 1193 Bound1UnwrapTraits::Unwrap(storage->p1_); | |
| 1194 return InvokeHelper<StorageType::IsWeakCall::value, R, | |
| 1195 typename StorageType::RunnableType, | |
| 1196 void(typename Bound1UnwrapTraits::ForwardType, | |
| 1197 typename CallbackParamTraits<X2>::ForwardType x2, | |
| 1198 typename CallbackParamTraits<X3>::ForwardType x3, | |
| 1199 typename CallbackParamTraits<X4>::ForwardType x4, | |
| 1200 typename CallbackParamTraits<X5>::ForwardType x5, | |
| 1201 typename CallbackParamTraits<X6>::ForwardType x6)> | |
| 1202 ::MakeItSo(storage->runnable_, CallbackForward(x1), | |
| 1203 CallbackForward(x2), CallbackForward(x3), | |
| 1204 CallbackForward(x4), CallbackForward(x5), | |
| 1205 CallbackForward(x6)); | |
| 1206 } | |
| 1207 }; | |
| 1208 | |
| 1209 // Arity 6 -> 4. | |
| 1210 template <typename StorageType, typename R,typename X1, typename X2, | |
| 1211 typename X3, typename X4, typename X5, typename X6> | |
| 1212 struct Invoker<2, StorageType, R(X1, X2, X3, X4, X5, X6)> { | |
| 1213 typedef R(RunType)(BindStateBase*, | |
| 1214 typename CallbackParamTraits<X3>::ForwardType, | |
| 1215 typename CallbackParamTraits<X4>::ForwardType, | |
| 1216 typename CallbackParamTraits<X5>::ForwardType, | |
| 1217 typename CallbackParamTraits<X6>::ForwardType); | |
| 1218 | |
| 1219 typedef R(UnboundRunType)(X3, X4, X5, X6); | |
| 1220 | |
| 1221 static R Run(BindStateBase* base, | |
| 1222 typename CallbackParamTraits<X3>::ForwardType x3, | |
| 1223 typename CallbackParamTraits<X4>::ForwardType x4, | |
| 1224 typename CallbackParamTraits<X5>::ForwardType x5, | |
| 1225 typename CallbackParamTraits<X6>::ForwardType x6) { | |
| 1226 StorageType* storage = static_cast<StorageType*>(base); | |
| 1227 | |
| 1228 // Local references to make debugger stepping easier. If in a debugger, | |
| 1229 // you really want to warp ahead and step through the | |
| 1230 // InvokeHelper<>::MakeItSo() call below. | |
| 1231 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits; | |
| 1232 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits; | |
| 1233 | |
| 1234 typename Bound1UnwrapTraits::ForwardType x1 = | |
| 1235 Bound1UnwrapTraits::Unwrap(storage->p1_); | |
| 1236 typename Bound2UnwrapTraits::ForwardType x2 = | |
| 1237 Bound2UnwrapTraits::Unwrap(storage->p2_); | |
| 1238 return InvokeHelper<StorageType::IsWeakCall::value, R, | |
| 1239 typename StorageType::RunnableType, | |
| 1240 void(typename Bound1UnwrapTraits::ForwardType, | |
| 1241 typename Bound2UnwrapTraits::ForwardType, | |
| 1242 typename CallbackParamTraits<X3>::ForwardType x3, | |
| 1243 typename CallbackParamTraits<X4>::ForwardType x4, | |
| 1244 typename CallbackParamTraits<X5>::ForwardType x5, | |
| 1245 typename CallbackParamTraits<X6>::ForwardType x6)> | |
| 1246 ::MakeItSo(storage->runnable_, CallbackForward(x1), | |
| 1247 CallbackForward(x2), CallbackForward(x3), | |
| 1248 CallbackForward(x4), CallbackForward(x5), | |
| 1249 CallbackForward(x6)); | |
| 1250 } | |
| 1251 }; | |
| 1252 | |
| 1253 // Arity 6 -> 3. | |
| 1254 template <typename StorageType, typename R,typename X1, typename X2, | |
| 1255 typename X3, typename X4, typename X5, typename X6> | |
| 1256 struct Invoker<3, StorageType, R(X1, X2, X3, X4, X5, X6)> { | |
| 1257 typedef R(RunType)(BindStateBase*, | |
| 1258 typename CallbackParamTraits<X4>::ForwardType, | |
| 1259 typename CallbackParamTraits<X5>::ForwardType, | |
| 1260 typename CallbackParamTraits<X6>::ForwardType); | |
| 1261 | |
| 1262 typedef R(UnboundRunType)(X4, X5, X6); | |
| 1263 | |
| 1264 static R Run(BindStateBase* base, | |
| 1265 typename CallbackParamTraits<X4>::ForwardType x4, | |
| 1266 typename CallbackParamTraits<X5>::ForwardType x5, | |
| 1267 typename CallbackParamTraits<X6>::ForwardType x6) { | |
| 1268 StorageType* storage = static_cast<StorageType*>(base); | |
| 1269 | |
| 1270 // Local references to make debugger stepping easier. If in a debugger, | |
| 1271 // you really want to warp ahead and step through the | |
| 1272 // InvokeHelper<>::MakeItSo() call below. | |
| 1273 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits; | |
| 1274 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits; | |
| 1275 typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits; | |
| 1276 | |
| 1277 typename Bound1UnwrapTraits::ForwardType x1 = | |
| 1278 Bound1UnwrapTraits::Unwrap(storage->p1_); | |
| 1279 typename Bound2UnwrapTraits::ForwardType x2 = | |
| 1280 Bound2UnwrapTraits::Unwrap(storage->p2_); | |
| 1281 typename Bound3UnwrapTraits::ForwardType x3 = | |
| 1282 Bound3UnwrapTraits::Unwrap(storage->p3_); | |
| 1283 return InvokeHelper<StorageType::IsWeakCall::value, R, | |
| 1284 typename StorageType::RunnableType, | |
| 1285 void(typename Bound1UnwrapTraits::ForwardType, | |
| 1286 typename Bound2UnwrapTraits::ForwardType, | |
| 1287 typename Bound3UnwrapTraits::ForwardType, | |
| 1288 typename CallbackParamTraits<X4>::ForwardType x4, | |
| 1289 typename CallbackParamTraits<X5>::ForwardType x5, | |
| 1290 typename CallbackParamTraits<X6>::ForwardType x6)> | |
| 1291 ::MakeItSo(storage->runnable_, CallbackForward(x1), | |
| 1292 CallbackForward(x2), CallbackForward(x3), | |
| 1293 CallbackForward(x4), CallbackForward(x5), | |
| 1294 CallbackForward(x6)); | |
| 1295 } | |
| 1296 }; | |
| 1297 | |
| 1298 // Arity 6 -> 2. | |
| 1299 template <typename StorageType, typename R,typename X1, typename X2, | |
| 1300 typename X3, typename X4, typename X5, typename X6> | |
| 1301 struct Invoker<4, StorageType, R(X1, X2, X3, X4, X5, X6)> { | |
| 1302 typedef R(RunType)(BindStateBase*, | |
| 1303 typename CallbackParamTraits<X5>::ForwardType, | |
| 1304 typename CallbackParamTraits<X6>::ForwardType); | |
| 1305 | |
| 1306 typedef R(UnboundRunType)(X5, X6); | |
| 1307 | |
| 1308 static R Run(BindStateBase* base, | |
| 1309 typename CallbackParamTraits<X5>::ForwardType x5, | |
| 1310 typename CallbackParamTraits<X6>::ForwardType x6) { | |
| 1311 StorageType* storage = static_cast<StorageType*>(base); | |
| 1312 | |
| 1313 // Local references to make debugger stepping easier. If in a debugger, | |
| 1314 // you really want to warp ahead and step through the | |
| 1315 // InvokeHelper<>::MakeItSo() call below. | |
| 1316 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits; | |
| 1317 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits; | |
| 1318 typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits; | |
| 1319 typedef typename StorageType::Bound4UnwrapTraits Bound4UnwrapTraits; | |
| 1320 | |
| 1321 typename Bound1UnwrapTraits::ForwardType x1 = | |
| 1322 Bound1UnwrapTraits::Unwrap(storage->p1_); | |
| 1323 typename Bound2UnwrapTraits::ForwardType x2 = | |
| 1324 Bound2UnwrapTraits::Unwrap(storage->p2_); | |
| 1325 typename Bound3UnwrapTraits::ForwardType x3 = | |
| 1326 Bound3UnwrapTraits::Unwrap(storage->p3_); | |
| 1327 typename Bound4UnwrapTraits::ForwardType x4 = | |
| 1328 Bound4UnwrapTraits::Unwrap(storage->p4_); | |
| 1329 return InvokeHelper<StorageType::IsWeakCall::value, R, | |
| 1330 typename StorageType::RunnableType, | |
| 1331 void(typename Bound1UnwrapTraits::ForwardType, | |
| 1332 typename Bound2UnwrapTraits::ForwardType, | |
| 1333 typename Bound3UnwrapTraits::ForwardType, | |
| 1334 typename Bound4UnwrapTraits::ForwardType, | |
| 1335 typename CallbackParamTraits<X5>::ForwardType x5, | |
| 1336 typename CallbackParamTraits<X6>::ForwardType x6)> | |
| 1337 ::MakeItSo(storage->runnable_, CallbackForward(x1), | |
| 1338 CallbackForward(x2), CallbackForward(x3), | |
| 1339 CallbackForward(x4), CallbackForward(x5), | |
| 1340 CallbackForward(x6)); | |
| 1341 } | |
| 1342 }; | |
| 1343 | |
| 1344 // Arity 6 -> 1. | |
| 1345 template <typename StorageType, typename R,typename X1, typename X2, | |
| 1346 typename X3, typename X4, typename X5, typename X6> | |
| 1347 struct Invoker<5, StorageType, R(X1, X2, X3, X4, X5, X6)> { | |
| 1348 typedef R(RunType)(BindStateBase*, | |
| 1349 typename CallbackParamTraits<X6>::ForwardType); | |
| 1350 | |
| 1351 typedef R(UnboundRunType)(X6); | |
| 1352 | |
| 1353 static R Run(BindStateBase* base, | |
| 1354 typename CallbackParamTraits<X6>::ForwardType x6) { | |
| 1355 StorageType* storage = static_cast<StorageType*>(base); | |
| 1356 | |
| 1357 // Local references to make debugger stepping easier. If in a debugger, | |
| 1358 // you really want to warp ahead and step through the | |
| 1359 // InvokeHelper<>::MakeItSo() call below. | |
| 1360 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits; | |
| 1361 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits; | |
| 1362 typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits; | |
| 1363 typedef typename StorageType::Bound4UnwrapTraits Bound4UnwrapTraits; | |
| 1364 typedef typename StorageType::Bound5UnwrapTraits Bound5UnwrapTraits; | |
| 1365 | |
| 1366 typename Bound1UnwrapTraits::ForwardType x1 = | |
| 1367 Bound1UnwrapTraits::Unwrap(storage->p1_); | |
| 1368 typename Bound2UnwrapTraits::ForwardType x2 = | |
| 1369 Bound2UnwrapTraits::Unwrap(storage->p2_); | |
| 1370 typename Bound3UnwrapTraits::ForwardType x3 = | |
| 1371 Bound3UnwrapTraits::Unwrap(storage->p3_); | |
| 1372 typename Bound4UnwrapTraits::ForwardType x4 = | |
| 1373 Bound4UnwrapTraits::Unwrap(storage->p4_); | |
| 1374 typename Bound5UnwrapTraits::ForwardType x5 = | |
| 1375 Bound5UnwrapTraits::Unwrap(storage->p5_); | |
| 1376 return InvokeHelper<StorageType::IsWeakCall::value, R, | |
| 1377 typename StorageType::RunnableType, | |
| 1378 void(typename Bound1UnwrapTraits::ForwardType, | |
| 1379 typename Bound2UnwrapTraits::ForwardType, | |
| 1380 typename Bound3UnwrapTraits::ForwardType, | |
| 1381 typename Bound4UnwrapTraits::ForwardType, | |
| 1382 typename Bound5UnwrapTraits::ForwardType, | |
| 1383 typename CallbackParamTraits<X6>::ForwardType x6)> | |
| 1384 ::MakeItSo(storage->runnable_, CallbackForward(x1), | |
| 1385 CallbackForward(x2), CallbackForward(x3), | |
| 1386 CallbackForward(x4), CallbackForward(x5), | |
| 1387 CallbackForward(x6)); | |
| 1388 } | |
| 1389 }; | |
| 1390 | |
| 1391 // Arity 6 -> 0. | |
| 1392 template <typename StorageType, typename R,typename X1, typename X2, | |
| 1393 typename X3, typename X4, typename X5, typename X6> | |
| 1394 struct Invoker<6, StorageType, R(X1, X2, X3, X4, X5, X6)> { | |
| 1395 typedef R(RunType)(BindStateBase*); | |
| 1396 | |
| 1397 typedef R(UnboundRunType)(); | |
| 1398 | |
| 1399 static R Run(BindStateBase* base) { | |
| 1400 StorageType* storage = static_cast<StorageType*>(base); | |
| 1401 | |
| 1402 // Local references to make debugger stepping easier. If in a debugger, | |
| 1403 // you really want to warp ahead and step through the | |
| 1404 // InvokeHelper<>::MakeItSo() call below. | |
| 1405 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits; | |
| 1406 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits; | |
| 1407 typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits; | |
| 1408 typedef typename StorageType::Bound4UnwrapTraits Bound4UnwrapTraits; | |
| 1409 typedef typename StorageType::Bound5UnwrapTraits Bound5UnwrapTraits; | |
| 1410 typedef typename StorageType::Bound6UnwrapTraits Bound6UnwrapTraits; | |
| 1411 | |
| 1412 typename Bound1UnwrapTraits::ForwardType x1 = | |
| 1413 Bound1UnwrapTraits::Unwrap(storage->p1_); | |
| 1414 typename Bound2UnwrapTraits::ForwardType x2 = | |
| 1415 Bound2UnwrapTraits::Unwrap(storage->p2_); | |
| 1416 typename Bound3UnwrapTraits::ForwardType x3 = | |
| 1417 Bound3UnwrapTraits::Unwrap(storage->p3_); | |
| 1418 typename Bound4UnwrapTraits::ForwardType x4 = | |
| 1419 Bound4UnwrapTraits::Unwrap(storage->p4_); | |
| 1420 typename Bound5UnwrapTraits::ForwardType x5 = | |
| 1421 Bound5UnwrapTraits::Unwrap(storage->p5_); | |
| 1422 typename Bound6UnwrapTraits::ForwardType x6 = | |
| 1423 Bound6UnwrapTraits::Unwrap(storage->p6_); | |
| 1424 return InvokeHelper<StorageType::IsWeakCall::value, R, | |
| 1425 typename StorageType::RunnableType, | |
| 1426 void(typename Bound1UnwrapTraits::ForwardType, | |
| 1427 typename Bound2UnwrapTraits::ForwardType, | |
| 1428 typename Bound3UnwrapTraits::ForwardType, | |
| 1429 typename Bound4UnwrapTraits::ForwardType, | |
| 1430 typename Bound5UnwrapTraits::ForwardType, | |
| 1431 typename Bound6UnwrapTraits::ForwardType)> | |
| 1432 ::MakeItSo(storage->runnable_, CallbackForward(x1), | |
| 1433 CallbackForward(x2), CallbackForward(x3), | |
| 1434 CallbackForward(x4), CallbackForward(x5), | |
| 1435 CallbackForward(x6)); | |
| 1436 } | |
| 1437 }; | |
| 1438 | |
| 1439 // Arity 7 -> 7. | |
| 1440 template <typename StorageType, typename R,typename X1, typename X2, | |
| 1441 typename X3, typename X4, typename X5, typename X6, typename X7> | |
| 1442 struct Invoker<0, StorageType, R(X1, X2, X3, X4, X5, X6, X7)> { | |
| 1443 typedef R(RunType)(BindStateBase*, | |
| 1444 typename CallbackParamTraits<X1>::ForwardType, | |
| 1445 typename CallbackParamTraits<X2>::ForwardType, | |
| 1446 typename CallbackParamTraits<X3>::ForwardType, | |
| 1447 typename CallbackParamTraits<X4>::ForwardType, | |
| 1448 typename CallbackParamTraits<X5>::ForwardType, | |
| 1449 typename CallbackParamTraits<X6>::ForwardType, | |
| 1450 typename CallbackParamTraits<X7>::ForwardType); | |
| 1451 | |
| 1452 typedef R(UnboundRunType)(X1, X2, X3, X4, X5, X6, X7); | |
| 1453 | |
| 1454 static R Run(BindStateBase* base, | |
| 1455 typename CallbackParamTraits<X1>::ForwardType x1, | |
| 1456 typename CallbackParamTraits<X2>::ForwardType x2, | |
| 1457 typename CallbackParamTraits<X3>::ForwardType x3, | |
| 1458 typename CallbackParamTraits<X4>::ForwardType x4, | |
| 1459 typename CallbackParamTraits<X5>::ForwardType x5, | |
| 1460 typename CallbackParamTraits<X6>::ForwardType x6, | |
| 1461 typename CallbackParamTraits<X7>::ForwardType x7) { | |
| 1462 StorageType* storage = static_cast<StorageType*>(base); | |
| 1463 | |
| 1464 // Local references to make debugger stepping easier. If in a debugger, | |
| 1465 // you really want to warp ahead and step through the | |
| 1466 // InvokeHelper<>::MakeItSo() call below. | |
| 1467 | |
| 1468 return InvokeHelper<StorageType::IsWeakCall::value, R, | |
| 1469 typename StorageType::RunnableType, | |
| 1470 void(typename CallbackParamTraits<X1>::ForwardType x1, | |
| 1471 typename CallbackParamTraits<X2>::ForwardType x2, | |
| 1472 typename CallbackParamTraits<X3>::ForwardType x3, | |
| 1473 typename CallbackParamTraits<X4>::ForwardType x4, | |
| 1474 typename CallbackParamTraits<X5>::ForwardType x5, | |
| 1475 typename CallbackParamTraits<X6>::ForwardType x6, | |
| 1476 typename CallbackParamTraits<X7>::ForwardType x7)> | |
| 1477 ::MakeItSo(storage->runnable_, CallbackForward(x1), | |
| 1478 CallbackForward(x2), CallbackForward(x3), | |
| 1479 CallbackForward(x4), CallbackForward(x5), | |
| 1480 CallbackForward(x6), CallbackForward(x7)); | |
| 1481 } | |
| 1482 }; | |
| 1483 | |
| 1484 // Arity 7 -> 6. | |
| 1485 template <typename StorageType, typename R,typename X1, typename X2, | |
| 1486 typename X3, typename X4, typename X5, typename X6, typename X7> | |
| 1487 struct Invoker<1, StorageType, R(X1, X2, X3, X4, X5, X6, X7)> { | |
| 1488 typedef R(RunType)(BindStateBase*, | |
| 1489 typename CallbackParamTraits<X2>::ForwardType, | |
| 1490 typename CallbackParamTraits<X3>::ForwardType, | |
| 1491 typename CallbackParamTraits<X4>::ForwardType, | |
| 1492 typename CallbackParamTraits<X5>::ForwardType, | |
| 1493 typename CallbackParamTraits<X6>::ForwardType, | |
| 1494 typename CallbackParamTraits<X7>::ForwardType); | |
| 1495 | |
| 1496 typedef R(UnboundRunType)(X2, X3, X4, X5, X6, X7); | |
| 1497 | |
| 1498 static R Run(BindStateBase* base, | |
| 1499 typename CallbackParamTraits<X2>::ForwardType x2, | |
| 1500 typename CallbackParamTraits<X3>::ForwardType x3, | |
| 1501 typename CallbackParamTraits<X4>::ForwardType x4, | |
| 1502 typename CallbackParamTraits<X5>::ForwardType x5, | |
| 1503 typename CallbackParamTraits<X6>::ForwardType x6, | |
| 1504 typename CallbackParamTraits<X7>::ForwardType x7) { | |
| 1505 StorageType* storage = static_cast<StorageType*>(base); | |
| 1506 | |
| 1507 // Local references to make debugger stepping easier. If in a debugger, | |
| 1508 // you really want to warp ahead and step through the | |
| 1509 // InvokeHelper<>::MakeItSo() call below. | |
| 1510 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits; | |
| 1511 | |
| 1512 typename Bound1UnwrapTraits::ForwardType x1 = | |
| 1513 Bound1UnwrapTraits::Unwrap(storage->p1_); | |
| 1514 return InvokeHelper<StorageType::IsWeakCall::value, R, | |
| 1515 typename StorageType::RunnableType, | |
| 1516 void(typename Bound1UnwrapTraits::ForwardType, | |
| 1517 typename CallbackParamTraits<X2>::ForwardType x2, | |
| 1518 typename CallbackParamTraits<X3>::ForwardType x3, | |
| 1519 typename CallbackParamTraits<X4>::ForwardType x4, | |
| 1520 typename CallbackParamTraits<X5>::ForwardType x5, | |
| 1521 typename CallbackParamTraits<X6>::ForwardType x6, | |
| 1522 typename CallbackParamTraits<X7>::ForwardType x7)> | |
| 1523 ::MakeItSo(storage->runnable_, CallbackForward(x1), | |
| 1524 CallbackForward(x2), CallbackForward(x3), | |
| 1525 CallbackForward(x4), CallbackForward(x5), | |
| 1526 CallbackForward(x6), CallbackForward(x7)); | |
| 1527 } | |
| 1528 }; | |
| 1529 | |
| 1530 // Arity 7 -> 5. | |
| 1531 template <typename StorageType, typename R,typename X1, typename X2, | |
| 1532 typename X3, typename X4, typename X5, typename X6, typename X7> | |
| 1533 struct Invoker<2, StorageType, R(X1, X2, X3, X4, X5, X6, X7)> { | |
| 1534 typedef R(RunType)(BindStateBase*, | |
| 1535 typename CallbackParamTraits<X3>::ForwardType, | |
| 1536 typename CallbackParamTraits<X4>::ForwardType, | |
| 1537 typename CallbackParamTraits<X5>::ForwardType, | |
| 1538 typename CallbackParamTraits<X6>::ForwardType, | |
| 1539 typename CallbackParamTraits<X7>::ForwardType); | |
| 1540 | |
| 1541 typedef R(UnboundRunType)(X3, X4, X5, X6, X7); | |
| 1542 | |
| 1543 static R Run(BindStateBase* base, | |
| 1544 typename CallbackParamTraits<X3>::ForwardType x3, | |
| 1545 typename CallbackParamTraits<X4>::ForwardType x4, | |
| 1546 typename CallbackParamTraits<X5>::ForwardType x5, | |
| 1547 typename CallbackParamTraits<X6>::ForwardType x6, | |
| 1548 typename CallbackParamTraits<X7>::ForwardType x7) { | |
| 1549 StorageType* storage = static_cast<StorageType*>(base); | |
| 1550 | |
| 1551 // Local references to make debugger stepping easier. If in a debugger, | |
| 1552 // you really want to warp ahead and step through the | |
| 1553 // InvokeHelper<>::MakeItSo() call below. | |
| 1554 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits; | |
| 1555 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits; | |
| 1556 | |
| 1557 typename Bound1UnwrapTraits::ForwardType x1 = | |
| 1558 Bound1UnwrapTraits::Unwrap(storage->p1_); | |
| 1559 typename Bound2UnwrapTraits::ForwardType x2 = | |
| 1560 Bound2UnwrapTraits::Unwrap(storage->p2_); | |
| 1561 return InvokeHelper<StorageType::IsWeakCall::value, R, | |
| 1562 typename StorageType::RunnableType, | |
| 1563 void(typename Bound1UnwrapTraits::ForwardType, | |
| 1564 typename Bound2UnwrapTraits::ForwardType, | |
| 1565 typename CallbackParamTraits<X3>::ForwardType x3, | |
| 1566 typename CallbackParamTraits<X4>::ForwardType x4, | |
| 1567 typename CallbackParamTraits<X5>::ForwardType x5, | |
| 1568 typename CallbackParamTraits<X6>::ForwardType x6, | |
| 1569 typename CallbackParamTraits<X7>::ForwardType x7)> | |
| 1570 ::MakeItSo(storage->runnable_, CallbackForward(x1), | |
| 1571 CallbackForward(x2), CallbackForward(x3), | |
| 1572 CallbackForward(x4), CallbackForward(x5), | |
| 1573 CallbackForward(x6), CallbackForward(x7)); | |
| 1574 } | |
| 1575 }; | |
| 1576 | |
| 1577 // Arity 7 -> 4. | |
| 1578 template <typename StorageType, typename R,typename X1, typename X2, | |
| 1579 typename X3, typename X4, typename X5, typename X6, typename X7> | |
| 1580 struct Invoker<3, StorageType, R(X1, X2, X3, X4, X5, X6, X7)> { | |
| 1581 typedef R(RunType)(BindStateBase*, | |
| 1582 typename CallbackParamTraits<X4>::ForwardType, | |
| 1583 typename CallbackParamTraits<X5>::ForwardType, | |
| 1584 typename CallbackParamTraits<X6>::ForwardType, | |
| 1585 typename CallbackParamTraits<X7>::ForwardType); | |
| 1586 | |
| 1587 typedef R(UnboundRunType)(X4, X5, X6, X7); | |
| 1588 | |
| 1589 static R Run(BindStateBase* base, | |
| 1590 typename CallbackParamTraits<X4>::ForwardType x4, | |
| 1591 typename CallbackParamTraits<X5>::ForwardType x5, | |
| 1592 typename CallbackParamTraits<X6>::ForwardType x6, | |
| 1593 typename CallbackParamTraits<X7>::ForwardType x7) { | |
| 1594 StorageType* storage = static_cast<StorageType*>(base); | |
| 1595 | |
| 1596 // Local references to make debugger stepping easier. If in a debugger, | |
| 1597 // you really want to warp ahead and step through the | |
| 1598 // InvokeHelper<>::MakeItSo() call below. | |
| 1599 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits; | |
| 1600 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits; | |
| 1601 typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits; | |
| 1602 | |
| 1603 typename Bound1UnwrapTraits::ForwardType x1 = | |
| 1604 Bound1UnwrapTraits::Unwrap(storage->p1_); | |
| 1605 typename Bound2UnwrapTraits::ForwardType x2 = | |
| 1606 Bound2UnwrapTraits::Unwrap(storage->p2_); | |
| 1607 typename Bound3UnwrapTraits::ForwardType x3 = | |
| 1608 Bound3UnwrapTraits::Unwrap(storage->p3_); | |
| 1609 return InvokeHelper<StorageType::IsWeakCall::value, R, | |
| 1610 typename StorageType::RunnableType, | |
| 1611 void(typename Bound1UnwrapTraits::ForwardType, | |
| 1612 typename Bound2UnwrapTraits::ForwardType, | |
| 1613 typename Bound3UnwrapTraits::ForwardType, | |
| 1614 typename CallbackParamTraits<X4>::ForwardType x4, | |
| 1615 typename CallbackParamTraits<X5>::ForwardType x5, | |
| 1616 typename CallbackParamTraits<X6>::ForwardType x6, | |
| 1617 typename CallbackParamTraits<X7>::ForwardType x7)> | |
| 1618 ::MakeItSo(storage->runnable_, CallbackForward(x1), | |
| 1619 CallbackForward(x2), CallbackForward(x3), | |
| 1620 CallbackForward(x4), CallbackForward(x5), | |
| 1621 CallbackForward(x6), CallbackForward(x7)); | |
| 1622 } | |
| 1623 }; | |
| 1624 | |
| 1625 // Arity 7 -> 3. | |
| 1626 template <typename StorageType, typename R,typename X1, typename X2, | |
| 1627 typename X3, typename X4, typename X5, typename X6, typename X7> | |
| 1628 struct Invoker<4, StorageType, R(X1, X2, X3, X4, X5, X6, X7)> { | |
| 1629 typedef R(RunType)(BindStateBase*, | |
| 1630 typename CallbackParamTraits<X5>::ForwardType, | |
| 1631 typename CallbackParamTraits<X6>::ForwardType, | |
| 1632 typename CallbackParamTraits<X7>::ForwardType); | |
| 1633 | |
| 1634 typedef R(UnboundRunType)(X5, X6, X7); | |
| 1635 | |
| 1636 static R Run(BindStateBase* base, | |
| 1637 typename CallbackParamTraits<X5>::ForwardType x5, | |
| 1638 typename CallbackParamTraits<X6>::ForwardType x6, | |
| 1639 typename CallbackParamTraits<X7>::ForwardType x7) { | |
| 1640 StorageType* storage = static_cast<StorageType*>(base); | |
| 1641 | |
| 1642 // Local references to make debugger stepping easier. If in a debugger, | |
| 1643 // you really want to warp ahead and step through the | |
| 1644 // InvokeHelper<>::MakeItSo() call below. | |
| 1645 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits; | |
| 1646 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits; | |
| 1647 typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits; | |
| 1648 typedef typename StorageType::Bound4UnwrapTraits Bound4UnwrapTraits; | |
| 1649 | |
| 1650 typename Bound1UnwrapTraits::ForwardType x1 = | |
| 1651 Bound1UnwrapTraits::Unwrap(storage->p1_); | |
| 1652 typename Bound2UnwrapTraits::ForwardType x2 = | |
| 1653 Bound2UnwrapTraits::Unwrap(storage->p2_); | |
| 1654 typename Bound3UnwrapTraits::ForwardType x3 = | |
| 1655 Bound3UnwrapTraits::Unwrap(storage->p3_); | |
| 1656 typename Bound4UnwrapTraits::ForwardType x4 = | |
| 1657 Bound4UnwrapTraits::Unwrap(storage->p4_); | |
| 1658 return InvokeHelper<StorageType::IsWeakCall::value, R, | |
| 1659 typename StorageType::RunnableType, | |
| 1660 void(typename Bound1UnwrapTraits::ForwardType, | |
| 1661 typename Bound2UnwrapTraits::ForwardType, | |
| 1662 typename Bound3UnwrapTraits::ForwardType, | |
| 1663 typename Bound4UnwrapTraits::ForwardType, | |
| 1664 typename CallbackParamTraits<X5>::ForwardType x5, | |
| 1665 typename CallbackParamTraits<X6>::ForwardType x6, | |
| 1666 typename CallbackParamTraits<X7>::ForwardType x7)> | |
| 1667 ::MakeItSo(storage->runnable_, CallbackForward(x1), | |
| 1668 CallbackForward(x2), CallbackForward(x3), | |
| 1669 CallbackForward(x4), CallbackForward(x5), | |
| 1670 CallbackForward(x6), CallbackForward(x7)); | |
| 1671 } | |
| 1672 }; | |
| 1673 | |
| 1674 // Arity 7 -> 2. | |
| 1675 template <typename StorageType, typename R,typename X1, typename X2, | |
| 1676 typename X3, typename X4, typename X5, typename X6, typename X7> | |
| 1677 struct Invoker<5, StorageType, R(X1, X2, X3, X4, X5, X6, X7)> { | |
| 1678 typedef R(RunType)(BindStateBase*, | |
| 1679 typename CallbackParamTraits<X6>::ForwardType, | |
| 1680 typename CallbackParamTraits<X7>::ForwardType); | |
| 1681 | |
| 1682 typedef R(UnboundRunType)(X6, X7); | |
| 1683 | |
| 1684 static R Run(BindStateBase* base, | |
| 1685 typename CallbackParamTraits<X6>::ForwardType x6, | |
| 1686 typename CallbackParamTraits<X7>::ForwardType x7) { | |
| 1687 StorageType* storage = static_cast<StorageType*>(base); | |
| 1688 | |
| 1689 // Local references to make debugger stepping easier. If in a debugger, | |
| 1690 // you really want to warp ahead and step through the | |
| 1691 // InvokeHelper<>::MakeItSo() call below. | |
| 1692 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits; | |
| 1693 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits; | |
| 1694 typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits; | |
| 1695 typedef typename StorageType::Bound4UnwrapTraits Bound4UnwrapTraits; | |
| 1696 typedef typename StorageType::Bound5UnwrapTraits Bound5UnwrapTraits; | |
| 1697 | |
| 1698 typename Bound1UnwrapTraits::ForwardType x1 = | |
| 1699 Bound1UnwrapTraits::Unwrap(storage->p1_); | |
| 1700 typename Bound2UnwrapTraits::ForwardType x2 = | |
| 1701 Bound2UnwrapTraits::Unwrap(storage->p2_); | |
| 1702 typename Bound3UnwrapTraits::ForwardType x3 = | |
| 1703 Bound3UnwrapTraits::Unwrap(storage->p3_); | |
| 1704 typename Bound4UnwrapTraits::ForwardType x4 = | |
| 1705 Bound4UnwrapTraits::Unwrap(storage->p4_); | |
| 1706 typename Bound5UnwrapTraits::ForwardType x5 = | |
| 1707 Bound5UnwrapTraits::Unwrap(storage->p5_); | |
| 1708 return InvokeHelper<StorageType::IsWeakCall::value, R, | |
| 1709 typename StorageType::RunnableType, | |
| 1710 void(typename Bound1UnwrapTraits::ForwardType, | |
| 1711 typename Bound2UnwrapTraits::ForwardType, | |
| 1712 typename Bound3UnwrapTraits::ForwardType, | |
| 1713 typename Bound4UnwrapTraits::ForwardType, | |
| 1714 typename Bound5UnwrapTraits::ForwardType, | |
| 1715 typename CallbackParamTraits<X6>::ForwardType x6, | |
| 1716 typename CallbackParamTraits<X7>::ForwardType x7)> | |
| 1717 ::MakeItSo(storage->runnable_, CallbackForward(x1), | |
| 1718 CallbackForward(x2), CallbackForward(x3), | |
| 1719 CallbackForward(x4), CallbackForward(x5), | |
| 1720 CallbackForward(x6), CallbackForward(x7)); | |
| 1721 } | |
| 1722 }; | |
| 1723 | |
| 1724 // Arity 7 -> 1. | |
| 1725 template <typename StorageType, typename R,typename X1, typename X2, | |
| 1726 typename X3, typename X4, typename X5, typename X6, typename X7> | |
| 1727 struct Invoker<6, StorageType, R(X1, X2, X3, X4, X5, X6, X7)> { | |
| 1728 typedef R(RunType)(BindStateBase*, | |
| 1729 typename CallbackParamTraits<X7>::ForwardType); | |
| 1730 | |
| 1731 typedef R(UnboundRunType)(X7); | |
| 1732 | |
| 1733 static R Run(BindStateBase* base, | |
| 1734 typename CallbackParamTraits<X7>::ForwardType x7) { | |
| 1735 StorageType* storage = static_cast<StorageType*>(base); | |
| 1736 | |
| 1737 // Local references to make debugger stepping easier. If in a debugger, | |
| 1738 // you really want to warp ahead and step through the | |
| 1739 // InvokeHelper<>::MakeItSo() call below. | |
| 1740 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits; | |
| 1741 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits; | |
| 1742 typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits; | |
| 1743 typedef typename StorageType::Bound4UnwrapTraits Bound4UnwrapTraits; | |
| 1744 typedef typename StorageType::Bound5UnwrapTraits Bound5UnwrapTraits; | |
| 1745 typedef typename StorageType::Bound6UnwrapTraits Bound6UnwrapTraits; | |
| 1746 | |
| 1747 typename Bound1UnwrapTraits::ForwardType x1 = | |
| 1748 Bound1UnwrapTraits::Unwrap(storage->p1_); | |
| 1749 typename Bound2UnwrapTraits::ForwardType x2 = | |
| 1750 Bound2UnwrapTraits::Unwrap(storage->p2_); | |
| 1751 typename Bound3UnwrapTraits::ForwardType x3 = | |
| 1752 Bound3UnwrapTraits::Unwrap(storage->p3_); | |
| 1753 typename Bound4UnwrapTraits::ForwardType x4 = | |
| 1754 Bound4UnwrapTraits::Unwrap(storage->p4_); | |
| 1755 typename Bound5UnwrapTraits::ForwardType x5 = | |
| 1756 Bound5UnwrapTraits::Unwrap(storage->p5_); | |
| 1757 typename Bound6UnwrapTraits::ForwardType x6 = | |
| 1758 Bound6UnwrapTraits::Unwrap(storage->p6_); | |
| 1759 return InvokeHelper<StorageType::IsWeakCall::value, R, | |
| 1760 typename StorageType::RunnableType, | |
| 1761 void(typename Bound1UnwrapTraits::ForwardType, | |
| 1762 typename Bound2UnwrapTraits::ForwardType, | |
| 1763 typename Bound3UnwrapTraits::ForwardType, | |
| 1764 typename Bound4UnwrapTraits::ForwardType, | |
| 1765 typename Bound5UnwrapTraits::ForwardType, | |
| 1766 typename Bound6UnwrapTraits::ForwardType, | |
| 1767 typename CallbackParamTraits<X7>::ForwardType x7)> | |
| 1768 ::MakeItSo(storage->runnable_, CallbackForward(x1), | |
| 1769 CallbackForward(x2), CallbackForward(x3), | |
| 1770 CallbackForward(x4), CallbackForward(x5), | |
| 1771 CallbackForward(x6), CallbackForward(x7)); | |
| 1772 } | |
| 1773 }; | |
| 1774 | |
| 1775 // Arity 7 -> 0. | |
| 1776 template <typename StorageType, typename R,typename X1, typename X2, | |
| 1777 typename X3, typename X4, typename X5, typename X6, typename X7> | |
| 1778 struct Invoker<7, StorageType, R(X1, X2, X3, X4, X5, X6, X7)> { | |
| 1779 typedef R(RunType)(BindStateBase*); | |
| 1780 | |
| 1781 typedef R(UnboundRunType)(); | |
| 1782 | |
| 1783 static R Run(BindStateBase* base) { | |
| 1784 StorageType* storage = static_cast<StorageType*>(base); | |
| 1785 | |
| 1786 // Local references to make debugger stepping easier. If in a debugger, | |
| 1787 // you really want to warp ahead and step through the | |
| 1788 // InvokeHelper<>::MakeItSo() call below. | |
| 1789 typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits; | |
| 1790 typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits; | |
| 1791 typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits; | |
| 1792 typedef typename StorageType::Bound4UnwrapTraits Bound4UnwrapTraits; | |
| 1793 typedef typename StorageType::Bound5UnwrapTraits Bound5UnwrapTraits; | |
| 1794 typedef typename StorageType::Bound6UnwrapTraits Bound6UnwrapTraits; | |
| 1795 typedef typename StorageType::Bound7UnwrapTraits Bound7UnwrapTraits; | |
| 1796 | |
| 1797 typename Bound1UnwrapTraits::ForwardType x1 = | |
| 1798 Bound1UnwrapTraits::Unwrap(storage->p1_); | |
| 1799 typename Bound2UnwrapTraits::ForwardType x2 = | |
| 1800 Bound2UnwrapTraits::Unwrap(storage->p2_); | |
| 1801 typename Bound3UnwrapTraits::ForwardType x3 = | |
| 1802 Bound3UnwrapTraits::Unwrap(storage->p3_); | |
| 1803 typename Bound4UnwrapTraits::ForwardType x4 = | |
| 1804 Bound4UnwrapTraits::Unwrap(storage->p4_); | |
| 1805 typename Bound5UnwrapTraits::ForwardType x5 = | |
| 1806 Bound5UnwrapTraits::Unwrap(storage->p5_); | |
| 1807 typename Bound6UnwrapTraits::ForwardType x6 = | |
| 1808 Bound6UnwrapTraits::Unwrap(storage->p6_); | |
| 1809 typename Bound7UnwrapTraits::ForwardType x7 = | |
| 1810 Bound7UnwrapTraits::Unwrap(storage->p7_); | |
| 1811 return InvokeHelper<StorageType::IsWeakCall::value, R, | |
| 1812 typename StorageType::RunnableType, | |
| 1813 void(typename Bound1UnwrapTraits::ForwardType, | |
| 1814 typename Bound2UnwrapTraits::ForwardType, | |
| 1815 typename Bound3UnwrapTraits::ForwardType, | |
| 1816 typename Bound4UnwrapTraits::ForwardType, | |
| 1817 typename Bound5UnwrapTraits::ForwardType, | |
| 1818 typename Bound6UnwrapTraits::ForwardType, | |
| 1819 typename Bound7UnwrapTraits::ForwardType)> | |
| 1820 ::MakeItSo(storage->runnable_, CallbackForward(x1), | |
| 1821 CallbackForward(x2), CallbackForward(x3), | |
| 1822 CallbackForward(x4), CallbackForward(x5), | |
| 1823 CallbackForward(x6), CallbackForward(x7)); | |
| 1824 } | |
| 1825 }; | |
| 1826 | |
| 1827 | 350 |
| 1828 // BindState<> | 351 // BindState<> |
| 1829 // | 352 // |
| 1830 // This stores all the state passed into Bind() and is also where most | 353 // This stores all the state passed into Bind() and is also where most |
| 1831 // of the template resolution magic occurs. | 354 // of the template resolution magic occurs. |
| 1832 // | 355 // |
| 1833 // Runnable is the functor we are binding arguments to. | 356 // Runnable is the functor we are binding arguments to. |
| 1834 // RunType is type of the Run() function that the Invoker<> should use. | 357 // RunType is type of the Run() function that the Invoker<> should use. |
| 1835 // Normally, this is the same as the RunType of the Runnable, but it can | 358 // Normally, this is the same as the RunType of the Runnable, but it can |
| 1836 // be different if an adapter like IgnoreResult() has been used. | 359 // be different if an adapter like IgnoreResult() has been used. |
| 1837 // | 360 // |
| 1838 // BoundArgsType contains the storage type for all the bound arguments by | 361 // BoundArgsType contains the storage type for all the bound arguments by |
| 1839 // (ab)using a function type. | 362 // (ab)using a function type. |
| 1840 template <typename Runnable, typename RunType, typename BoundArgsType> | 363 template <typename Runnable, typename RunType, typename BoundArgList> |
| 1841 struct BindState; | 364 struct BindState; |
| 1842 | 365 |
| 1843 template <typename Runnable, typename RunType> | 366 template <typename Runnable, |
| 1844 struct BindState<Runnable, RunType, void()> : public BindStateBase { | 367 typename R, typename... Args, |
| 1845 typedef Runnable RunnableType; | 368 typename... BoundArgs> |
| 1846 typedef false_type IsWeakCall; | 369 struct BindState<Runnable, R(Args...), TypeList<BoundArgs...>> |
| 1847 typedef Invoker<0, BindState, RunType> InvokerType; | 370 : public BindStateBase { |
| 1848 typedef typename InvokerType::UnboundRunType UnboundRunType; | 371 private: |
| 1849 explicit BindState(const Runnable& runnable) | 372 using StorageType = BindState<Runnable, R(Args...), TypeList<BoundArgs...>>; |
| 1850 : runnable_(runnable) { | 373 using RunnableType = Runnable; |
| 1851 } | 374 |
| 375 // true_type if Runnable is a method invocation and the first bound argument |
| 376 // is a WeakPtr. |
| 377 using IsWeakCall = |
| 378 IsWeakMethod<HasIsMethodTag<Runnable>::value, BoundArgs...>; |
| 379 |
| 380 using BoundIndices = MakeIndexSequence<sizeof...(BoundArgs)>; |
| 381 using Unwrappers = TypeList<UnwrapTraits<BoundArgs>...>; |
| 382 using UnboundForwardArgs = DropTypeListItem< |
| 383 sizeof...(BoundArgs), |
| 384 TypeList<typename CallbackParamTraits<Args>::ForwardType...>>; |
| 385 using UnboundForwardRunType = MakeFunctionType<R, UnboundForwardArgs>; |
| 386 |
| 387 using InvokeHelperArgs = ConcatTypeLists< |
| 388 TypeList<typename UnwrapTraits<BoundArgs>::ForwardType...>, |
| 389 UnboundForwardArgs>; |
| 390 using InvokeHelperType = |
| 391 InvokeHelper<IsWeakCall::value, R, Runnable, InvokeHelperArgs>; |
| 392 |
| 393 using UnboundArgs = DropTypeListItem<sizeof...(BoundArgs), TypeList<Args...>>; |
| 394 |
| 395 public: |
| 396 using InvokerType = Invoker<BoundIndices, StorageType, Unwrappers, |
| 397 InvokeHelperType, UnboundForwardRunType>; |
| 398 using UnboundRunType = MakeFunctionType<R, UnboundArgs>; |
| 399 |
| 400 BindState(const Runnable& runnable, const BoundArgs&... bound_args) |
| 401 : runnable_(runnable), ref_(bound_args...), bound_args_(bound_args...) {} |
| 1852 | 402 |
| 1853 RunnableType runnable_; | 403 RunnableType runnable_; |
| 404 MaybeScopedRefPtr<HasIsMethodTag<Runnable>::value, BoundArgs...> ref_; |
| 405 Tuple<BoundArgs...> bound_args_; |
| 1854 | 406 |
| 1855 private: | 407 private: |
| 1856 ~BindState() override { } | 408 ~BindState() override {} |
| 1857 | |
| 1858 }; | |
| 1859 | |
| 1860 template <typename Runnable, typename RunType, typename P1> | |
| 1861 struct BindState<Runnable, RunType, void(P1)> : public BindStateBase { | |
| 1862 typedef Runnable RunnableType; | |
| 1863 typedef IsWeakMethod<HasIsMethodTag<Runnable>::value, P1> IsWeakCall; | |
| 1864 typedef Invoker<1, BindState, RunType> InvokerType; | |
| 1865 typedef typename InvokerType::UnboundRunType UnboundRunType; | |
| 1866 | |
| 1867 // Convenience typedefs for bound argument types. | |
| 1868 typedef UnwrapTraits<P1> Bound1UnwrapTraits; | |
| 1869 | |
| 1870 BindState(const Runnable& runnable, const P1& p1) | |
| 1871 : runnable_(runnable), | |
| 1872 p1_(p1) { | |
| 1873 MaybeRefcount<HasIsMethodTag<Runnable>::value, P1>::AddRef(p1_); | |
| 1874 } | |
| 1875 | |
| 1876 RunnableType runnable_; | |
| 1877 P1 p1_; | |
| 1878 | |
| 1879 private: | |
| 1880 ~BindState() override { MaybeRefcount<HasIsMethodTag<Runnable>::value, | |
| 1881 P1>::Release(p1_); } | |
| 1882 | |
| 1883 }; | |
| 1884 | |
| 1885 template <typename Runnable, typename RunType, typename P1, typename P2> | |
| 1886 struct BindState<Runnable, RunType, void(P1, P2)> : public BindStateBase { | |
| 1887 typedef Runnable RunnableType; | |
| 1888 typedef IsWeakMethod<HasIsMethodTag<Runnable>::value, P1> IsWeakCall; | |
| 1889 typedef Invoker<2, BindState, RunType> InvokerType; | |
| 1890 typedef typename InvokerType::UnboundRunType UnboundRunType; | |
| 1891 | |
| 1892 // Convenience typedefs for bound argument types. | |
| 1893 typedef UnwrapTraits<P1> Bound1UnwrapTraits; | |
| 1894 typedef UnwrapTraits<P2> Bound2UnwrapTraits; | |
| 1895 | |
| 1896 BindState(const Runnable& runnable, const P1& p1, const P2& p2) | |
| 1897 : runnable_(runnable), | |
| 1898 p1_(p1), | |
| 1899 p2_(p2) { | |
| 1900 MaybeRefcount<HasIsMethodTag<Runnable>::value, P1>::AddRef(p1_); | |
| 1901 } | |
| 1902 | |
| 1903 RunnableType runnable_; | |
| 1904 P1 p1_; | |
| 1905 P2 p2_; | |
| 1906 | |
| 1907 private: | |
| 1908 ~BindState() override { MaybeRefcount<HasIsMethodTag<Runnable>::value, | |
| 1909 P1>::Release(p1_); } | |
| 1910 | |
| 1911 }; | |
| 1912 | |
| 1913 template <typename Runnable, typename RunType, typename P1, typename P2, | |
| 1914 typename P3> | |
| 1915 struct BindState<Runnable, RunType, void(P1, P2, P3)> : public BindStateBase { | |
| 1916 typedef Runnable RunnableType; | |
| 1917 typedef IsWeakMethod<HasIsMethodTag<Runnable>::value, P1> IsWeakCall; | |
| 1918 typedef Invoker<3, BindState, RunType> InvokerType; | |
| 1919 typedef typename InvokerType::UnboundRunType UnboundRunType; | |
| 1920 | |
| 1921 // Convenience typedefs for bound argument types. | |
| 1922 typedef UnwrapTraits<P1> Bound1UnwrapTraits; | |
| 1923 typedef UnwrapTraits<P2> Bound2UnwrapTraits; | |
| 1924 typedef UnwrapTraits<P3> Bound3UnwrapTraits; | |
| 1925 | |
| 1926 BindState(const Runnable& runnable, const P1& p1, const P2& p2, const P3& p3) | |
| 1927 : runnable_(runnable), | |
| 1928 p1_(p1), | |
| 1929 p2_(p2), | |
| 1930 p3_(p3) { | |
| 1931 MaybeRefcount<HasIsMethodTag<Runnable>::value, P1>::AddRef(p1_); | |
| 1932 } | |
| 1933 | |
| 1934 RunnableType runnable_; | |
| 1935 P1 p1_; | |
| 1936 P2 p2_; | |
| 1937 P3 p3_; | |
| 1938 | |
| 1939 private: | |
| 1940 ~BindState() override { MaybeRefcount<HasIsMethodTag<Runnable>::value, | |
| 1941 P1>::Release(p1_); } | |
| 1942 | |
| 1943 }; | |
| 1944 | |
| 1945 template <typename Runnable, typename RunType, typename P1, typename P2, | |
| 1946 typename P3, typename P4> | |
| 1947 struct BindState<Runnable, RunType, void(P1, P2, P3, | |
| 1948 P4)> : public BindStateBase { | |
| 1949 typedef Runnable RunnableType; | |
| 1950 typedef IsWeakMethod<HasIsMethodTag<Runnable>::value, P1> IsWeakCall; | |
| 1951 typedef Invoker<4, BindState, RunType> InvokerType; | |
| 1952 typedef typename InvokerType::UnboundRunType UnboundRunType; | |
| 1953 | |
| 1954 // Convenience typedefs for bound argument types. | |
| 1955 typedef UnwrapTraits<P1> Bound1UnwrapTraits; | |
| 1956 typedef UnwrapTraits<P2> Bound2UnwrapTraits; | |
| 1957 typedef UnwrapTraits<P3> Bound3UnwrapTraits; | |
| 1958 typedef UnwrapTraits<P4> Bound4UnwrapTraits; | |
| 1959 | |
| 1960 BindState(const Runnable& runnable, const P1& p1, const P2& p2, const P3& p3, | |
| 1961 const P4& p4) | |
| 1962 : runnable_(runnable), | |
| 1963 p1_(p1), | |
| 1964 p2_(p2), | |
| 1965 p3_(p3), | |
| 1966 p4_(p4) { | |
| 1967 MaybeRefcount<HasIsMethodTag<Runnable>::value, P1>::AddRef(p1_); | |
| 1968 } | |
| 1969 | |
| 1970 RunnableType runnable_; | |
| 1971 P1 p1_; | |
| 1972 P2 p2_; | |
| 1973 P3 p3_; | |
| 1974 P4 p4_; | |
| 1975 | |
| 1976 private: | |
| 1977 ~BindState() override { MaybeRefcount<HasIsMethodTag<Runnable>::value, | |
| 1978 P1>::Release(p1_); } | |
| 1979 | |
| 1980 }; | |
| 1981 | |
| 1982 template <typename Runnable, typename RunType, typename P1, typename P2, | |
| 1983 typename P3, typename P4, typename P5> | |
| 1984 struct BindState<Runnable, RunType, void(P1, P2, P3, P4, | |
| 1985 P5)> : public BindStateBase { | |
| 1986 typedef Runnable RunnableType; | |
| 1987 typedef IsWeakMethod<HasIsMethodTag<Runnable>::value, P1> IsWeakCall; | |
| 1988 typedef Invoker<5, BindState, RunType> InvokerType; | |
| 1989 typedef typename InvokerType::UnboundRunType UnboundRunType; | |
| 1990 | |
| 1991 // Convenience typedefs for bound argument types. | |
| 1992 typedef UnwrapTraits<P1> Bound1UnwrapTraits; | |
| 1993 typedef UnwrapTraits<P2> Bound2UnwrapTraits; | |
| 1994 typedef UnwrapTraits<P3> Bound3UnwrapTraits; | |
| 1995 typedef UnwrapTraits<P4> Bound4UnwrapTraits; | |
| 1996 typedef UnwrapTraits<P5> Bound5UnwrapTraits; | |
| 1997 | |
| 1998 BindState(const Runnable& runnable, const P1& p1, const P2& p2, const P3& p3, | |
| 1999 const P4& p4, const P5& p5) | |
| 2000 : runnable_(runnable), | |
| 2001 p1_(p1), | |
| 2002 p2_(p2), | |
| 2003 p3_(p3), | |
| 2004 p4_(p4), | |
| 2005 p5_(p5) { | |
| 2006 MaybeRefcount<HasIsMethodTag<Runnable>::value, P1>::AddRef(p1_); | |
| 2007 } | |
| 2008 | |
| 2009 RunnableType runnable_; | |
| 2010 P1 p1_; | |
| 2011 P2 p2_; | |
| 2012 P3 p3_; | |
| 2013 P4 p4_; | |
| 2014 P5 p5_; | |
| 2015 | |
| 2016 private: | |
| 2017 ~BindState() override { MaybeRefcount<HasIsMethodTag<Runnable>::value, | |
| 2018 P1>::Release(p1_); } | |
| 2019 | |
| 2020 }; | |
| 2021 | |
| 2022 template <typename Runnable, typename RunType, typename P1, typename P2, | |
| 2023 typename P3, typename P4, typename P5, typename P6> | |
| 2024 struct BindState<Runnable, RunType, void(P1, P2, P3, P4, P5, | |
| 2025 P6)> : public BindStateBase { | |
| 2026 typedef Runnable RunnableType; | |
| 2027 typedef IsWeakMethod<HasIsMethodTag<Runnable>::value, P1> IsWeakCall; | |
| 2028 typedef Invoker<6, BindState, RunType> InvokerType; | |
| 2029 typedef typename InvokerType::UnboundRunType UnboundRunType; | |
| 2030 | |
| 2031 // Convenience typedefs for bound argument types. | |
| 2032 typedef UnwrapTraits<P1> Bound1UnwrapTraits; | |
| 2033 typedef UnwrapTraits<P2> Bound2UnwrapTraits; | |
| 2034 typedef UnwrapTraits<P3> Bound3UnwrapTraits; | |
| 2035 typedef UnwrapTraits<P4> Bound4UnwrapTraits; | |
| 2036 typedef UnwrapTraits<P5> Bound5UnwrapTraits; | |
| 2037 typedef UnwrapTraits<P6> Bound6UnwrapTraits; | |
| 2038 | |
| 2039 BindState(const Runnable& runnable, const P1& p1, const P2& p2, const P3& p3, | |
| 2040 const P4& p4, const P5& p5, const P6& p6) | |
| 2041 : runnable_(runnable), | |
| 2042 p1_(p1), | |
| 2043 p2_(p2), | |
| 2044 p3_(p3), | |
| 2045 p4_(p4), | |
| 2046 p5_(p5), | |
| 2047 p6_(p6) { | |
| 2048 MaybeRefcount<HasIsMethodTag<Runnable>::value, P1>::AddRef(p1_); | |
| 2049 } | |
| 2050 | |
| 2051 RunnableType runnable_; | |
| 2052 P1 p1_; | |
| 2053 P2 p2_; | |
| 2054 P3 p3_; | |
| 2055 P4 p4_; | |
| 2056 P5 p5_; | |
| 2057 P6 p6_; | |
| 2058 | |
| 2059 private: | |
| 2060 ~BindState() override { MaybeRefcount<HasIsMethodTag<Runnable>::value, | |
| 2061 P1>::Release(p1_); } | |
| 2062 | |
| 2063 }; | |
| 2064 | |
| 2065 template <typename Runnable, typename RunType, typename P1, typename P2, | |
| 2066 typename P3, typename P4, typename P5, typename P6, typename P7> | |
| 2067 struct BindState<Runnable, RunType, void(P1, P2, P3, P4, P5, P6, | |
| 2068 P7)> : public BindStateBase { | |
| 2069 typedef Runnable RunnableType; | |
| 2070 typedef IsWeakMethod<HasIsMethodTag<Runnable>::value, P1> IsWeakCall; | |
| 2071 typedef Invoker<7, BindState, RunType> InvokerType; | |
| 2072 typedef typename InvokerType::UnboundRunType UnboundRunType; | |
| 2073 | |
| 2074 // Convenience typedefs for bound argument types. | |
| 2075 typedef UnwrapTraits<P1> Bound1UnwrapTraits; | |
| 2076 typedef UnwrapTraits<P2> Bound2UnwrapTraits; | |
| 2077 typedef UnwrapTraits<P3> Bound3UnwrapTraits; | |
| 2078 typedef UnwrapTraits<P4> Bound4UnwrapTraits; | |
| 2079 typedef UnwrapTraits<P5> Bound5UnwrapTraits; | |
| 2080 typedef UnwrapTraits<P6> Bound6UnwrapTraits; | |
| 2081 typedef UnwrapTraits<P7> Bound7UnwrapTraits; | |
| 2082 | |
| 2083 BindState(const Runnable& runnable, const P1& p1, const P2& p2, const P3& p3, | |
| 2084 const P4& p4, const P5& p5, const P6& p6, const P7& p7) | |
| 2085 : runnable_(runnable), | |
| 2086 p1_(p1), | |
| 2087 p2_(p2), | |
| 2088 p3_(p3), | |
| 2089 p4_(p4), | |
| 2090 p5_(p5), | |
| 2091 p6_(p6), | |
| 2092 p7_(p7) { | |
| 2093 MaybeRefcount<HasIsMethodTag<Runnable>::value, P1>::AddRef(p1_); | |
| 2094 } | |
| 2095 | |
| 2096 RunnableType runnable_; | |
| 2097 P1 p1_; | |
| 2098 P2 p2_; | |
| 2099 P3 p3_; | |
| 2100 P4 p4_; | |
| 2101 P5 p5_; | |
| 2102 P6 p6_; | |
| 2103 P7 p7_; | |
| 2104 | |
| 2105 private: | |
| 2106 ~BindState() override { MaybeRefcount<HasIsMethodTag<Runnable>::value, | |
| 2107 P1>::Release(p1_); } | |
| 2108 | |
| 2109 }; | 409 }; |
| 2110 | 410 |
| 2111 } // namespace internal | 411 } // namespace internal |
| 2112 } // namespace base | 412 } // namespace base |
| 2113 | 413 |
| 2114 #endif // BASE_BIND_INTERNAL_H_ | 414 #endif // BASE_BIND_INTERNAL_H_ |
| OLD | NEW |