Index: base/bind.h |
diff --git a/base/bind.h b/base/bind.h |
index 46dbb913bee1d0bc17825fec1dbced0719c1b350..bf59cb1afd09e75ead47c8cbc382a81d82d4d891 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...>; |
dcheng
2016/06/27 07:57:22
Nit: It seems a little unusual to have base::MakeU
tzik
2016/06/27 08:43:11
We have several place that uses MakeUnboundRunType
|
template <typename Functor, typename... Args> |
-base::Callback<MakeUnboundRunType<Functor, Args...>> |
+inline base::Callback<MakeUnboundRunType<Functor, Args...>> |
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 |