Chromium Code Reviews| Index: base/callback_forward.h |
| diff --git a/base/callback_forward.h b/base/callback_forward.h |
| index 8b9b89cdc231bcf1020111e91bcbda14fd4e678c..58b3f29e2e942f5c9f7e6035ead5a07a497e23c6 100644 |
| --- a/base/callback_forward.h |
| +++ b/base/callback_forward.h |
| @@ -15,16 +15,36 @@ enum class CopyMode { |
| MoveOnly, Copyable, |
| }; |
| +enum class RepeatMode { |
| + Once, |
|
dcheng
2016/09/08 04:09:01
Super minor optional nit: here, the order is Once,
tzik
2016/09/12 11:00:34
Done. I moved all .*Once.* before Repeating.
|
| + Repeating, |
| +}; |
| + |
| } // namespace internal |
| template <typename Signature, |
| - internal::CopyMode copy_mode = internal::CopyMode::Copyable> |
| + internal::CopyMode copy_mode = internal::CopyMode::Copyable, |
| + internal::RepeatMode repeat_mode = internal::RepeatMode::Repeating> |
| class Callback; |
| // Syntactic sugar to make Callback<void()> easier to declare since it |
| // will be used in a lot of APIs with delayed execution. |
| using Closure = Callback<void()>; |
| +namespace internal { |
| + |
| +template <typename Signature> |
| +using RepeatingCallback = Callback<Signature, |
| + internal::CopyMode::Copyable, |
| + internal::RepeatMode::Repeating>; |
| +template <typename Signature> |
| +using OnceCallback = Callback<Signature, |
| + internal::CopyMode::MoveOnly, |
| + internal::RepeatMode::Once>; |
| +using RepeatingClosure = RepeatingCallback<void()>; |
| +using OnceClosure = OnceCallback<void()>; |
| + |
| +} // namespace internal |
| } // namespace base |
| #endif // BASE_CALLBACK_FORWARD_H_ |