Chromium Code Reviews| Index: base/callback.h |
| diff --git a/base/callback.h b/base/callback.h |
| index 00669dd83d1c2dbb518134f0243fd5dbec104133..6572afc3dc0ddf333d205598911304b4bd41914f 100644 |
| --- a/base/callback.h |
| +++ b/base/callback.h |
| @@ -165,7 +165,7 @@ |
| // that doesn't expect a return value. |
| // |
| // int DoSomething(int arg) { cout << arg << endl; } |
| -// base::Callback<void<int>) cb = |
| +// base::Callback<void(int)> cb = |
| // base::Bind(base::IgnoreResult(&DoSomething)); |
| // |
| // |
| @@ -354,40 +354,25 @@ namespace base { |
| // |
| // If you are thinking of forward declaring Callback in your own header file, |
| // please include "base/callback_forward.h" instead. |
| -template <typename Sig> |
| -class Callback; |
| - |
| -namespace internal { |
| -template <typename Runnable, typename RunType, typename BoundArgsType> |
| -struct BindState; |
| -} // namespace internal |
| template <typename R, typename... Args> |
| class Callback<R(Args...)> : public internal::CallbackBase { |
| public: |
| typedef R(RunType)(Args...); |
| - Callback() : CallbackBase(NULL) { } |
| + Callback() : CallbackBase(nullptr) { } |
| - // Note that this constructor CANNOT be explicit, and that Bind() CANNOT |
| - // return the exact Callback<> type. See base/bind.h for details. |
| - template <typename Runnable, typename BindRunType, typename BoundArgsType> |
| - Callback(internal::BindState<Runnable, BindRunType, |
| - BoundArgsType>* bind_state) |
| + // See base/bind.h for details. |
| + template <typename BindStateType> |
| + explicit Callback(BindStateType* bind_state) |
|
dcheng
2015/12/08 20:16:46
This would allow an external implementation of Bin
tzik
2015/12/09 07:03:15
No use case for now, except for callback_unittest.
|
| : CallbackBase(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, BoundArgsType> |
| - ::InvokerType::Run; |
| + PolymorphicInvoke invoke_func = &BindStateType::InvokerType::Run; |
| polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func); |
| } |
| - bool Equals(const Callback& other) const { |
| - return CallbackBase::Equals(other); |
| - } |
| - |
| R Run(typename internal::CallbackParamTraits<Args>::ForwardType... args) |
| const { |
| PolymorphicInvoke f = |
| @@ -402,10 +387,6 @@ class Callback<R(Args...)> : public internal::CallbackBase { |
| typename internal::CallbackParamTraits<Args>::ForwardType...); |
| }; |
| -// Syntactic sugar to make Callback<void(void)> easier to declare since it |
| -// will be used in a lot of APIs with delayed execution. |
| -typedef Callback<void(void)> Closure; |
| - |
| } // namespace base |
| #endif // BASE_CALLBACK_H_ |