| Index: base/bind.h
|
| diff --git a/base/bind.h b/base/bind.h
|
| index 9cf65b67764b0cbcb393cd392f6fdb480d57496b..905ad4891a0c3debd00eabeb8793ad068a5f7f47 100644
|
| --- a/base/bind.h
|
| +++ b/base/bind.h
|
| @@ -11,7 +11,7 @@
|
| // Usage documentation
|
| // -----------------------------------------------------------------------------
|
| //
|
| -// See base/callback.h for documentation.
|
| +// See //docs/callback.md for documentation.
|
| //
|
| //
|
| // -----------------------------------------------------------------------------
|
| @@ -23,21 +23,48 @@
|
| // terms and concepts.
|
|
|
| namespace base {
|
| +namespace internal {
|
|
|
| +// Bind as RepeatingCallback.
|
| template <typename Functor, typename... Args>
|
| -inline base::Callback<MakeUnboundRunType<Functor, Args...>> Bind(
|
| - Functor&& functor,
|
| - Args&&... args) {
|
| +inline RepeatingCallback<MakeUnboundRunType<Functor, Args...>>
|
| +BindRepeating(Functor&& functor, Args&&... args) {
|
| using BindState = internal::MakeBindStateType<Functor, Args...>;
|
| using UnboundRunType = MakeUnboundRunType<Functor, Args...>;
|
| using Invoker = internal::Invoker<BindState, UnboundRunType>;
|
|
|
| - using CallbackType = Callback<UnboundRunType>;
|
| + using CallbackType = RepeatingCallback<UnboundRunType>;
|
| return CallbackType(new BindState(std::forward<Functor>(functor),
|
| std::forward<Args>(args)...),
|
| &Invoker::Run);
|
| }
|
|
|
| +// Bind as OnceCallback.
|
| +template <typename Functor, typename... Args>
|
| +inline OnceCallback<MakeUnboundRunType<Functor, Args...>>
|
| +BindOnce(Functor&& functor, Args&&... args) {
|
| + using BindState = internal::MakeBindStateType<Functor, Args...>;
|
| + using UnboundRunType = MakeUnboundRunType<Functor, Args...>;
|
| + using Invoker = internal::Invoker<BindState, UnboundRunType>;
|
| +
|
| + using CallbackType = OnceCallback<UnboundRunType>;
|
| + return CallbackType(new BindState(std::forward<Functor>(functor),
|
| + std::forward<Args>(args)...),
|
| + &Invoker::RunOnce);
|
| +}
|
| +
|
| +} // namespace internal
|
| +
|
| +// Unannotated Bind.
|
| +// TODO(tzik): Deprecate this and migrate to OnceCallback and
|
| +// RepeatingCallback, once they get ready.
|
| +template <typename Functor, typename... Args>
|
| +inline Callback<MakeUnboundRunType<Functor, Args...>>
|
| +Bind(Functor&& functor, Args&&... args) {
|
| + return internal::BindRepeating(std::forward<Functor>(functor),
|
| + std::forward<Args>(args)...);
|
| +}
|
| +
|
| } // namespace base
|
|
|
| #endif // BASE_BIND_H_
|
|
|