OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // A Tuple is a generic templatized container, similar in concept to std::pair. | 5 // A Tuple is a generic templatized container, similar in concept to std::pair. |
6 // There are classes Tuple0 to Tuple6, cooresponding to the number of elements | 6 // There are classes Tuple0 to Tuple6, cooresponding to the number of elements |
7 // it contains. The convenient MakeTuple() function takes 0 to 6 arguments, | 7 // it contains. The convenient MakeTuple() function takes 0 to 6 arguments, |
8 // and will construct and return the appropriate Tuple object. The functions | 8 // and will construct and return the appropriate Tuple object. The functions |
9 // DispatchToMethod and DispatchToFunction take a function pointer or instance | 9 // DispatchToMethod and DispatchToFunction take a function pointer or instance |
10 // and method pointer, and unpack a tuple into arguments to the call. | 10 // and method pointer, and unpack a tuple into arguments to the call. |
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
537 (obj->*method)(); | 537 (obj->*method)(); |
538 } | 538 } |
539 | 539 |
540 template <class ObjT, class Method, class A> | 540 template <class ObjT, class Method, class A> |
541 inline void DispatchToMethod(ObjT* obj, Method method, const A& arg) { | 541 inline void DispatchToMethod(ObjT* obj, Method method, const A& arg) { |
542 (obj->*method)(arg); | 542 (obj->*method)(arg); |
543 } | 543 } |
544 | 544 |
545 template <class ObjT, class Method, class A> | 545 template <class ObjT, class Method, class A> |
546 inline void DispatchToMethod(ObjT* obj, Method method, const Tuple1<A>& arg) { | 546 inline void DispatchToMethod(ObjT* obj, Method method, const Tuple1<A>& arg) { |
| 547 |
| 548 #if defined(OS_CHROMEOS) && defined(CHECK) |
| 549 // To troubleshoot crosbug.com/7327. |
| 550 CHECK(obj); |
| 551 CHECK(&arg); |
| 552 CHECK(method); |
| 553 #endif |
547 (obj->*method)(arg.a); | 554 (obj->*method)(arg.a); |
548 } | 555 } |
549 | 556 |
550 template<class ObjT, class Method, class A, class B> | 557 template<class ObjT, class Method, class A, class B> |
551 inline void DispatchToMethod(ObjT* obj, | 558 inline void DispatchToMethod(ObjT* obj, |
552 Method method, | 559 Method method, |
553 const Tuple2<A, B>& arg) { | 560 const Tuple2<A, B>& arg) { |
554 (obj->*method)(arg.a, arg.b); | 561 (obj->*method)(arg.a, arg.b); |
555 } | 562 } |
556 | 563 |
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1036 class InA, class InB, class InC, class InD, class InE, class InF, | 1043 class InA, class InB, class InC, class InD, class InE, class InF, |
1037 class OutA, class OutB, class OutC, class OutD, class OutE> | 1044 class OutA, class OutB, class OutC, class OutD, class OutE> |
1038 inline void DispatchToMethod(ObjT* obj, Method method, | 1045 inline void DispatchToMethod(ObjT* obj, Method method, |
1039 const Tuple6<InA, InB, InC, InD, InE, InF>& in, | 1046 const Tuple6<InA, InB, InC, InD, InE, InF>& in, |
1040 Tuple5<OutA, OutB, OutC, OutD, OutE>* out) { | 1047 Tuple5<OutA, OutB, OutC, OutD, OutE>* out) { |
1041 (obj->*method)(in.a, in.b, in.c, in.d, in.e, in.f, | 1048 (obj->*method)(in.a, in.b, in.c, in.d, in.e, in.f, |
1042 &out->a, &out->b, &out->c, &out->d, &out->e); | 1049 &out->a, &out->b, &out->c, &out->d, &out->e); |
1043 } | 1050 } |
1044 | 1051 |
1045 #endif // BASE_TUPLE_H__ | 1052 #endif // BASE_TUPLE_H__ |
OLD | NEW |