OLD | NEW |
1 // This file was GENERATED by command: | |
2 // pump.py bind_internal_win.h.pump | |
3 // DO NOT EDIT BY HAND!!! | |
4 | |
5 | |
6 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
7 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
8 // found in the LICENSE file. | 3 // found in the LICENSE file. |
9 | 4 |
10 // Specializations of RunnableAdapter<> for Windows specific calling | 5 // Specializations of RunnableAdapter<> for Windows specific calling |
11 // conventions. Please see base/bind_internal.h for more info. | 6 // conventions. Please see base/bind_internal.h for more info. |
12 | 7 |
13 #ifndef BASE_BIND_INTERNAL_WIN_H_ | 8 #ifndef BASE_BIND_INTERNAL_WIN_H_ |
14 #define BASE_BIND_INTERNAL_WIN_H_ | 9 #define BASE_BIND_INTERNAL_WIN_H_ |
15 | 10 |
16 // In the x64 architecture in Windows, __fastcall, __stdcall, etc, are all | 11 // In the x64 architecture in Windows, __fastcall, __stdcall, etc, are all |
17 // the same as __cdecl which would turn the following specializations into | 12 // the same as __cdecl which would turn the following specializations into |
18 // multiple definitions. | 13 // multiple definitions. |
19 #if !defined(ARCH_CPU_X86_64) | 14 #if !defined(ARCH_CPU_X86_64) |
20 | 15 |
21 namespace base { | 16 namespace base { |
22 namespace internal { | 17 namespace internal { |
23 | 18 |
24 template <typename Functor> | 19 template <typename Functor> |
25 class RunnableAdapter; | 20 class RunnableAdapter; |
26 | 21 |
27 // __stdcall Function: Arity 0. | 22 // __stdcall Function. |
28 template <typename R> | 23 template <typename R, typename... Args> |
29 class RunnableAdapter<R(__stdcall *)()> { | 24 class RunnableAdapter<R(__stdcall *)(Args...)> { |
30 public: | 25 public: |
31 typedef R (RunType)(); | 26 typedef R (RunType)(Args...); |
32 | 27 |
33 explicit RunnableAdapter(R(__stdcall *function)()) | 28 explicit RunnableAdapter(R(__stdcall *function)(Args...)) |
34 : function_(function) { | 29 : function_(function) { |
35 } | 30 } |
36 | 31 |
37 R Run() { | 32 R Run(typename CallbackParamTraits<Args>::ForwardType... args) { |
38 return function_(); | 33 return function_(args...); |
39 } | 34 } |
40 | 35 |
41 private: | 36 private: |
42 R (__stdcall *function_)(); | 37 R (__stdcall *function_)(Args...); |
43 }; | 38 }; |
44 | 39 |
45 // __fastcall Function: Arity 0. | 40 // __fastcall Function. |
46 template <typename R> | 41 template <typename R, typename... Args> |
47 class RunnableAdapter<R(__fastcall *)()> { | 42 class RunnableAdapter<R(__fastcall *)(Args...)> { |
48 public: | 43 public: |
49 typedef R (RunType)(); | 44 typedef R (RunType)(Args...); |
50 | 45 |
51 explicit RunnableAdapter(R(__fastcall *function)()) | 46 explicit RunnableAdapter(R(__fastcall *function)(Args...)) |
52 : function_(function) { | 47 : function_(function) { |
53 } | 48 } |
54 | 49 |
55 R Run() { | 50 R Run(typename CallbackParamTraits<Args>::ForwardType... args) { |
56 return function_(); | 51 return function_(args...); |
57 } | 52 } |
58 | 53 |
59 private: | 54 private: |
60 R (__fastcall *function_)(); | 55 R (__fastcall *function_)(Args...); |
61 }; | |
62 | |
63 // __stdcall Function: Arity 1. | |
64 template <typename R, typename A1> | |
65 class RunnableAdapter<R(__stdcall *)(A1)> { | |
66 public: | |
67 typedef R (RunType)(A1); | |
68 | |
69 explicit RunnableAdapter(R(__stdcall *function)(A1)) | |
70 : function_(function) { | |
71 } | |
72 | |
73 R Run(typename CallbackParamTraits<A1>::ForwardType a1) { | |
74 return function_(a1); | |
75 } | |
76 | |
77 private: | |
78 R (__stdcall *function_)(A1); | |
79 }; | |
80 | |
81 // __fastcall Function: Arity 1. | |
82 template <typename R, typename A1> | |
83 class RunnableAdapter<R(__fastcall *)(A1)> { | |
84 public: | |
85 typedef R (RunType)(A1); | |
86 | |
87 explicit RunnableAdapter(R(__fastcall *function)(A1)) | |
88 : function_(function) { | |
89 } | |
90 | |
91 R Run(typename CallbackParamTraits<A1>::ForwardType a1) { | |
92 return function_(a1); | |
93 } | |
94 | |
95 private: | |
96 R (__fastcall *function_)(A1); | |
97 }; | |
98 | |
99 // __stdcall Function: Arity 2. | |
100 template <typename R, typename A1, typename A2> | |
101 class RunnableAdapter<R(__stdcall *)(A1, A2)> { | |
102 public: | |
103 typedef R (RunType)(A1, A2); | |
104 | |
105 explicit RunnableAdapter(R(__stdcall *function)(A1, A2)) | |
106 : function_(function) { | |
107 } | |
108 | |
109 R Run(typename CallbackParamTraits<A1>::ForwardType a1, | |
110 typename CallbackParamTraits<A2>::ForwardType a2) { | |
111 return function_(a1, a2); | |
112 } | |
113 | |
114 private: | |
115 R (__stdcall *function_)(A1, A2); | |
116 }; | |
117 | |
118 // __fastcall Function: Arity 2. | |
119 template <typename R, typename A1, typename A2> | |
120 class RunnableAdapter<R(__fastcall *)(A1, A2)> { | |
121 public: | |
122 typedef R (RunType)(A1, A2); | |
123 | |
124 explicit RunnableAdapter(R(__fastcall *function)(A1, A2)) | |
125 : function_(function) { | |
126 } | |
127 | |
128 R Run(typename CallbackParamTraits<A1>::ForwardType a1, | |
129 typename CallbackParamTraits<A2>::ForwardType a2) { | |
130 return function_(a1, a2); | |
131 } | |
132 | |
133 private: | |
134 R (__fastcall *function_)(A1, A2); | |
135 }; | |
136 | |
137 // __stdcall Function: Arity 3. | |
138 template <typename R, typename A1, typename A2, typename A3> | |
139 class RunnableAdapter<R(__stdcall *)(A1, A2, A3)> { | |
140 public: | |
141 typedef R (RunType)(A1, A2, A3); | |
142 | |
143 explicit RunnableAdapter(R(__stdcall *function)(A1, A2, A3)) | |
144 : function_(function) { | |
145 } | |
146 | |
147 R Run(typename CallbackParamTraits<A1>::ForwardType a1, | |
148 typename CallbackParamTraits<A2>::ForwardType a2, | |
149 typename CallbackParamTraits<A3>::ForwardType a3) { | |
150 return function_(a1, a2, a3); | |
151 } | |
152 | |
153 private: | |
154 R (__stdcall *function_)(A1, A2, A3); | |
155 }; | |
156 | |
157 // __fastcall Function: Arity 3. | |
158 template <typename R, typename A1, typename A2, typename A3> | |
159 class RunnableAdapter<R(__fastcall *)(A1, A2, A3)> { | |
160 public: | |
161 typedef R (RunType)(A1, A2, A3); | |
162 | |
163 explicit RunnableAdapter(R(__fastcall *function)(A1, A2, A3)) | |
164 : function_(function) { | |
165 } | |
166 | |
167 R Run(typename CallbackParamTraits<A1>::ForwardType a1, | |
168 typename CallbackParamTraits<A2>::ForwardType a2, | |
169 typename CallbackParamTraits<A3>::ForwardType a3) { | |
170 return function_(a1, a2, a3); | |
171 } | |
172 | |
173 private: | |
174 R (__fastcall *function_)(A1, A2, A3); | |
175 }; | |
176 | |
177 // __stdcall Function: Arity 4. | |
178 template <typename R, typename A1, typename A2, typename A3, typename A4> | |
179 class RunnableAdapter<R(__stdcall *)(A1, A2, A3, A4)> { | |
180 public: | |
181 typedef R (RunType)(A1, A2, A3, A4); | |
182 | |
183 explicit RunnableAdapter(R(__stdcall *function)(A1, A2, A3, A4)) | |
184 : function_(function) { | |
185 } | |
186 | |
187 R Run(typename CallbackParamTraits<A1>::ForwardType a1, | |
188 typename CallbackParamTraits<A2>::ForwardType a2, | |
189 typename CallbackParamTraits<A3>::ForwardType a3, | |
190 typename CallbackParamTraits<A4>::ForwardType a4) { | |
191 return function_(a1, a2, a3, a4); | |
192 } | |
193 | |
194 private: | |
195 R (__stdcall *function_)(A1, A2, A3, A4); | |
196 }; | |
197 | |
198 // __fastcall Function: Arity 4. | |
199 template <typename R, typename A1, typename A2, typename A3, typename A4> | |
200 class RunnableAdapter<R(__fastcall *)(A1, A2, A3, A4)> { | |
201 public: | |
202 typedef R (RunType)(A1, A2, A3, A4); | |
203 | |
204 explicit RunnableAdapter(R(__fastcall *function)(A1, A2, A3, A4)) | |
205 : function_(function) { | |
206 } | |
207 | |
208 R Run(typename CallbackParamTraits<A1>::ForwardType a1, | |
209 typename CallbackParamTraits<A2>::ForwardType a2, | |
210 typename CallbackParamTraits<A3>::ForwardType a3, | |
211 typename CallbackParamTraits<A4>::ForwardType a4) { | |
212 return function_(a1, a2, a3, a4); | |
213 } | |
214 | |
215 private: | |
216 R (__fastcall *function_)(A1, A2, A3, A4); | |
217 }; | |
218 | |
219 // __stdcall Function: Arity 5. | |
220 template <typename R, typename A1, typename A2, typename A3, typename A4, | |
221 typename A5> | |
222 class RunnableAdapter<R(__stdcall *)(A1, A2, A3, A4, A5)> { | |
223 public: | |
224 typedef R (RunType)(A1, A2, A3, A4, A5); | |
225 | |
226 explicit RunnableAdapter(R(__stdcall *function)(A1, A2, A3, A4, A5)) | |
227 : function_(function) { | |
228 } | |
229 | |
230 R Run(typename CallbackParamTraits<A1>::ForwardType a1, | |
231 typename CallbackParamTraits<A2>::ForwardType a2, | |
232 typename CallbackParamTraits<A3>::ForwardType a3, | |
233 typename CallbackParamTraits<A4>::ForwardType a4, | |
234 typename CallbackParamTraits<A5>::ForwardType a5) { | |
235 return function_(a1, a2, a3, a4, a5); | |
236 } | |
237 | |
238 private: | |
239 R (__stdcall *function_)(A1, A2, A3, A4, A5); | |
240 }; | |
241 | |
242 // __fastcall Function: Arity 5. | |
243 template <typename R, typename A1, typename A2, typename A3, typename A4, | |
244 typename A5> | |
245 class RunnableAdapter<R(__fastcall *)(A1, A2, A3, A4, A5)> { | |
246 public: | |
247 typedef R (RunType)(A1, A2, A3, A4, A5); | |
248 | |
249 explicit RunnableAdapter(R(__fastcall *function)(A1, A2, A3, A4, A5)) | |
250 : function_(function) { | |
251 } | |
252 | |
253 R Run(typename CallbackParamTraits<A1>::ForwardType a1, | |
254 typename CallbackParamTraits<A2>::ForwardType a2, | |
255 typename CallbackParamTraits<A3>::ForwardType a3, | |
256 typename CallbackParamTraits<A4>::ForwardType a4, | |
257 typename CallbackParamTraits<A5>::ForwardType a5) { | |
258 return function_(a1, a2, a3, a4, a5); | |
259 } | |
260 | |
261 private: | |
262 R (__fastcall *function_)(A1, A2, A3, A4, A5); | |
263 }; | |
264 | |
265 // __stdcall Function: Arity 6. | |
266 template <typename R, typename A1, typename A2, typename A3, typename A4, | |
267 typename A5, typename A6> | |
268 class RunnableAdapter<R(__stdcall *)(A1, A2, A3, A4, A5, A6)> { | |
269 public: | |
270 typedef R (RunType)(A1, A2, A3, A4, A5, A6); | |
271 | |
272 explicit RunnableAdapter(R(__stdcall *function)(A1, A2, A3, A4, A5, A6)) | |
273 : function_(function) { | |
274 } | |
275 | |
276 R Run(typename CallbackParamTraits<A1>::ForwardType a1, | |
277 typename CallbackParamTraits<A2>::ForwardType a2, | |
278 typename CallbackParamTraits<A3>::ForwardType a3, | |
279 typename CallbackParamTraits<A4>::ForwardType a4, | |
280 typename CallbackParamTraits<A5>::ForwardType a5, | |
281 typename CallbackParamTraits<A6>::ForwardType a6) { | |
282 return function_(a1, a2, a3, a4, a5, a6); | |
283 } | |
284 | |
285 private: | |
286 R (__stdcall *function_)(A1, A2, A3, A4, A5, A6); | |
287 }; | |
288 | |
289 // __fastcall Function: Arity 6. | |
290 template <typename R, typename A1, typename A2, typename A3, typename A4, | |
291 typename A5, typename A6> | |
292 class RunnableAdapter<R(__fastcall *)(A1, A2, A3, A4, A5, A6)> { | |
293 public: | |
294 typedef R (RunType)(A1, A2, A3, A4, A5, A6); | |
295 | |
296 explicit RunnableAdapter(R(__fastcall *function)(A1, A2, A3, A4, A5, A6)) | |
297 : function_(function) { | |
298 } | |
299 | |
300 R Run(typename CallbackParamTraits<A1>::ForwardType a1, | |
301 typename CallbackParamTraits<A2>::ForwardType a2, | |
302 typename CallbackParamTraits<A3>::ForwardType a3, | |
303 typename CallbackParamTraits<A4>::ForwardType a4, | |
304 typename CallbackParamTraits<A5>::ForwardType a5, | |
305 typename CallbackParamTraits<A6>::ForwardType a6) { | |
306 return function_(a1, a2, a3, a4, a5, a6); | |
307 } | |
308 | |
309 private: | |
310 R (__fastcall *function_)(A1, A2, A3, A4, A5, A6); | |
311 }; | |
312 | |
313 // __stdcall Function: Arity 7. | |
314 template <typename R, typename A1, typename A2, typename A3, typename A4, | |
315 typename A5, typename A6, typename A7> | |
316 class RunnableAdapter<R(__stdcall *)(A1, A2, A3, A4, A5, A6, A7)> { | |
317 public: | |
318 typedef R (RunType)(A1, A2, A3, A4, A5, A6, A7); | |
319 | |
320 explicit RunnableAdapter(R(__stdcall *function)(A1, A2, A3, A4, A5, A6, A7)) | |
321 : function_(function) { | |
322 } | |
323 | |
324 R Run(typename CallbackParamTraits<A1>::ForwardType a1, | |
325 typename CallbackParamTraits<A2>::ForwardType a2, | |
326 typename CallbackParamTraits<A3>::ForwardType a3, | |
327 typename CallbackParamTraits<A4>::ForwardType a4, | |
328 typename CallbackParamTraits<A5>::ForwardType a5, | |
329 typename CallbackParamTraits<A6>::ForwardType a6, | |
330 typename CallbackParamTraits<A7>::ForwardType a7) { | |
331 return function_(a1, a2, a3, a4, a5, a6, a7); | |
332 } | |
333 | |
334 private: | |
335 R (__stdcall *function_)(A1, A2, A3, A4, A5, A6, A7); | |
336 }; | |
337 | |
338 // __fastcall Function: Arity 7. | |
339 template <typename R, typename A1, typename A2, typename A3, typename A4, | |
340 typename A5, typename A6, typename A7> | |
341 class RunnableAdapter<R(__fastcall *)(A1, A2, A3, A4, A5, A6, A7)> { | |
342 public: | |
343 typedef R (RunType)(A1, A2, A3, A4, A5, A6, A7); | |
344 | |
345 explicit RunnableAdapter(R(__fastcall *function)(A1, A2, A3, A4, A5, A6, A7)) | |
346 : function_(function) { | |
347 } | |
348 | |
349 R Run(typename CallbackParamTraits<A1>::ForwardType a1, | |
350 typename CallbackParamTraits<A2>::ForwardType a2, | |
351 typename CallbackParamTraits<A3>::ForwardType a3, | |
352 typename CallbackParamTraits<A4>::ForwardType a4, | |
353 typename CallbackParamTraits<A5>::ForwardType a5, | |
354 typename CallbackParamTraits<A6>::ForwardType a6, | |
355 typename CallbackParamTraits<A7>::ForwardType a7) { | |
356 return function_(a1, a2, a3, a4, a5, a6, a7); | |
357 } | |
358 | |
359 private: | |
360 R (__fastcall *function_)(A1, A2, A3, A4, A5, A6, A7); | |
361 }; | 56 }; |
362 | 57 |
363 } // namespace internal | 58 } // namespace internal |
364 } // namespace base | 59 } // namespace base |
365 | 60 |
366 #endif // !defined(ARCH_CPU_X86_64) | 61 #endif // !defined(ARCH_CPU_X86_64) |
367 | 62 |
368 #endif // BASE_BIND_INTERNAL_WIN_H_ | 63 #endif // BASE_BIND_INTERNAL_WIN_H_ |
OLD | NEW |