Chromium Code Reviews| Index: base/bind.h |
| diff --git a/base/bind.h b/base/bind.h |
| index 46dbb913bee1d0bc17825fec1dbced0719c1b350..2d7e0c2085a8ce77a39630d3647b71e73d6e01d3 100644 |
| --- a/base/bind.h |
| +++ b/base/bind.h |
| @@ -46,30 +46,14 @@ |
| namespace base { |
| -namespace internal { |
| - |
| -// Don't use Alias Template directly here to avoid a compile error on MSVC2013. |
| -template <typename Functor, typename... Args> |
| -struct MakeUnboundRunTypeImpl { |
| - using Type = |
| - typename BindState< |
| - typename FunctorTraits<Functor>::RunnableType, |
| - typename FunctorTraits<Functor>::RunType, |
| - Args...>::UnboundRunType; |
| -}; |
| - |
| -} // namespace internal |
| - |
| template <typename Functor, typename... Args> |
| -using MakeUnboundRunType = |
| - typename internal::MakeUnboundRunTypeImpl<Functor, Args...>::Type; |
| +using MakeUnboundRunType = internal::MakeUnboundRunType<Functor, Args...>; |
| template <typename Functor, typename... Args> |
| -base::Callback<MakeUnboundRunType<Functor, Args...>> |
| +static inline base::Callback<MakeUnboundRunType<Functor, Args...>> |
|
Nico
2016/06/02 17:27:44
(looks like this bit was part of the other cl as w
|
| Bind(Functor functor, Args&&... args) { |
| // Type aliases for how to store and run the functor. |
| using RunnableType = typename internal::FunctorTraits<Functor>::RunnableType; |
| - using RunType = typename internal::FunctorTraits<Functor>::RunType; |
| // Use RunnableType::RunType instead of RunType above because our |
| // checks below for bound references need to know what the actual |
| @@ -100,11 +84,14 @@ Bind(Functor functor, Args&&... args) { |
| !internal::HasRefCountedParamAsRawPtr<is_method, Args...>::value, |
| "a parameter is a refcounted type and needs scoped_refptr"); |
| - using BindState = internal::BindState<RunnableType, RunType, Args...>; |
| + using BindState = internal::BindState<RunnableType, Args...>; |
| + using UnboundRunType = MakeUnboundRunType<Functor, Args...>; |
| + using CallbackType = Callback<UnboundRunType>; |
| + using Invoker = internal::Invoker<BindState, UnboundRunType>; |
| - return Callback<typename BindState::UnboundRunType>( |
| - new BindState(internal::MakeRunnable(functor), |
| - std::forward<Args>(args)...)); |
| + return CallbackType(new BindState(internal::MakeRunnable(functor), |
| + std::forward<Args>(args)...), |
| + &Invoker::Run); |
| } |
| } // namespace base |