Revert 115441 - Redo r113722 - Add Pass(), which implements move semantics, to scoped_ptr, scoped_array....
(This undoes the revert in r114247. Win canaries still can't link, but
this change has been deemed safe).
Add Pass(), which implements move semantics, to scoped_ptr, scoped_array, and
scoped_ptr_malloc.
This modification to the scopers implements the "moveable but not copyable"
semantics that were introduced in C++11's unique_ptr<>.
With this, is now possible to use scopers as an argument type or a return type.
This signifies, in the type system, transfer of ownership into a function or out
of a function respectively. Calling, or returning such a function MUST use the
temporary resulting from a function or explicit cast.
This distinction makes it possible to avoid the implicit ownership transfer
issues of auto_ptr, but still allow us to have compiler enforced ownership
transfer.
Also adds a Passed() helper that allows using a scoper with Bind().
BUG=96118
TEST=new unittests
Review URL: http://codereview.chromium.org/9021032
TBR=ajwong@chromium.org
Review URL: http://codereview.chromium.org/8949057
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@115444 0039d316-1c4b-4281-b951-d872f2087c98
CrOS-Libchrome-Original-Commit: 088badbc399465ef8fc2ea9e5c12cc0c98c3bba6
diff --git a/base/bind_internal.h.pump b/base/bind_internal.h.pump
index 7fd63d8..53dcbd3 100644
--- a/base/bind_internal.h.pump
+++ b/base/bind_internal.h.pump
@@ -82,6 +82,7 @@
// into the Bind() system, doing most of the type resolution.
// There are ARITY BindState types.
+
// RunnableAdapter<>
//
// The RunnableAdapter<> templates provide a uniform interface for invoking
@@ -120,7 +121,7 @@
}
R Run($for ARG , [[typename CallbackParamTraits<A$(ARG)>::ForwardType a$(ARG)]]) {
- return function_($for ARG , [[CallbackForward(a$(ARG))]]);
+ return function_($for ARG , [[a$(ARG)]]);
}
private:
@@ -142,7 +143,7 @@
R Run(T* object[[]]
$if ARITY > 0[[, ]] $for ARG, [[typename CallbackParamTraits<A$(ARG)>::ForwardType a$(ARG)]]) {
- return (object->*method_)($for ARG , [[CallbackForward(a$(ARG))]]);
+ return (object->*method_)($for ARG , [[a$(ARG)]]);
}
private:
@@ -164,7 +165,7 @@
R Run(const T* object[[]]
$if ARITY > 0[[, ]] $for ARG, [[typename CallbackParamTraits<A$(ARG)>::ForwardType a$(ARG)]]) {
- return (object->*method_)($for ARG , [[CallbackForward(a$(ARG))]]);
+ return (object->*method_)($for ARG , [[a$(ARG)]]);
}
private:
@@ -290,7 +291,7 @@
void($for ARG , [[A$(ARG)]])> {
static ReturnType MakeItSo(Runnable runnable[[]]
$if ARITY > 0[[, ]] $for ARG , [[A$(ARG) a$(ARG)]]) {
- return runnable.Run($for ARG , [[CallbackForward(a$(ARG))]]);
+ return runnable.Run($for ARG , [[a$(ARG)]]);
}
};
@@ -300,7 +301,7 @@
void($for ARG , [[A$(ARG)]])> {
static void MakeItSo(Runnable runnable[[]]
$if ARITY > 0[[, ]] $for ARG , [[A$(ARG) a$(ARG)]]) {
- runnable.Run($for ARG , [[CallbackForward(a$(ARG))]]);
+ runnable.Run($for ARG , [[a$(ARG)]]);
}
};
@@ -315,7 +316,7 @@
return;
}
- runnable.Run($for ARG , [[CallbackForward(a$(ARG))]]);
+ runnable.Run($for ARG , [[a$(ARG)]]);
}
};
@@ -403,7 +404,7 @@
]]
)>
::MakeItSo(storage->runnable_
-$if ARITY > 0[[, ]] $for ARG , [[CallbackForward(x$(ARG))]]);
+$if ARITY > 0[[, ]] $for ARG , [[x$(ARG)]]);
}
};