Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2100)

Unified Diff: base/callback_forward.h

Issue 2042223002: Introduce OnceClosure and BindOnce (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update docs Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: base/callback_forward.h
diff --git a/base/callback_forward.h b/base/callback_forward.h
index 8b9b89cdc231bcf1020111e91bcbda14fd4e678c..78cc65100c5d33ab2a480d05993e9d0ebf8e928c 100644
--- a/base/callback_forward.h
+++ b/base/callback_forward.h
@@ -15,16 +15,36 @@ enum class CopyMode {
MoveOnly, Copyable,
};
+enum class RepeatMode {
+ OneShot,
+ 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 OneShotCallback = Callback<Signature,
+ internal::CopyMode::MoveOnly,
+ internal::RepeatMode::OneShot>;
+using RepeatingClosure = RepeatingCallback<void()>;
+using OneShotClosure = OneShotCallback<void()>;
+
+} // namespace internal
} // namespace base
#endif // BASE_CALLBACK_FORWARD_H_

Powered by Google App Engine
This is Rietveld 408576698