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 = 7 | 8 $var MAX_ARITY = 7 |
9 | 9 |
10 // Copyright 2014 The Chromium Authors. All rights reserved. | 10 // Copyright 2014 The Chromium Authors. All rights reserved. |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 // be adapted to a Callback using this constructor. | 45 // be adapted to a Callback using this constructor. |
46 template <typename Sink> | 46 template <typename Sink> |
47 Callback(const Sink& sink) : sink_(new Adapter<Sink>(sink)) {} | 47 Callback(const Sink& sink) : sink_(new Adapter<Sink>(sink)) {} |
48 | 48 |
49 void Run( | 49 void Run( |
50 $for ARG , | 50 $for ARG , |
51 [[typename internal::Callback_ParamTraits<A$(ARG)>::ForwardType a$(ARG)]])
const { | 51 [[typename internal::Callback_ParamTraits<A$(ARG)>::ForwardType a$(ARG)]])
const { |
52 if (sink_.get()) | 52 if (sink_.get()) |
53 sink_->Run( | 53 sink_->Run( |
54 $for ARG , | 54 $for ARG , |
55 [[internal::Callback_Forward(a$(ARG))]]); | 55 [[internal::Forward(a$(ARG))]]); |
56 } | 56 } |
57 | 57 |
58 private: | 58 private: |
59 template <typename Sink> | 59 template <typename Sink> |
60 struct Adapter : public Runnable { | 60 struct Adapter : public Runnable { |
61 explicit Adapter(const Sink& sink) : sink(sink) {} | 61 explicit Adapter(const Sink& sink) : sink(sink) {} |
62 virtual void Run( | 62 virtual void Run( |
63 $for ARG , | 63 $for ARG , |
64 [[typename internal::Callback_ParamTraits<A$(ARG)>::ForwardType a$(ARG)]
]) const MOJO_OVERRIDE { | 64 [[typename internal::Callback_ParamTraits<A$(ARG)>::ForwardType a$(ARG)]
]) const MOJO_OVERRIDE { |
65 sink.Run( | 65 sink.Run( |
66 $for ARG , | 66 $for ARG , |
67 [[internal::Callback_Forward(a$(ARG))]]); | 67 [[internal::Forward(a$(ARG))]]); |
68 } | 68 } |
69 Sink sink; | 69 Sink sink; |
70 }; | 70 }; |
71 | 71 |
72 internal::SharedPtr<Runnable> sink_; | 72 internal::SharedPtr<Runnable> sink_; |
73 }; | 73 }; |
74 | 74 |
75 ]] $$ for ARITY | 75 ]] $$ for ARITY |
76 | 76 |
77 } // namespace mojo | 77 } // namespace mojo |
78 | 78 |
79 #endif // MOJO_PUBLIC_CPP_BINDINGS_CALLBACK_H_ | 79 #endif // MOJO_PUBLIC_CPP_BINDINGS_CALLBACK_H_ |
OLD | NEW |