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 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 template <typename T> | 267 template <typename T> |
268 Callback(const internal::InvokerStorageHolder<T>& invoker_holder) | 268 Callback(const internal::InvokerStorageHolder<T>& invoker_holder) |
269 : CallbackBase( | 269 : CallbackBase( |
270 reinterpret_cast<InvokeFuncStorage>(&T::Invoker::DoInvoke), | 270 reinterpret_cast<InvokeFuncStorage>(&T::Invoker::DoInvoke), |
271 &invoker_holder.invoker_storage_) { | 271 &invoker_holder.invoker_storage_) { |
272 COMPILE_ASSERT((is_same<PolymorphicInvoke, | 272 COMPILE_ASSERT((is_same<PolymorphicInvoke, |
273 typename T::Invoker::DoInvokeType>::value), | 273 typename T::Invoker::DoInvokeType>::value), |
274 callback_type_does_not_match_bind_result); | 274 callback_type_does_not_match_bind_result); |
275 } | 275 } |
276 | 276 |
| 277 bool Equals(const Callback& other) const { |
| 278 return CallbackBase::Equals(other); |
| 279 } |
| 280 |
277 R Run($for ARG , | 281 R Run($for ARG , |
278 [[typename internal::ParamTraits<A$(ARG)>::ForwardType a$(ARG)]]) const
{ | 282 [[typename internal::ParamTraits<A$(ARG)>::ForwardType a$(ARG)]]) const
{ |
279 PolymorphicInvoke f = | 283 PolymorphicInvoke f = |
280 reinterpret_cast<PolymorphicInvoke>(polymorphic_invoke_); | 284 reinterpret_cast<PolymorphicInvoke>(polymorphic_invoke_); |
281 | 285 |
282 return f(invoker_storage_.get()[[]] | 286 return f(invoker_storage_.get()[[]] |
283 $if ARITY != 0 [[, ]] | 287 $if ARITY != 0 [[, ]] |
284 $for ARG , | 288 $for ARG , |
285 [[a$(ARG)]]); | 289 [[a$(ARG)]]); |
286 } | 290 } |
287 }; | 291 }; |
288 | 292 |
289 | 293 |
290 ]] $$ for ARITY | 294 ]] $$ for ARITY |
291 | 295 |
292 // Syntactic sugar to make Callbacks<void(void)> easier to declare since it | 296 // Syntactic sugar to make Callbacks<void(void)> easier to declare since it |
293 // will be used in a lot of APIs with delayed execution. | 297 // will be used in a lot of APIs with delayed execution. |
294 typedef Callback<void(void)> Closure; | 298 typedef Callback<void(void)> Closure; |
295 | 299 |
296 } // namespace base | 300 } // namespace base |
297 | 301 |
298 #endif // BASE_CALLBACK_H | 302 #endif // BASE_CALLBACK_H |
OLD | NEW |