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

Unified Diff: base/callback_forward.h

Issue 1699773002: Extend base::Callback to have a move-only variant (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 9 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
« no previous file with comments | « 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 a9a263a50ea77517e6514792843660d6d25435ca..8b9b89cdc231bcf1020111e91bcbda14fd4e678c 100644
--- a/base/callback_forward.h
+++ b/base/callback_forward.h
@@ -6,8 +6,19 @@
#define BASE_CALLBACK_FORWARD_H_
namespace base {
+namespace internal {
-template <typename Sig>
+// CopyMode is used to control the copyablity of a Callback.
+// MoveOnly indicates the Callback is not copyable but movable, and Copyable
+// indicates it is copyable and movable.
+enum class CopyMode {
+ MoveOnly, Copyable,
+};
+
+} // namespace internal
+
+template <typename Signature,
+ internal::CopyMode copy_mode = internal::CopyMode::Copyable>
class Callback;
// Syntactic sugar to make Callback<void()> easier to declare since it
« no previous file with comments | « base/callback.h ('k') | base/callback_internal.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698