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

Side by Side Diff: webrtc/base/bind.h

Issue 1226153003: Improvements to rtc::Bind (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 5 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 | webrtc/base/messagehandler.h » ('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 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 * Copyright 2012 The WebRTC Project Authors. All rights reserved. 6 * Copyright 2012 The WebRTC Project Authors. All rights reserved.
7 * 7 *
8 * Use of this source code is governed by a BSD-style license 8 * Use of this source code is governed by a BSD-style license
9 * that can be found in the LICENSE file in the root of the source 9 * that can be found in the LICENSE file in the root of the source
10 * tree. An additional intellectual property rights grant can be found 10 * tree. An additional intellectual property rights grant can be found
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 typename detail::identity<P1>::type p1, 572 typename detail::identity<P1>::type p1,
573 typename detail::identity<P2>::type p2, 573 typename detail::identity<P2>::type p2,
574 typename detail::identity<P3>::type p3, 574 typename detail::identity<P3>::type p3,
575 typename detail::identity<P4>::type p4, 575 typename detail::identity<P4>::type p4,
576 typename detail::identity<P5>::type p5) { 576 typename detail::identity<P5>::type p5) {
577 return Functor5<FP_T(NONAME), R, P1, P2, P3, P4, P5>( 577 return Functor5<FP_T(NONAME), R, P1, P2, P3, P4, P5>(
578 function, p1, p2, p3, p4, p5); 578 function, p1, p2, p3, p4, p5);
579 } 579 }
580 580
581 #undef FP_T 581 #undef FP_T
582 template <class ObjectT,
583 class MethodT,
584 class R,
585 class P1,
586 class P2,
587 class P3,
588 class P4,
589 class P5,
590 class P6>
591 class MethodFunctor6 {
592 public:
593 MethodFunctor6(MethodT method,
594 ObjectT* object,
595 P1 p1,
596 P2 p2,
597 P3 p3,
598 P4 p4,
599 P5 p5,
600 P6 p6)
601 : method_(method),
602 object_(object),
603 p1_(p1),
604 p2_(p2),
605 p3_(p3),
606 p4_(p4),
607 p5_(p5),
608 p6_(p6) {}
609 R operator()() const {
610 return (object_->*method_)(p1_, p2_, p3_, p4_, p5_, p6_);
611 }
612
613 private:
614 MethodT method_;
615 ObjectT* object_;
616 P1 p1_;
617 P2 p2_;
618 P3 p3_;
619 P4 p4_;
620 P5 p5_;
621 P6 p6_;
622 };
623
624 template <class FunctorT,
625 class R,
626 class P1,
627 class P2,
628 class P3,
629 class P4,
630 class P5,
631 class P6>
632 class Functor6 {
633 public:
634 Functor6(const FunctorT& functor, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6)
635 : functor_(functor),
636 p1_(p1),
637 p2_(p2),
638 p3_(p3),
639 p4_(p4),
640 p5_(p5),
641 p6_(p6) {}
642 R operator()() const { return functor_(p1_, p2_, p3_, p4_, p5_, p6_); }
643
644 private:
645 FunctorT functor_;
646 P1 p1_;
647 P2 p2_;
648 P3 p3_;
649 P4 p4_;
650 P5 p5_;
651 P6 p6_;
652 };
653
654 #define FP_T(x) R (ObjectT::*x)(P1, P2, P3, P4, P5, P6)
655
656 template <class ObjectT,
657 class R,
658 class P1,
659 class P2,
660 class P3,
661 class P4,
662 class P5,
663 class P6>
664 MethodFunctor6<ObjectT, FP_T(NONAME), R, P1, P2, P3, P4, P5, P6> Bind(
665 FP_T(method),
666 ObjectT* object,
667 typename detail::identity<P1>::type p1,
668 typename detail::identity<P2>::type p2,
669 typename detail::identity<P3>::type p3,
670 typename detail::identity<P4>::type p4,
671 typename detail::identity<P5>::type p5,
672 typename detail::identity<P6>::type p6) {
673 return MethodFunctor6<ObjectT, FP_T(NONAME), R, P1, P2, P3, P4, P5, P6>(
674 method, object, p1, p2, p3, p4, p5, p6);
675 }
676
677 #undef FP_T
678 #define FP_T(x) R (ObjectT::*x)(P1, P2, P3, P4, P5, P6) const
679
680 template <class ObjectT,
681 class R,
682 class P1,
683 class P2,
684 class P3,
685 class P4,
686 class P5,
687 class P6>
688 MethodFunctor6<const ObjectT, FP_T(NONAME), R, P1, P2, P3, P4, P5, P6> Bind(
689 FP_T(method),
690 const ObjectT* object,
691 typename detail::identity<P1>::type p1,
692 typename detail::identity<P2>::type p2,
693 typename detail::identity<P3>::type p3,
694 typename detail::identity<P4>::type p4,
695 typename detail::identity<P5>::type p5,
696 typename detail::identity<P6>::type p6) {
697 return MethodFunctor6<const ObjectT, FP_T(NONAME), R, P1, P2, P3, P4, P5, P6>(
698 method, object, p1, p2, p3, p4, p5, p6);
699 }
700
701 #undef FP_T
702 #define FP_T(x) R (*x)(P1, P2, P3, P4, P5, P6)
703
704 template <class R, class P1, class P2, class P3, class P4, class P5, class P6>
705 Functor6<FP_T(NONAME), R, P1, P2, P3, P4, P5, P6> Bind(
706 FP_T(function),
707 typename detail::identity<P1>::type p1,
708 typename detail::identity<P2>::type p2,
709 typename detail::identity<P3>::type p3,
710 typename detail::identity<P4>::type p4,
711 typename detail::identity<P5>::type p5,
712 typename detail::identity<P5>::type p6) {
713 return Functor6<FP_T(NONAME), R, P1, P2, P3, P4, P5, P6>(function, p1, p2, p3,
714 p4, p5, p6);
715 }
716
717 #undef FP_T
582 718
583 } // namespace rtc 719 } // namespace rtc
584 720
585 #undef NONAME 721 #undef NONAME
586 722
587 #endif // WEBRTC_BASE_BIND_H_ 723 #endif // WEBRTC_BASE_BIND_H_
OLDNEW
« no previous file with comments | « no previous file | webrtc/base/messagehandler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698