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