Chromium Code Reviews| Index: base/callback.h |
| diff --git a/base/callback.h b/base/callback.h |
| index abb907bef950e2303f51f26304a8bbbb6e8fdf92..f2859104be11150410f2eb25fa5c2fe9f349708a 100644 |
| --- a/base/callback.h |
| +++ b/base/callback.h |
| @@ -345,31 +345,23 @@ |
| // please include "base/callback_forward.h" instead. |
| namespace base { |
| -namespace internal { |
| -template <typename Runnable, typename RunType, typename... BoundArgsType> |
| -struct BindState; |
| -} // namespace internal |
| template <typename R, typename... Args, internal::CopyMode copy_mode> |
| class Callback<R(Args...), copy_mode> |
| : public internal::CallbackBase<copy_mode> { |
| + private: |
| + using PolymorphicInvoke = R (*)(internal::BindStateBase*, Args&&...); |
| public: |
| + |
|
Yuta Kitamura
2016/06/23 07:22:45
super nit: This newline is probably not needed. Yo
tzik
2016/06/23 08:16:10
Done.
|
| // MSVC 2013 doesn't support Type Alias of function types. |
| // Revisit this after we update it to newer version. |
| typedef R RunType(Args...); |
| Callback() : internal::CallbackBase<copy_mode>(nullptr) {} |
| - template <typename Runnable, typename BindRunType, typename... BoundArgs> |
| - explicit Callback( |
| - internal::BindState<Runnable, BindRunType, BoundArgs...>* bind_state) |
| + Callback(internal::BindStateBase* bind_state, |
| + PolymorphicInvoke invoke_func) |
| : internal::CallbackBase<copy_mode>(bind_state) { |
| - // Force the assignment to a local variable of PolymorphicInvoke |
| - // so the compiler will typecheck that the passed in Run() method has |
| - // the correct type. |
| - PolymorphicInvoke invoke_func = |
| - &internal::BindState<Runnable, BindRunType, BoundArgs...> |
| - ::InvokerType::Run; |
| using InvokeFuncStorage = |
| typename internal::CallbackBase<copy_mode>::InvokeFuncStorage; |
| this->polymorphic_invoke_ = |
| @@ -396,9 +388,6 @@ class Callback<R(Args...), copy_mode> |
| reinterpret_cast<PolymorphicInvoke>(this->polymorphic_invoke_); |
| return f(this->bind_state_.get(), std::forward<Args>(args)...); |
| } |
| - |
| - private: |
| - using PolymorphicInvoke = R (*)(internal::BindStateBase*, Args&&...); |
| }; |
| } // namespace base |