OLD | NEW |
1 // This file was GENERATED by command: | 1 // This file was GENERATED by command: |
2 // pump.py bind.h.pump | 2 // pump.py bind.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 |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 new internal::BindState<RunnableType, RunType, | 403 new internal::BindState<RunnableType, RunType, |
404 void(typename internal::CallbackParamTraits<P1>::StorageType, | 404 void(typename internal::CallbackParamTraits<P1>::StorageType, |
405 typename internal::CallbackParamTraits<P2>::StorageType, | 405 typename internal::CallbackParamTraits<P2>::StorageType, |
406 typename internal::CallbackParamTraits<P3>::StorageType, | 406 typename internal::CallbackParamTraits<P3>::StorageType, |
407 typename internal::CallbackParamTraits<P4>::StorageType, | 407 typename internal::CallbackParamTraits<P4>::StorageType, |
408 typename internal::CallbackParamTraits<P5>::StorageType, | 408 typename internal::CallbackParamTraits<P5>::StorageType, |
409 typename internal::CallbackParamTraits<P6>::StorageType)>( | 409 typename internal::CallbackParamTraits<P6>::StorageType)>( |
410 internal::MakeRunnable(functor), p1, p2, p3, p4, p5, p6)); | 410 internal::MakeRunnable(functor), p1, p2, p3, p4, p5, p6)); |
411 } | 411 } |
412 | 412 |
| 413 template <typename Functor, typename P1, typename P2, typename P3, typename P4, |
| 414 typename P5, typename P6, typename P7> |
| 415 internal::BindStateHolder< |
| 416 internal::BindState< |
| 417 typename internal::FunctorTraits<Functor>::RunnableType, |
| 418 typename internal::FunctorTraits<Functor>::RunType, |
| 419 void(typename internal::CallbackParamTraits<P1>::StorageType, |
| 420 typename internal::CallbackParamTraits<P2>::StorageType, |
| 421 typename internal::CallbackParamTraits<P3>::StorageType, |
| 422 typename internal::CallbackParamTraits<P4>::StorageType, |
| 423 typename internal::CallbackParamTraits<P5>::StorageType, |
| 424 typename internal::CallbackParamTraits<P6>::StorageType, |
| 425 typename internal::CallbackParamTraits<P7>::StorageType)> > |
| 426 Bind(Functor functor, const P1& p1, const P2& p2, const P3& p3, const P4& p4, |
| 427 const P5& p5, const P6& p6, const P7& p7) { |
| 428 // Typedefs for how to store and run the functor. |
| 429 typedef typename internal::FunctorTraits<Functor>::RunnableType RunnableType; |
| 430 typedef typename internal::FunctorTraits<Functor>::RunType RunType; |
| 431 |
| 432 // Use RunnableType::RunType instead of RunType above because our |
| 433 // checks should below for bound references need to know what the actual |
| 434 // functor is going to interpret the argument as. |
| 435 typedef internal::FunctionTraits<typename RunnableType::RunType> |
| 436 BoundFunctorTraits; |
| 437 |
| 438 // Do not allow binding a non-const reference parameter. Non-const reference |
| 439 // parameters are disallowed by the Google style guide. Also, binding a |
| 440 // non-const reference parameter can make for subtle bugs because the |
| 441 // invoked function will receive a reference to the stored copy of the |
| 442 // argument and not the original. |
| 443 COMPILE_ASSERT( |
| 444 !(is_non_const_reference<typename BoundFunctorTraits::A1Type>::value || |
| 445 is_non_const_reference<typename BoundFunctorTraits::A2Type>::value || |
| 446 is_non_const_reference<typename BoundFunctorTraits::A3Type>::value || |
| 447 is_non_const_reference<typename BoundFunctorTraits::A4Type>::value || |
| 448 is_non_const_reference<typename BoundFunctorTraits::A5Type>::value || |
| 449 is_non_const_reference<typename BoundFunctorTraits::A6Type>::value || |
| 450 is_non_const_reference<typename BoundFunctorTraits::A7Type>::value ), |
| 451 do_not_bind_functions_with_nonconst_ref); |
| 452 |
| 453 // For methods, we need to be careful for parameter 1. We do not require |
| 454 // a scoped_refptr because BindState<> itself takes care of AddRef() for |
| 455 // methods. We also disallow binding of an array as the method's target |
| 456 // object. |
| 457 COMPILE_ASSERT( |
| 458 internal::HasIsMethodTag<RunnableType>::value || |
| 459 !internal::NeedsScopedRefptrButGetsRawPtr<P1>::value, |
| 460 p1_is_refcounted_type_and_needs_scoped_refptr); |
| 461 COMPILE_ASSERT(!internal::HasIsMethodTag<RunnableType>::value || |
| 462 !is_array<P1>::value, |
| 463 first_bound_argument_to_method_cannot_be_array); |
| 464 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr<P2>::value, |
| 465 p2_is_refcounted_type_and_needs_scoped_refptr); |
| 466 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr<P3>::value, |
| 467 p3_is_refcounted_type_and_needs_scoped_refptr); |
| 468 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr<P4>::value, |
| 469 p4_is_refcounted_type_and_needs_scoped_refptr); |
| 470 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr<P5>::value, |
| 471 p5_is_refcounted_type_and_needs_scoped_refptr); |
| 472 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr<P6>::value, |
| 473 p6_is_refcounted_type_and_needs_scoped_refptr); |
| 474 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr<P7>::value, |
| 475 p7_is_refcounted_type_and_needs_scoped_refptr); |
| 476 |
| 477 return internal::MakeBindStateHolder( |
| 478 new internal::BindState<RunnableType, RunType, |
| 479 void(typename internal::CallbackParamTraits<P1>::StorageType, |
| 480 typename internal::CallbackParamTraits<P2>::StorageType, |
| 481 typename internal::CallbackParamTraits<P3>::StorageType, |
| 482 typename internal::CallbackParamTraits<P4>::StorageType, |
| 483 typename internal::CallbackParamTraits<P5>::StorageType, |
| 484 typename internal::CallbackParamTraits<P6>::StorageType, |
| 485 typename internal::CallbackParamTraits<P7>::StorageType)>( |
| 486 internal::MakeRunnable(functor), p1, p2, p3, p4, p5, p6, p7)); |
| 487 } |
| 488 |
| 489 template <typename Functor, typename P1, typename P2, typename P3, typename P4, |
| 490 typename P5, typename P6, typename P7, typename P8> |
| 491 internal::BindStateHolder< |
| 492 internal::BindState< |
| 493 typename internal::FunctorTraits<Functor>::RunnableType, |
| 494 typename internal::FunctorTraits<Functor>::RunType, |
| 495 void(typename internal::CallbackParamTraits<P1>::StorageType, |
| 496 typename internal::CallbackParamTraits<P2>::StorageType, |
| 497 typename internal::CallbackParamTraits<P3>::StorageType, |
| 498 typename internal::CallbackParamTraits<P4>::StorageType, |
| 499 typename internal::CallbackParamTraits<P5>::StorageType, |
| 500 typename internal::CallbackParamTraits<P6>::StorageType, |
| 501 typename internal::CallbackParamTraits<P7>::StorageType, |
| 502 typename internal::CallbackParamTraits<P8>::StorageType)> > |
| 503 Bind(Functor functor, const P1& p1, const P2& p2, const P3& p3, const P4& p4, |
| 504 const P5& p5, const P6& p6, const P7& p7, const P8& p8) { |
| 505 // Typedefs for how to store and run the functor. |
| 506 typedef typename internal::FunctorTraits<Functor>::RunnableType RunnableType; |
| 507 typedef typename internal::FunctorTraits<Functor>::RunType RunType; |
| 508 |
| 509 // Use RunnableType::RunType instead of RunType above because our |
| 510 // checks should below for bound references need to know what the actual |
| 511 // functor is going to interpret the argument as. |
| 512 typedef internal::FunctionTraits<typename RunnableType::RunType> |
| 513 BoundFunctorTraits; |
| 514 |
| 515 // Do not allow binding a non-const reference parameter. Non-const reference |
| 516 // parameters are disallowed by the Google style guide. Also, binding a |
| 517 // non-const reference parameter can make for subtle bugs because the |
| 518 // invoked function will receive a reference to the stored copy of the |
| 519 // argument and not the original. |
| 520 COMPILE_ASSERT( |
| 521 !(is_non_const_reference<typename BoundFunctorTraits::A1Type>::value || |
| 522 is_non_const_reference<typename BoundFunctorTraits::A2Type>::value || |
| 523 is_non_const_reference<typename BoundFunctorTraits::A3Type>::value || |
| 524 is_non_const_reference<typename BoundFunctorTraits::A4Type>::value || |
| 525 is_non_const_reference<typename BoundFunctorTraits::A5Type>::value || |
| 526 is_non_const_reference<typename BoundFunctorTraits::A6Type>::value || |
| 527 is_non_const_reference<typename BoundFunctorTraits::A7Type>::value || |
| 528 is_non_const_reference<typename BoundFunctorTraits::A8Type>::value ), |
| 529 do_not_bind_functions_with_nonconst_ref); |
| 530 |
| 531 // For methods, we need to be careful for parameter 1. We do not require |
| 532 // a scoped_refptr because BindState<> itself takes care of AddRef() for |
| 533 // methods. We also disallow binding of an array as the method's target |
| 534 // object. |
| 535 COMPILE_ASSERT( |
| 536 internal::HasIsMethodTag<RunnableType>::value || |
| 537 !internal::NeedsScopedRefptrButGetsRawPtr<P1>::value, |
| 538 p1_is_refcounted_type_and_needs_scoped_refptr); |
| 539 COMPILE_ASSERT(!internal::HasIsMethodTag<RunnableType>::value || |
| 540 !is_array<P1>::value, |
| 541 first_bound_argument_to_method_cannot_be_array); |
| 542 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr<P2>::value, |
| 543 p2_is_refcounted_type_and_needs_scoped_refptr); |
| 544 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr<P3>::value, |
| 545 p3_is_refcounted_type_and_needs_scoped_refptr); |
| 546 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr<P4>::value, |
| 547 p4_is_refcounted_type_and_needs_scoped_refptr); |
| 548 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr<P5>::value, |
| 549 p5_is_refcounted_type_and_needs_scoped_refptr); |
| 550 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr<P6>::value, |
| 551 p6_is_refcounted_type_and_needs_scoped_refptr); |
| 552 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr<P7>::value, |
| 553 p7_is_refcounted_type_and_needs_scoped_refptr); |
| 554 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr<P8>::value, |
| 555 p8_is_refcounted_type_and_needs_scoped_refptr); |
| 556 |
| 557 return internal::MakeBindStateHolder( |
| 558 new internal::BindState<RunnableType, RunType, |
| 559 void(typename internal::CallbackParamTraits<P1>::StorageType, |
| 560 typename internal::CallbackParamTraits<P2>::StorageType, |
| 561 typename internal::CallbackParamTraits<P3>::StorageType, |
| 562 typename internal::CallbackParamTraits<P4>::StorageType, |
| 563 typename internal::CallbackParamTraits<P5>::StorageType, |
| 564 typename internal::CallbackParamTraits<P6>::StorageType, |
| 565 typename internal::CallbackParamTraits<P7>::StorageType, |
| 566 typename internal::CallbackParamTraits<P8>::StorageType)>( |
| 567 internal::MakeRunnable(functor), p1, p2, p3, p4, p5, p6, p7, p8)); |
| 568 } |
| 569 |
| 570 template <typename Functor, typename P1, typename P2, typename P3, typename P4, |
| 571 typename P5, typename P6, typename P7, typename P8, typename P9> |
| 572 internal::BindStateHolder< |
| 573 internal::BindState< |
| 574 typename internal::FunctorTraits<Functor>::RunnableType, |
| 575 typename internal::FunctorTraits<Functor>::RunType, |
| 576 void(typename internal::CallbackParamTraits<P1>::StorageType, |
| 577 typename internal::CallbackParamTraits<P2>::StorageType, |
| 578 typename internal::CallbackParamTraits<P3>::StorageType, |
| 579 typename internal::CallbackParamTraits<P4>::StorageType, |
| 580 typename internal::CallbackParamTraits<P5>::StorageType, |
| 581 typename internal::CallbackParamTraits<P6>::StorageType, |
| 582 typename internal::CallbackParamTraits<P7>::StorageType, |
| 583 typename internal::CallbackParamTraits<P8>::StorageType, |
| 584 typename internal::CallbackParamTraits<P9>::StorageType)> > |
| 585 Bind(Functor functor, const P1& p1, const P2& p2, const P3& p3, const P4& p4, |
| 586 const P5& p5, const P6& p6, const P7& p7, const P8& p8, const P9& p9) { |
| 587 // Typedefs for how to store and run the functor. |
| 588 typedef typename internal::FunctorTraits<Functor>::RunnableType RunnableType; |
| 589 typedef typename internal::FunctorTraits<Functor>::RunType RunType; |
| 590 |
| 591 // Use RunnableType::RunType instead of RunType above because our |
| 592 // checks should below for bound references need to know what the actual |
| 593 // functor is going to interpret the argument as. |
| 594 typedef internal::FunctionTraits<typename RunnableType::RunType> |
| 595 BoundFunctorTraits; |
| 596 |
| 597 // Do not allow binding a non-const reference parameter. Non-const reference |
| 598 // parameters are disallowed by the Google style guide. Also, binding a |
| 599 // non-const reference parameter can make for subtle bugs because the |
| 600 // invoked function will receive a reference to the stored copy of the |
| 601 // argument and not the original. |
| 602 COMPILE_ASSERT( |
| 603 !(is_non_const_reference<typename BoundFunctorTraits::A1Type>::value || |
| 604 is_non_const_reference<typename BoundFunctorTraits::A2Type>::value || |
| 605 is_non_const_reference<typename BoundFunctorTraits::A3Type>::value || |
| 606 is_non_const_reference<typename BoundFunctorTraits::A4Type>::value || |
| 607 is_non_const_reference<typename BoundFunctorTraits::A5Type>::value || |
| 608 is_non_const_reference<typename BoundFunctorTraits::A6Type>::value || |
| 609 is_non_const_reference<typename BoundFunctorTraits::A7Type>::value || |
| 610 is_non_const_reference<typename BoundFunctorTraits::A8Type>::value || |
| 611 is_non_const_reference<typename BoundFunctorTraits::A9Type>::value ), |
| 612 do_not_bind_functions_with_nonconst_ref); |
| 613 |
| 614 // For methods, we need to be careful for parameter 1. We do not require |
| 615 // a scoped_refptr because BindState<> itself takes care of AddRef() for |
| 616 // methods. We also disallow binding of an array as the method's target |
| 617 // object. |
| 618 COMPILE_ASSERT( |
| 619 internal::HasIsMethodTag<RunnableType>::value || |
| 620 !internal::NeedsScopedRefptrButGetsRawPtr<P1>::value, |
| 621 p1_is_refcounted_type_and_needs_scoped_refptr); |
| 622 COMPILE_ASSERT(!internal::HasIsMethodTag<RunnableType>::value || |
| 623 !is_array<P1>::value, |
| 624 first_bound_argument_to_method_cannot_be_array); |
| 625 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr<P2>::value, |
| 626 p2_is_refcounted_type_and_needs_scoped_refptr); |
| 627 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr<P3>::value, |
| 628 p3_is_refcounted_type_and_needs_scoped_refptr); |
| 629 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr<P4>::value, |
| 630 p4_is_refcounted_type_and_needs_scoped_refptr); |
| 631 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr<P5>::value, |
| 632 p5_is_refcounted_type_and_needs_scoped_refptr); |
| 633 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr<P6>::value, |
| 634 p6_is_refcounted_type_and_needs_scoped_refptr); |
| 635 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr<P7>::value, |
| 636 p7_is_refcounted_type_and_needs_scoped_refptr); |
| 637 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr<P8>::value, |
| 638 p8_is_refcounted_type_and_needs_scoped_refptr); |
| 639 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr<P9>::value, |
| 640 p9_is_refcounted_type_and_needs_scoped_refptr); |
| 641 |
| 642 return internal::MakeBindStateHolder( |
| 643 new internal::BindState<RunnableType, RunType, |
| 644 void(typename internal::CallbackParamTraits<P1>::StorageType, |
| 645 typename internal::CallbackParamTraits<P2>::StorageType, |
| 646 typename internal::CallbackParamTraits<P3>::StorageType, |
| 647 typename internal::CallbackParamTraits<P4>::StorageType, |
| 648 typename internal::CallbackParamTraits<P5>::StorageType, |
| 649 typename internal::CallbackParamTraits<P6>::StorageType, |
| 650 typename internal::CallbackParamTraits<P7>::StorageType, |
| 651 typename internal::CallbackParamTraits<P8>::StorageType, |
| 652 typename internal::CallbackParamTraits<P9>::StorageType)>( |
| 653 internal::MakeRunnable(functor), p1, p2, p3, p4, p5, p6, p7, p8, p9)); |
| 654 } |
| 655 |
| 656 template <typename Functor, typename P1, typename P2, typename P3, typename P4, |
| 657 typename P5, typename P6, typename P7, typename P8, typename P9, |
| 658 typename P10> |
| 659 internal::BindStateHolder< |
| 660 internal::BindState< |
| 661 typename internal::FunctorTraits<Functor>::RunnableType, |
| 662 typename internal::FunctorTraits<Functor>::RunType, |
| 663 void(typename internal::CallbackParamTraits<P1>::StorageType, |
| 664 typename internal::CallbackParamTraits<P2>::StorageType, |
| 665 typename internal::CallbackParamTraits<P3>::StorageType, |
| 666 typename internal::CallbackParamTraits<P4>::StorageType, |
| 667 typename internal::CallbackParamTraits<P5>::StorageType, |
| 668 typename internal::CallbackParamTraits<P6>::StorageType, |
| 669 typename internal::CallbackParamTraits<P7>::StorageType, |
| 670 typename internal::CallbackParamTraits<P8>::StorageType, |
| 671 typename internal::CallbackParamTraits<P9>::StorageType, |
| 672 typename internal::CallbackParamTraits<P10>::StorageType)> > |
| 673 Bind(Functor functor, const P1& p1, const P2& p2, const P3& p3, const P4& p4, |
| 674 const P5& p5, const P6& p6, const P7& p7, const P8& p8, const P9& p9, |
| 675 const P10& p10) { |
| 676 // Typedefs for how to store and run the functor. |
| 677 typedef typename internal::FunctorTraits<Functor>::RunnableType RunnableType; |
| 678 typedef typename internal::FunctorTraits<Functor>::RunType RunType; |
| 679 |
| 680 // Use RunnableType::RunType instead of RunType above because our |
| 681 // checks should below for bound references need to know what the actual |
| 682 // functor is going to interpret the argument as. |
| 683 typedef internal::FunctionTraits<typename RunnableType::RunType> |
| 684 BoundFunctorTraits; |
| 685 |
| 686 // Do not allow binding a non-const reference parameter. Non-const reference |
| 687 // parameters are disallowed by the Google style guide. Also, binding a |
| 688 // non-const reference parameter can make for subtle bugs because the |
| 689 // invoked function will receive a reference to the stored copy of the |
| 690 // argument and not the original. |
| 691 COMPILE_ASSERT( |
| 692 !(is_non_const_reference<typename BoundFunctorTraits::A1Type>::value || |
| 693 is_non_const_reference<typename BoundFunctorTraits::A2Type>::value || |
| 694 is_non_const_reference<typename BoundFunctorTraits::A3Type>::value || |
| 695 is_non_const_reference<typename BoundFunctorTraits::A4Type>::value || |
| 696 is_non_const_reference<typename BoundFunctorTraits::A5Type>::value || |
| 697 is_non_const_reference<typename BoundFunctorTraits::A6Type>::value || |
| 698 is_non_const_reference<typename BoundFunctorTraits::A7Type>::value || |
| 699 is_non_const_reference<typename BoundFunctorTraits::A8Type>::value || |
| 700 is_non_const_reference<typename BoundFunctorTraits::A9Type>::value || |
| 701 |
| 702 is_non_const_reference<typename BoundFunctorTraits::A10Type>::value ), |
| 703 do_not_bind_functions_with_nonconst_ref); |
| 704 |
| 705 // For methods, we need to be careful for parameter 1. We do not require |
| 706 // a scoped_refptr because BindState<> itself takes care of AddRef() for |
| 707 // methods. We also disallow binding of an array as the method's target |
| 708 // object. |
| 709 COMPILE_ASSERT( |
| 710 internal::HasIsMethodTag<RunnableType>::value || |
| 711 !internal::NeedsScopedRefptrButGetsRawPtr<P1>::value, |
| 712 p1_is_refcounted_type_and_needs_scoped_refptr); |
| 713 COMPILE_ASSERT(!internal::HasIsMethodTag<RunnableType>::value || |
| 714 !is_array<P1>::value, |
| 715 first_bound_argument_to_method_cannot_be_array); |
| 716 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr<P2>::value, |
| 717 p2_is_refcounted_type_and_needs_scoped_refptr); |
| 718 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr<P3>::value, |
| 719 p3_is_refcounted_type_and_needs_scoped_refptr); |
| 720 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr<P4>::value, |
| 721 p4_is_refcounted_type_and_needs_scoped_refptr); |
| 722 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr<P5>::value, |
| 723 p5_is_refcounted_type_and_needs_scoped_refptr); |
| 724 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr<P6>::value, |
| 725 p6_is_refcounted_type_and_needs_scoped_refptr); |
| 726 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr<P7>::value, |
| 727 p7_is_refcounted_type_and_needs_scoped_refptr); |
| 728 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr<P8>::value, |
| 729 p8_is_refcounted_type_and_needs_scoped_refptr); |
| 730 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr<P9>::value, |
| 731 p9_is_refcounted_type_and_needs_scoped_refptr); |
| 732 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr<P10>::value, |
| 733 p10_is_refcounted_type_and_needs_scoped_refptr); |
| 734 |
| 735 return internal::MakeBindStateHolder( |
| 736 new internal::BindState<RunnableType, RunType, |
| 737 void(typename internal::CallbackParamTraits<P1>::StorageType, |
| 738 typename internal::CallbackParamTraits<P2>::StorageType, |
| 739 typename internal::CallbackParamTraits<P3>::StorageType, |
| 740 typename internal::CallbackParamTraits<P4>::StorageType, |
| 741 typename internal::CallbackParamTraits<P5>::StorageType, |
| 742 typename internal::CallbackParamTraits<P6>::StorageType, |
| 743 typename internal::CallbackParamTraits<P7>::StorageType, |
| 744 typename internal::CallbackParamTraits<P8>::StorageType, |
| 745 typename internal::CallbackParamTraits<P9>::StorageType, |
| 746 typename internal::CallbackParamTraits<P10>::StorageType)>( |
| 747 internal::MakeRunnable(functor), p1, p2, p3, p4, p5, p6, p7, p8, p9, |
| 748 p10)); |
| 749 } |
| 750 |
| 751 template <typename Functor, typename P1, typename P2, typename P3, typename P4, |
| 752 typename P5, typename P6, typename P7, typename P8, typename P9, |
| 753 typename P10, typename P11> |
| 754 internal::BindStateHolder< |
| 755 internal::BindState< |
| 756 typename internal::FunctorTraits<Functor>::RunnableType, |
| 757 typename internal::FunctorTraits<Functor>::RunType, |
| 758 void(typename internal::CallbackParamTraits<P1>::StorageType, |
| 759 typename internal::CallbackParamTraits<P2>::StorageType, |
| 760 typename internal::CallbackParamTraits<P3>::StorageType, |
| 761 typename internal::CallbackParamTraits<P4>::StorageType, |
| 762 typename internal::CallbackParamTraits<P5>::StorageType, |
| 763 typename internal::CallbackParamTraits<P6>::StorageType, |
| 764 typename internal::CallbackParamTraits<P7>::StorageType, |
| 765 typename internal::CallbackParamTraits<P8>::StorageType, |
| 766 typename internal::CallbackParamTraits<P9>::StorageType, |
| 767 typename internal::CallbackParamTraits<P10>::StorageType, |
| 768 typename internal::CallbackParamTraits<P11>::StorageType)> > |
| 769 Bind(Functor functor, const P1& p1, const P2& p2, const P3& p3, const P4& p4, |
| 770 const P5& p5, const P6& p6, const P7& p7, const P8& p8, const P9& p9, |
| 771 const P10& p10, const P11& p11) { |
| 772 // Typedefs for how to store and run the functor. |
| 773 typedef typename internal::FunctorTraits<Functor>::RunnableType RunnableType; |
| 774 typedef typename internal::FunctorTraits<Functor>::RunType RunType; |
| 775 |
| 776 // Use RunnableType::RunType instead of RunType above because our |
| 777 // checks should below for bound references need to know what the actual |
| 778 // functor is going to interpret the argument as. |
| 779 typedef internal::FunctionTraits<typename RunnableType::RunType> |
| 780 BoundFunctorTraits; |
| 781 |
| 782 // Do not allow binding a non-const reference parameter. Non-const reference |
| 783 // parameters are disallowed by the Google style guide. Also, binding a |
| 784 // non-const reference parameter can make for subtle bugs because the |
| 785 // invoked function will receive a reference to the stored copy of the |
| 786 // argument and not the original. |
| 787 COMPILE_ASSERT( |
| 788 !(is_non_const_reference<typename BoundFunctorTraits::A1Type>::value || |
| 789 is_non_const_reference<typename BoundFunctorTraits::A2Type>::value || |
| 790 is_non_const_reference<typename BoundFunctorTraits::A3Type>::value || |
| 791 is_non_const_reference<typename BoundFunctorTraits::A4Type>::value || |
| 792 is_non_const_reference<typename BoundFunctorTraits::A5Type>::value || |
| 793 is_non_const_reference<typename BoundFunctorTraits::A6Type>::value || |
| 794 is_non_const_reference<typename BoundFunctorTraits::A7Type>::value || |
| 795 is_non_const_reference<typename BoundFunctorTraits::A8Type>::value || |
| 796 is_non_const_reference<typename BoundFunctorTraits::A9Type>::value || |
| 797 is_non_const_reference<typename BoundFunctorTraits::A10Type>::value |
| 798 || is_non_const_reference<typename |
| 799 BoundFunctorTraits::A11Type>::value ), |
| 800 do_not_bind_functions_with_nonconst_ref); |
| 801 |
| 802 // For methods, we need to be careful for parameter 1. We do not require |
| 803 // a scoped_refptr because BindState<> itself takes care of AddRef() for |
| 804 // methods. We also disallow binding of an array as the method's target |
| 805 // object. |
| 806 COMPILE_ASSERT( |
| 807 internal::HasIsMethodTag<RunnableType>::value || |
| 808 !internal::NeedsScopedRefptrButGetsRawPtr<P1>::value, |
| 809 p1_is_refcounted_type_and_needs_scoped_refptr); |
| 810 COMPILE_ASSERT(!internal::HasIsMethodTag<RunnableType>::value || |
| 811 !is_array<P1>::value, |
| 812 first_bound_argument_to_method_cannot_be_array); |
| 813 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr<P2>::value, |
| 814 p2_is_refcounted_type_and_needs_scoped_refptr); |
| 815 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr<P3>::value, |
| 816 p3_is_refcounted_type_and_needs_scoped_refptr); |
| 817 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr<P4>::value, |
| 818 p4_is_refcounted_type_and_needs_scoped_refptr); |
| 819 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr<P5>::value, |
| 820 p5_is_refcounted_type_and_needs_scoped_refptr); |
| 821 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr<P6>::value, |
| 822 p6_is_refcounted_type_and_needs_scoped_refptr); |
| 823 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr<P7>::value, |
| 824 p7_is_refcounted_type_and_needs_scoped_refptr); |
| 825 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr<P8>::value, |
| 826 p8_is_refcounted_type_and_needs_scoped_refptr); |
| 827 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr<P9>::value, |
| 828 p9_is_refcounted_type_and_needs_scoped_refptr); |
| 829 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr<P10>::value, |
| 830 p10_is_refcounted_type_and_needs_scoped_refptr); |
| 831 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr<P11>::value, |
| 832 p11_is_refcounted_type_and_needs_scoped_refptr); |
| 833 |
| 834 return internal::MakeBindStateHolder( |
| 835 new internal::BindState<RunnableType, RunType, |
| 836 void(typename internal::CallbackParamTraits<P1>::StorageType, |
| 837 typename internal::CallbackParamTraits<P2>::StorageType, |
| 838 typename internal::CallbackParamTraits<P3>::StorageType, |
| 839 typename internal::CallbackParamTraits<P4>::StorageType, |
| 840 typename internal::CallbackParamTraits<P5>::StorageType, |
| 841 typename internal::CallbackParamTraits<P6>::StorageType, |
| 842 typename internal::CallbackParamTraits<P7>::StorageType, |
| 843 typename internal::CallbackParamTraits<P8>::StorageType, |
| 844 typename internal::CallbackParamTraits<P9>::StorageType, |
| 845 typename internal::CallbackParamTraits<P10>::StorageType, |
| 846 typename internal::CallbackParamTraits<P11>::StorageType)>( |
| 847 internal::MakeRunnable(functor), p1, p2, p3, p4, p5, p6, p7, p8, p9, |
| 848 p10, p11)); |
| 849 } |
| 850 |
413 } // namespace base | 851 } // namespace base |
414 | 852 |
415 #endif // BASE_BIND_H_ | 853 #endif // BASE_BIND_H_ |
OLD | NEW |