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

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 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_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_) {}
+
+CallbackBase<CopyMode::MoveOnly>& CallbackBase<CopyMode::MoveOnly>::operator=(
+ const CallbackBase<CopyMode::Copyable>& c) {
+ bind_state_ = c.bind_state_;
+ polymorphic_invoke_ = c.polymorphic_invoke_;
+ return *this;
+}
Yuta Kitamura 2016/08/16 07:44:12 Is there any reason why these can't be defined wit
tzik 2016/08/16 15:19:00 "= default" is not available for them, since they
Yuta Kitamura 2016/08/17 05:18:07 Ah okay. I was dumb.
+
void CallbackBase<CopyMode::MoveOnly>::Reset() {
polymorphic_invoke_ = nullptr;
// NULL the bind_state_ last, since it may be holding the last ref to whatever
« base/callback.h ('K') | « base/callback_internal.h ('k') | base/callback_unittest.nc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698