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 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 6 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
7 // Use of this source code is governed by a BSD-style license that can be | 7 // Use of this source code is governed by a BSD-style license that can be |
8 // found in the LICENSE file. | 8 // found in the LICENSE file. |
9 | 9 |
10 #ifndef BASE_BIND_H_ | 10 #ifndef BASE_BIND_H_ |
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 typename internal::CallbackParamTraits<P5>::StorageType, | 505 typename internal::CallbackParamTraits<P5>::StorageType, |
506 typename internal::CallbackParamTraits<P6>::StorageType, | 506 typename internal::CallbackParamTraits<P6>::StorageType, |
507 typename internal::CallbackParamTraits<P7>::StorageType)> BindState; | 507 typename internal::CallbackParamTraits<P7>::StorageType)> BindState; |
508 | 508 |
509 | 509 |
510 return Callback<typename BindState::UnboundRunType>( | 510 return Callback<typename BindState::UnboundRunType>( |
511 new BindState(internal::MakeRunnable(functor), p1, p2, p3, p4, p5, p6, | 511 new BindState(internal::MakeRunnable(functor), p1, p2, p3, p4, p5, p6, |
512 p7)); | 512 p7)); |
513 } | 513 } |
514 | 514 |
515 template <typename Functor, typename P1, typename P2, typename P3, typename P4, | |
516 typename P5, typename P6, typename P7, typename P8> | |
517 base::Callback< | |
518 typename internal::BindState< | |
519 typename internal::FunctorTraits<Functor>::RunnableType, | |
520 typename internal::FunctorTraits<Functor>::RunType, | |
521 void(typename internal::CallbackParamTraits<P1>::StorageType, | |
522 typename internal::CallbackParamTraits<P2>::StorageType, | |
523 typename internal::CallbackParamTraits<P3>::StorageType, | |
524 typename internal::CallbackParamTraits<P4>::StorageType, | |
525 typename internal::CallbackParamTraits<P5>::StorageType, | |
526 typename internal::CallbackParamTraits<P6>::StorageType, | |
527 typename internal::CallbackParamTraits<P7>::StorageType, | |
528 typename internal::CallbackParamTraits<P8>::StorageType)> | |
529 ::UnboundRunType> | |
530 Bind(Functor functor, const P1& p1, const P2& p2, const P3& p3, const P4& p4, | |
531 const P5& p5, const P6& p6, const P7& p7, const P8& p8) { | |
532 // Typedefs for how to store and run the functor. | |
533 typedef typename internal::FunctorTraits<Functor>::RunnableType RunnableType; | |
534 typedef typename internal::FunctorTraits<Functor>::RunType RunType; | |
535 | |
536 // Use RunnableType::RunType instead of RunType above because our | |
537 // checks should below for bound references need to know what the actual | |
538 // functor is going to interpret the argument as. | |
539 typedef internal::FunctionTraits<typename RunnableType::RunType> | |
540 BoundFunctorTraits; | |
541 | |
542 // Do not allow binding a non-const reference parameter. Non-const reference | |
543 // parameters are disallowed by the Google style guide. Also, binding a | |
544 // non-const reference parameter can make for subtle bugs because the | |
545 // invoked function will receive a reference to the stored copy of the | |
546 // argument and not the original. | |
547 COMPILE_ASSERT( | |
548 !(is_non_const_reference<typename BoundFunctorTraits::A1Type>::value || | |
549 is_non_const_reference<typename BoundFunctorTraits::A2Type>::value || | |
550 is_non_const_reference<typename BoundFunctorTraits::A3Type>::value || | |
551 is_non_const_reference<typename BoundFunctorTraits::A4Type>::value || | |
552 is_non_const_reference<typename BoundFunctorTraits::A5Type>::value || | |
553 is_non_const_reference<typename BoundFunctorTraits::A6Type>::value || | |
554 is_non_const_reference<typename BoundFunctorTraits::A7Type>::value || | |
555 is_non_const_reference<typename BoundFunctorTraits::A8Type>::value ), | |
556 do_not_bind_functions_with_nonconst_ref); | |
557 | |
558 // For methods, we need to be careful for parameter 1. We do not require | |
559 // a scoped_refptr because BindState<> itself takes care of AddRef() for | |
560 // methods. We also disallow binding of an array as the method's target | |
561 // object. | |
562 COMPILE_ASSERT( | |
563 internal::HasIsMethodTag<RunnableType>::value || | |
564 !internal::NeedsScopedRefptrButGetsRawPtr<P1>::value, | |
565 p1_is_refcounted_type_and_needs_scoped_refptr); | |
566 COMPILE_ASSERT(!internal::HasIsMethodTag<RunnableType>::value || | |
567 !is_array<P1>::value, | |
568 first_bound_argument_to_method_cannot_be_array); | |
569 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr<P2>::value, | |
570 p2_is_refcounted_type_and_needs_scoped_refptr); | |
571 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr<P3>::value, | |
572 p3_is_refcounted_type_and_needs_scoped_refptr); | |
573 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr<P4>::value, | |
574 p4_is_refcounted_type_and_needs_scoped_refptr); | |
575 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr<P5>::value, | |
576 p5_is_refcounted_type_and_needs_scoped_refptr); | |
577 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr<P6>::value, | |
578 p6_is_refcounted_type_and_needs_scoped_refptr); | |
579 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr<P7>::value, | |
580 p7_is_refcounted_type_and_needs_scoped_refptr); | |
581 COMPILE_ASSERT(!internal::NeedsScopedRefptrButGetsRawPtr<P8>::value, | |
582 p8_is_refcounted_type_and_needs_scoped_refptr); | |
583 typedef internal::BindState<RunnableType, RunType, | |
584 void(typename internal::CallbackParamTraits<P1>::StorageType, | |
585 typename internal::CallbackParamTraits<P2>::StorageType, | |
586 typename internal::CallbackParamTraits<P3>::StorageType, | |
587 typename internal::CallbackParamTraits<P4>::StorageType, | |
588 typename internal::CallbackParamTraits<P5>::StorageType, | |
589 typename internal::CallbackParamTraits<P6>::StorageType, | |
590 typename internal::CallbackParamTraits<P7>::StorageType, | |
591 typename internal::CallbackParamTraits<P8>::StorageType)> BindState; | |
592 | |
593 | |
594 return Callback<typename BindState::UnboundRunType>( | |
595 new BindState(internal::MakeRunnable(functor), p1, p2, p3, p4, p5, p6, | |
596 p7, p8)); | |
597 } | |
598 | |
599 } // namespace base | 515 } // namespace base |
600 | 516 |
601 #endif // BASE_BIND_H_ | 517 #endif // BASE_BIND_H_ |
OLD | NEW |