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

Unified Diff: base/callback_internal.cc

Issue 2042223002: Introduce OnceClosure and BindOnce (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update callback.md for Passed and movable types 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_internal.cc
diff --git a/base/callback_internal.cc b/base/callback_internal.cc
index 24b44272e0b6a8f3cfeb5f2eae0c152868217d7b..6e5a2763931234ddebf342a098a8552a15ee5a94 100644
--- a/base/callback_internal.cc
+++ b/base/callback_internal.cc
@@ -23,6 +23,17 @@ CallbackBase<CopyMode::MoveOnly>::CallbackBase(CallbackBase&& c) = default;
CallbackBase<CopyMode::MoveOnly>&
CallbackBase<CopyMode::MoveOnly>::operator=(CallbackBase&& c) = default;
+CallbackBase<CopyMode::MoveOnly>::CallbackBase(
+ const CallbackBase<CopyMode::Copyable>& c)
+ : bind_state_(c.bind_state_), polymorphic_invoke_(c.polymorphic_invoke_) {}
dcheng 2016/08/26 07:37:57 If we're creating it from a copyable callback, sho
dcheng 2016/08/31 06:20:53 Any thoughts on this comment?
tzik 2016/08/31 08:14:10 Oh, sorry. I missed this comment. Since the origi
+
+CallbackBase<CopyMode::MoveOnly>& CallbackBase<CopyMode::MoveOnly>::operator=(
+ const CallbackBase<CopyMode::Copyable>& c) {
+ bind_state_ = c.bind_state_;
+ polymorphic_invoke_ = c.polymorphic_invoke_;
+ return *this;
+}
+
void CallbackBase<CopyMode::MoveOnly>::Reset() {
polymorphic_invoke_ = nullptr;
// NULL the bind_state_ last, since it may be holding the last ref to whatever

Powered by Google App Engine
This is Rietveld 408576698