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

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

Issue 1291543006: Update Bind to match its comments and always capture by value. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Removed references to std::remove_reference (har har) Created 5 years, 1 month 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
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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 121
122 // PointerType<T>::type will be scoped_refptr<T> for ref counted types, and T* 122 // PointerType<T>::type will be scoped_refptr<T> for ref counted types, and T*
123 // otherwise. 123 // otherwise.
124 template <class T> 124 template <class T>
125 struct PointerType { 125 struct PointerType {
126 typedef typename TernaryTypeOperator<IsRefCounted<T>::value, 126 typedef typename TernaryTypeOperator<IsRefCounted<T>::value,
127 scoped_refptr<T>, 127 scoped_refptr<T>,
128 T*>::type type; 128 T*>::type type;
129 }; 129 };
130 130
131 // RemoveScopedPtrRef will capture scoped_refptr by-value instead of 131 // RemoveAllRef implementations are equivalent to std::remove_reference make
132 // by-reference. 132 // sure references and rvalue references are captured by value.
133 template <class T> struct RemoveScopedPtrRef { typedef T type; };
134 template <class T> 133 template <class T>
135 struct RemoveScopedPtrRef<const scoped_refptr<T>&> { 134 struct RemoveAllRef {
136 typedef scoped_refptr<T> type; 135 typedef T type;
137 }; 136 };
137 // Remove plain references.
138 template <class T> 138 template <class T>
139 struct RemoveScopedPtrRef<scoped_refptr<T>&> { 139 struct RemoveAllRef<T&> {
140 typedef scoped_refptr<T> type; 140 typedef T type;
141 };
142 // Remove rvalue references.
143 template <class T>
144 struct RemoveAllRef<T&&> {
145 typedef T type;
141 }; 146 };
142 147
143 } // namespace detail 148 } // namespace detail
144 149
145 template <class ObjectT, class MethodT, class R> 150 template <class ObjectT, class MethodT, class R>
146 class MethodFunctor0 { 151 class MethodFunctor0 {
147 public: 152 public:
148 MethodFunctor0(MethodT method, ObjectT* object) 153 MethodFunctor0(MethodT method, ObjectT* object)
149 : method_(method), object_(object) {} 154 : method_(method), object_(object) {}
150 R operator()() const { 155 R operator()() const {
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 public: 218 public:
214 MethodFunctor1(MethodT method, ObjectT* object, 219 MethodFunctor1(MethodT method, ObjectT* object,
215 P1 p1) 220 P1 p1)
216 : method_(method), object_(object), 221 : method_(method), object_(object),
217 p1_(p1) {} 222 p1_(p1) {}
218 R operator()() const { 223 R operator()() const {
219 return (object_->*method_)(p1_); } 224 return (object_->*method_)(p1_); }
220 private: 225 private:
221 MethodT method_; 226 MethodT method_;
222 typename detail::PointerType<ObjectT>::type object_; 227 typename detail::PointerType<ObjectT>::type object_;
223 typename detail::RemoveScopedPtrRef<P1>::type p1_; 228 typename detail::RemoveAllRef<P1>::type p1_;
224 }; 229 };
225 230
226 template <class FunctorT, class R, 231 template <class FunctorT, class R,
227 class P1> 232 class P1>
228 class Functor1 { 233 class Functor1 {
229 public: 234 public:
230 Functor1(const FunctorT& functor, P1 p1) 235 Functor1(const FunctorT& functor, P1 p1)
231 : functor_(functor), 236 : functor_(functor),
232 p1_(p1) {} 237 p1_(p1) {}
233 R operator()() const { 238 R operator()() const {
234 return functor_(p1_); } 239 return functor_(p1_); }
235 private: 240 private:
236 FunctorT functor_; 241 FunctorT functor_;
237 typename detail::RemoveScopedPtrRef<P1>::type p1_; 242 typename detail::RemoveAllRef<P1>::type p1_;
238 }; 243 };
239 244
240 245
241 #define FP_T(x) R (ObjectT::*x)(P1) 246 #define FP_T(x) R (ObjectT::*x)(P1)
242 247
243 template <class ObjectT, class R, 248 template <class ObjectT, class R,
244 class P1> 249 class P1>
245 MethodFunctor1<ObjectT, FP_T(NONAME), R, P1> 250 MethodFunctor1<ObjectT, FP_T(NONAME), R, P1>
246 Bind(FP_T(method), ObjectT* object, 251 Bind(FP_T(method), ObjectT* object,
247 typename detail::identity<P1>::type p1) { 252 typename detail::identity<P1>::type p1) {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 P1 p1, 301 P1 p1,
297 P2 p2) 302 P2 p2)
298 : method_(method), object_(object), 303 : method_(method), object_(object),
299 p1_(p1), 304 p1_(p1),
300 p2_(p2) {} 305 p2_(p2) {}
301 R operator()() const { 306 R operator()() const {
302 return (object_->*method_)(p1_, p2_); } 307 return (object_->*method_)(p1_, p2_); }
303 private: 308 private:
304 MethodT method_; 309 MethodT method_;
305 typename detail::PointerType<ObjectT>::type object_; 310 typename detail::PointerType<ObjectT>::type object_;
306 typename detail::RemoveScopedPtrRef<P1>::type p1_; 311 typename detail::RemoveAllRef<P1>::type p1_;
307 typename detail::RemoveScopedPtrRef<P2>::type p2_; 312 typename detail::RemoveAllRef<P2>::type p2_;
308 }; 313 };
309 314
310 template <class FunctorT, class R, 315 template <class FunctorT, class R,
311 class P1, 316 class P1,
312 class P2> 317 class P2>
313 class Functor2 { 318 class Functor2 {
314 public: 319 public:
315 Functor2(const FunctorT& functor, P1 p1, P2 p2) 320 Functor2(const FunctorT& functor, P1 p1, P2 p2)
316 : functor_(functor), 321 : functor_(functor),
317 p1_(p1), 322 p1_(p1),
318 p2_(p2) {} 323 p2_(p2) {}
319 R operator()() const { 324 R operator()() const {
320 return functor_(p1_, p2_); } 325 return functor_(p1_, p2_); }
321 private: 326 private:
322 FunctorT functor_; 327 FunctorT functor_;
323 typename detail::RemoveScopedPtrRef<P1>::type p1_; 328 typename detail::RemoveAllRef<P1>::type p1_;
324 typename detail::RemoveScopedPtrRef<P2>::type p2_; 329 typename detail::RemoveAllRef<P2>::type p2_;
325 }; 330 };
326 331
327 332
328 #define FP_T(x) R (ObjectT::*x)(P1, P2) 333 #define FP_T(x) R (ObjectT::*x)(P1, P2)
329 334
330 template <class ObjectT, class R, 335 template <class ObjectT, class R,
331 class P1, 336 class P1,
332 class P2> 337 class P2>
333 MethodFunctor2<ObjectT, FP_T(NONAME), R, P1, P2> 338 MethodFunctor2<ObjectT, FP_T(NONAME), R, P1, P2>
334 Bind(FP_T(method), ObjectT* object, 339 Bind(FP_T(method), ObjectT* object,
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 P3 p3) 399 P3 p3)
395 : method_(method), object_(object), 400 : method_(method), object_(object),
396 p1_(p1), 401 p1_(p1),
397 p2_(p2), 402 p2_(p2),
398 p3_(p3) {} 403 p3_(p3) {}
399 R operator()() const { 404 R operator()() const {
400 return (object_->*method_)(p1_, p2_, p3_); } 405 return (object_->*method_)(p1_, p2_, p3_); }
401 private: 406 private:
402 MethodT method_; 407 MethodT method_;
403 typename detail::PointerType<ObjectT>::type object_; 408 typename detail::PointerType<ObjectT>::type object_;
404 typename detail::RemoveScopedPtrRef<P1>::type p1_; 409 typename detail::RemoveAllRef<P1>::type p1_;
405 typename detail::RemoveScopedPtrRef<P2>::type p2_; 410 typename detail::RemoveAllRef<P2>::type p2_;
406 typename detail::RemoveScopedPtrRef<P3>::type p3_; 411 typename detail::RemoveAllRef<P3>::type p3_;
407 }; 412 };
408 413
409 template <class FunctorT, class R, 414 template <class FunctorT, class R,
410 class P1, 415 class P1,
411 class P2, 416 class P2,
412 class P3> 417 class P3>
413 class Functor3 { 418 class Functor3 {
414 public: 419 public:
415 Functor3(const FunctorT& functor, P1 p1, P2 p2, P3 p3) 420 Functor3(const FunctorT& functor, P1 p1, P2 p2, P3 p3)
416 : functor_(functor), 421 : functor_(functor),
417 p1_(p1), 422 p1_(p1),
418 p2_(p2), 423 p2_(p2),
419 p3_(p3) {} 424 p3_(p3) {}
420 R operator()() const { 425 R operator()() const {
421 return functor_(p1_, p2_, p3_); } 426 return functor_(p1_, p2_, p3_); }
422 private: 427 private:
423 FunctorT functor_; 428 FunctorT functor_;
424 typename detail::RemoveScopedPtrRef<P1>::type p1_; 429 typename detail::RemoveAllRef<P1>::type p1_;
425 typename detail::RemoveScopedPtrRef<P2>::type p2_; 430 typename detail::RemoveAllRef<P2>::type p2_;
426 typename detail::RemoveScopedPtrRef<P3>::type p3_; 431 typename detail::RemoveAllRef<P3>::type p3_;
427 }; 432 };
428 433
429 434
430 #define FP_T(x) R (ObjectT::*x)(P1, P2, P3) 435 #define FP_T(x) R (ObjectT::*x)(P1, P2, P3)
431 436
432 template <class ObjectT, class R, 437 template <class ObjectT, class R,
433 class P1, 438 class P1,
434 class P2, 439 class P2,
435 class P3> 440 class P3>
436 MethodFunctor3<ObjectT, FP_T(NONAME), R, P1, P2, P3> 441 MethodFunctor3<ObjectT, FP_T(NONAME), R, P1, P2, P3>
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 : method_(method), object_(object), 512 : method_(method), object_(object),
508 p1_(p1), 513 p1_(p1),
509 p2_(p2), 514 p2_(p2),
510 p3_(p3), 515 p3_(p3),
511 p4_(p4) {} 516 p4_(p4) {}
512 R operator()() const { 517 R operator()() const {
513 return (object_->*method_)(p1_, p2_, p3_, p4_); } 518 return (object_->*method_)(p1_, p2_, p3_, p4_); }
514 private: 519 private:
515 MethodT method_; 520 MethodT method_;
516 typename detail::PointerType<ObjectT>::type object_; 521 typename detail::PointerType<ObjectT>::type object_;
517 typename detail::RemoveScopedPtrRef<P1>::type p1_; 522 typename detail::RemoveAllRef<P1>::type p1_;
518 typename detail::RemoveScopedPtrRef<P2>::type p2_; 523 typename detail::RemoveAllRef<P2>::type p2_;
519 typename detail::RemoveScopedPtrRef<P3>::type p3_; 524 typename detail::RemoveAllRef<P3>::type p3_;
520 typename detail::RemoveScopedPtrRef<P4>::type p4_; 525 typename detail::RemoveAllRef<P4>::type p4_;
521 }; 526 };
522 527
523 template <class FunctorT, class R, 528 template <class FunctorT, class R,
524 class P1, 529 class P1,
525 class P2, 530 class P2,
526 class P3, 531 class P3,
527 class P4> 532 class P4>
528 class Functor4 { 533 class Functor4 {
529 public: 534 public:
530 Functor4(const FunctorT& functor, P1 p1, P2 p2, P3 p3, P4 p4) 535 Functor4(const FunctorT& functor, P1 p1, P2 p2, P3 p3, P4 p4)
531 : functor_(functor), 536 : functor_(functor),
532 p1_(p1), 537 p1_(p1),
533 p2_(p2), 538 p2_(p2),
534 p3_(p3), 539 p3_(p3),
535 p4_(p4) {} 540 p4_(p4) {}
536 R operator()() const { 541 R operator()() const {
537 return functor_(p1_, p2_, p3_, p4_); } 542 return functor_(p1_, p2_, p3_, p4_); }
538 private: 543 private:
539 FunctorT functor_; 544 FunctorT functor_;
540 typename detail::RemoveScopedPtrRef<P1>::type p1_; 545 typename detail::RemoveAllRef<P1>::type p1_;
541 typename detail::RemoveScopedPtrRef<P2>::type p2_; 546 typename detail::RemoveAllRef<P2>::type p2_;
542 typename detail::RemoveScopedPtrRef<P3>::type p3_; 547 typename detail::RemoveAllRef<P3>::type p3_;
543 typename detail::RemoveScopedPtrRef<P4>::type p4_; 548 typename detail::RemoveAllRef<P4>::type p4_;
544 }; 549 };
545 550
546 551
547 #define FP_T(x) R (ObjectT::*x)(P1, P2, P3, P4) 552 #define FP_T(x) R (ObjectT::*x)(P1, P2, P3, P4)
548 553
549 template <class ObjectT, class R, 554 template <class ObjectT, class R,
550 class P1, 555 class P1,
551 class P2, 556 class P2,
552 class P3, 557 class P3,
553 class P4> 558 class P4>
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
635 p1_(p1), 640 p1_(p1),
636 p2_(p2), 641 p2_(p2),
637 p3_(p3), 642 p3_(p3),
638 p4_(p4), 643 p4_(p4),
639 p5_(p5) {} 644 p5_(p5) {}
640 R operator()() const { 645 R operator()() const {
641 return (object_->*method_)(p1_, p2_, p3_, p4_, p5_); } 646 return (object_->*method_)(p1_, p2_, p3_, p4_, p5_); }
642 private: 647 private:
643 MethodT method_; 648 MethodT method_;
644 typename detail::PointerType<ObjectT>::type object_; 649 typename detail::PointerType<ObjectT>::type object_;
645 typename detail::RemoveScopedPtrRef<P1>::type p1_; 650 typename detail::RemoveAllRef<P1>::type p1_;
646 typename detail::RemoveScopedPtrRef<P2>::type p2_; 651 typename detail::RemoveAllRef<P2>::type p2_;
647 typename detail::RemoveScopedPtrRef<P3>::type p3_; 652 typename detail::RemoveAllRef<P3>::type p3_;
648 typename detail::RemoveScopedPtrRef<P4>::type p4_; 653 typename detail::RemoveAllRef<P4>::type p4_;
649 typename detail::RemoveScopedPtrRef<P5>::type p5_; 654 typename detail::RemoveAllRef<P5>::type p5_;
650 }; 655 };
651 656
652 template <class FunctorT, class R, 657 template <class FunctorT, class R,
653 class P1, 658 class P1,
654 class P2, 659 class P2,
655 class P3, 660 class P3,
656 class P4, 661 class P4,
657 class P5> 662 class P5>
658 class Functor5 { 663 class Functor5 {
659 public: 664 public:
660 Functor5(const FunctorT& functor, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) 665 Functor5(const FunctorT& functor, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5)
661 : functor_(functor), 666 : functor_(functor),
662 p1_(p1), 667 p1_(p1),
663 p2_(p2), 668 p2_(p2),
664 p3_(p3), 669 p3_(p3),
665 p4_(p4), 670 p4_(p4),
666 p5_(p5) {} 671 p5_(p5) {}
667 R operator()() const { 672 R operator()() const {
668 return functor_(p1_, p2_, p3_, p4_, p5_); } 673 return functor_(p1_, p2_, p3_, p4_, p5_); }
669 private: 674 private:
670 FunctorT functor_; 675 FunctorT functor_;
671 typename detail::RemoveScopedPtrRef<P1>::type p1_; 676 typename detail::RemoveAllRef<P1>::type p1_;
672 typename detail::RemoveScopedPtrRef<P2>::type p2_; 677 typename detail::RemoveAllRef<P2>::type p2_;
673 typename detail::RemoveScopedPtrRef<P3>::type p3_; 678 typename detail::RemoveAllRef<P3>::type p3_;
674 typename detail::RemoveScopedPtrRef<P4>::type p4_; 679 typename detail::RemoveAllRef<P4>::type p4_;
675 typename detail::RemoveScopedPtrRef<P5>::type p5_; 680 typename detail::RemoveAllRef<P5>::type p5_;
676 }; 681 };
677 682
678 683
679 #define FP_T(x) R (ObjectT::*x)(P1, P2, P3, P4, P5) 684 #define FP_T(x) R (ObjectT::*x)(P1, P2, P3, P4, P5)
680 685
681 template <class ObjectT, class R, 686 template <class ObjectT, class R,
682 class P1, 687 class P1,
683 class P2, 688 class P2,
684 class P3, 689 class P3,
685 class P4, 690 class P4,
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
778 p2_(p2), 783 p2_(p2),
779 p3_(p3), 784 p3_(p3),
780 p4_(p4), 785 p4_(p4),
781 p5_(p5), 786 p5_(p5),
782 p6_(p6) {} 787 p6_(p6) {}
783 R operator()() const { 788 R operator()() const {
784 return (object_->*method_)(p1_, p2_, p3_, p4_, p5_, p6_); } 789 return (object_->*method_)(p1_, p2_, p3_, p4_, p5_, p6_); }
785 private: 790 private:
786 MethodT method_; 791 MethodT method_;
787 typename detail::PointerType<ObjectT>::type object_; 792 typename detail::PointerType<ObjectT>::type object_;
788 typename detail::RemoveScopedPtrRef<P1>::type p1_; 793 typename detail::RemoveAllRef<P1>::type p1_;
789 typename detail::RemoveScopedPtrRef<P2>::type p2_; 794 typename detail::RemoveAllRef<P2>::type p2_;
790 typename detail::RemoveScopedPtrRef<P3>::type p3_; 795 typename detail::RemoveAllRef<P3>::type p3_;
791 typename detail::RemoveScopedPtrRef<P4>::type p4_; 796 typename detail::RemoveAllRef<P4>::type p4_;
792 typename detail::RemoveScopedPtrRef<P5>::type p5_; 797 typename detail::RemoveAllRef<P5>::type p5_;
793 typename detail::RemoveScopedPtrRef<P6>::type p6_; 798 typename detail::RemoveAllRef<P6>::type p6_;
794 }; 799 };
795 800
796 template <class FunctorT, class R, 801 template <class FunctorT, class R,
797 class P1, 802 class P1,
798 class P2, 803 class P2,
799 class P3, 804 class P3,
800 class P4, 805 class P4,
801 class P5, 806 class P5,
802 class P6> 807 class P6>
803 class Functor6 { 808 class Functor6 {
804 public: 809 public:
805 Functor6(const FunctorT& functor, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6) 810 Functor6(const FunctorT& functor, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6)
806 : functor_(functor), 811 : functor_(functor),
807 p1_(p1), 812 p1_(p1),
808 p2_(p2), 813 p2_(p2),
809 p3_(p3), 814 p3_(p3),
810 p4_(p4), 815 p4_(p4),
811 p5_(p5), 816 p5_(p5),
812 p6_(p6) {} 817 p6_(p6) {}
813 R operator()() const { 818 R operator()() const {
814 return functor_(p1_, p2_, p3_, p4_, p5_, p6_); } 819 return functor_(p1_, p2_, p3_, p4_, p5_, p6_); }
815 private: 820 private:
816 FunctorT functor_; 821 FunctorT functor_;
817 typename detail::RemoveScopedPtrRef<P1>::type p1_; 822 typename detail::RemoveAllRef<P1>::type p1_;
818 typename detail::RemoveScopedPtrRef<P2>::type p2_; 823 typename detail::RemoveAllRef<P2>::type p2_;
819 typename detail::RemoveScopedPtrRef<P3>::type p3_; 824 typename detail::RemoveAllRef<P3>::type p3_;
820 typename detail::RemoveScopedPtrRef<P4>::type p4_; 825 typename detail::RemoveAllRef<P4>::type p4_;
821 typename detail::RemoveScopedPtrRef<P5>::type p5_; 826 typename detail::RemoveAllRef<P5>::type p5_;
822 typename detail::RemoveScopedPtrRef<P6>::type p6_; 827 typename detail::RemoveAllRef<P6>::type p6_;
823 }; 828 };
824 829
825 830
826 #define FP_T(x) R (ObjectT::*x)(P1, P2, P3, P4, P5, P6) 831 #define FP_T(x) R (ObjectT::*x)(P1, P2, P3, P4, P5, P6)
827 832
828 template <class ObjectT, class R, 833 template <class ObjectT, class R,
829 class P1, 834 class P1,
830 class P2, 835 class P2,
831 class P3, 836 class P3,
832 class P4, 837 class P4,
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
905 typename detail::identity<P3>::type p3, 910 typename detail::identity<P3>::type p3,
906 typename detail::identity<P4>::type p4, 911 typename detail::identity<P4>::type p4,
907 typename detail::identity<P5>::type p5, 912 typename detail::identity<P5>::type p5,
908 typename detail::identity<P6>::type p6) { 913 typename detail::identity<P6>::type p6) {
909 return Functor6<FP_T(NONAME), R, P1, P2, P3, P4, P5, P6>( 914 return Functor6<FP_T(NONAME), R, P1, P2, P3, P4, P5, P6>(
910 function, p1, p2, p3, p4, p5, p6); 915 function, p1, p2, p3, p4, p5, p6);
911 } 916 }
912 917
913 #undef FP_T 918 #undef FP_T
914 919
920 template <class ObjectT, class MethodT, class R,
921 class P1,
922 class P2,
923 class P3,
924 class P4,
925 class P5,
926 class P6,
927 class P7>
928 class MethodFunctor7 {
929 public:
930 MethodFunctor7(MethodT method, ObjectT* object,
931 P1 p1,
932 P2 p2,
933 P3 p3,
934 P4 p4,
935 P5 p5,
936 P6 p6,
937 P7 p7)
938 : method_(method), object_(object),
939 p1_(p1),
940 p2_(p2),
941 p3_(p3),
942 p4_(p4),
943 p5_(p5),
944 p6_(p6),
945 p7_(p7) {}
946 R operator()() const {
947 return (object_->*method_)(p1_, p2_, p3_, p4_, p5_, p6_, p7_); }
948 private:
949 MethodT method_;
950 typename detail::PointerType<ObjectT>::type object_;
951 typename detail::RemoveAllRef<P1>::type p1_;
952 typename detail::RemoveAllRef<P2>::type p2_;
953 typename detail::RemoveAllRef<P3>::type p3_;
954 typename detail::RemoveAllRef<P4>::type p4_;
955 typename detail::RemoveAllRef<P5>::type p5_;
956 typename detail::RemoveAllRef<P6>::type p6_;
957 typename detail::RemoveAllRef<P7>::type p7_;
958 };
959
960 template <class FunctorT, class R,
961 class P1,
962 class P2,
963 class P3,
964 class P4,
965 class P5,
966 class P6,
967 class P7>
968 class Functor7 {
969 public:
970 Functor7(const FunctorT& functor, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6,
971 P7 p7)
972 : functor_(functor),
973 p1_(p1),
974 p2_(p2),
975 p3_(p3),
976 p4_(p4),
977 p5_(p5),
978 p6_(p6),
979 p7_(p7) {}
980 R operator()() const {
981 return functor_(p1_, p2_, p3_, p4_, p5_, p6_, p7_); }
982 private:
983 FunctorT functor_;
984 typename detail::RemoveAllRef<P1>::type p1_;
985 typename detail::RemoveAllRef<P2>::type p2_;
986 typename detail::RemoveAllRef<P3>::type p3_;
987 typename detail::RemoveAllRef<P4>::type p4_;
988 typename detail::RemoveAllRef<P5>::type p5_;
989 typename detail::RemoveAllRef<P6>::type p6_;
990 typename detail::RemoveAllRef<P7>::type p7_;
991 };
992
993
994 #define FP_T(x) R (ObjectT::*x)(P1, P2, P3, P4, P5, P6, P7)
995
996 template <class ObjectT, class R,
997 class P1,
998 class P2,
999 class P3,
1000 class P4,
1001 class P5,
1002 class P6,
1003 class P7>
1004 MethodFunctor7<ObjectT, FP_T(NONAME), R, P1, P2, P3, P4, P5, P6, P7>
1005 Bind(FP_T(method), ObjectT* object,
1006 typename detail::identity<P1>::type p1,
1007 typename detail::identity<P2>::type p2,
1008 typename detail::identity<P3>::type p3,
1009 typename detail::identity<P4>::type p4,
1010 typename detail::identity<P5>::type p5,
1011 typename detail::identity<P6>::type p6,
1012 typename detail::identity<P7>::type p7) {
1013 return MethodFunctor7<ObjectT, FP_T(NONAME), R, P1, P2, P3, P4, P5, P6, P7>(
1014 method, object, p1, p2, p3, p4, p5, p6, p7);
1015 }
1016
1017 #undef FP_T
1018 #define FP_T(x) R (ObjectT::*x)(P1, P2, P3, P4, P5, P6, P7) const
1019
1020 template <class ObjectT, class R,
1021 class P1,
1022 class P2,
1023 class P3,
1024 class P4,
1025 class P5,
1026 class P6,
1027 class P7>
1028 MethodFunctor7<const ObjectT, FP_T(NONAME), R, P1, P2, P3, P4, P5, P6, P7>
1029 Bind(FP_T(method), const ObjectT* object,
1030 typename detail::identity<P1>::type p1,
1031 typename detail::identity<P2>::type p2,
1032 typename detail::identity<P3>::type p3,
1033 typename detail::identity<P4>::type p4,
1034 typename detail::identity<P5>::type p5,
1035 typename detail::identity<P6>::type p6,
1036 typename detail::identity<P7>::type p7) {
1037 return MethodFunctor7<const ObjectT, FP_T(NONAME), R, P1, P2, P3, P4, P5, P6,
1038 P7>(
1039 method, object, p1, p2, p3, p4, p5, p6, p7);
1040 }
1041
1042 #undef FP_T
1043 #define FP_T(x) R (ObjectT::*x)(P1, P2, P3, P4, P5, P6, P7)
1044
1045 template <class ObjectT, class R,
1046 class P1,
1047 class P2,
1048 class P3,
1049 class P4,
1050 class P5,
1051 class P6,
1052 class P7>
1053 MethodFunctor7<ObjectT, FP_T(NONAME), R, P1, P2, P3, P4, P5, P6, P7>
1054 Bind(FP_T(method), const scoped_refptr<ObjectT>& object,
1055 typename detail::identity<P1>::type p1,
1056 typename detail::identity<P2>::type p2,
1057 typename detail::identity<P3>::type p3,
1058 typename detail::identity<P4>::type p4,
1059 typename detail::identity<P5>::type p5,
1060 typename detail::identity<P6>::type p6,
1061 typename detail::identity<P7>::type p7) {
1062 return MethodFunctor7<ObjectT, FP_T(NONAME), R, P1, P2, P3, P4, P5, P6, P7>(
1063 method, object.get(), p1, p2, p3, p4, p5, p6, p7);
1064 }
1065
1066 #undef FP_T
1067 #define FP_T(x) R (*x)(P1, P2, P3, P4, P5, P6, P7)
1068
1069 template <class R,
1070 class P1,
1071 class P2,
1072 class P3,
1073 class P4,
1074 class P5,
1075 class P6,
1076 class P7>
1077 Functor7<FP_T(NONAME), R, P1, P2, P3, P4, P5, P6, P7>
1078 Bind(FP_T(function),
1079 typename detail::identity<P1>::type p1,
1080 typename detail::identity<P2>::type p2,
1081 typename detail::identity<P3>::type p3,
1082 typename detail::identity<P4>::type p4,
1083 typename detail::identity<P5>::type p5,
1084 typename detail::identity<P6>::type p6,
1085 typename detail::identity<P7>::type p7) {
1086 return Functor7<FP_T(NONAME), R, P1, P2, P3, P4, P5, P6, P7>(
1087 function, p1, p2, p3, p4, p5, p6, p7);
1088 }
1089
1090 #undef FP_T
1091
1092 template <class ObjectT, class MethodT, class R,
1093 class P1,
1094 class P2,
1095 class P3,
1096 class P4,
1097 class P5,
1098 class P6,
1099 class P7,
1100 class P8>
1101 class MethodFunctor8 {
1102 public:
1103 MethodFunctor8(MethodT method, ObjectT* object,
1104 P1 p1,
1105 P2 p2,
1106 P3 p3,
1107 P4 p4,
1108 P5 p5,
1109 P6 p6,
1110 P7 p7,
1111 P8 p8)
1112 : method_(method), object_(object),
1113 p1_(p1),
1114 p2_(p2),
1115 p3_(p3),
1116 p4_(p4),
1117 p5_(p5),
1118 p6_(p6),
1119 p7_(p7),
1120 p8_(p8) {}
1121 R operator()() const {
1122 return (object_->*method_)(p1_, p2_, p3_, p4_, p5_, p6_, p7_, p8_); }
1123 private:
1124 MethodT method_;
1125 typename detail::PointerType<ObjectT>::type object_;
1126 typename detail::RemoveAllRef<P1>::type p1_;
1127 typename detail::RemoveAllRef<P2>::type p2_;
1128 typename detail::RemoveAllRef<P3>::type p3_;
1129 typename detail::RemoveAllRef<P4>::type p4_;
1130 typename detail::RemoveAllRef<P5>::type p5_;
1131 typename detail::RemoveAllRef<P6>::type p6_;
1132 typename detail::RemoveAllRef<P7>::type p7_;
1133 typename detail::RemoveAllRef<P8>::type p8_;
1134 };
1135
1136 template <class FunctorT, class R,
1137 class P1,
1138 class P2,
1139 class P3,
1140 class P4,
1141 class P5,
1142 class P6,
1143 class P7,
1144 class P8>
1145 class Functor8 {
1146 public:
1147 Functor8(const FunctorT& functor, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6,
1148 P7 p7, P8 p8)
1149 : functor_(functor),
1150 p1_(p1),
1151 p2_(p2),
1152 p3_(p3),
1153 p4_(p4),
1154 p5_(p5),
1155 p6_(p6),
1156 p7_(p7),
1157 p8_(p8) {}
1158 R operator()() const {
1159 return functor_(p1_, p2_, p3_, p4_, p5_, p6_, p7_, p8_); }
1160 private:
1161 FunctorT functor_;
1162 typename detail::RemoveAllRef<P1>::type p1_;
1163 typename detail::RemoveAllRef<P2>::type p2_;
1164 typename detail::RemoveAllRef<P3>::type p3_;
1165 typename detail::RemoveAllRef<P4>::type p4_;
1166 typename detail::RemoveAllRef<P5>::type p5_;
1167 typename detail::RemoveAllRef<P6>::type p6_;
1168 typename detail::RemoveAllRef<P7>::type p7_;
1169 typename detail::RemoveAllRef<P8>::type p8_;
1170 };
1171
1172
1173 #define FP_T(x) R (ObjectT::*x)(P1, P2, P3, P4, P5, P6, P7, P8)
1174
1175 template <class ObjectT, class R,
1176 class P1,
1177 class P2,
1178 class P3,
1179 class P4,
1180 class P5,
1181 class P6,
1182 class P7,
1183 class P8>
1184 MethodFunctor8<ObjectT, FP_T(NONAME), R, P1, P2, P3, P4, P5, P6, P7, P8>
1185 Bind(FP_T(method), ObjectT* object,
1186 typename detail::identity<P1>::type p1,
1187 typename detail::identity<P2>::type p2,
1188 typename detail::identity<P3>::type p3,
1189 typename detail::identity<P4>::type p4,
1190 typename detail::identity<P5>::type p5,
1191 typename detail::identity<P6>::type p6,
1192 typename detail::identity<P7>::type p7,
1193 typename detail::identity<P8>::type p8) {
1194 return MethodFunctor8<ObjectT, FP_T(NONAME), R, P1, P2, P3, P4, P5, P6, P7,
1195 P8>(
1196 method, object, p1, p2, p3, p4, p5, p6, p7, p8);
1197 }
1198
1199 #undef FP_T
1200 #define FP_T(x) R (ObjectT::*x)(P1, P2, P3, P4, P5, P6, P7, P8) const
1201
1202 template <class ObjectT, class R,
1203 class P1,
1204 class P2,
1205 class P3,
1206 class P4,
1207 class P5,
1208 class P6,
1209 class P7,
1210 class P8>
1211 MethodFunctor8<const ObjectT, FP_T(NONAME), R, P1, P2, P3, P4, P5, P6, P7, P8>
1212 Bind(FP_T(method), const ObjectT* object,
1213 typename detail::identity<P1>::type p1,
1214 typename detail::identity<P2>::type p2,
1215 typename detail::identity<P3>::type p3,
1216 typename detail::identity<P4>::type p4,
1217 typename detail::identity<P5>::type p5,
1218 typename detail::identity<P6>::type p6,
1219 typename detail::identity<P7>::type p7,
1220 typename detail::identity<P8>::type p8) {
1221 return MethodFunctor8<const ObjectT, FP_T(NONAME), R, P1, P2, P3, P4, P5, P6,
1222 P7, P8>(
1223 method, object, p1, p2, p3, p4, p5, p6, p7, p8);
1224 }
1225
1226 #undef FP_T
1227 #define FP_T(x) R (ObjectT::*x)(P1, P2, P3, P4, P5, P6, P7, P8)
1228
1229 template <class ObjectT, class R,
1230 class P1,
1231 class P2,
1232 class P3,
1233 class P4,
1234 class P5,
1235 class P6,
1236 class P7,
1237 class P8>
1238 MethodFunctor8<ObjectT, FP_T(NONAME), R, P1, P2, P3, P4, P5, P6, P7, P8>
1239 Bind(FP_T(method), const scoped_refptr<ObjectT>& object,
1240 typename detail::identity<P1>::type p1,
1241 typename detail::identity<P2>::type p2,
1242 typename detail::identity<P3>::type p3,
1243 typename detail::identity<P4>::type p4,
1244 typename detail::identity<P5>::type p5,
1245 typename detail::identity<P6>::type p6,
1246 typename detail::identity<P7>::type p7,
1247 typename detail::identity<P8>::type p8) {
1248 return MethodFunctor8<ObjectT, FP_T(NONAME), R, P1, P2, P3, P4, P5, P6, P7,
1249 P8>(
1250 method, object.get(), p1, p2, p3, p4, p5, p6, p7, p8);
1251 }
1252
1253 #undef FP_T
1254 #define FP_T(x) R (*x)(P1, P2, P3, P4, P5, P6, P7, P8)
1255
1256 template <class R,
1257 class P1,
1258 class P2,
1259 class P3,
1260 class P4,
1261 class P5,
1262 class P6,
1263 class P7,
1264 class P8>
1265 Functor8<FP_T(NONAME), R, P1, P2, P3, P4, P5, P6, P7, P8>
1266 Bind(FP_T(function),
1267 typename detail::identity<P1>::type p1,
1268 typename detail::identity<P2>::type p2,
1269 typename detail::identity<P3>::type p3,
1270 typename detail::identity<P4>::type p4,
1271 typename detail::identity<P5>::type p5,
1272 typename detail::identity<P6>::type p6,
1273 typename detail::identity<P7>::type p7,
1274 typename detail::identity<P8>::type p8) {
1275 return Functor8<FP_T(NONAME), R, P1, P2, P3, P4, P5, P6, P7, P8>(
1276 function, p1, p2, p3, p4, p5, p6, p7, p8);
1277 }
1278
1279 #undef FP_T
1280
1281 template <class ObjectT, class MethodT, class R,
1282 class P1,
1283 class P2,
1284 class P3,
1285 class P4,
1286 class P5,
1287 class P6,
1288 class P7,
1289 class P8,
1290 class P9>
1291 class MethodFunctor9 {
1292 public:
1293 MethodFunctor9(MethodT method, ObjectT* object,
1294 P1 p1,
1295 P2 p2,
1296 P3 p3,
1297 P4 p4,
1298 P5 p5,
1299 P6 p6,
1300 P7 p7,
1301 P8 p8,
1302 P9 p9)
1303 : method_(method), object_(object),
1304 p1_(p1),
1305 p2_(p2),
1306 p3_(p3),
1307 p4_(p4),
1308 p5_(p5),
1309 p6_(p6),
1310 p7_(p7),
1311 p8_(p8),
1312 p9_(p9) {}
1313 R operator()() const {
1314 return (object_->*method_)(p1_, p2_, p3_, p4_, p5_, p6_, p7_, p8_, p9_); }
1315 private:
1316 MethodT method_;
1317 typename detail::PointerType<ObjectT>::type object_;
1318 typename detail::RemoveAllRef<P1>::type p1_;
1319 typename detail::RemoveAllRef<P2>::type p2_;
1320 typename detail::RemoveAllRef<P3>::type p3_;
1321 typename detail::RemoveAllRef<P4>::type p4_;
1322 typename detail::RemoveAllRef<P5>::type p5_;
1323 typename detail::RemoveAllRef<P6>::type p6_;
1324 typename detail::RemoveAllRef<P7>::type p7_;
1325 typename detail::RemoveAllRef<P8>::type p8_;
1326 typename detail::RemoveAllRef<P9>::type p9_;
1327 };
1328
1329 template <class FunctorT, class R,
1330 class P1,
1331 class P2,
1332 class P3,
1333 class P4,
1334 class P5,
1335 class P6,
1336 class P7,
1337 class P8,
1338 class P9>
1339 class Functor9 {
1340 public:
1341 Functor9(const FunctorT& functor, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6,
1342 P7 p7, P8 p8, P9 p9)
1343 : functor_(functor),
1344 p1_(p1),
1345 p2_(p2),
1346 p3_(p3),
1347 p4_(p4),
1348 p5_(p5),
1349 p6_(p6),
1350 p7_(p7),
1351 p8_(p8),
1352 p9_(p9) {}
1353 R operator()() const {
1354 return functor_(p1_, p2_, p3_, p4_, p5_, p6_, p7_, p8_, p9_); }
1355 private:
1356 FunctorT functor_;
1357 typename detail::RemoveAllRef<P1>::type p1_;
1358 typename detail::RemoveAllRef<P2>::type p2_;
1359 typename detail::RemoveAllRef<P3>::type p3_;
1360 typename detail::RemoveAllRef<P4>::type p4_;
1361 typename detail::RemoveAllRef<P5>::type p5_;
1362 typename detail::RemoveAllRef<P6>::type p6_;
1363 typename detail::RemoveAllRef<P7>::type p7_;
1364 typename detail::RemoveAllRef<P8>::type p8_;
1365 typename detail::RemoveAllRef<P9>::type p9_;
1366 };
1367
1368
1369 #define FP_T(x) R (ObjectT::*x)(P1, P2, P3, P4, P5, P6, P7, P8, P9)
1370
1371 template <class ObjectT, class R,
1372 class P1,
1373 class P2,
1374 class P3,
1375 class P4,
1376 class P5,
1377 class P6,
1378 class P7,
1379 class P8,
1380 class P9>
1381 MethodFunctor9<ObjectT, FP_T(NONAME), R, P1, P2, P3, P4, P5, P6, P7, P8, P9>
1382 Bind(FP_T(method), ObjectT* object,
1383 typename detail::identity<P1>::type p1,
1384 typename detail::identity<P2>::type p2,
1385 typename detail::identity<P3>::type p3,
1386 typename detail::identity<P4>::type p4,
1387 typename detail::identity<P5>::type p5,
1388 typename detail::identity<P6>::type p6,
1389 typename detail::identity<P7>::type p7,
1390 typename detail::identity<P8>::type p8,
1391 typename detail::identity<P9>::type p9) {
1392 return MethodFunctor9<ObjectT, FP_T(NONAME), R, P1, P2, P3, P4, P5, P6, P7,
1393 P8, P9>(
1394 method, object, p1, p2, p3, p4, p5, p6, p7, p8, p9);
1395 }
1396
1397 #undef FP_T
1398 #define FP_T(x) R (ObjectT::*x)(P1, P2, P3, P4, P5, P6, P7, P8, P9) const
1399
1400 template <class ObjectT, class R,
1401 class P1,
1402 class P2,
1403 class P3,
1404 class P4,
1405 class P5,
1406 class P6,
1407 class P7,
1408 class P8,
1409 class P9>
1410 MethodFunctor9<const ObjectT, FP_T(NONAME), R, P1, P2, P3, P4, P5, P6, P7, P8,
1411 P9>
1412 Bind(FP_T(method), const ObjectT* object,
1413 typename detail::identity<P1>::type p1,
1414 typename detail::identity<P2>::type p2,
1415 typename detail::identity<P3>::type p3,
1416 typename detail::identity<P4>::type p4,
1417 typename detail::identity<P5>::type p5,
1418 typename detail::identity<P6>::type p6,
1419 typename detail::identity<P7>::type p7,
1420 typename detail::identity<P8>::type p8,
1421 typename detail::identity<P9>::type p9) {
1422 return MethodFunctor9<const ObjectT, FP_T(NONAME), R, P1, P2, P3, P4, P5, P6,
1423 P7, P8, P9>(
1424 method, object, p1, p2, p3, p4, p5, p6, p7, p8, p9);
1425 }
1426
1427 #undef FP_T
1428 #define FP_T(x) R (ObjectT::*x)(P1, P2, P3, P4, P5, P6, P7, P8, P9)
1429
1430 template <class ObjectT, class R,
1431 class P1,
1432 class P2,
1433 class P3,
1434 class P4,
1435 class P5,
1436 class P6,
1437 class P7,
1438 class P8,
1439 class P9>
1440 MethodFunctor9<ObjectT, FP_T(NONAME), R, P1, P2, P3, P4, P5, P6, P7, P8, P9>
1441 Bind(FP_T(method), const scoped_refptr<ObjectT>& object,
1442 typename detail::identity<P1>::type p1,
1443 typename detail::identity<P2>::type p2,
1444 typename detail::identity<P3>::type p3,
1445 typename detail::identity<P4>::type p4,
1446 typename detail::identity<P5>::type p5,
1447 typename detail::identity<P6>::type p6,
1448 typename detail::identity<P7>::type p7,
1449 typename detail::identity<P8>::type p8,
1450 typename detail::identity<P9>::type p9) {
1451 return MethodFunctor9<ObjectT, FP_T(NONAME), R, P1, P2, P3, P4, P5, P6, P7,
1452 P8, P9>(
1453 method, object.get(), p1, p2, p3, p4, p5, p6, p7, p8, p9);
1454 }
1455
1456 #undef FP_T
1457 #define FP_T(x) R (*x)(P1, P2, P3, P4, P5, P6, P7, P8, P9)
1458
1459 template <class R,
1460 class P1,
1461 class P2,
1462 class P3,
1463 class P4,
1464 class P5,
1465 class P6,
1466 class P7,
1467 class P8,
1468 class P9>
1469 Functor9<FP_T(NONAME), R, P1, P2, P3, P4, P5, P6, P7, P8, P9>
1470 Bind(FP_T(function),
1471 typename detail::identity<P1>::type p1,
1472 typename detail::identity<P2>::type p2,
1473 typename detail::identity<P3>::type p3,
1474 typename detail::identity<P4>::type p4,
1475 typename detail::identity<P5>::type p5,
1476 typename detail::identity<P6>::type p6,
1477 typename detail::identity<P7>::type p7,
1478 typename detail::identity<P8>::type p8,
1479 typename detail::identity<P9>::type p9) {
1480 return Functor9<FP_T(NONAME), R, P1, P2, P3, P4, P5, P6, P7, P8, P9>(
1481 function, p1, p2, p3, p4, p5, p6, p7, p8, p9);
1482 }
1483
1484 #undef FP_T
1485
915 } // namespace rtc 1486 } // namespace rtc
916 1487
917 #undef NONAME 1488 #undef NONAME
918 1489
919 #endif // WEBRTC_BASE_BIND_H_ 1490 #endif // WEBRTC_BASE_BIND_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698