| Index: base/callback.h
|
| diff --git a/base/callback.h b/base/callback.h
|
| index 6844cc54dcb34317e9e0645753a304f52cc8bfc5..496f9d2e5d45fe1da432649e9fc5e9ecfba06e2e 100644
|
| --- a/base/callback.h
|
| +++ b/base/callback.h
|
| @@ -227,7 +227,7 @@ namespace base {
|
| // compiler that the template only has 1 type parameter which is the function
|
| // signature that the Callback is representing.
|
| //
|
| -// After this, create template specializations for 0-6 parameters. Note that
|
| +// After this, create template specializations for 0-7 parameters. Note that
|
| // even though the template typelist grows, the specialization still
|
| // only has one type: the function signature.
|
| template <typename Sig>
|
| @@ -573,6 +573,67 @@ class Callback<R(A1, A2, A3, A4, A5, A6)> : public internal::CallbackBase {
|
|
|
| };
|
|
|
| +template <typename R, typename A1, typename A2, typename A3, typename A4,
|
| + typename A5, typename A6, typename A7>
|
| +class Callback<R(A1, A2, A3, A4, A5, A6, A7)> : public internal::CallbackBase {
|
| + public:
|
| + typedef R(RunType)(A1, A2, A3, A4, A5, A6, A7);
|
| +
|
| + Callback() : CallbackBase(NULL, NULL) { }
|
| +
|
| + // We pass BindStateHolder by const ref to avoid incurring an
|
| + // unnecessary AddRef/Unref pair even though we will modify the object.
|
| + // We cannot use a normal reference because the compiler will warn
|
| + // since this is often used on a return value, which is a temporary.
|
| + //
|
| + // Note that this constructor CANNOT be explicit, and that Bind() CANNOT
|
| + // return the exact Callback<> type. See base/bind.h for details.
|
| + template <typename T>
|
| + Callback(const internal::BindStateHolder<T>& bind_state_holder)
|
| + : CallbackBase(NULL, &bind_state_holder.bind_state_) {
|
| + // Force the assignment to a location variable of PolymorphicInvoke
|
| + // so the compiler will typecheck that the passed in Run() method has
|
| + // the correct type.
|
| + PolymorphicInvoke invoke_func = &T::InvokerType::Run;
|
| + polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
|
| + }
|
| +
|
| + bool Equals(const Callback& other) const {
|
| + return CallbackBase::Equals(other);
|
| + }
|
| +
|
| + R Run(typename internal::CallbackParamTraits<A1>::ForwardType a1,
|
| + typename internal::CallbackParamTraits<A2>::ForwardType a2,
|
| + typename internal::CallbackParamTraits<A3>::ForwardType a3,
|
| + typename internal::CallbackParamTraits<A4>::ForwardType a4,
|
| + typename internal::CallbackParamTraits<A5>::ForwardType a5,
|
| + typename internal::CallbackParamTraits<A6>::ForwardType a6,
|
| + typename internal::CallbackParamTraits<A7>::ForwardType a7) const {
|
| + PolymorphicInvoke f =
|
| + reinterpret_cast<PolymorphicInvoke>(polymorphic_invoke_);
|
| +
|
| + return f(bind_state_.get(), a1,
|
| + a2,
|
| + a3,
|
| + a4,
|
| + a5,
|
| + a6,
|
| + a7);
|
| + }
|
| +
|
| + private:
|
| + typedef R(*PolymorphicInvoke)(
|
| + internal::BindStateBase*,
|
| + typename internal::CallbackParamTraits<A1>::ForwardType,
|
| + typename internal::CallbackParamTraits<A2>::ForwardType,
|
| + typename internal::CallbackParamTraits<A3>::ForwardType,
|
| + typename internal::CallbackParamTraits<A4>::ForwardType,
|
| + typename internal::CallbackParamTraits<A5>::ForwardType,
|
| + typename internal::CallbackParamTraits<A6>::ForwardType,
|
| + typename internal::CallbackParamTraits<A7>::ForwardType);
|
| +
|
| +};
|
| +
|
|
|
| // Syntactic sugar to make Callbacks<void(void)> easier to declare since it
|
| // will be used in a lot of APIs with delayed execution.
|
|
|