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

Side by Side Diff: base/bind.h.pump

Issue 8073012: Callback API Change: Allow Bind() to take a Callback<> and bind all its free parameters. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/bind.h ('k') | base/bind_internal.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 $$ This is a pump file for generating file templates. Pump is a python 1 $$ This is a pump file for generating file templates. Pump is a python
2 $$ script that is part of the Google Test suite of utilities. Description 2 $$ script that is part of the Google Test suite of utilities. Description
3 $$ can be found here: 3 $$ can be found here:
4 $$ 4 $$
5 $$ http://code.google.com/p/googletest/wiki/PumpManual 5 $$ http://code.google.com/p/googletest/wiki/PumpManual
6 $$ 6 $$
7 7
8 $var MAX_ARITY = 6 8 $var MAX_ARITY = 6
9 9
10 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 10 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 internal::InvokerStorageHolder<internal::InvokerStorage$(BOUND)<Sig, 56 internal::InvokerStorageHolder<internal::InvokerStorage$(BOUND)<Sig,
57 $for BOUND_ARG , [[P$(BOUND_ARG)]]> > 57 $for BOUND_ARG , [[P$(BOUND_ARG)]]> >
58 Bind(Sig f, $for BOUND_ARG , [[const P$(BOUND_ARG)& p$(BOUND_ARG)]]) { 58 Bind(Sig f, $for BOUND_ARG , [[const P$(BOUND_ARG)& p$(BOUND_ARG)]]) {
59 return internal::MakeInvokerStorageHolder( 59 return internal::MakeInvokerStorageHolder(
60 new internal::InvokerStorage$(BOUND)<Sig, [[]] 60 new internal::InvokerStorage$(BOUND)<Sig, [[]]
61 $for BOUND_ARG , [[P$(BOUND_ARG)]]>( 61 $for BOUND_ARG , [[P$(BOUND_ARG)]]>(
62 f, $for BOUND_ARG , [[p$(BOUND_ARG)]])); 62 f, $for BOUND_ARG , [[p$(BOUND_ARG)]]));
63 } 63 }
64 64
65 ]] 65 ]]
66 ]] $$ for BOUND
67
68 // Specializations to allow binding all the free arguments in a
69 // pre-existing base::Callback<>. This does not give full support for
70 // currying, but is significantly simpler and addresses the use case
71 // where a base::Callback<> needs to be invoked on another context/thread.
72 $for BOUND [[
73 $range BOUND_ARG 1..BOUND
74 $if BOUND != 0 [[
75
76 template <typename Sig, $for BOUND_ARG , [[typename P$(BOUND_ARG)]]>
77 base::Closure Bind(const base::Callback<Sig>& callback, [[]]
78 $for BOUND_ARG , [[const P$(BOUND_ARG)& p$(BOUND_ARG)]]) {
79 return base::Bind([[]]
80 &internal::BindMoreFunc$(BOUND)<Sig, $for BOUND_ARG , [[P$(BOUND_ARG)]]>, [[]]
81 callback, [[]]
82 $for BOUND_ARG , [[p$(BOUND_ARG)]]);
83 }
84
85 ]]
66 86
67 ]] $$ for BOUND 87 ]] $$ for BOUND
68 88
69 } // namespace base 89 } // namespace base
70 90
71 #endif // BASE_BIND_H_ 91 #endif // BASE_BIND_H_
OLDNEW
« no previous file with comments | « base/bind.h ('k') | base/bind_internal.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698