| 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, p.a); \ | 460 (obj->*func)(parameter, get<0>(p)); \ |
| 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, p.a, p.b); \ | 472 (obj->*func)(parameter, get<0>(p), get<1>(p)); \ |
| 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, p.a, p.b, p.c); \ | 484 (obj->*func)(parameter, get<0>(p), get<1>(p), get<2>(p)); \ |
| 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, p.a, p.b, p.c, p.d); \ | 497 (obj->*func)(parameter, get<0>(p), get<1>(p), get<2>(p), get<3>(p)); \ |
| 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, p.a, p.b, p.c, p.d, p.e); \ | 510 (obj->*func)(parameter, get<0>(p), get<1>(p), get<2>(p), get<3>(p), \ |
| 511 get<4>(p)); \ |
| 511 return true; \ | 512 return true; \ |
| 512 } \ | 513 } \ |
| 513 return false; \ | 514 return false; \ |
| 514 } | 515 } |
| 515 | 516 |
| 516 // The following macros define the common set of methods provided by SYNC | 517 // The following macros define the common set of methods provided by SYNC |
| 517 // message classes. | 518 // message classes. |
| 518 #define IPC_SYNC_MESSAGE_METHODS_GENERIC \ | 519 #define IPC_SYNC_MESSAGE_METHODS_GENERIC \ |
| 519 template<class T, class S, class P, class Method> \ | 520 template<class T, class S, class P, class Method> \ |
| 520 static bool Dispatch(const Message* msg, T* obj, S* sender, P* parameter, \ | 521 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... |
| 810 #define IPC_TYPE_IN_3(t1, t2, t3) const t1& arg1, const t2& arg2, cons
t t3& arg3 | 811 #define IPC_TYPE_IN_3(t1, t2, t3) const t1& arg1, const t2& arg2, cons
t t3& arg3 |
| 811 #define IPC_TYPE_IN_4(t1, t2, t3, t4) const t1& arg1, const t2& arg2, cons
t t3& arg3, const t4& arg4 | 812 #define IPC_TYPE_IN_4(t1, t2, t3, t4) const t1& arg1, const t2& arg2, cons
t t3& arg3, const t4& arg4 |
| 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 | 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 |
| 813 | 814 |
| 814 #define IPC_TYPE_OUT_0() | 815 #define IPC_TYPE_OUT_0() |
| 815 #define IPC_TYPE_OUT_1(t1) t1* arg6 | 816 #define IPC_TYPE_OUT_1(t1) t1* arg6 |
| 816 #define IPC_TYPE_OUT_2(t1, t2) t1* arg6, t2* arg7 | 817 #define IPC_TYPE_OUT_2(t1, t2) t1* arg6, t2* arg7 |
| 817 #define IPC_TYPE_OUT_3(t1, t2, t3) t1* arg6, t2* arg7, t3* arg8 | 818 #define IPC_TYPE_OUT_3(t1, t2, t3) t1* arg6, t2* arg7, t3* arg8 |
| 818 #define IPC_TYPE_OUT_4(t1, t2, t3, t4) t1* arg6, t2* arg7, t3* arg8, t4* ar
g9 | 819 #define IPC_TYPE_OUT_4(t1, t2, t3, t4) t1* arg6, t2* arg7, t3* arg8, t4* ar
g9 |
| 819 | 820 |
| 820 #define IPC_TUPLE_IN_0() Tuple0 | 821 #define IPC_TUPLE_IN_0() Tuple<> |
| 821 #define IPC_TUPLE_IN_1(t1) Tuple1<t1> | 822 #define IPC_TUPLE_IN_1(t1) Tuple<t1> |
| 822 #define IPC_TUPLE_IN_2(t1, t2) Tuple2<t1, t2> | 823 #define IPC_TUPLE_IN_2(t1, t2) Tuple<t1, t2> |
| 823 #define IPC_TUPLE_IN_3(t1, t2, t3) Tuple3<t1, t2, t3> | 824 #define IPC_TUPLE_IN_3(t1, t2, t3) Tuple<t1, t2, t3> |
| 824 #define IPC_TUPLE_IN_4(t1, t2, t3, t4) Tuple4<t1, t2, t3, t4> | 825 #define IPC_TUPLE_IN_4(t1, t2, t3, t4) Tuple<t1, t2, t3, t4> |
| 825 #define IPC_TUPLE_IN_5(t1, t2, t3, t4, t5) Tuple5<t1, t2, t3, t4, t5> | 826 #define IPC_TUPLE_IN_5(t1, t2, t3, t4, t5) Tuple<t1, t2, t3, t4, t5> |
| 826 | 827 |
| 827 #define IPC_TUPLE_OUT_0() Tuple0 | 828 #define IPC_TUPLE_OUT_0() Tuple<> |
| 828 #define IPC_TUPLE_OUT_1(t1) Tuple1<t1&> | 829 #define IPC_TUPLE_OUT_1(t1) Tuple<t1&> |
| 829 #define IPC_TUPLE_OUT_2(t1, t2) Tuple2<t1&, t2&> | 830 #define IPC_TUPLE_OUT_2(t1, t2) Tuple<t1&, t2&> |
| 830 #define IPC_TUPLE_OUT_3(t1, t2, t3) Tuple3<t1&, t2&, t3&> | 831 #define IPC_TUPLE_OUT_3(t1, t2, t3) Tuple<t1&, t2&, t3&> |
| 831 #define IPC_TUPLE_OUT_4(t1, t2, t3, t4) Tuple4<t1&, t2&, t3&, t4&> | 832 #define IPC_TUPLE_OUT_4(t1, t2, t3, t4) Tuple<t1&, t2&, t3&, t4&> |
| 832 | 833 |
| 833 #define IPC_NAME_IN_0() MakeTuple() | 834 #define IPC_NAME_IN_0() MakeTuple() |
| 834 #define IPC_NAME_IN_1(t1) MakeRefTuple(arg1) | 835 #define IPC_NAME_IN_1(t1) MakeRefTuple(arg1) |
| 835 #define IPC_NAME_IN_2(t1, t2) MakeRefTuple(arg1, arg2) | 836 #define IPC_NAME_IN_2(t1, t2) MakeRefTuple(arg1, arg2) |
| 836 #define IPC_NAME_IN_3(t1, t2, t3) MakeRefTuple(arg1, arg2, arg3) | 837 #define IPC_NAME_IN_3(t1, t2, t3) MakeRefTuple(arg1, arg2, arg3) |
| 837 #define IPC_NAME_IN_4(t1, t2, t3, t4) MakeRefTuple(arg1, arg2, arg3, arg4) | 838 #define IPC_NAME_IN_4(t1, t2, t3, t4) MakeRefTuple(arg1, arg2, arg3, arg4) |
| 838 #define IPC_NAME_IN_5(t1, t2, t3, t4, t5) MakeRefTuple(arg1, arg2, arg3, arg4,
arg5) | 839 #define IPC_NAME_IN_5(t1, t2, t3, t4, t5) MakeRefTuple(arg1, arg2, arg3, arg4,
arg5) |
| 839 | 840 |
| 840 #define IPC_NAME_OUT_0() MakeTuple() | 841 #define IPC_NAME_OUT_0() MakeTuple() |
| 841 #define IPC_NAME_OUT_1(t1) MakeRefTuple(*arg6) | 842 #define IPC_NAME_OUT_1(t1) MakeRefTuple(*arg6) |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 970 // equivalent without the #ifdef, VS2013 contains a bug where it is | 971 // equivalent without the #ifdef, VS2013 contains a bug where it is |
| 971 // over-aggressive in optimizing out #includes. Putting the #ifdef is a | 972 // over-aggressive in optimizing out #includes. Putting the #ifdef is a |
| 972 // workaround for this bug. See http://goo.gl/eGt2Fb for more details. | 973 // workaround for this bug. See http://goo.gl/eGt2Fb for more details. |
| 973 // This can be removed once VS2013 is fixed. | 974 // This can be removed once VS2013 is fixed. |
| 974 #ifdef IPC_MESSAGE_START | 975 #ifdef IPC_MESSAGE_START |
| 975 // Clean up IPC_MESSAGE_START in this unguarded section so that the | 976 // Clean up IPC_MESSAGE_START in this unguarded section so that the |
| 976 // XXX_messages.h files need not do so themselves. This makes the | 977 // XXX_messages.h files need not do so themselves. This makes the |
| 977 // XXX_messages.h files easier to write. | 978 // XXX_messages.h files easier to write. |
| 978 #undef IPC_MESSAGE_START | 979 #undef IPC_MESSAGE_START |
| 979 #endif | 980 #endif |
| OLD | NEW |