Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2630)

Unified Diff: base/bind_internal.h

Issue 10919055: Extend base::Callback to 8 arguments. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/bind.h ('k') | base/bind_internal_win.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/bind_internal.h
diff --git a/base/bind_internal.h b/base/bind_internal.h
index 4e155ab5c98286317f5dcded4d0369641fccbff6..3e7fa8bb023bbc509e61735d97ca1e3f98def04e 100644
--- a/base/bind_internal.h
+++ b/base/bind_internal.h
@@ -644,6 +644,91 @@ class RunnableAdapter<R(T::*)(A1, A2, A3, A4, A5, A6, A7) const> {
R (T::*method_)(A1, A2, A3, A4, A5, A6, A7) const;
};
+// Function: Arity 8.
+template <typename R, typename A1, typename A2, typename A3, typename A4,
+ typename A5, typename A6, typename A7, typename A8>
+class RunnableAdapter<R(*)(A1, A2, A3, A4, A5, A6, A7, A8)> {
+ public:
+ typedef R (RunType)(A1, A2, A3, A4, A5, A6, A7, A8);
+
+ explicit RunnableAdapter(R(*function)(A1, A2, A3, A4, A5, A6, A7, A8))
+ : function_(function) {
+ }
+
+ R Run(typename CallbackParamTraits<A1>::ForwardType a1,
+ typename CallbackParamTraits<A2>::ForwardType a2,
+ typename CallbackParamTraits<A3>::ForwardType a3,
+ typename CallbackParamTraits<A4>::ForwardType a4,
+ typename CallbackParamTraits<A5>::ForwardType a5,
+ typename CallbackParamTraits<A6>::ForwardType a6,
+ typename CallbackParamTraits<A7>::ForwardType a7,
+ typename CallbackParamTraits<A8>::ForwardType a8) {
+ return function_(CallbackForward(a1), CallbackForward(a2),
+ CallbackForward(a3), CallbackForward(a4), CallbackForward(a5),
+ CallbackForward(a6), CallbackForward(a7), CallbackForward(a8));
+ }
+
+ private:
+ R (*function_)(A1, A2, A3, A4, A5, A6, A7, A8);
+};
+
+// Method: Arity 8.
+template <typename R, typename T, typename A1, typename A2, typename A3,
+ typename A4, typename A5, typename A6, typename A7, typename A8>
+class RunnableAdapter<R(T::*)(A1, A2, A3, A4, A5, A6, A7, A8)> {
+ public:
+ typedef R (RunType)(T*, A1, A2, A3, A4, A5, A6, A7, A8);
+ typedef true_type IsMethod;
+
+ explicit RunnableAdapter(R(T::*method)(A1, A2, A3, A4, A5, A6, A7, A8))
+ : method_(method) {
+ }
+
+ R Run(T* object, typename CallbackParamTraits<A1>::ForwardType a1,
+ typename CallbackParamTraits<A2>::ForwardType a2,
+ typename CallbackParamTraits<A3>::ForwardType a3,
+ typename CallbackParamTraits<A4>::ForwardType a4,
+ typename CallbackParamTraits<A5>::ForwardType a5,
+ typename CallbackParamTraits<A6>::ForwardType a6,
+ typename CallbackParamTraits<A7>::ForwardType a7,
+ typename CallbackParamTraits<A8>::ForwardType a8) {
+ return (object->*method_)(CallbackForward(a1), CallbackForward(a2),
+ CallbackForward(a3), CallbackForward(a4), CallbackForward(a5),
+ CallbackForward(a6), CallbackForward(a7), CallbackForward(a8));
+ }
+
+ private:
+ R (T::*method_)(A1, A2, A3, A4, A5, A6, A7, A8);
+};
+
+// Const Method: Arity 8.
+template <typename R, typename T, typename A1, typename A2, typename A3,
+ typename A4, typename A5, typename A6, typename A7, typename A8>
+class RunnableAdapter<R(T::*)(A1, A2, A3, A4, A5, A6, A7, A8) const> {
+ public:
+ typedef R (RunType)(const T*, A1, A2, A3, A4, A5, A6, A7, A8);
+ typedef true_type IsMethod;
+
+ explicit RunnableAdapter(R(T::*method)(A1, A2, A3, A4, A5, A6, A7, A8) const)
+ : method_(method) {
+ }
+
+ R Run(const T* object, typename CallbackParamTraits<A1>::ForwardType a1,
+ typename CallbackParamTraits<A2>::ForwardType a2,
+ typename CallbackParamTraits<A3>::ForwardType a3,
+ typename CallbackParamTraits<A4>::ForwardType a4,
+ typename CallbackParamTraits<A5>::ForwardType a5,
+ typename CallbackParamTraits<A6>::ForwardType a6,
+ typename CallbackParamTraits<A7>::ForwardType a7,
+ typename CallbackParamTraits<A8>::ForwardType a8) {
+ return (object->*method_)(CallbackForward(a1), CallbackForward(a2),
+ CallbackForward(a3), CallbackForward(a4), CallbackForward(a5),
+ CallbackForward(a6), CallbackForward(a7), CallbackForward(a8));
+ }
+
+ private:
+ R (T::*method_)(A1, A2, A3, A4, A5, A6, A7, A8) const;
+};
// FunctionTraits<>
//
@@ -722,6 +807,19 @@ struct FunctionTraits<R(A1, A2, A3, A4, A5, A6, A7)> {
typedef A7 A7Type;
};
+template <typename R, typename A1, typename A2, typename A3, typename A4,
+ typename A5, typename A6, typename A7, typename A8>
+struct FunctionTraits<R(A1, A2, A3, A4, A5, A6, A7, A8)> {
+ typedef R ReturnType;
+ typedef A1 A1Type;
+ typedef A2 A2Type;
+ typedef A3 A3Type;
+ typedef A4 A4Type;
+ typedef A5 A5Type;
+ typedef A6 A6Type;
+ typedef A7 A7Type;
+ typedef A8 A8Type;
+};
// ForceVoidReturn<>
//
@@ -772,6 +870,11 @@ struct ForceVoidReturn<R(A1, A2, A3, A4, A5, A6, A7)> {
typedef void(RunType)(A1, A2, A3, A4, A5, A6, A7);
};
+template <typename R, typename A1, typename A2, typename A3, typename A4,
+ typename A5, typename A6, typename A7, typename A8>
+struct ForceVoidReturn<R(A1, A2, A3, A4, A5, A6, A7, A8)> {
+ typedef void(RunType)(A1, A2, A3, A4, A5, A6, A7, A8);
+};
// FunctorTraits<>
//
@@ -1020,7 +1123,7 @@ struct InvokeHelper<false, ReturnType, Runnable,
}
};
-template <typename Runnable,typename A1, typename A2, typename A3, typename A4,
+template <typename Runnable, typename A1, typename A2, typename A3, typename A4,
typename A5, typename A6>
struct InvokeHelper<false, void, Runnable,
void(A1, A2, A3, A4, A5, A6)> {
@@ -1086,6 +1189,47 @@ struct InvokeHelper<true, void, Runnable,
}
};
+template <typename ReturnType, typename Runnable,typename A1, typename A2,
+ typename A3, typename A4, typename A5, typename A6, typename A7,
+ typename A8>
+struct InvokeHelper<false, ReturnType, Runnable,
+ void(A1, A2, A3, A4, A5, A6, A7, A8)> {
+ static ReturnType MakeItSo(Runnable runnable, A1 a1, A2 a2, A3 a3, A4 a4,
+ A5 a5, A6 a6, A7 a7, A8 a8) {
+ return runnable.Run(CallbackForward(a1), CallbackForward(a2),
+ CallbackForward(a3), CallbackForward(a4), CallbackForward(a5),
+ CallbackForward(a6), CallbackForward(a7), CallbackForward(a8));
+ }
+};
+
+template <typename Runnable,typename A1, typename A2, typename A3, typename A4,
+ typename A5, typename A6, typename A7, typename A8>
+struct InvokeHelper<false, void, Runnable,
+ void(A1, A2, A3, A4, A5, A6, A7, A8)> {
+ static void MakeItSo(Runnable runnable, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5,
+ A6 a6, A7 a7, A8 a8) {
+ runnable.Run(CallbackForward(a1), CallbackForward(a2), CallbackForward(a3),
+ CallbackForward(a4), CallbackForward(a5), CallbackForward(a6),
+ CallbackForward(a7), CallbackForward(a8));
+ }
+};
+
+template <typename Runnable, typename A1, typename A2, typename A3,
+ typename A4, typename A5, typename A6, typename A7, typename A8>
+struct InvokeHelper<true, void, Runnable,
+ void(A1, A2, A3, A4, A5, A6, A7, A8)> {
+ static void MakeItSo(Runnable runnable, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5,
+ A6 a6, A7 a7, A8 a8) {
+ if (!a1.get()) {
+ return;
+ }
+
+ runnable.Run(CallbackForward(a1), CallbackForward(a2), CallbackForward(a3),
+ CallbackForward(a4), CallbackForward(a5), CallbackForward(a6),
+ CallbackForward(a7), CallbackForward(a8));
+ }
+};
+
#if !defined(_MSC_VER)
template <typename ReturnType, typename Runnable, typename ArgsType>
@@ -2518,6 +2662,491 @@ struct Invoker<7, StorageType, R(X1, X2, X3, X4, X5, X6, X7)> {
}
};
+// Arity 8 -> 8.
+template <typename StorageType, typename R,typename X1, typename X2,
+ typename X3, typename X4, typename X5, typename X6, typename X7,
+ typename X8>
+struct Invoker<0, StorageType, R(X1, X2, X3, X4, X5, X6, X7, X8)> {
+ typedef R(RunType)(BindStateBase*,
+ typename CallbackParamTraits<X1>::ForwardType,
+ typename CallbackParamTraits<X2>::ForwardType,
+ typename CallbackParamTraits<X3>::ForwardType,
+ typename CallbackParamTraits<X4>::ForwardType,
+ typename CallbackParamTraits<X5>::ForwardType,
+ typename CallbackParamTraits<X6>::ForwardType,
+ typename CallbackParamTraits<X7>::ForwardType,
+ typename CallbackParamTraits<X8>::ForwardType);
+
+ typedef R(UnboundRunType)(X1, X2, X3, X4, X5, X6, X7, X8);
+
+ static R Run(BindStateBase* base,
+ typename CallbackParamTraits<X1>::ForwardType x1,
+ typename CallbackParamTraits<X2>::ForwardType x2,
+ typename CallbackParamTraits<X3>::ForwardType x3,
+ typename CallbackParamTraits<X4>::ForwardType x4,
+ typename CallbackParamTraits<X5>::ForwardType x5,
+ typename CallbackParamTraits<X6>::ForwardType x6,
+ typename CallbackParamTraits<X7>::ForwardType x7,
+ typename CallbackParamTraits<X8>::ForwardType x8) {
+ StorageType* storage = static_cast<StorageType*>(base);
+
+ // Local references to make debugger stepping easier. If in a debugger,
+ // you really want to warp ahead and step through the
+ // InvokeHelper<>::MakeItSo() call below.
+
+ return InvokeHelper<StorageType::IsWeakCall::value, R,
+ typename StorageType::RunnableType,
+ void(typename CallbackParamTraits<X1>::ForwardType x1,
+ typename CallbackParamTraits<X2>::ForwardType x2,
+ typename CallbackParamTraits<X3>::ForwardType x3,
+ typename CallbackParamTraits<X4>::ForwardType x4,
+ typename CallbackParamTraits<X5>::ForwardType x5,
+ typename CallbackParamTraits<X6>::ForwardType x6,
+ typename CallbackParamTraits<X7>::ForwardType x7,
+ typename CallbackParamTraits<X8>::ForwardType x8)>
+ ::MakeItSo(storage->runnable_, CallbackForward(x1),
+ CallbackForward(x2), CallbackForward(x3),
+ CallbackForward(x4), CallbackForward(x5),
+ CallbackForward(x6), CallbackForward(x7),
+ CallbackForward(x8));
+ }
+};
+
+// Arity 8 -> 7.
+template <typename StorageType, typename R,typename X1, typename X2,
+ typename X3, typename X4, typename X5, typename X6, typename X7,
+ typename X8>
+struct Invoker<1, StorageType, R(X1, X2, X3, X4, X5, X6, X7, X8)> {
+ typedef R(RunType)(BindStateBase*,
+ typename CallbackParamTraits<X2>::ForwardType,
+ typename CallbackParamTraits<X3>::ForwardType,
+ typename CallbackParamTraits<X4>::ForwardType,
+ typename CallbackParamTraits<X5>::ForwardType,
+ typename CallbackParamTraits<X6>::ForwardType,
+ typename CallbackParamTraits<X7>::ForwardType,
+ typename CallbackParamTraits<X8>::ForwardType);
+
+ typedef R(UnboundRunType)(X2, X3, X4, X5, X6, X7, X8);
+
+ static R Run(BindStateBase* base,
+ typename CallbackParamTraits<X2>::ForwardType x2,
+ typename CallbackParamTraits<X3>::ForwardType x3,
+ typename CallbackParamTraits<X4>::ForwardType x4,
+ typename CallbackParamTraits<X5>::ForwardType x5,
+ typename CallbackParamTraits<X6>::ForwardType x6,
+ typename CallbackParamTraits<X7>::ForwardType x7,
+ typename CallbackParamTraits<X8>::ForwardType x8) {
+ StorageType* storage = static_cast<StorageType*>(base);
+
+ // Local references to make debugger stepping easier. If in a debugger,
+ // you really want to warp ahead and step through the
+ // InvokeHelper<>::MakeItSo() call below.
+ typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
+
+ typename Bound1UnwrapTraits::ForwardType x1 =
+ Bound1UnwrapTraits::Unwrap(storage->p1_);
+ return InvokeHelper<StorageType::IsWeakCall::value, R,
+ typename StorageType::RunnableType,
+ void(typename Bound1UnwrapTraits::ForwardType,
+ typename CallbackParamTraits<X2>::ForwardType x2,
+ typename CallbackParamTraits<X3>::ForwardType x3,
+ typename CallbackParamTraits<X4>::ForwardType x4,
+ typename CallbackParamTraits<X5>::ForwardType x5,
+ typename CallbackParamTraits<X6>::ForwardType x6,
+ typename CallbackParamTraits<X7>::ForwardType x7,
+ typename CallbackParamTraits<X8>::ForwardType x8)>
+ ::MakeItSo(storage->runnable_, CallbackForward(x1),
+ CallbackForward(x2), CallbackForward(x3),
+ CallbackForward(x4), CallbackForward(x5),
+ CallbackForward(x6), CallbackForward(x7),
+ CallbackForward(x8));
+ }
+};
+
+// Arity 8 -> 6.
+template <typename StorageType, typename R,typename X1, typename X2,
+ typename X3, typename X4, typename X5, typename X6, typename X7,
+ typename X8>
+struct Invoker<2, StorageType, R(X1, X2, X3, X4, X5, X6, X7, X8)> {
+ typedef R(RunType)(BindStateBase*,
+ typename CallbackParamTraits<X3>::ForwardType,
+ typename CallbackParamTraits<X4>::ForwardType,
+ typename CallbackParamTraits<X5>::ForwardType,
+ typename CallbackParamTraits<X6>::ForwardType,
+ typename CallbackParamTraits<X7>::ForwardType,
+ typename CallbackParamTraits<X8>::ForwardType);
+
+ typedef R(UnboundRunType)(X3, X4, X5, X6, X7, X8);
+
+ static R Run(BindStateBase* base,
+ typename CallbackParamTraits<X3>::ForwardType x3,
+ typename CallbackParamTraits<X4>::ForwardType x4,
+ typename CallbackParamTraits<X5>::ForwardType x5,
+ typename CallbackParamTraits<X6>::ForwardType x6,
+ typename CallbackParamTraits<X7>::ForwardType x7,
+ typename CallbackParamTraits<X8>::ForwardType x8) {
+ StorageType* storage = static_cast<StorageType*>(base);
+
+ // Local references to make debugger stepping easier. If in a debugger,
+ // you really want to warp ahead and step through the
+ // InvokeHelper<>::MakeItSo() call below.
+ typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
+ typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
+
+ typename Bound1UnwrapTraits::ForwardType x1 =
+ Bound1UnwrapTraits::Unwrap(storage->p1_);
+ typename Bound2UnwrapTraits::ForwardType x2 =
+ Bound2UnwrapTraits::Unwrap(storage->p2_);
+ return InvokeHelper<StorageType::IsWeakCall::value, R,
+ typename StorageType::RunnableType,
+ void(typename Bound1UnwrapTraits::ForwardType,
+ typename Bound2UnwrapTraits::ForwardType,
+ typename CallbackParamTraits<X3>::ForwardType x3,
+ typename CallbackParamTraits<X4>::ForwardType x4,
+ typename CallbackParamTraits<X5>::ForwardType x5,
+ typename CallbackParamTraits<X6>::ForwardType x6,
+ typename CallbackParamTraits<X7>::ForwardType x7,
+ typename CallbackParamTraits<X8>::ForwardType x8)>
+ ::MakeItSo(storage->runnable_, CallbackForward(x1),
+ CallbackForward(x2), CallbackForward(x3),
+ CallbackForward(x4), CallbackForward(x5),
+ CallbackForward(x6), CallbackForward(x7),
+ CallbackForward(x8));
+ }
+};
+
+// Arity 8 -> 5.
+template <typename StorageType, typename R,typename X1, typename X2,
+ typename X3, typename X4, typename X5, typename X6, typename X7,
+ typename X8>
+struct Invoker<3, StorageType, R(X1, X2, X3, X4, X5, X6, X7, X8)> {
+ typedef R(RunType)(BindStateBase*,
+ typename CallbackParamTraits<X4>::ForwardType,
+ typename CallbackParamTraits<X5>::ForwardType,
+ typename CallbackParamTraits<X6>::ForwardType,
+ typename CallbackParamTraits<X7>::ForwardType,
+ typename CallbackParamTraits<X8>::ForwardType);
+
+ typedef R(UnboundRunType)(X4, X5, X6, X7, X8);
+
+ static R Run(BindStateBase* base,
+ typename CallbackParamTraits<X4>::ForwardType x4,
+ typename CallbackParamTraits<X5>::ForwardType x5,
+ typename CallbackParamTraits<X6>::ForwardType x6,
+ typename CallbackParamTraits<X7>::ForwardType x7,
+ typename CallbackParamTraits<X8>::ForwardType x8) {
+ StorageType* storage = static_cast<StorageType*>(base);
+
+ // Local references to make debugger stepping easier. If in a debugger,
+ // you really want to warp ahead and step through the
+ // InvokeHelper<>::MakeItSo() call below.
+ typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
+ typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
+ typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits;
+
+ typename Bound1UnwrapTraits::ForwardType x1 =
+ Bound1UnwrapTraits::Unwrap(storage->p1_);
+ typename Bound2UnwrapTraits::ForwardType x2 =
+ Bound2UnwrapTraits::Unwrap(storage->p2_);
+ typename Bound3UnwrapTraits::ForwardType x3 =
+ Bound3UnwrapTraits::Unwrap(storage->p3_);
+ return InvokeHelper<StorageType::IsWeakCall::value, R,
+ typename StorageType::RunnableType,
+ void(typename Bound1UnwrapTraits::ForwardType,
+ typename Bound2UnwrapTraits::ForwardType,
+ typename Bound3UnwrapTraits::ForwardType,
+ typename CallbackParamTraits<X4>::ForwardType x4,
+ typename CallbackParamTraits<X5>::ForwardType x5,
+ typename CallbackParamTraits<X6>::ForwardType x6,
+ typename CallbackParamTraits<X7>::ForwardType x7,
+ typename CallbackParamTraits<X8>::ForwardType x8)>
+ ::MakeItSo(storage->runnable_, CallbackForward(x1),
+ CallbackForward(x2), CallbackForward(x3),
+ CallbackForward(x4), CallbackForward(x5),
+ CallbackForward(x6), CallbackForward(x7),
+ CallbackForward(x8));
+ }
+};
+
+// Arity 8 -> 4.
+template <typename StorageType, typename R,typename X1, typename X2,
+ typename X3, typename X4, typename X5, typename X6, typename X7,
+ typename X8>
+struct Invoker<4, StorageType, R(X1, X2, X3, X4, X5, X6, X7, X8)> {
+ typedef R(RunType)(BindStateBase*,
+ typename CallbackParamTraits<X5>::ForwardType,
+ typename CallbackParamTraits<X6>::ForwardType,
+ typename CallbackParamTraits<X7>::ForwardType,
+ typename CallbackParamTraits<X8>::ForwardType);
+
+ typedef R(UnboundRunType)(X5, X6, X7, X8);
+
+ static R Run(BindStateBase* base,
+ typename CallbackParamTraits<X5>::ForwardType x5,
+ typename CallbackParamTraits<X6>::ForwardType x6,
+ typename CallbackParamTraits<X7>::ForwardType x7,
+ typename CallbackParamTraits<X8>::ForwardType x8) {
+ StorageType* storage = static_cast<StorageType*>(base);
+
+ // Local references to make debugger stepping easier. If in a debugger,
+ // you really want to warp ahead and step through the
+ // InvokeHelper<>::MakeItSo() call below.
+ typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
+ typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
+ typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits;
+ typedef typename StorageType::Bound4UnwrapTraits Bound4UnwrapTraits;
+
+ typename Bound1UnwrapTraits::ForwardType x1 =
+ Bound1UnwrapTraits::Unwrap(storage->p1_);
+ typename Bound2UnwrapTraits::ForwardType x2 =
+ Bound2UnwrapTraits::Unwrap(storage->p2_);
+ typename Bound3UnwrapTraits::ForwardType x3 =
+ Bound3UnwrapTraits::Unwrap(storage->p3_);
+ typename Bound4UnwrapTraits::ForwardType x4 =
+ Bound4UnwrapTraits::Unwrap(storage->p4_);
+ return InvokeHelper<StorageType::IsWeakCall::value, R,
+ typename StorageType::RunnableType,
+ void(typename Bound1UnwrapTraits::ForwardType,
+ typename Bound2UnwrapTraits::ForwardType,
+ typename Bound3UnwrapTraits::ForwardType,
+ typename Bound4UnwrapTraits::ForwardType,
+ typename CallbackParamTraits<X5>::ForwardType x5,
+ typename CallbackParamTraits<X6>::ForwardType x6,
+ typename CallbackParamTraits<X7>::ForwardType x7,
+ typename CallbackParamTraits<X8>::ForwardType x8)>
+ ::MakeItSo(storage->runnable_, CallbackForward(x1),
+ CallbackForward(x2), CallbackForward(x3),
+ CallbackForward(x4), CallbackForward(x5),
+ CallbackForward(x6), CallbackForward(x7),
+ CallbackForward(x8));
+ }
+};
+
+// Arity 8 -> 3.
+template <typename StorageType, typename R,typename X1, typename X2,
+ typename X3, typename X4, typename X5, typename X6, typename X7,
+ typename X8>
+struct Invoker<5, StorageType, R(X1, X2, X3, X4, X5, X6, X7, X8)> {
+ typedef R(RunType)(BindStateBase*,
+ typename CallbackParamTraits<X6>::ForwardType,
+ typename CallbackParamTraits<X7>::ForwardType,
+ typename CallbackParamTraits<X8>::ForwardType);
+
+ typedef R(UnboundRunType)(X6, X7, X8);
+
+ static R Run(BindStateBase* base,
+ typename CallbackParamTraits<X6>::ForwardType x6,
+ typename CallbackParamTraits<X7>::ForwardType x7,
+ typename CallbackParamTraits<X8>::ForwardType x8) {
+ StorageType* storage = static_cast<StorageType*>(base);
+
+ // Local references to make debugger stepping easier. If in a debugger,
+ // you really want to warp ahead and step through the
+ // InvokeHelper<>::MakeItSo() call below.
+ typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
+ typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
+ typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits;
+ typedef typename StorageType::Bound4UnwrapTraits Bound4UnwrapTraits;
+ typedef typename StorageType::Bound5UnwrapTraits Bound5UnwrapTraits;
+
+ typename Bound1UnwrapTraits::ForwardType x1 =
+ Bound1UnwrapTraits::Unwrap(storage->p1_);
+ typename Bound2UnwrapTraits::ForwardType x2 =
+ Bound2UnwrapTraits::Unwrap(storage->p2_);
+ typename Bound3UnwrapTraits::ForwardType x3 =
+ Bound3UnwrapTraits::Unwrap(storage->p3_);
+ typename Bound4UnwrapTraits::ForwardType x4 =
+ Bound4UnwrapTraits::Unwrap(storage->p4_);
+ typename Bound5UnwrapTraits::ForwardType x5 =
+ Bound5UnwrapTraits::Unwrap(storage->p5_);
+ return InvokeHelper<StorageType::IsWeakCall::value, R,
+ typename StorageType::RunnableType,
+ void(typename Bound1UnwrapTraits::ForwardType,
+ typename Bound2UnwrapTraits::ForwardType,
+ typename Bound3UnwrapTraits::ForwardType,
+ typename Bound4UnwrapTraits::ForwardType,
+ typename Bound5UnwrapTraits::ForwardType,
+ typename CallbackParamTraits<X6>::ForwardType x6,
+ typename CallbackParamTraits<X7>::ForwardType x7,
+ typename CallbackParamTraits<X8>::ForwardType x8)>
+ ::MakeItSo(storage->runnable_, CallbackForward(x1),
+ CallbackForward(x2), CallbackForward(x3),
+ CallbackForward(x4), CallbackForward(x5),
+ CallbackForward(x6), CallbackForward(x7),
+ CallbackForward(x8));
+ }
+};
+
+// Arity 8 -> 2.
+template <typename StorageType, typename R,typename X1, typename X2,
+ typename X3, typename X4, typename X5, typename X6, typename X7,
+ typename X8>
+struct Invoker<6, StorageType, R(X1, X2, X3, X4, X5, X6, X7, X8)> {
+ typedef R(RunType)(BindStateBase*,
+ typename CallbackParamTraits<X7>::ForwardType,
+ typename CallbackParamTraits<X8>::ForwardType);
+
+ typedef R(UnboundRunType)(X7, X8);
+
+ static R Run(BindStateBase* base,
+ typename CallbackParamTraits<X7>::ForwardType x7,
+ typename CallbackParamTraits<X8>::ForwardType x8) {
+ StorageType* storage = static_cast<StorageType*>(base);
+
+ // Local references to make debugger stepping easier. If in a debugger,
+ // you really want to warp ahead and step through the
+ // InvokeHelper<>::MakeItSo() call below.
+ typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
+ typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
+ typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits;
+ typedef typename StorageType::Bound4UnwrapTraits Bound4UnwrapTraits;
+ typedef typename StorageType::Bound5UnwrapTraits Bound5UnwrapTraits;
+ typedef typename StorageType::Bound6UnwrapTraits Bound6UnwrapTraits;
+
+ typename Bound1UnwrapTraits::ForwardType x1 =
+ Bound1UnwrapTraits::Unwrap(storage->p1_);
+ typename Bound2UnwrapTraits::ForwardType x2 =
+ Bound2UnwrapTraits::Unwrap(storage->p2_);
+ typename Bound3UnwrapTraits::ForwardType x3 =
+ Bound3UnwrapTraits::Unwrap(storage->p3_);
+ typename Bound4UnwrapTraits::ForwardType x4 =
+ Bound4UnwrapTraits::Unwrap(storage->p4_);
+ typename Bound5UnwrapTraits::ForwardType x5 =
+ Bound5UnwrapTraits::Unwrap(storage->p5_);
+ typename Bound6UnwrapTraits::ForwardType x6 =
+ Bound6UnwrapTraits::Unwrap(storage->p6_);
+ return InvokeHelper<StorageType::IsWeakCall::value, R,
+ typename StorageType::RunnableType,
+ void(typename Bound1UnwrapTraits::ForwardType,
+ typename Bound2UnwrapTraits::ForwardType,
+ typename Bound3UnwrapTraits::ForwardType,
+ typename Bound4UnwrapTraits::ForwardType,
+ typename Bound5UnwrapTraits::ForwardType,
+ typename Bound6UnwrapTraits::ForwardType,
+ typename CallbackParamTraits<X7>::ForwardType x7,
+ typename CallbackParamTraits<X8>::ForwardType x8)>
+ ::MakeItSo(storage->runnable_, CallbackForward(x1),
+ CallbackForward(x2), CallbackForward(x3),
+ CallbackForward(x4), CallbackForward(x5),
+ CallbackForward(x6), CallbackForward(x7),
+ CallbackForward(x8));
+ }
+};
+
+// Arity 8 -> 1.
+template <typename StorageType, typename R,typename X1, typename X2,
+ typename X3, typename X4, typename X5, typename X6, typename X7,
+ typename X8>
+struct Invoker<7, StorageType, R(X1, X2, X3, X4, X5, X6, X7, X8)> {
+ typedef R(RunType)(BindStateBase*,
+ typename CallbackParamTraits<X8>::ForwardType);
+
+ typedef R(UnboundRunType)(X8);
+
+ static R Run(BindStateBase* base,
+ typename CallbackParamTraits<X8>::ForwardType x8) {
+ StorageType* storage = static_cast<StorageType*>(base);
+
+ // Local references to make debugger stepping easier. If in a debugger,
+ // you really want to warp ahead and step through the
+ // InvokeHelper<>::MakeItSo() call below.
+ typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
+ typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
+ typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits;
+ typedef typename StorageType::Bound4UnwrapTraits Bound4UnwrapTraits;
+ typedef typename StorageType::Bound5UnwrapTraits Bound5UnwrapTraits;
+ typedef typename StorageType::Bound6UnwrapTraits Bound6UnwrapTraits;
+ typedef typename StorageType::Bound7UnwrapTraits Bound7UnwrapTraits;
+
+ typename Bound1UnwrapTraits::ForwardType x1 =
+ Bound1UnwrapTraits::Unwrap(storage->p1_);
+ typename Bound2UnwrapTraits::ForwardType x2 =
+ Bound2UnwrapTraits::Unwrap(storage->p2_);
+ typename Bound3UnwrapTraits::ForwardType x3 =
+ Bound3UnwrapTraits::Unwrap(storage->p3_);
+ typename Bound4UnwrapTraits::ForwardType x4 =
+ Bound4UnwrapTraits::Unwrap(storage->p4_);
+ typename Bound5UnwrapTraits::ForwardType x5 =
+ Bound5UnwrapTraits::Unwrap(storage->p5_);
+ typename Bound6UnwrapTraits::ForwardType x6 =
+ Bound6UnwrapTraits::Unwrap(storage->p6_);
+ typename Bound7UnwrapTraits::ForwardType x7 =
+ Bound7UnwrapTraits::Unwrap(storage->p7_);
+ return InvokeHelper<StorageType::IsWeakCall::value, R,
+ typename StorageType::RunnableType,
+ void(typename Bound1UnwrapTraits::ForwardType,
+ typename Bound2UnwrapTraits::ForwardType,
+ typename Bound3UnwrapTraits::ForwardType,
+ typename Bound4UnwrapTraits::ForwardType,
+ typename Bound5UnwrapTraits::ForwardType,
+ typename Bound6UnwrapTraits::ForwardType,
+ typename Bound7UnwrapTraits::ForwardType,
+ typename CallbackParamTraits<X8>::ForwardType x8)>
+ ::MakeItSo(storage->runnable_, CallbackForward(x1),
+ CallbackForward(x2), CallbackForward(x3),
+ CallbackForward(x4), CallbackForward(x5),
+ CallbackForward(x6), CallbackForward(x7),
+ CallbackForward(x8));
+ }
+};
+
+// Arity 8 -> 0.
+template <typename StorageType, typename R,typename X1, typename X2,
+ typename X3, typename X4, typename X5, typename X6, typename X7,
+ typename X8>
+struct Invoker<8, StorageType, R(X1, X2, X3, X4, X5, X6, X7, X8)> {
+ typedef R(RunType)(BindStateBase*);
+
+ typedef R(UnboundRunType)();
+
+ static R Run(BindStateBase* base) {
+ StorageType* storage = static_cast<StorageType*>(base);
+
+ // Local references to make debugger stepping easier. If in a debugger,
+ // you really want to warp ahead and step through the
+ // InvokeHelper<>::MakeItSo() call below.
+ typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits;
+ typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits;
+ typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits;
+ typedef typename StorageType::Bound4UnwrapTraits Bound4UnwrapTraits;
+ typedef typename StorageType::Bound5UnwrapTraits Bound5UnwrapTraits;
+ typedef typename StorageType::Bound6UnwrapTraits Bound6UnwrapTraits;
+ typedef typename StorageType::Bound7UnwrapTraits Bound7UnwrapTraits;
+ typedef typename StorageType::Bound8UnwrapTraits Bound8UnwrapTraits;
+
+ typename Bound1UnwrapTraits::ForwardType x1 =
+ Bound1UnwrapTraits::Unwrap(storage->p1_);
+ typename Bound2UnwrapTraits::ForwardType x2 =
+ Bound2UnwrapTraits::Unwrap(storage->p2_);
+ typename Bound3UnwrapTraits::ForwardType x3 =
+ Bound3UnwrapTraits::Unwrap(storage->p3_);
+ typename Bound4UnwrapTraits::ForwardType x4 =
+ Bound4UnwrapTraits::Unwrap(storage->p4_);
+ typename Bound5UnwrapTraits::ForwardType x5 =
+ Bound5UnwrapTraits::Unwrap(storage->p5_);
+ typename Bound6UnwrapTraits::ForwardType x6 =
+ Bound6UnwrapTraits::Unwrap(storage->p6_);
+ typename Bound7UnwrapTraits::ForwardType x7 =
+ Bound7UnwrapTraits::Unwrap(storage->p7_);
+ typename Bound8UnwrapTraits::ForwardType x8 =
+ Bound8UnwrapTraits::Unwrap(storage->p8_);
+ return InvokeHelper<StorageType::IsWeakCall::value, R,
+ typename StorageType::RunnableType,
+ void(typename Bound1UnwrapTraits::ForwardType,
+ typename Bound2UnwrapTraits::ForwardType,
+ typename Bound3UnwrapTraits::ForwardType,
+ typename Bound4UnwrapTraits::ForwardType,
+ typename Bound5UnwrapTraits::ForwardType,
+ typename Bound6UnwrapTraits::ForwardType,
+ typename Bound7UnwrapTraits::ForwardType,
+ typename Bound8UnwrapTraits::ForwardType)>
+ ::MakeItSo(storage->runnable_, CallbackForward(x1),
+ CallbackForward(x2), CallbackForward(x3),
+ CallbackForward(x4), CallbackForward(x5),
+ CallbackForward(x6), CallbackForward(x7),
+ CallbackForward(x8));
+ }
+};
// BindState<>
//
@@ -2786,6 +3415,54 @@ struct BindState<Runnable, RunType, void(P1, P2, P3, P4, P5, P6,
P7 p7_;
};
+template <typename Runnable, typename RunType, typename P1, typename P2,
+ typename P3, typename P4, typename P5, typename P6, typename P7,
+ typename P8>
+struct BindState<Runnable, RunType, void(P1, P2, P3, P4, P5, P6,
+ P7, P8)> : public BindStateBase {
+ typedef Runnable RunnableType;
+ typedef IsWeakMethod<HasIsMethodTag<Runnable>::value, P1> IsWeakCall;
+ typedef Invoker<8, BindState, RunType> InvokerType;
+ typedef typename InvokerType::UnboundRunType UnboundRunType;
+
+ // Convenience typedefs for bound argument types.
+ typedef UnwrapTraits<P1> Bound1UnwrapTraits;
+ typedef UnwrapTraits<P2> Bound2UnwrapTraits;
+ typedef UnwrapTraits<P3> Bound3UnwrapTraits;
+ typedef UnwrapTraits<P4> Bound4UnwrapTraits;
+ typedef UnwrapTraits<P5> Bound5UnwrapTraits;
+ typedef UnwrapTraits<P6> Bound6UnwrapTraits;
+ typedef UnwrapTraits<P7> Bound7UnwrapTraits;
+ typedef UnwrapTraits<P8> Bound8UnwrapTraits;
+
+ BindState(const Runnable& runnable, const P1& p1, const P2& p2, const P3& p3,
+ const P4& p4, const P5& p5, const P6& p6, const P7& p7, const P8& p8)
+ : runnable_(runnable),
+ p1_(p1),
+ p2_(p2),
+ p3_(p3),
+ p4_(p4),
+ p5_(p5),
+ p6_(p6),
+ p7_(p7),
+ p8_(p8) {
+ MaybeRefcount<HasIsMethodTag<Runnable>::value, P1>::AddRef(p1_);
+ }
+
+ virtual ~BindState() { MaybeRefcount<HasIsMethodTag<Runnable>::value,
+ P1>::Release(p1_); }
+
+ RunnableType runnable_;
+ P1 p1_;
+ P2 p2_;
+ P3 p3_;
+ P4 p4_;
+ P5 p5_;
+ P6 p6_;
+ P7 p7_;
+ P8 p8_;
+};
+
} // namespace internal
} // namespace base
« no previous file with comments | « base/bind.h ('k') | base/bind_internal_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698