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

Side by Side Diff: base/callback.h

Issue 10919055: Extend base::Callback to 8 arguments. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « base/bind_internal_win.h ('k') | no next file » | 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 730 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 typename internal::CallbackParamTraits<A1>::ForwardType, 741 typename internal::CallbackParamTraits<A1>::ForwardType,
742 typename internal::CallbackParamTraits<A2>::ForwardType, 742 typename internal::CallbackParamTraits<A2>::ForwardType,
743 typename internal::CallbackParamTraits<A3>::ForwardType, 743 typename internal::CallbackParamTraits<A3>::ForwardType,
744 typename internal::CallbackParamTraits<A4>::ForwardType, 744 typename internal::CallbackParamTraits<A4>::ForwardType,
745 typename internal::CallbackParamTraits<A5>::ForwardType, 745 typename internal::CallbackParamTraits<A5>::ForwardType,
746 typename internal::CallbackParamTraits<A6>::ForwardType, 746 typename internal::CallbackParamTraits<A6>::ForwardType,
747 typename internal::CallbackParamTraits<A7>::ForwardType); 747 typename internal::CallbackParamTraits<A7>::ForwardType);
748 748
749 }; 749 };
750 750
751 template <typename R, typename A1, typename A2, typename A3, typename A4,
752 typename A5, typename A6, typename A7, typename A8>
753 class Callback<R(A1, A2, A3, A4, A5, A6, A7, A8)>
754 : public internal::CallbackBase {
755 public:
756 typedef R(RunType)(A1, A2, A3, A4, A5, A6, A7, A8);
757
758 Callback() : CallbackBase(NULL) { }
759
760 // Note that this constructor CANNOT be explicit, and that Bind() CANNOT
761 // return the exact Callback<> type. See base/bind.h for details.
762 template <typename Runnable, typename BindRunType, typename BoundArgsType>
763 Callback(internal::BindState<Runnable, BindRunType,
764 BoundArgsType>* bind_state)
765 : CallbackBase(bind_state) {
766
767 // Force the assignment to a local variable of PolymorphicInvoke
768 // so the compiler will typecheck that the passed in Run() method has
769 // the correct type.
770 PolymorphicInvoke invoke_func =
771 &internal::BindState<Runnable, BindRunType, BoundArgsType>
772 ::InvokerType::Run;
773 polymorphic_invoke_ = reinterpret_cast<InvokeFuncStorage>(invoke_func);
774 }
775
776 bool Equals(const Callback& other) const {
777 return CallbackBase::Equals(other);
778 }
779
780 R Run(typename internal::CallbackParamTraits<A1>::ForwardType a1,
781 typename internal::CallbackParamTraits<A2>::ForwardType a2,
782 typename internal::CallbackParamTraits<A3>::ForwardType a3,
783 typename internal::CallbackParamTraits<A4>::ForwardType a4,
784 typename internal::CallbackParamTraits<A5>::ForwardType a5,
785 typename internal::CallbackParamTraits<A6>::ForwardType a6,
786 typename internal::CallbackParamTraits<A7>::ForwardType a7,
787 typename internal::CallbackParamTraits<A8>::ForwardType a8) const {
788 PolymorphicInvoke f =
789 reinterpret_cast<PolymorphicInvoke>(polymorphic_invoke_);
790
791 return f(bind_state_.get(), internal::CallbackForward(a1),
792 internal::CallbackForward(a2),
793 internal::CallbackForward(a3),
794 internal::CallbackForward(a4),
795 internal::CallbackForward(a5),
796 internal::CallbackForward(a6),
797 internal::CallbackForward(a7),
798 internal::CallbackForward(a8));
799 }
800
801 private:
802 typedef R(*PolymorphicInvoke)(
803 internal::BindStateBase*,
804 typename internal::CallbackParamTraits<A1>::ForwardType,
805 typename internal::CallbackParamTraits<A2>::ForwardType,
806 typename internal::CallbackParamTraits<A3>::ForwardType,
807 typename internal::CallbackParamTraits<A4>::ForwardType,
808 typename internal::CallbackParamTraits<A5>::ForwardType,
809 typename internal::CallbackParamTraits<A6>::ForwardType,
810 typename internal::CallbackParamTraits<A7>::ForwardType,
811 typename internal::CallbackParamTraits<A8>::ForwardType);
812
813 };
751 814
752 // Syntactic sugar to make Callbacks<void(void)> easier to declare since it 815 // Syntactic sugar to make Callbacks<void(void)> easier to declare since it
753 // will be used in a lot of APIs with delayed execution. 816 // will be used in a lot of APIs with delayed execution.
754 typedef Callback<void(void)> Closure; 817 typedef Callback<void(void)> Closure;
755 818
756 } // namespace base 819 } // namespace base
757 820
758 #endif // BASE_CALLBACK_H 821 #endif // BASE_CALLBACK_H
OLDNEW
« no previous file with comments | « base/bind_internal_win.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698