OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // Defining IPC Messages | 5 // Defining IPC Messages |
6 // | 6 // |
7 // Your IPC messages will be defined by macros inside of an XXX_messages.h | 7 // Your IPC messages will be defined by macros inside of an XXX_messages.h |
8 // header file. Most of the time, the system can automatically generate all | 8 // header file. Most of the time, the system can automatically generate all |
9 // of messaging mechanism from these definitions, but sometimes some manual | 9 // of messaging mechanism from these definitions, but sometimes some manual |
10 // coding is required. In these cases, you will also have an XXX_messages.cc | 10 // coding is required. In these cases, you will also have an XXX_messages.cc |
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 | 450 |
451 // The following macros are for for async IPCs which have a dispatcher with an | 451 // The following macros are for for async IPCs which have a dispatcher with an |
452 // extra parameter specified using IPC_BEGIN_MESSAGE_MAP_WITH_PARAM. | 452 // extra parameter specified using IPC_BEGIN_MESSAGE_MAP_WITH_PARAM. |
453 #define IPC_ASYNC_MESSAGE_METHODS_1 \ | 453 #define IPC_ASYNC_MESSAGE_METHODS_1 \ |
454 IPC_ASYNC_MESSAGE_METHODS_GENERIC \ | 454 IPC_ASYNC_MESSAGE_METHODS_GENERIC \ |
455 template<class T, class S, class P, typename TA> \ | 455 template<class T, class S, class P, typename TA> \ |
456 static bool Dispatch(const Message* msg, T* obj, S* sender, P* parameter, \ | 456 static bool Dispatch(const Message* msg, T* obj, S* sender, P* parameter, \ |
457 void (T::*func)(P*, TA)) { \ | 457 void (T::*func)(P*, TA)) { \ |
458 Schema::Param p; \ | 458 Schema::Param p; \ |
459 if (Read(msg, &p)) { \ | 459 if (Read(msg, &p)) { \ |
460 (obj->*func)(parameter, get<0>(p)); \ | 460 (obj->*func)(parameter, p.a); \ |
461 return true; \ | 461 return true; \ |
462 } \ | 462 } \ |
463 return false; \ | 463 return false; \ |
464 } | 464 } |
465 #define IPC_ASYNC_MESSAGE_METHODS_2 \ | 465 #define IPC_ASYNC_MESSAGE_METHODS_2 \ |
466 IPC_ASYNC_MESSAGE_METHODS_GENERIC \ | 466 IPC_ASYNC_MESSAGE_METHODS_GENERIC \ |
467 template<class T, class S, class P, typename TA, typename TB> \ | 467 template<class T, class S, class P, typename TA, typename TB> \ |
468 static bool Dispatch(const Message* msg, T* obj, S* sender, P* parameter, \ | 468 static bool Dispatch(const Message* msg, T* obj, S* sender, P* parameter, \ |
469 void (T::*func)(P*, TA, TB)) { \ | 469 void (T::*func)(P*, TA, TB)) { \ |
470 Schema::Param p; \ | 470 Schema::Param p; \ |
471 if (Read(msg, &p)) { \ | 471 if (Read(msg, &p)) { \ |
472 (obj->*func)(parameter, get<0>(p), get<1>(p)); \ | 472 (obj->*func)(parameter, p.a, p.b); \ |
473 return true; \ | 473 return true; \ |
474 } \ | 474 } \ |
475 return false; \ | 475 return false; \ |
476 } | 476 } |
477 #define IPC_ASYNC_MESSAGE_METHODS_3 \ | 477 #define IPC_ASYNC_MESSAGE_METHODS_3 \ |
478 IPC_ASYNC_MESSAGE_METHODS_GENERIC \ | 478 IPC_ASYNC_MESSAGE_METHODS_GENERIC \ |
479 template<class T, class S, class P, typename TA, typename TB, typename TC> \ | 479 template<class T, class S, class P, typename TA, typename TB, typename TC> \ |
480 static bool Dispatch(const Message* msg, T* obj, S* sender, P* parameter, \ | 480 static bool Dispatch(const Message* msg, T* obj, S* sender, P* parameter, \ |
481 void (T::*func)(P*, TA, TB, TC)) { \ | 481 void (T::*func)(P*, TA, TB, TC)) { \ |
482 Schema::Param p; \ | 482 Schema::Param p; \ |
483 if (Read(msg, &p)) { \ | 483 if (Read(msg, &p)) { \ |
484 (obj->*func)(parameter, get<0>(p), get<1>(p), get<2>(p)); \ | 484 (obj->*func)(parameter, p.a, p.b, p.c); \ |
485 return true; \ | 485 return true; \ |
486 } \ | 486 } \ |
487 return false; \ | 487 return false; \ |
488 } | 488 } |
489 #define IPC_ASYNC_MESSAGE_METHODS_4 \ | 489 #define IPC_ASYNC_MESSAGE_METHODS_4 \ |
490 IPC_ASYNC_MESSAGE_METHODS_GENERIC \ | 490 IPC_ASYNC_MESSAGE_METHODS_GENERIC \ |
491 template<class T, class S, class P, typename TA, typename TB, typename TC, \ | 491 template<class T, class S, class P, typename TA, typename TB, typename TC, \ |
492 typename TD> \ | 492 typename TD> \ |
493 static bool Dispatch(const Message* msg, T* obj, S* sender, P* parameter, \ | 493 static bool Dispatch(const Message* msg, T* obj, S* sender, P* parameter, \ |
494 void (T::*func)(P*, TA, TB, TC, TD)) { \ | 494 void (T::*func)(P*, TA, TB, TC, TD)) { \ |
495 Schema::Param p; \ | 495 Schema::Param p; \ |
496 if (Read(msg, &p)) { \ | 496 if (Read(msg, &p)) { \ |
497 (obj->*func)(parameter, get<0>(p), get<1>(p), get<2>(p), get<3>(p)); \ | 497 (obj->*func)(parameter, p.a, p.b, p.c, p.d); \ |
498 return true; \ | 498 return true; \ |
499 } \ | 499 } \ |
500 return false; \ | 500 return false; \ |
501 } | 501 } |
502 #define IPC_ASYNC_MESSAGE_METHODS_5 \ | 502 #define IPC_ASYNC_MESSAGE_METHODS_5 \ |
503 IPC_ASYNC_MESSAGE_METHODS_GENERIC \ | 503 IPC_ASYNC_MESSAGE_METHODS_GENERIC \ |
504 template<class T, class S, class P, typename TA, typename TB, typename TC, \ | 504 template<class T, class S, class P, typename TA, typename TB, typename TC, \ |
505 typename TD, typename TE> \ | 505 typename TD, typename TE> \ |
506 static bool Dispatch(const Message* msg, T* obj, S* sender, P* parameter, \ | 506 static bool Dispatch(const Message* msg, T* obj, S* sender, P* parameter, \ |
507 void (T::*func)(P*, TA, TB, TC, TD, TE)) { \ | 507 void (T::*func)(P*, TA, TB, TC, TD, TE)) { \ |
508 Schema::Param p; \ | 508 Schema::Param p; \ |
509 if (Read(msg, &p)) { \ | 509 if (Read(msg, &p)) { \ |
510 (obj->*func)(parameter, get<0>(p), get<1>(p), get<2>(p), get<3>(p), \ | 510 (obj->*func)(parameter, p.a, p.b, p.c, p.d, p.e); \ |
511 get<4>(p)); \ | |
512 return true; \ | 511 return true; \ |
513 } \ | 512 } \ |
514 return false; \ | 513 return false; \ |
515 } | 514 } |
516 | 515 |
517 // The following macros define the common set of methods provided by SYNC | 516 // The following macros define the common set of methods provided by SYNC |
518 // message classes. | 517 // message classes. |
519 #define IPC_SYNC_MESSAGE_METHODS_GENERIC \ | 518 #define IPC_SYNC_MESSAGE_METHODS_GENERIC \ |
520 template<class T, class S, class P, class Method> \ | 519 template<class T, class S, class P, class Method> \ |
521 static bool Dispatch(const Message* msg, T* obj, S* sender, P* parameter, \ | 520 static bool Dispatch(const Message* msg, T* obj, S* sender, P* parameter, \ |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
811 #define IPC_TYPE_IN_3(t1, t2, t3) const t1& arg1, const t2& arg2, cons
t t3& arg3 | 810 #define IPC_TYPE_IN_3(t1, t2, t3) const t1& arg1, const t2& arg2, cons
t t3& arg3 |
812 #define IPC_TYPE_IN_4(t1, t2, t3, t4) const t1& arg1, const t2& arg2, cons
t t3& arg3, const t4& arg4 | 811 #define IPC_TYPE_IN_4(t1, t2, t3, t4) const t1& arg1, const t2& arg2, cons
t t3& arg3, const t4& arg4 |
813 #define IPC_TYPE_IN_5(t1, t2, t3, t4, t5) const t1& arg1, const t2& arg2, cons
t t3& arg3, const t4& arg4, const t5& arg5 | 812 #define IPC_TYPE_IN_5(t1, t2, t3, t4, t5) const t1& arg1, const t2& arg2, cons
t t3& arg3, const t4& arg4, const t5& arg5 |
814 | 813 |
815 #define IPC_TYPE_OUT_0() | 814 #define IPC_TYPE_OUT_0() |
816 #define IPC_TYPE_OUT_1(t1) t1* arg6 | 815 #define IPC_TYPE_OUT_1(t1) t1* arg6 |
817 #define IPC_TYPE_OUT_2(t1, t2) t1* arg6, t2* arg7 | 816 #define IPC_TYPE_OUT_2(t1, t2) t1* arg6, t2* arg7 |
818 #define IPC_TYPE_OUT_3(t1, t2, t3) t1* arg6, t2* arg7, t3* arg8 | 817 #define IPC_TYPE_OUT_3(t1, t2, t3) t1* arg6, t2* arg7, t3* arg8 |
819 #define IPC_TYPE_OUT_4(t1, t2, t3, t4) t1* arg6, t2* arg7, t3* arg8, t4* ar
g9 | 818 #define IPC_TYPE_OUT_4(t1, t2, t3, t4) t1* arg6, t2* arg7, t3* arg8, t4* ar
g9 |
820 | 819 |
821 #define IPC_TUPLE_IN_0() Tuple<> | 820 #define IPC_TUPLE_IN_0() Tuple0 |
822 #define IPC_TUPLE_IN_1(t1) Tuple<t1> | 821 #define IPC_TUPLE_IN_1(t1) Tuple1<t1> |
823 #define IPC_TUPLE_IN_2(t1, t2) Tuple<t1, t2> | 822 #define IPC_TUPLE_IN_2(t1, t2) Tuple2<t1, t2> |
824 #define IPC_TUPLE_IN_3(t1, t2, t3) Tuple<t1, t2, t3> | 823 #define IPC_TUPLE_IN_3(t1, t2, t3) Tuple3<t1, t2, t3> |
825 #define IPC_TUPLE_IN_4(t1, t2, t3, t4) Tuple<t1, t2, t3, t4> | 824 #define IPC_TUPLE_IN_4(t1, t2, t3, t4) Tuple4<t1, t2, t3, t4> |
826 #define IPC_TUPLE_IN_5(t1, t2, t3, t4, t5) Tuple<t1, t2, t3, t4, t5> | 825 #define IPC_TUPLE_IN_5(t1, t2, t3, t4, t5) Tuple5<t1, t2, t3, t4, t5> |
827 | 826 |
828 #define IPC_TUPLE_OUT_0() Tuple<> | 827 #define IPC_TUPLE_OUT_0() Tuple0 |
829 #define IPC_TUPLE_OUT_1(t1) Tuple<t1&> | 828 #define IPC_TUPLE_OUT_1(t1) Tuple1<t1&> |
830 #define IPC_TUPLE_OUT_2(t1, t2) Tuple<t1&, t2&> | 829 #define IPC_TUPLE_OUT_2(t1, t2) Tuple2<t1&, t2&> |
831 #define IPC_TUPLE_OUT_3(t1, t2, t3) Tuple<t1&, t2&, t3&> | 830 #define IPC_TUPLE_OUT_3(t1, t2, t3) Tuple3<t1&, t2&, t3&> |
832 #define IPC_TUPLE_OUT_4(t1, t2, t3, t4) Tuple<t1&, t2&, t3&, t4&> | 831 #define IPC_TUPLE_OUT_4(t1, t2, t3, t4) Tuple4<t1&, t2&, t3&, t4&> |
833 | 832 |
834 #define IPC_NAME_IN_0() MakeTuple() | 833 #define IPC_NAME_IN_0() MakeTuple() |
835 #define IPC_NAME_IN_1(t1) MakeRefTuple(arg1) | 834 #define IPC_NAME_IN_1(t1) MakeRefTuple(arg1) |
836 #define IPC_NAME_IN_2(t1, t2) MakeRefTuple(arg1, arg2) | 835 #define IPC_NAME_IN_2(t1, t2) MakeRefTuple(arg1, arg2) |
837 #define IPC_NAME_IN_3(t1, t2, t3) MakeRefTuple(arg1, arg2, arg3) | 836 #define IPC_NAME_IN_3(t1, t2, t3) MakeRefTuple(arg1, arg2, arg3) |
838 #define IPC_NAME_IN_4(t1, t2, t3, t4) MakeRefTuple(arg1, arg2, arg3, arg4) | 837 #define IPC_NAME_IN_4(t1, t2, t3, t4) MakeRefTuple(arg1, arg2, arg3, arg4) |
839 #define IPC_NAME_IN_5(t1, t2, t3, t4, t5) MakeRefTuple(arg1, arg2, arg3, arg4,
arg5) | 838 #define IPC_NAME_IN_5(t1, t2, t3, t4, t5) MakeRefTuple(arg1, arg2, arg3, arg4,
arg5) |
840 | 839 |
841 #define IPC_NAME_OUT_0() MakeTuple() | 840 #define IPC_NAME_OUT_0() MakeTuple() |
842 #define IPC_NAME_OUT_1(t1) MakeRefTuple(*arg6) | 841 #define IPC_NAME_OUT_1(t1) MakeRefTuple(*arg6) |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
971 // equivalent without the #ifdef, VS2013 contains a bug where it is | 970 // equivalent without the #ifdef, VS2013 contains a bug where it is |
972 // over-aggressive in optimizing out #includes. Putting the #ifdef is a | 971 // over-aggressive in optimizing out #includes. Putting the #ifdef is a |
973 // workaround for this bug. See http://goo.gl/eGt2Fb for more details. | 972 // workaround for this bug. See http://goo.gl/eGt2Fb for more details. |
974 // This can be removed once VS2013 is fixed. | 973 // This can be removed once VS2013 is fixed. |
975 #ifdef IPC_MESSAGE_START | 974 #ifdef IPC_MESSAGE_START |
976 // Clean up IPC_MESSAGE_START in this unguarded section so that the | 975 // Clean up IPC_MESSAGE_START in this unguarded section so that the |
977 // XXX_messages.h files need not do so themselves. This makes the | 976 // XXX_messages.h files need not do so themselves. This makes the |
978 // XXX_messages.h files easier to write. | 977 // XXX_messages.h files easier to write. |
979 #undef IPC_MESSAGE_START | 978 #undef IPC_MESSAGE_START |
980 #endif | 979 #endif |
OLD | NEW |