| OLD | NEW |
| 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 Loading... |
| 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_ |
| OLD | NEW |