Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(596)

Side by Side Diff: base/bind_internal.h

Issue 8774032: Add Pass(), which implements move semantics, to scoped_ptr, scoped_array, and scoped_ptr_malloc. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: small fixes. Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // This file was GENERATED by command: 1 // This file was GENERATED by command:
2 // pump.py bind_internal.h.pump 2 // pump.py bind_internal.h.pump
3 // DO NOT EDIT BY HAND!!! 3 // DO NOT EDIT BY HAND!!!
4 4
5 5
6 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 6 // 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 7 // Use of this source code is governed by a BSD-style license that can be
8 // found in the LICENSE file. 8 // found in the LICENSE file.
9 9
10 #ifndef BASE_BIND_INTERNAL_H_ 10 #ifndef BASE_BIND_INTERNAL_H_
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 // and for ignoring return values. This is separate from 69 // and for ignoring return values. This is separate from
70 // Invoker to avoid creating multiple version of Invoker<> 70 // Invoker to avoid creating multiple version of Invoker<>
71 // which grows at O(n^2) with the arity. 71 // which grows at O(n^2) with the arity.
72 // There are |k*ARITY| InvokeHelper types. 72 // There are |k*ARITY| InvokeHelper types.
73 // Invoker<> -- Unwraps the curried parameters and executes the Runnable. 73 // Invoker<> -- Unwraps the curried parameters and executes the Runnable.
74 // There are |(ARITY^2 + ARITY)/2| Invoketypes. 74 // There are |(ARITY^2 + ARITY)/2| Invoketypes.
75 // BindState<> -- Stores the curried parameters, and is the main entry point 75 // BindState<> -- Stores the curried parameters, and is the main entry point
76 // into the Bind() system, doing most of the type resolution. 76 // into the Bind() system, doing most of the type resolution.
77 // There are ARITY BindState types. 77 // There are ARITY BindState types.
78 78
79
80 // RunnableAdapter<> 79 // RunnableAdapter<>
81 // 80 //
82 // The RunnableAdapter<> templates provide a uniform interface for invoking 81 // The RunnableAdapter<> templates provide a uniform interface for invoking
83 // a function pointer, method pointer, or const method pointer. The adapter 82 // a function pointer, method pointer, or const method pointer. The adapter
84 // exposes a Run() method with an appropriate signature. Using this wrapper 83 // exposes a Run() method with an appropriate signature. Using this wrapper
85 // allows for writing code that supports all three pointer types without 84 // allows for writing code that supports all three pointer types without
86 // undue repetition. Without it, a lot of code would need to be repeated 3 85 // undue repetition. Without it, a lot of code would need to be repeated 3
87 // times. 86 // times.
88 // 87 //
89 // For method pointers and const method pointers the first argument to Run() 88 // For method pointers and const method pointers the first argument to Run()
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 template <typename R, typename A1> 159 template <typename R, typename A1>
161 class RunnableAdapter<R(*)(A1)> { 160 class RunnableAdapter<R(*)(A1)> {
162 public: 161 public:
163 typedef R (RunType)(A1); 162 typedef R (RunType)(A1);
164 163
165 explicit RunnableAdapter(R(*function)(A1)) 164 explicit RunnableAdapter(R(*function)(A1))
166 : function_(function) { 165 : function_(function) {
167 } 166 }
168 167
169 R Run(typename CallbackParamTraits<A1>::ForwardType a1) { 168 R Run(typename CallbackParamTraits<A1>::ForwardType a1) {
170 return function_(a1); 169 return function_(BindMoveSupport(a1));
171 } 170 }
172 171
173 private: 172 private:
174 R (*function_)(A1); 173 R (*function_)(A1);
175 }; 174 };
176 175
177 // Method: Arity 1. 176 // Method: Arity 1.
178 template <typename R, typename T, typename A1> 177 template <typename R, typename T, typename A1>
179 class RunnableAdapter<R(T::*)(A1)> { 178 class RunnableAdapter<R(T::*)(A1)> {
180 public: 179 public:
181 typedef R (RunType)(T*, A1); 180 typedef R (RunType)(T*, A1);
182 typedef true_type IsMethod; 181 typedef true_type IsMethod;
183 182
184 explicit RunnableAdapter(R(T::*method)(A1)) 183 explicit RunnableAdapter(R(T::*method)(A1))
185 : method_(method) { 184 : method_(method) {
186 } 185 }
187 186
188 R Run(T* object, typename CallbackParamTraits<A1>::ForwardType a1) { 187 R Run(T* object, typename CallbackParamTraits<A1>::ForwardType a1) {
189 return (object->*method_)(a1); 188 return (object->*method_)(BindMoveSupport(a1));
190 } 189 }
191 190
192 private: 191 private:
193 R (T::*method_)(A1); 192 R (T::*method_)(A1);
194 }; 193 };
195 194
196 // Const Method: Arity 1. 195 // Const Method: Arity 1.
197 template <typename R, typename T, typename A1> 196 template <typename R, typename T, typename A1>
198 class RunnableAdapter<R(T::*)(A1) const> { 197 class RunnableAdapter<R(T::*)(A1) const> {
199 public: 198 public:
200 typedef R (RunType)(const T*, A1); 199 typedef R (RunType)(const T*, A1);
201 typedef true_type IsMethod; 200 typedef true_type IsMethod;
202 201
203 explicit RunnableAdapter(R(T::*method)(A1) const) 202 explicit RunnableAdapter(R(T::*method)(A1) const)
204 : method_(method) { 203 : method_(method) {
205 } 204 }
206 205
207 R Run(const T* object, typename CallbackParamTraits<A1>::ForwardType a1) { 206 R Run(const T* object, typename CallbackParamTraits<A1>::ForwardType a1) {
208 return (object->*method_)(a1); 207 return (object->*method_)(BindMoveSupport(a1));
209 } 208 }
210 209
211 private: 210 private:
212 R (T::*method_)(A1) const; 211 R (T::*method_)(A1) const;
213 }; 212 };
214 213
215 // Function: Arity 2. 214 // Function: Arity 2.
216 template <typename R, typename A1, typename A2> 215 template <typename R, typename A1, typename A2>
217 class RunnableAdapter<R(*)(A1, A2)> { 216 class RunnableAdapter<R(*)(A1, A2)> {
218 public: 217 public:
219 typedef R (RunType)(A1, A2); 218 typedef R (RunType)(A1, A2);
220 219
221 explicit RunnableAdapter(R(*function)(A1, A2)) 220 explicit RunnableAdapter(R(*function)(A1, A2))
222 : function_(function) { 221 : function_(function) {
223 } 222 }
224 223
225 R Run(typename CallbackParamTraits<A1>::ForwardType a1, 224 R Run(typename CallbackParamTraits<A1>::ForwardType a1,
226 typename CallbackParamTraits<A2>::ForwardType a2) { 225 typename CallbackParamTraits<A2>::ForwardType a2) {
227 return function_(a1, a2); 226 return function_(BindMoveSupport(a1), BindMoveSupport(a2));
228 } 227 }
229 228
230 private: 229 private:
231 R (*function_)(A1, A2); 230 R (*function_)(A1, A2);
232 }; 231 };
233 232
234 // Method: Arity 2. 233 // Method: Arity 2.
235 template <typename R, typename T, typename A1, typename A2> 234 template <typename R, typename T, typename A1, typename A2>
236 class RunnableAdapter<R(T::*)(A1, A2)> { 235 class RunnableAdapter<R(T::*)(A1, A2)> {
237 public: 236 public:
238 typedef R (RunType)(T*, A1, A2); 237 typedef R (RunType)(T*, A1, A2);
239 typedef true_type IsMethod; 238 typedef true_type IsMethod;
240 239
241 explicit RunnableAdapter(R(T::*method)(A1, A2)) 240 explicit RunnableAdapter(R(T::*method)(A1, A2))
242 : method_(method) { 241 : method_(method) {
243 } 242 }
244 243
245 R Run(T* object, typename CallbackParamTraits<A1>::ForwardType a1, 244 R Run(T* object, typename CallbackParamTraits<A1>::ForwardType a1,
246 typename CallbackParamTraits<A2>::ForwardType a2) { 245 typename CallbackParamTraits<A2>::ForwardType a2) {
247 return (object->*method_)(a1, a2); 246 return (object->*method_)(BindMoveSupport(a1), BindMoveSupport(a2));
248 } 247 }
249 248
250 private: 249 private:
251 R (T::*method_)(A1, A2); 250 R (T::*method_)(A1, A2);
252 }; 251 };
253 252
254 // Const Method: Arity 2. 253 // Const Method: Arity 2.
255 template <typename R, typename T, typename A1, typename A2> 254 template <typename R, typename T, typename A1, typename A2>
256 class RunnableAdapter<R(T::*)(A1, A2) const> { 255 class RunnableAdapter<R(T::*)(A1, A2) const> {
257 public: 256 public:
258 typedef R (RunType)(const T*, A1, A2); 257 typedef R (RunType)(const T*, A1, A2);
259 typedef true_type IsMethod; 258 typedef true_type IsMethod;
260 259
261 explicit RunnableAdapter(R(T::*method)(A1, A2) const) 260 explicit RunnableAdapter(R(T::*method)(A1, A2) const)
262 : method_(method) { 261 : method_(method) {
263 } 262 }
264 263
265 R Run(const T* object, typename CallbackParamTraits<A1>::ForwardType a1, 264 R Run(const T* object, typename CallbackParamTraits<A1>::ForwardType a1,
266 typename CallbackParamTraits<A2>::ForwardType a2) { 265 typename CallbackParamTraits<A2>::ForwardType a2) {
267 return (object->*method_)(a1, a2); 266 return (object->*method_)(BindMoveSupport(a1), BindMoveSupport(a2));
268 } 267 }
269 268
270 private: 269 private:
271 R (T::*method_)(A1, A2) const; 270 R (T::*method_)(A1, A2) const;
272 }; 271 };
273 272
274 // Function: Arity 3. 273 // Function: Arity 3.
275 template <typename R, typename A1, typename A2, typename A3> 274 template <typename R, typename A1, typename A2, typename A3>
276 class RunnableAdapter<R(*)(A1, A2, A3)> { 275 class RunnableAdapter<R(*)(A1, A2, A3)> {
277 public: 276 public:
278 typedef R (RunType)(A1, A2, A3); 277 typedef R (RunType)(A1, A2, A3);
279 278
280 explicit RunnableAdapter(R(*function)(A1, A2, A3)) 279 explicit RunnableAdapter(R(*function)(A1, A2, A3))
281 : function_(function) { 280 : function_(function) {
282 } 281 }
283 282
284 R Run(typename CallbackParamTraits<A1>::ForwardType a1, 283 R Run(typename CallbackParamTraits<A1>::ForwardType a1,
285 typename CallbackParamTraits<A2>::ForwardType a2, 284 typename CallbackParamTraits<A2>::ForwardType a2,
286 typename CallbackParamTraits<A3>::ForwardType a3) { 285 typename CallbackParamTraits<A3>::ForwardType a3) {
287 return function_(a1, a2, a3); 286 return function_(BindMoveSupport(a1), BindMoveSupport(a2),
287 BindMoveSupport(a3));
288 } 288 }
289 289
290 private: 290 private:
291 R (*function_)(A1, A2, A3); 291 R (*function_)(A1, A2, A3);
292 }; 292 };
293 293
294 // Method: Arity 3. 294 // Method: Arity 3.
295 template <typename R, typename T, typename A1, typename A2, typename A3> 295 template <typename R, typename T, typename A1, typename A2, typename A3>
296 class RunnableAdapter<R(T::*)(A1, A2, A3)> { 296 class RunnableAdapter<R(T::*)(A1, A2, A3)> {
297 public: 297 public:
298 typedef R (RunType)(T*, A1, A2, A3); 298 typedef R (RunType)(T*, A1, A2, A3);
299 typedef true_type IsMethod; 299 typedef true_type IsMethod;
300 300
301 explicit RunnableAdapter(R(T::*method)(A1, A2, A3)) 301 explicit RunnableAdapter(R(T::*method)(A1, A2, A3))
302 : method_(method) { 302 : method_(method) {
303 } 303 }
304 304
305 R Run(T* object, typename CallbackParamTraits<A1>::ForwardType a1, 305 R Run(T* object, typename CallbackParamTraits<A1>::ForwardType a1,
306 typename CallbackParamTraits<A2>::ForwardType a2, 306 typename CallbackParamTraits<A2>::ForwardType a2,
307 typename CallbackParamTraits<A3>::ForwardType a3) { 307 typename CallbackParamTraits<A3>::ForwardType a3) {
308 return (object->*method_)(a1, a2, a3); 308 return (object->*method_)(BindMoveSupport(a1), BindMoveSupport(a2),
309 BindMoveSupport(a3));
309 } 310 }
310 311
311 private: 312 private:
312 R (T::*method_)(A1, A2, A3); 313 R (T::*method_)(A1, A2, A3);
313 }; 314 };
314 315
315 // Const Method: Arity 3. 316 // Const Method: Arity 3.
316 template <typename R, typename T, typename A1, typename A2, typename A3> 317 template <typename R, typename T, typename A1, typename A2, typename A3>
317 class RunnableAdapter<R(T::*)(A1, A2, A3) const> { 318 class RunnableAdapter<R(T::*)(A1, A2, A3) const> {
318 public: 319 public:
319 typedef R (RunType)(const T*, A1, A2, A3); 320 typedef R (RunType)(const T*, A1, A2, A3);
320 typedef true_type IsMethod; 321 typedef true_type IsMethod;
321 322
322 explicit RunnableAdapter(R(T::*method)(A1, A2, A3) const) 323 explicit RunnableAdapter(R(T::*method)(A1, A2, A3) const)
323 : method_(method) { 324 : method_(method) {
324 } 325 }
325 326
326 R Run(const T* object, typename CallbackParamTraits<A1>::ForwardType a1, 327 R Run(const T* object, typename CallbackParamTraits<A1>::ForwardType a1,
327 typename CallbackParamTraits<A2>::ForwardType a2, 328 typename CallbackParamTraits<A2>::ForwardType a2,
328 typename CallbackParamTraits<A3>::ForwardType a3) { 329 typename CallbackParamTraits<A3>::ForwardType a3) {
329 return (object->*method_)(a1, a2, a3); 330 return (object->*method_)(BindMoveSupport(a1), BindMoveSupport(a2),
331 BindMoveSupport(a3));
330 } 332 }
331 333
332 private: 334 private:
333 R (T::*method_)(A1, A2, A3) const; 335 R (T::*method_)(A1, A2, A3) const;
334 }; 336 };
335 337
336 // Function: Arity 4. 338 // Function: Arity 4.
337 template <typename R, typename A1, typename A2, typename A3, typename A4> 339 template <typename R, typename A1, typename A2, typename A3, typename A4>
338 class RunnableAdapter<R(*)(A1, A2, A3, A4)> { 340 class RunnableAdapter<R(*)(A1, A2, A3, A4)> {
339 public: 341 public:
340 typedef R (RunType)(A1, A2, A3, A4); 342 typedef R (RunType)(A1, A2, A3, A4);
341 343
342 explicit RunnableAdapter(R(*function)(A1, A2, A3, A4)) 344 explicit RunnableAdapter(R(*function)(A1, A2, A3, A4))
343 : function_(function) { 345 : function_(function) {
344 } 346 }
345 347
346 R Run(typename CallbackParamTraits<A1>::ForwardType a1, 348 R Run(typename CallbackParamTraits<A1>::ForwardType a1,
347 typename CallbackParamTraits<A2>::ForwardType a2, 349 typename CallbackParamTraits<A2>::ForwardType a2,
348 typename CallbackParamTraits<A3>::ForwardType a3, 350 typename CallbackParamTraits<A3>::ForwardType a3,
349 typename CallbackParamTraits<A4>::ForwardType a4) { 351 typename CallbackParamTraits<A4>::ForwardType a4) {
350 return function_(a1, a2, a3, a4); 352 return function_(BindMoveSupport(a1), BindMoveSupport(a2),
353 BindMoveSupport(a3), BindMoveSupport(a4));
351 } 354 }
352 355
353 private: 356 private:
354 R (*function_)(A1, A2, A3, A4); 357 R (*function_)(A1, A2, A3, A4);
355 }; 358 };
356 359
357 // Method: Arity 4. 360 // Method: Arity 4.
358 template <typename R, typename T, typename A1, typename A2, typename A3, 361 template <typename R, typename T, typename A1, typename A2, typename A3,
359 typename A4> 362 typename A4>
360 class RunnableAdapter<R(T::*)(A1, A2, A3, A4)> { 363 class RunnableAdapter<R(T::*)(A1, A2, A3, A4)> {
361 public: 364 public:
362 typedef R (RunType)(T*, A1, A2, A3, A4); 365 typedef R (RunType)(T*, A1, A2, A3, A4);
363 typedef true_type IsMethod; 366 typedef true_type IsMethod;
364 367
365 explicit RunnableAdapter(R(T::*method)(A1, A2, A3, A4)) 368 explicit RunnableAdapter(R(T::*method)(A1, A2, A3, A4))
366 : method_(method) { 369 : method_(method) {
367 } 370 }
368 371
369 R Run(T* object, typename CallbackParamTraits<A1>::ForwardType a1, 372 R Run(T* object, typename CallbackParamTraits<A1>::ForwardType a1,
370 typename CallbackParamTraits<A2>::ForwardType a2, 373 typename CallbackParamTraits<A2>::ForwardType a2,
371 typename CallbackParamTraits<A3>::ForwardType a3, 374 typename CallbackParamTraits<A3>::ForwardType a3,
372 typename CallbackParamTraits<A4>::ForwardType a4) { 375 typename CallbackParamTraits<A4>::ForwardType a4) {
373 return (object->*method_)(a1, a2, a3, a4); 376 return (object->*method_)(BindMoveSupport(a1), BindMoveSupport(a2),
377 BindMoveSupport(a3), BindMoveSupport(a4));
374 } 378 }
375 379
376 private: 380 private:
377 R (T::*method_)(A1, A2, A3, A4); 381 R (T::*method_)(A1, A2, A3, A4);
378 }; 382 };
379 383
380 // Const Method: Arity 4. 384 // Const Method: Arity 4.
381 template <typename R, typename T, typename A1, typename A2, typename A3, 385 template <typename R, typename T, typename A1, typename A2, typename A3,
382 typename A4> 386 typename A4>
383 class RunnableAdapter<R(T::*)(A1, A2, A3, A4) const> { 387 class RunnableAdapter<R(T::*)(A1, A2, A3, A4) const> {
384 public: 388 public:
385 typedef R (RunType)(const T*, A1, A2, A3, A4); 389 typedef R (RunType)(const T*, A1, A2, A3, A4);
386 typedef true_type IsMethod; 390 typedef true_type IsMethod;
387 391
388 explicit RunnableAdapter(R(T::*method)(A1, A2, A3, A4) const) 392 explicit RunnableAdapter(R(T::*method)(A1, A2, A3, A4) const)
389 : method_(method) { 393 : method_(method) {
390 } 394 }
391 395
392 R Run(const T* object, typename CallbackParamTraits<A1>::ForwardType a1, 396 R Run(const T* object, typename CallbackParamTraits<A1>::ForwardType a1,
393 typename CallbackParamTraits<A2>::ForwardType a2, 397 typename CallbackParamTraits<A2>::ForwardType a2,
394 typename CallbackParamTraits<A3>::ForwardType a3, 398 typename CallbackParamTraits<A3>::ForwardType a3,
395 typename CallbackParamTraits<A4>::ForwardType a4) { 399 typename CallbackParamTraits<A4>::ForwardType a4) {
396 return (object->*method_)(a1, a2, a3, a4); 400 return (object->*method_)(BindMoveSupport(a1), BindMoveSupport(a2),
401 BindMoveSupport(a3), BindMoveSupport(a4));
397 } 402 }
398 403
399 private: 404 private:
400 R (T::*method_)(A1, A2, A3, A4) const; 405 R (T::*method_)(A1, A2, A3, A4) const;
401 }; 406 };
402 407
403 // Function: Arity 5. 408 // Function: Arity 5.
404 template <typename R, typename A1, typename A2, typename A3, typename A4, 409 template <typename R, typename A1, typename A2, typename A3, typename A4,
405 typename A5> 410 typename A5>
406 class RunnableAdapter<R(*)(A1, A2, A3, A4, A5)> { 411 class RunnableAdapter<R(*)(A1, A2, A3, A4, A5)> {
407 public: 412 public:
408 typedef R (RunType)(A1, A2, A3, A4, A5); 413 typedef R (RunType)(A1, A2, A3, A4, A5);
409 414
410 explicit RunnableAdapter(R(*function)(A1, A2, A3, A4, A5)) 415 explicit RunnableAdapter(R(*function)(A1, A2, A3, A4, A5))
411 : function_(function) { 416 : function_(function) {
412 } 417 }
413 418
414 R Run(typename CallbackParamTraits<A1>::ForwardType a1, 419 R Run(typename CallbackParamTraits<A1>::ForwardType a1,
415 typename CallbackParamTraits<A2>::ForwardType a2, 420 typename CallbackParamTraits<A2>::ForwardType a2,
416 typename CallbackParamTraits<A3>::ForwardType a3, 421 typename CallbackParamTraits<A3>::ForwardType a3,
417 typename CallbackParamTraits<A4>::ForwardType a4, 422 typename CallbackParamTraits<A4>::ForwardType a4,
418 typename CallbackParamTraits<A5>::ForwardType a5) { 423 typename CallbackParamTraits<A5>::ForwardType a5) {
419 return function_(a1, a2, a3, a4, a5); 424 return function_(BindMoveSupport(a1), BindMoveSupport(a2),
425 BindMoveSupport(a3), BindMoveSupport(a4), BindMoveSupport(a5));
420 } 426 }
421 427
422 private: 428 private:
423 R (*function_)(A1, A2, A3, A4, A5); 429 R (*function_)(A1, A2, A3, A4, A5);
424 }; 430 };
425 431
426 // Method: Arity 5. 432 // Method: Arity 5.
427 template <typename R, typename T, typename A1, typename A2, typename A3, 433 template <typename R, typename T, typename A1, typename A2, typename A3,
428 typename A4, typename A5> 434 typename A4, typename A5>
429 class RunnableAdapter<R(T::*)(A1, A2, A3, A4, A5)> { 435 class RunnableAdapter<R(T::*)(A1, A2, A3, A4, A5)> {
430 public: 436 public:
431 typedef R (RunType)(T*, A1, A2, A3, A4, A5); 437 typedef R (RunType)(T*, A1, A2, A3, A4, A5);
432 typedef true_type IsMethod; 438 typedef true_type IsMethod;
433 439
434 explicit RunnableAdapter(R(T::*method)(A1, A2, A3, A4, A5)) 440 explicit RunnableAdapter(R(T::*method)(A1, A2, A3, A4, A5))
435 : method_(method) { 441 : method_(method) {
436 } 442 }
437 443
438 R Run(T* object, typename CallbackParamTraits<A1>::ForwardType a1, 444 R Run(T* object, typename CallbackParamTraits<A1>::ForwardType a1,
439 typename CallbackParamTraits<A2>::ForwardType a2, 445 typename CallbackParamTraits<A2>::ForwardType a2,
440 typename CallbackParamTraits<A3>::ForwardType a3, 446 typename CallbackParamTraits<A3>::ForwardType a3,
441 typename CallbackParamTraits<A4>::ForwardType a4, 447 typename CallbackParamTraits<A4>::ForwardType a4,
442 typename CallbackParamTraits<A5>::ForwardType a5) { 448 typename CallbackParamTraits<A5>::ForwardType a5) {
443 return (object->*method_)(a1, a2, a3, a4, a5); 449 return (object->*method_)(BindMoveSupport(a1), BindMoveSupport(a2),
450 BindMoveSupport(a3), BindMoveSupport(a4), BindMoveSupport(a5));
444 } 451 }
445 452
446 private: 453 private:
447 R (T::*method_)(A1, A2, A3, A4, A5); 454 R (T::*method_)(A1, A2, A3, A4, A5);
448 }; 455 };
449 456
450 // Const Method: Arity 5. 457 // Const Method: Arity 5.
451 template <typename R, typename T, typename A1, typename A2, typename A3, 458 template <typename R, typename T, typename A1, typename A2, typename A3,
452 typename A4, typename A5> 459 typename A4, typename A5>
453 class RunnableAdapter<R(T::*)(A1, A2, A3, A4, A5) const> { 460 class RunnableAdapter<R(T::*)(A1, A2, A3, A4, A5) const> {
454 public: 461 public:
455 typedef R (RunType)(const T*, A1, A2, A3, A4, A5); 462 typedef R (RunType)(const T*, A1, A2, A3, A4, A5);
456 typedef true_type IsMethod; 463 typedef true_type IsMethod;
457 464
458 explicit RunnableAdapter(R(T::*method)(A1, A2, A3, A4, A5) const) 465 explicit RunnableAdapter(R(T::*method)(A1, A2, A3, A4, A5) const)
459 : method_(method) { 466 : method_(method) {
460 } 467 }
461 468
462 R Run(const T* object, typename CallbackParamTraits<A1>::ForwardType a1, 469 R Run(const T* object, typename CallbackParamTraits<A1>::ForwardType a1,
463 typename CallbackParamTraits<A2>::ForwardType a2, 470 typename CallbackParamTraits<A2>::ForwardType a2,
464 typename CallbackParamTraits<A3>::ForwardType a3, 471 typename CallbackParamTraits<A3>::ForwardType a3,
465 typename CallbackParamTraits<A4>::ForwardType a4, 472 typename CallbackParamTraits<A4>::ForwardType a4,
466 typename CallbackParamTraits<A5>::ForwardType a5) { 473 typename CallbackParamTraits<A5>::ForwardType a5) {
467 return (object->*method_)(a1, a2, a3, a4, a5); 474 return (object->*method_)(BindMoveSupport(a1), BindMoveSupport(a2),
475 BindMoveSupport(a3), BindMoveSupport(a4), BindMoveSupport(a5));
468 } 476 }
469 477
470 private: 478 private:
471 R (T::*method_)(A1, A2, A3, A4, A5) const; 479 R (T::*method_)(A1, A2, A3, A4, A5) const;
472 }; 480 };
473 481
474 // Function: Arity 6. 482 // Function: Arity 6.
475 template <typename R, typename A1, typename A2, typename A3, typename A4, 483 template <typename R, typename A1, typename A2, typename A3, typename A4,
476 typename A5, typename A6> 484 typename A5, typename A6>
477 class RunnableAdapter<R(*)(A1, A2, A3, A4, A5, A6)> { 485 class RunnableAdapter<R(*)(A1, A2, A3, A4, A5, A6)> {
478 public: 486 public:
479 typedef R (RunType)(A1, A2, A3, A4, A5, A6); 487 typedef R (RunType)(A1, A2, A3, A4, A5, A6);
480 488
481 explicit RunnableAdapter(R(*function)(A1, A2, A3, A4, A5, A6)) 489 explicit RunnableAdapter(R(*function)(A1, A2, A3, A4, A5, A6))
482 : function_(function) { 490 : function_(function) {
483 } 491 }
484 492
485 R Run(typename CallbackParamTraits<A1>::ForwardType a1, 493 R Run(typename CallbackParamTraits<A1>::ForwardType a1,
486 typename CallbackParamTraits<A2>::ForwardType a2, 494 typename CallbackParamTraits<A2>::ForwardType a2,
487 typename CallbackParamTraits<A3>::ForwardType a3, 495 typename CallbackParamTraits<A3>::ForwardType a3,
488 typename CallbackParamTraits<A4>::ForwardType a4, 496 typename CallbackParamTraits<A4>::ForwardType a4,
489 typename CallbackParamTraits<A5>::ForwardType a5, 497 typename CallbackParamTraits<A5>::ForwardType a5,
490 typename CallbackParamTraits<A6>::ForwardType a6) { 498 typename CallbackParamTraits<A6>::ForwardType a6) {
491 return function_(a1, a2, a3, a4, a5, a6); 499 return function_(BindMoveSupport(a1), BindMoveSupport(a2),
500 BindMoveSupport(a3), BindMoveSupport(a4), BindMoveSupport(a5),
501 BindMoveSupport(a6));
492 } 502 }
493 503
494 private: 504 private:
495 R (*function_)(A1, A2, A3, A4, A5, A6); 505 R (*function_)(A1, A2, A3, A4, A5, A6);
496 }; 506 };
497 507
498 // Method: Arity 6. 508 // Method: Arity 6.
499 template <typename R, typename T, typename A1, typename A2, typename A3, 509 template <typename R, typename T, typename A1, typename A2, typename A3,
500 typename A4, typename A5, typename A6> 510 typename A4, typename A5, typename A6>
501 class RunnableAdapter<R(T::*)(A1, A2, A3, A4, A5, A6)> { 511 class RunnableAdapter<R(T::*)(A1, A2, A3, A4, A5, A6)> {
502 public: 512 public:
503 typedef R (RunType)(T*, A1, A2, A3, A4, A5, A6); 513 typedef R (RunType)(T*, A1, A2, A3, A4, A5, A6);
504 typedef true_type IsMethod; 514 typedef true_type IsMethod;
505 515
506 explicit RunnableAdapter(R(T::*method)(A1, A2, A3, A4, A5, A6)) 516 explicit RunnableAdapter(R(T::*method)(A1, A2, A3, A4, A5, A6))
507 : method_(method) { 517 : method_(method) {
508 } 518 }
509 519
510 R Run(T* object, typename CallbackParamTraits<A1>::ForwardType a1, 520 R Run(T* object, typename CallbackParamTraits<A1>::ForwardType a1,
511 typename CallbackParamTraits<A2>::ForwardType a2, 521 typename CallbackParamTraits<A2>::ForwardType a2,
512 typename CallbackParamTraits<A3>::ForwardType a3, 522 typename CallbackParamTraits<A3>::ForwardType a3,
513 typename CallbackParamTraits<A4>::ForwardType a4, 523 typename CallbackParamTraits<A4>::ForwardType a4,
514 typename CallbackParamTraits<A5>::ForwardType a5, 524 typename CallbackParamTraits<A5>::ForwardType a5,
515 typename CallbackParamTraits<A6>::ForwardType a6) { 525 typename CallbackParamTraits<A6>::ForwardType a6) {
516 return (object->*method_)(a1, a2, a3, a4, a5, a6); 526 return (object->*method_)(BindMoveSupport(a1), BindMoveSupport(a2),
527 BindMoveSupport(a3), BindMoveSupport(a4), BindMoveSupport(a5),
528 BindMoveSupport(a6));
517 } 529 }
518 530
519 private: 531 private:
520 R (T::*method_)(A1, A2, A3, A4, A5, A6); 532 R (T::*method_)(A1, A2, A3, A4, A5, A6);
521 }; 533 };
522 534
523 // Const Method: Arity 6. 535 // Const Method: Arity 6.
524 template <typename R, typename T, typename A1, typename A2, typename A3, 536 template <typename R, typename T, typename A1, typename A2, typename A3,
525 typename A4, typename A5, typename A6> 537 typename A4, typename A5, typename A6>
526 class RunnableAdapter<R(T::*)(A1, A2, A3, A4, A5, A6) const> { 538 class RunnableAdapter<R(T::*)(A1, A2, A3, A4, A5, A6) const> {
527 public: 539 public:
528 typedef R (RunType)(const T*, A1, A2, A3, A4, A5, A6); 540 typedef R (RunType)(const T*, A1, A2, A3, A4, A5, A6);
529 typedef true_type IsMethod; 541 typedef true_type IsMethod;
530 542
531 explicit RunnableAdapter(R(T::*method)(A1, A2, A3, A4, A5, A6) const) 543 explicit RunnableAdapter(R(T::*method)(A1, A2, A3, A4, A5, A6) const)
532 : method_(method) { 544 : method_(method) {
533 } 545 }
534 546
535 R Run(const T* object, typename CallbackParamTraits<A1>::ForwardType a1, 547 R Run(const T* object, typename CallbackParamTraits<A1>::ForwardType a1,
536 typename CallbackParamTraits<A2>::ForwardType a2, 548 typename CallbackParamTraits<A2>::ForwardType a2,
537 typename CallbackParamTraits<A3>::ForwardType a3, 549 typename CallbackParamTraits<A3>::ForwardType a3,
538 typename CallbackParamTraits<A4>::ForwardType a4, 550 typename CallbackParamTraits<A4>::ForwardType a4,
539 typename CallbackParamTraits<A5>::ForwardType a5, 551 typename CallbackParamTraits<A5>::ForwardType a5,
540 typename CallbackParamTraits<A6>::ForwardType a6) { 552 typename CallbackParamTraits<A6>::ForwardType a6) {
541 return (object->*method_)(a1, a2, a3, a4, a5, a6); 553 return (object->*method_)(BindMoveSupport(a1), BindMoveSupport(a2),
554 BindMoveSupport(a3), BindMoveSupport(a4), BindMoveSupport(a5),
555 BindMoveSupport(a6));
542 } 556 }
543 557
544 private: 558 private:
545 R (T::*method_)(A1, A2, A3, A4, A5, A6) const; 559 R (T::*method_)(A1, A2, A3, A4, A5, A6) const;
546 }; 560 };
547 561
548 // Function: Arity 7. 562 // Function: Arity 7.
549 template <typename R, typename A1, typename A2, typename A3, typename A4, 563 template <typename R, typename A1, typename A2, typename A3, typename A4,
550 typename A5, typename A6, typename A7> 564 typename A5, typename A6, typename A7>
551 class RunnableAdapter<R(*)(A1, A2, A3, A4, A5, A6, A7)> { 565 class RunnableAdapter<R(*)(A1, A2, A3, A4, A5, A6, A7)> {
552 public: 566 public:
553 typedef R (RunType)(A1, A2, A3, A4, A5, A6, A7); 567 typedef R (RunType)(A1, A2, A3, A4, A5, A6, A7);
554 568
555 explicit RunnableAdapter(R(*function)(A1, A2, A3, A4, A5, A6, A7)) 569 explicit RunnableAdapter(R(*function)(A1, A2, A3, A4, A5, A6, A7))
556 : function_(function) { 570 : function_(function) {
557 } 571 }
558 572
559 R Run(typename CallbackParamTraits<A1>::ForwardType a1, 573 R Run(typename CallbackParamTraits<A1>::ForwardType a1,
560 typename CallbackParamTraits<A2>::ForwardType a2, 574 typename CallbackParamTraits<A2>::ForwardType a2,
561 typename CallbackParamTraits<A3>::ForwardType a3, 575 typename CallbackParamTraits<A3>::ForwardType a3,
562 typename CallbackParamTraits<A4>::ForwardType a4, 576 typename CallbackParamTraits<A4>::ForwardType a4,
563 typename CallbackParamTraits<A5>::ForwardType a5, 577 typename CallbackParamTraits<A5>::ForwardType a5,
564 typename CallbackParamTraits<A6>::ForwardType a6, 578 typename CallbackParamTraits<A6>::ForwardType a6,
565 typename CallbackParamTraits<A7>::ForwardType a7) { 579 typename CallbackParamTraits<A7>::ForwardType a7) {
566 return function_(a1, a2, a3, a4, a5, a6, a7); 580 return function_(BindMoveSupport(a1), BindMoveSupport(a2),
581 BindMoveSupport(a3), BindMoveSupport(a4), BindMoveSupport(a5),
582 BindMoveSupport(a6), BindMoveSupport(a7));
567 } 583 }
568 584
569 private: 585 private:
570 R (*function_)(A1, A2, A3, A4, A5, A6, A7); 586 R (*function_)(A1, A2, A3, A4, A5, A6, A7);
571 }; 587 };
572 588
573 // Method: Arity 7. 589 // Method: Arity 7.
574 template <typename R, typename T, typename A1, typename A2, typename A3, 590 template <typename R, typename T, typename A1, typename A2, typename A3,
575 typename A4, typename A5, typename A6, typename A7> 591 typename A4, typename A5, typename A6, typename A7>
576 class RunnableAdapter<R(T::*)(A1, A2, A3, A4, A5, A6, A7)> { 592 class RunnableAdapter<R(T::*)(A1, A2, A3, A4, A5, A6, A7)> {
577 public: 593 public:
578 typedef R (RunType)(T*, A1, A2, A3, A4, A5, A6, A7); 594 typedef R (RunType)(T*, A1, A2, A3, A4, A5, A6, A7);
579 typedef true_type IsMethod; 595 typedef true_type IsMethod;
580 596
581 explicit RunnableAdapter(R(T::*method)(A1, A2, A3, A4, A5, A6, A7)) 597 explicit RunnableAdapter(R(T::*method)(A1, A2, A3, A4, A5, A6, A7))
582 : method_(method) { 598 : method_(method) {
583 } 599 }
584 600
585 R Run(T* object, typename CallbackParamTraits<A1>::ForwardType a1, 601 R Run(T* object, typename CallbackParamTraits<A1>::ForwardType a1,
586 typename CallbackParamTraits<A2>::ForwardType a2, 602 typename CallbackParamTraits<A2>::ForwardType a2,
587 typename CallbackParamTraits<A3>::ForwardType a3, 603 typename CallbackParamTraits<A3>::ForwardType a3,
588 typename CallbackParamTraits<A4>::ForwardType a4, 604 typename CallbackParamTraits<A4>::ForwardType a4,
589 typename CallbackParamTraits<A5>::ForwardType a5, 605 typename CallbackParamTraits<A5>::ForwardType a5,
590 typename CallbackParamTraits<A6>::ForwardType a6, 606 typename CallbackParamTraits<A6>::ForwardType a6,
591 typename CallbackParamTraits<A7>::ForwardType a7) { 607 typename CallbackParamTraits<A7>::ForwardType a7) {
592 return (object->*method_)(a1, a2, a3, a4, a5, a6, a7); 608 return (object->*method_)(BindMoveSupport(a1), BindMoveSupport(a2),
609 BindMoveSupport(a3), BindMoveSupport(a4), BindMoveSupport(a5),
610 BindMoveSupport(a6), BindMoveSupport(a7));
593 } 611 }
594 612
595 private: 613 private:
596 R (T::*method_)(A1, A2, A3, A4, A5, A6, A7); 614 R (T::*method_)(A1, A2, A3, A4, A5, A6, A7);
597 }; 615 };
598 616
599 // Const Method: Arity 7. 617 // Const Method: Arity 7.
600 template <typename R, typename T, typename A1, typename A2, typename A3, 618 template <typename R, typename T, typename A1, typename A2, typename A3,
601 typename A4, typename A5, typename A6, typename A7> 619 typename A4, typename A5, typename A6, typename A7>
602 class RunnableAdapter<R(T::*)(A1, A2, A3, A4, A5, A6, A7) const> { 620 class RunnableAdapter<R(T::*)(A1, A2, A3, A4, A5, A6, A7) const> {
603 public: 621 public:
604 typedef R (RunType)(const T*, A1, A2, A3, A4, A5, A6, A7); 622 typedef R (RunType)(const T*, A1, A2, A3, A4, A5, A6, A7);
605 typedef true_type IsMethod; 623 typedef true_type IsMethod;
606 624
607 explicit RunnableAdapter(R(T::*method)(A1, A2, A3, A4, A5, A6, A7) const) 625 explicit RunnableAdapter(R(T::*method)(A1, A2, A3, A4, A5, A6, A7) const)
608 : method_(method) { 626 : method_(method) {
609 } 627 }
610 628
611 R Run(const T* object, typename CallbackParamTraits<A1>::ForwardType a1, 629 R Run(const T* object, typename CallbackParamTraits<A1>::ForwardType a1,
612 typename CallbackParamTraits<A2>::ForwardType a2, 630 typename CallbackParamTraits<A2>::ForwardType a2,
613 typename CallbackParamTraits<A3>::ForwardType a3, 631 typename CallbackParamTraits<A3>::ForwardType a3,
614 typename CallbackParamTraits<A4>::ForwardType a4, 632 typename CallbackParamTraits<A4>::ForwardType a4,
615 typename CallbackParamTraits<A5>::ForwardType a5, 633 typename CallbackParamTraits<A5>::ForwardType a5,
616 typename CallbackParamTraits<A6>::ForwardType a6, 634 typename CallbackParamTraits<A6>::ForwardType a6,
617 typename CallbackParamTraits<A7>::ForwardType a7) { 635 typename CallbackParamTraits<A7>::ForwardType a7) {
618 return (object->*method_)(a1, a2, a3, a4, a5, a6, a7); 636 return (object->*method_)(BindMoveSupport(a1), BindMoveSupport(a2),
637 BindMoveSupport(a3), BindMoveSupport(a4), BindMoveSupport(a5),
638 BindMoveSupport(a6), BindMoveSupport(a7));
619 } 639 }
620 640
621 private: 641 private:
622 R (T::*method_)(A1, A2, A3, A4, A5, A6, A7) const; 642 R (T::*method_)(A1, A2, A3, A4, A5, A6, A7) const;
623 }; 643 };
624 644
625 645
626 // FunctionTraits<> 646 // FunctionTraits<>
627 // 647 //
628 // Breaks a function signature apart into typedefs for easier introspection. 648 // Breaks a function signature apart into typedefs for easier introspection.
(...skipping 2041 matching lines...) Expand 10 before | Expand all | Expand 10 after
2670 P4 p4_; 2690 P4 p4_;
2671 P5 p5_; 2691 P5 p5_;
2672 P6 p6_; 2692 P6 p6_;
2673 P7 p7_; 2693 P7 p7_;
2674 }; 2694 };
2675 2695
2676 } // namespace internal 2696 } // namespace internal
2677 } // namespace base 2697 } // namespace base
2678 2698
2679 #endif // BASE_BIND_INTERNAL_H_ 2699 #endif // BASE_BIND_INTERNAL_H_
OLDNEW
« no previous file with comments | « base/bind_helpers.h ('k') | base/bind_internal.h.pump » ('j') | base/memory/scoped_ptr.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698