summaryrefslogtreecommitdiffstats
path: root/base/bind_internal.h.pump
diff options
context:
space:
mode:
authorajwong@chromium.org <ajwong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-30 09:09:34 +0000
committerajwong@chromium.org <ajwong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-30 09:09:34 +0000
commitcea20fe4e5ee8e0b81c9d4f0ff7750cb8ef64aef (patch)
tree48ce1068ad3c94af442bdb9b373329ff3300ef5f /base/bind_internal.h.pump
parentf3f0da43dfff66771f894b48c45c8c567062244f (diff)
downloadchromium_src-cea20fe4e5ee8e0b81c9d4f0ff7750cb8ef64aef.zip
chromium_src-cea20fe4e5ee8e0b81c9d4f0ff7750cb8ef64aef.tar.gz
chromium_src-cea20fe4e5ee8e0b81c9d4f0ff7750cb8ef64aef.tar.bz2
Allow Bind() to take a Callback<> and bind all its free parameters.
Basically, turns base::Callback<void(...)> to base::Closure. It turns out there are a number of use caess where an API takes a callback, and then wants to invoke the Callback on another thread. This piece of syntactic sugar removes the need for custom helper functions. This isn't quite full currying, however it is much simpler to implement. BUG=87287 TEST=none Review URL: http://codereview.chromium.org/8073012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@103446 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/bind_internal.h.pump')
-rw-r--r--base/bind_internal.h.pump17
1 files changed, 17 insertions, 0 deletions
diff --git a/base/bind_internal.h.pump b/base/bind_internal.h.pump
index 31988c5..532fe3d 100644
--- a/base/bind_internal.h.pump
+++ b/base/bind_internal.h.pump
@@ -266,6 +266,23 @@ $for M_UNBOUND_ARG , [[x$(M_UNBOUND_ARG)]]);
]] $$ for ARITY
]] $$ for BOUND
+// BindMoreFuncN<>
+//
+// This set of functions help in fully binding the free parameters in a
+// Callback<>.
+$for BOUND [[
+$range BOUND_ARG 1..BOUND
+$if BOUND != 0 [[
+
+template <typename Sig, $for BOUND_ARG , [[typename P$(BOUND_ARG)]]>
+void BindMoreFunc$(BOUND)(const base::Callback<Sig>& callback, [[]]
+$for BOUND_ARG , [[const P$(BOUND_ARG)& p$(BOUND_ARG)]]) {
+ callback.Run($for BOUND_ARG , [[p$(BOUND_ARG)]]);
+}
+
+]] $$ if BOUND
+]] $$ for BOUND
+
// InvokerStorageN<>
//
// These are the actual storage classes for the Invokers.