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

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: rebase Created 4 years, 5 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
« base/bind.h ('K') | « base/callback.h ('k') | base/callback_internal.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/callback_forward.h
diff --git a/base/callback_forward.h b/base/callback_forward.h
index 8b9b89cdc231bcf1020111e91bcbda14fd4e678c..5e0af872bf9039072912cbeb49ff8f949ca83f61 100644
--- a/base/callback_forward.h
+++ b/base/callback_forward.h
@@ -15,15 +15,32 @@ 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;
+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>;
+
// 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()>;
+using RepeatingClosure = RepeatingCallback<void()>;
+using OneShotClosure = OneShotCallback<void()>;
} // namespace base
« base/bind.h ('K') | « base/callback.h ('k') | base/callback_internal.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698