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

Side by Side Diff: base/callback.h

Issue 10836215: Rename template parameter in callback from RunType to BindRunType. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix comment according to CR's comment. Created 8 years, 4 months 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
« no previous file with comments | « no previous file | base/callback.h.pump » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // This file was GENERATED by command: 1 // This file was GENERATED by command:
2 // pump.py callback.h.pump 2 // pump.py callback.h.pump
3 // DO NOT EDIT BY HAND!!! 3 // DO NOT EDIT BY HAND!!!
4 4
5 5
6 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 6 // Copyright (c) 2012 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_CALLBACK_H_ 10 #ifndef BASE_CALLBACK_H_
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 // pointer. 116 // pointer.
117 // 117 //
118 // base::Closure cb = base::Bind(&MyClass::MyFunc, this, 23, "hello world"); 118 // base::Closure cb = base::Bind(&MyClass::MyFunc, this, 23, "hello world");
119 // 119 //
120 // PARTIAL BINDING OF PARAMETERS 120 // PARTIAL BINDING OF PARAMETERS
121 // 121 //
122 // You can specify some parameters when you create the callback, and specify 122 // You can specify some parameters when you create the callback, and specify
123 // the rest when you execute the callback. 123 // the rest when you execute the callback.
124 // 124 //
125 // void MyFunc(int i, const std::string& str) {} 125 // void MyFunc(int i, const std::string& str) {}
126 // base::Callback<void(const std::string)> cb = base::Bind(&MyFunc, 23); 126 // base::Callback<void(const std::string&)> cb = base::Bind(&MyFunc, 23);
127 // cb.Run("hello world"); 127 // cb.Run("hello world");
128 // 128 //
129 // When calling a function bound parameters are first, followed by unbound 129 // When calling a function bound parameters are first, followed by unbound
130 // parameters. 130 // parameters.
131 // 131 //
132 // 132 //
133 // ----------------------------------------------------------------------------- 133 // -----------------------------------------------------------------------------
134 // Quick reference for advanced binding 134 // Quick reference for advanced binding
135 // ----------------------------------------------------------------------------- 135 // -----------------------------------------------------------------------------
136 // 136 //
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 357
358 template <typename R> 358 template <typename R>
359 class Callback<R(void)> : public internal::CallbackBase { 359 class Callback<R(void)> : public internal::CallbackBase {
360 public: 360 public:
361 typedef R(RunType)(); 361 typedef R(RunType)();
362 362
363 Callback() : CallbackBase(NULL) { } 363 Callback() : CallbackBase(NULL) { }
364 364
365 // Note that this constructor CANNOT be explicit, and that Bind() CANNOT 365 // Note that this constructor CANNOT be explicit, and that Bind() CANNOT
366 // return the exact Callback<> type. See base/bind.h for details. 366 // return the exact Callback<> type. See base/bind.h for details.
367 template <typename Runnable, typename RunType, typename BoundArgsType> 367 template <typename Runnable, typename BindRunType, typename BoundArgsType>
368 Callback(internal::BindState<Runnable, RunType, BoundArgsType>* bind_state) 368 Callback(internal::BindState<Runnable, BindRunType,
369 BoundArgsType>* bind_state)
369 : CallbackBase(bind_state) { 370 : CallbackBase(bind_state) {
370 371
371 // Force the assignment to a local variable of PolymorphicInvoke 372 // Force the assignment to a local variable of PolymorphicInvoke
372 // so the compiler will typecheck that the passed in Run() method has 373 // so the compiler will typecheck that the passed in Run() method has
373 // the correct type. 374 // the correct type.
374 PolymorphicInvoke invoke_func = 375 PolymorphicInvoke invoke_func =
375 &internal::BindState<Runnable, RunType, BoundArgsType> 376 &internal::BindState<Runnable, BindRunType, BoundArgsType>
376 ::InvokerType::Run; 377 ::InvokerType::Run;
377 polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func); 378 polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
378 } 379 }
379 380
380 bool Equals(const Callback& other) const { 381 bool Equals(const Callback& other) const {
381 return CallbackBase::Equals(other); 382 return CallbackBase::Equals(other);
382 } 383 }
383 384
384 R Run() const { 385 R Run() const {
385 PolymorphicInvoke f = 386 PolymorphicInvoke f =
(...skipping 10 matching lines...) Expand all
396 397
397 template <typename R, typename A1> 398 template <typename R, typename A1>
398 class Callback<R(A1)> : public internal::CallbackBase { 399 class Callback<R(A1)> : public internal::CallbackBase {
399 public: 400 public:
400 typedef R(RunType)(A1); 401 typedef R(RunType)(A1);
401 402
402 Callback() : CallbackBase(NULL) { } 403 Callback() : CallbackBase(NULL) { }
403 404
404 // Note that this constructor CANNOT be explicit, and that Bind() CANNOT 405 // Note that this constructor CANNOT be explicit, and that Bind() CANNOT
405 // return the exact Callback<> type. See base/bind.h for details. 406 // return the exact Callback<> type. See base/bind.h for details.
406 template <typename Runnable, typename RunType, typename BoundArgsType> 407 template <typename Runnable, typename BindRunType, typename BoundArgsType>
407 Callback(internal::BindState<Runnable, RunType, BoundArgsType>* bind_state) 408 Callback(internal::BindState<Runnable, BindRunType,
409 BoundArgsType>* bind_state)
408 : CallbackBase(bind_state) { 410 : CallbackBase(bind_state) {
409 411
410 // Force the assignment to a local variable of PolymorphicInvoke 412 // Force the assignment to a local variable of PolymorphicInvoke
411 // so the compiler will typecheck that the passed in Run() method has 413 // so the compiler will typecheck that the passed in Run() method has
412 // the correct type. 414 // the correct type.
413 PolymorphicInvoke invoke_func = 415 PolymorphicInvoke invoke_func =
414 &internal::BindState<Runnable, RunType, BoundArgsType> 416 &internal::BindState<Runnable, BindRunType, BoundArgsType>
415 ::InvokerType::Run; 417 ::InvokerType::Run;
416 polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func); 418 polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
417 } 419 }
418 420
419 bool Equals(const Callback& other) const { 421 bool Equals(const Callback& other) const {
420 return CallbackBase::Equals(other); 422 return CallbackBase::Equals(other);
421 } 423 }
422 424
423 R Run(typename internal::CallbackParamTraits<A1>::ForwardType a1) const { 425 R Run(typename internal::CallbackParamTraits<A1>::ForwardType a1) const {
424 PolymorphicInvoke f = 426 PolymorphicInvoke f =
(...skipping 11 matching lines...) Expand all
436 438
437 template <typename R, typename A1, typename A2> 439 template <typename R, typename A1, typename A2>
438 class Callback<R(A1, A2)> : public internal::CallbackBase { 440 class Callback<R(A1, A2)> : public internal::CallbackBase {
439 public: 441 public:
440 typedef R(RunType)(A1, A2); 442 typedef R(RunType)(A1, A2);
441 443
442 Callback() : CallbackBase(NULL) { } 444 Callback() : CallbackBase(NULL) { }
443 445
444 // Note that this constructor CANNOT be explicit, and that Bind() CANNOT 446 // Note that this constructor CANNOT be explicit, and that Bind() CANNOT
445 // return the exact Callback<> type. See base/bind.h for details. 447 // return the exact Callback<> type. See base/bind.h for details.
446 template <typename Runnable, typename RunType, typename BoundArgsType> 448 template <typename Runnable, typename BindRunType, typename BoundArgsType>
447 Callback(internal::BindState<Runnable, RunType, BoundArgsType>* bind_state) 449 Callback(internal::BindState<Runnable, BindRunType,
450 BoundArgsType>* bind_state)
448 : CallbackBase(bind_state) { 451 : CallbackBase(bind_state) {
449 452
450 // Force the assignment to a local variable of PolymorphicInvoke 453 // Force the assignment to a local variable of PolymorphicInvoke
451 // so the compiler will typecheck that the passed in Run() method has 454 // so the compiler will typecheck that the passed in Run() method has
452 // the correct type. 455 // the correct type.
453 PolymorphicInvoke invoke_func = 456 PolymorphicInvoke invoke_func =
454 &internal::BindState<Runnable, RunType, BoundArgsType> 457 &internal::BindState<Runnable, BindRunType, BoundArgsType>
455 ::InvokerType::Run; 458 ::InvokerType::Run;
456 polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func); 459 polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
457 } 460 }
458 461
459 bool Equals(const Callback& other) const { 462 bool Equals(const Callback& other) const {
460 return CallbackBase::Equals(other); 463 return CallbackBase::Equals(other);
461 } 464 }
462 465
463 R Run(typename internal::CallbackParamTraits<A1>::ForwardType a1, 466 R Run(typename internal::CallbackParamTraits<A1>::ForwardType a1,
464 typename internal::CallbackParamTraits<A2>::ForwardType a2) const { 467 typename internal::CallbackParamTraits<A2>::ForwardType a2) const {
(...skipping 14 matching lines...) Expand all
479 482
480 template <typename R, typename A1, typename A2, typename A3> 483 template <typename R, typename A1, typename A2, typename A3>
481 class Callback<R(A1, A2, A3)> : public internal::CallbackBase { 484 class Callback<R(A1, A2, A3)> : public internal::CallbackBase {
482 public: 485 public:
483 typedef R(RunType)(A1, A2, A3); 486 typedef R(RunType)(A1, A2, A3);
484 487
485 Callback() : CallbackBase(NULL) { } 488 Callback() : CallbackBase(NULL) { }
486 489
487 // Note that this constructor CANNOT be explicit, and that Bind() CANNOT 490 // Note that this constructor CANNOT be explicit, and that Bind() CANNOT
488 // return the exact Callback<> type. See base/bind.h for details. 491 // return the exact Callback<> type. See base/bind.h for details.
489 template <typename Runnable, typename RunType, typename BoundArgsType> 492 template <typename Runnable, typename BindRunType, typename BoundArgsType>
490 Callback(internal::BindState<Runnable, RunType, BoundArgsType>* bind_state) 493 Callback(internal::BindState<Runnable, BindRunType,
494 BoundArgsType>* bind_state)
491 : CallbackBase(bind_state) { 495 : CallbackBase(bind_state) {
492 496
493 // Force the assignment to a local variable of PolymorphicInvoke 497 // Force the assignment to a local variable of PolymorphicInvoke
494 // so the compiler will typecheck that the passed in Run() method has 498 // so the compiler will typecheck that the passed in Run() method has
495 // the correct type. 499 // the correct type.
496 PolymorphicInvoke invoke_func = 500 PolymorphicInvoke invoke_func =
497 &internal::BindState<Runnable, RunType, BoundArgsType> 501 &internal::BindState<Runnable, BindRunType, BoundArgsType>
498 ::InvokerType::Run; 502 ::InvokerType::Run;
499 polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func); 503 polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
500 } 504 }
501 505
502 bool Equals(const Callback& other) const { 506 bool Equals(const Callback& other) const {
503 return CallbackBase::Equals(other); 507 return CallbackBase::Equals(other);
504 } 508 }
505 509
506 R Run(typename internal::CallbackParamTraits<A1>::ForwardType a1, 510 R Run(typename internal::CallbackParamTraits<A1>::ForwardType a1,
507 typename internal::CallbackParamTraits<A2>::ForwardType a2, 511 typename internal::CallbackParamTraits<A2>::ForwardType a2,
(...skipping 17 matching lines...) Expand all
525 529
526 template <typename R, typename A1, typename A2, typename A3, typename A4> 530 template <typename R, typename A1, typename A2, typename A3, typename A4>
527 class Callback<R(A1, A2, A3, A4)> : public internal::CallbackBase { 531 class Callback<R(A1, A2, A3, A4)> : public internal::CallbackBase {
528 public: 532 public:
529 typedef R(RunType)(A1, A2, A3, A4); 533 typedef R(RunType)(A1, A2, A3, A4);
530 534
531 Callback() : CallbackBase(NULL) { } 535 Callback() : CallbackBase(NULL) { }
532 536
533 // Note that this constructor CANNOT be explicit, and that Bind() CANNOT 537 // Note that this constructor CANNOT be explicit, and that Bind() CANNOT
534 // return the exact Callback<> type. See base/bind.h for details. 538 // return the exact Callback<> type. See base/bind.h for details.
535 template <typename Runnable, typename RunType, typename BoundArgsType> 539 template <typename Runnable, typename BindRunType, typename BoundArgsType>
536 Callback(internal::BindState<Runnable, RunType, BoundArgsType>* bind_state) 540 Callback(internal::BindState<Runnable, BindRunType,
541 BoundArgsType>* bind_state)
537 : CallbackBase(bind_state) { 542 : CallbackBase(bind_state) {
538 543
539 // Force the assignment to a local variable of PolymorphicInvoke 544 // Force the assignment to a local variable of PolymorphicInvoke
540 // so the compiler will typecheck that the passed in Run() method has 545 // so the compiler will typecheck that the passed in Run() method has
541 // the correct type. 546 // the correct type.
542 PolymorphicInvoke invoke_func = 547 PolymorphicInvoke invoke_func =
543 &internal::BindState<Runnable, RunType, BoundArgsType> 548 &internal::BindState<Runnable, BindRunType, BoundArgsType>
544 ::InvokerType::Run; 549 ::InvokerType::Run;
545 polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func); 550 polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
546 } 551 }
547 552
548 bool Equals(const Callback& other) const { 553 bool Equals(const Callback& other) const {
549 return CallbackBase::Equals(other); 554 return CallbackBase::Equals(other);
550 } 555 }
551 556
552 R Run(typename internal::CallbackParamTraits<A1>::ForwardType a1, 557 R Run(typename internal::CallbackParamTraits<A1>::ForwardType a1,
553 typename internal::CallbackParamTraits<A2>::ForwardType a2, 558 typename internal::CallbackParamTraits<A2>::ForwardType a2,
(...skipping 21 matching lines...) Expand all
575 template <typename R, typename A1, typename A2, typename A3, typename A4, 580 template <typename R, typename A1, typename A2, typename A3, typename A4,
576 typename A5> 581 typename A5>
577 class Callback<R(A1, A2, A3, A4, A5)> : public internal::CallbackBase { 582 class Callback<R(A1, A2, A3, A4, A5)> : public internal::CallbackBase {
578 public: 583 public:
579 typedef R(RunType)(A1, A2, A3, A4, A5); 584 typedef R(RunType)(A1, A2, A3, A4, A5);
580 585
581 Callback() : CallbackBase(NULL) { } 586 Callback() : CallbackBase(NULL) { }
582 587
583 // Note that this constructor CANNOT be explicit, and that Bind() CANNOT 588 // Note that this constructor CANNOT be explicit, and that Bind() CANNOT
584 // return the exact Callback<> type. See base/bind.h for details. 589 // return the exact Callback<> type. See base/bind.h for details.
585 template <typename Runnable, typename RunType, typename BoundArgsType> 590 template <typename Runnable, typename BindRunType, typename BoundArgsType>
586 Callback(internal::BindState<Runnable, RunType, BoundArgsType>* bind_state) 591 Callback(internal::BindState<Runnable, BindRunType,
592 BoundArgsType>* bind_state)
587 : CallbackBase(bind_state) { 593 : CallbackBase(bind_state) {
588 594
589 // Force the assignment to a local variable of PolymorphicInvoke 595 // Force the assignment to a local variable of PolymorphicInvoke
590 // so the compiler will typecheck that the passed in Run() method has 596 // so the compiler will typecheck that the passed in Run() method has
591 // the correct type. 597 // the correct type.
592 PolymorphicInvoke invoke_func = 598 PolymorphicInvoke invoke_func =
593 &internal::BindState<Runnable, RunType, BoundArgsType> 599 &internal::BindState<Runnable, BindRunType, BoundArgsType>
594 ::InvokerType::Run; 600 ::InvokerType::Run;
595 polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func); 601 polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
596 } 602 }
597 603
598 bool Equals(const Callback& other) const { 604 bool Equals(const Callback& other) const {
599 return CallbackBase::Equals(other); 605 return CallbackBase::Equals(other);
600 } 606 }
601 607
602 R Run(typename internal::CallbackParamTraits<A1>::ForwardType a1, 608 R Run(typename internal::CallbackParamTraits<A1>::ForwardType a1,
603 typename internal::CallbackParamTraits<A2>::ForwardType a2, 609 typename internal::CallbackParamTraits<A2>::ForwardType a2,
(...skipping 24 matching lines...) Expand all
628 template <typename R, typename A1, typename A2, typename A3, typename A4, 634 template <typename R, typename A1, typename A2, typename A3, typename A4,
629 typename A5, typename A6> 635 typename A5, typename A6>
630 class Callback<R(A1, A2, A3, A4, A5, A6)> : public internal::CallbackBase { 636 class Callback<R(A1, A2, A3, A4, A5, A6)> : public internal::CallbackBase {
631 public: 637 public:
632 typedef R(RunType)(A1, A2, A3, A4, A5, A6); 638 typedef R(RunType)(A1, A2, A3, A4, A5, A6);
633 639
634 Callback() : CallbackBase(NULL) { } 640 Callback() : CallbackBase(NULL) { }
635 641
636 // Note that this constructor CANNOT be explicit, and that Bind() CANNOT 642 // Note that this constructor CANNOT be explicit, and that Bind() CANNOT
637 // return the exact Callback<> type. See base/bind.h for details. 643 // return the exact Callback<> type. See base/bind.h for details.
638 template <typename Runnable, typename RunType, typename BoundArgsType> 644 template <typename Runnable, typename BindRunType, typename BoundArgsType>
639 Callback(internal::BindState<Runnable, RunType, BoundArgsType>* bind_state) 645 Callback(internal::BindState<Runnable, BindRunType,
646 BoundArgsType>* bind_state)
640 : CallbackBase(bind_state) { 647 : CallbackBase(bind_state) {
641 648
642 // Force the assignment to a local variable of PolymorphicInvoke 649 // Force the assignment to a local variable of PolymorphicInvoke
643 // so the compiler will typecheck that the passed in Run() method has 650 // so the compiler will typecheck that the passed in Run() method has
644 // the correct type. 651 // the correct type.
645 PolymorphicInvoke invoke_func = 652 PolymorphicInvoke invoke_func =
646 &internal::BindState<Runnable, RunType, BoundArgsType> 653 &internal::BindState<Runnable, BindRunType, BoundArgsType>
647 ::InvokerType::Run; 654 ::InvokerType::Run;
648 polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func); 655 polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
649 } 656 }
650 657
651 bool Equals(const Callback& other) const { 658 bool Equals(const Callback& other) const {
652 return CallbackBase::Equals(other); 659 return CallbackBase::Equals(other);
653 } 660 }
654 661
655 R Run(typename internal::CallbackParamTraits<A1>::ForwardType a1, 662 R Run(typename internal::CallbackParamTraits<A1>::ForwardType a1,
656 typename internal::CallbackParamTraits<A2>::ForwardType a2, 663 typename internal::CallbackParamTraits<A2>::ForwardType a2,
(...skipping 27 matching lines...) Expand all
684 template <typename R, typename A1, typename A2, typename A3, typename A4, 691 template <typename R, typename A1, typename A2, typename A3, typename A4,
685 typename A5, typename A6, typename A7> 692 typename A5, typename A6, typename A7>
686 class Callback<R(A1, A2, A3, A4, A5, A6, A7)> : public internal::CallbackBase { 693 class Callback<R(A1, A2, A3, A4, A5, A6, A7)> : public internal::CallbackBase {
687 public: 694 public:
688 typedef R(RunType)(A1, A2, A3, A4, A5, A6, A7); 695 typedef R(RunType)(A1, A2, A3, A4, A5, A6, A7);
689 696
690 Callback() : CallbackBase(NULL) { } 697 Callback() : CallbackBase(NULL) { }
691 698
692 // Note that this constructor CANNOT be explicit, and that Bind() CANNOT 699 // Note that this constructor CANNOT be explicit, and that Bind() CANNOT
693 // return the exact Callback<> type. See base/bind.h for details. 700 // return the exact Callback<> type. See base/bind.h for details.
694 template <typename Runnable, typename RunType, typename BoundArgsType> 701 template <typename Runnable, typename BindRunType, typename BoundArgsType>
695 Callback(internal::BindState<Runnable, RunType, BoundArgsType>* bind_state) 702 Callback(internal::BindState<Runnable, BindRunType,
703 BoundArgsType>* bind_state)
696 : CallbackBase(bind_state) { 704 : CallbackBase(bind_state) {
697 705
698 // Force the assignment to a local variable of PolymorphicInvoke 706 // Force the assignment to a local variable of PolymorphicInvoke
699 // so the compiler will typecheck that the passed in Run() method has 707 // so the compiler will typecheck that the passed in Run() method has
700 // the correct type. 708 // the correct type.
701 PolymorphicInvoke invoke_func = 709 PolymorphicInvoke invoke_func =
702 &internal::BindState<Runnable, RunType, BoundArgsType> 710 &internal::BindState<Runnable, BindRunType, BoundArgsType>
703 ::InvokerType::Run; 711 ::InvokerType::Run;
704 polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func); 712 polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
705 } 713 }
706 714
707 bool Equals(const Callback& other) const { 715 bool Equals(const Callback& other) const {
708 return CallbackBase::Equals(other); 716 return CallbackBase::Equals(other);
709 } 717 }
710 718
711 R Run(typename internal::CallbackParamTraits<A1>::ForwardType a1, 719 R Run(typename internal::CallbackParamTraits<A1>::ForwardType a1,
712 typename internal::CallbackParamTraits<A2>::ForwardType a2, 720 typename internal::CallbackParamTraits<A2>::ForwardType a2,
(...skipping 28 matching lines...) Expand all
741 }; 749 };
742 750
743 751
744 // Syntactic sugar to make Callbacks<void(void)> easier to declare since it 752 // Syntactic sugar to make Callbacks<void(void)> easier to declare since it
745 // will be used in a lot of APIs with delayed execution. 753 // will be used in a lot of APIs with delayed execution.
746 typedef Callback<void(void)> Closure; 754 typedef Callback<void(void)> Closure;
747 755
748 } // namespace base 756 } // namespace base
749 757
750 #endif // BASE_CALLBACK_H 758 #endif // BASE_CALLBACK_H
OLDNEW
« no previous file with comments | « no previous file | base/callback.h.pump » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698