diff options
author | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-11 17:36:32 +0000 |
---|---|---|
committer | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-11 17:36:32 +0000 |
commit | 1c99edc8d48f94702ac085197779ea22b820549b (patch) | |
tree | dbcb2aa6714c5769a5a0c134011e90b104603144 /ipc | |
parent | 4fd3c1a3faa42ee98f95e5f03182a597dea17196 (diff) | |
download | chromium_src-1c99edc8d48f94702ac085197779ea22b820549b.zip chromium_src-1c99edc8d48f94702ac085197779ea22b820549b.tar.gz chromium_src-1c99edc8d48f94702ac085197779ea22b820549b.tar.bz2 |
Reapplies r55735, fixing some message code that was checked in that I collided with.
BUG=51411
TEST=none
TBR=mpcomplete
Review URL: http://codereview.chromium.org/3118009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@55749 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ipc')
-rw-r--r-- | ipc/ipc_message_impl_macros.h | 602 | ||||
-rw-r--r-- | ipc/ipc_message_macros.h | 352 | ||||
-rw-r--r-- | ipc/ipc_message_utils.h | 117 | ||||
-rw-r--r-- | ipc/ipc_message_utils_impl.h | 13 | ||||
-rw-r--r-- | ipc/ipc_sync_channel_unittest.cc | 4 |
5 files changed, 718 insertions, 370 deletions
diff --git a/ipc/ipc_message_impl_macros.h b/ipc/ipc_message_impl_macros.h index f0adac5..1098357 100644 --- a/ipc/ipc_message_impl_macros.h +++ b/ipc/ipc_message_impl_macros.h @@ -7,12 +7,7 @@ // implementations of the constructors and the logging methods. (These only // have to be generated once). It is meant to be included in a XXX_messages.cc // file. -// -// Unlike ipc_message_macros.h, this file is only included once; it uses one -// pass. But we *still* can't use normal include guards because we still need -// to use the MESSAGES_INTERNAL_FILE dispatch system. Because that #define is -// unset, we use the different name MESSAGES_INTERNAL_IMPL_FILE to tell this -// file what to do. + #ifndef IPC_IPC_MESSAGE_IMPL_MACROS_H_ #define IPC_IPC_MESSAGE_IMPL_MACROS_H_ @@ -97,6 +92,17 @@ #define IPC_BEGIN_MESSAGES(label) #define IPC_END_MESSAGES(label) +// Every class must include a destructor and a log method that is keyed to the +// specific types. +#define IPC_ASYNC_MESSAGE_DTOR_AND_LOG(msg_class) \ + msg_class::~msg_class() {} \ + \ + void msg_class::Log(const Message* msg, std::wstring* l) { \ + Param p; \ + if (Read(msg, &p)) \ + IPC::LogParam(p, l); \ + } + // This derives from IPC::Message and thus doesn't need us to keep the // implementations in this impl file. #define IPC_MESSAGE_CONTROL0(msg_class) @@ -106,26 +112,14 @@ : IPC::MessageWithTuple< Tuple1<type1> >( \ MSG_ROUTING_CONTROL, ID, MakeRefTuple(arg1)) {} \ \ - msg_class::~msg_class() {} \ - \ - void msg_class::Log(const Message* msg, std::wstring* l) { \ - Param p; \ - if (Read(msg, &p)) \ - IPC::LogParam(p, l); \ - } + IPC_ASYNC_MESSAGE_DTOR_AND_LOG(msg_class) #define IPC_MESSAGE_CONTROL2(msg_class, type1, type2) \ msg_class::msg_class(const type1& arg1, const type2& arg2) \ : IPC::MessageWithTuple< Tuple2<type1, type2> >( \ MSG_ROUTING_CONTROL, ID, MakeRefTuple(arg1, arg2)) {} \ \ - msg_class::~msg_class() {} \ - \ - void msg_class::Log(const Message* msg, std::wstring* l) { \ - Param p; \ - if (Read(msg, &p)) \ - IPC::LogParam(p, l); \ - } + IPC_ASYNC_MESSAGE_DTOR_AND_LOG(msg_class) #define IPC_MESSAGE_CONTROL3(msg_class, type1, type2, type3) \ msg_class::msg_class(const type1& arg1, const type2& arg2, \ @@ -133,13 +127,7 @@ : IPC::MessageWithTuple< Tuple3<type1, type2, type3> >( \ MSG_ROUTING_CONTROL, ID, MakeRefTuple(arg1, arg2, arg3)) {} \ \ - msg_class::~msg_class() {} \ - \ - void msg_class::Log(const Message* msg, std::wstring* l) { \ - Param p; \ - if (Read(msg, &p)) \ - IPC::LogParam(p, l); \ - } + IPC_ASYNC_MESSAGE_DTOR_AND_LOG(msg_class) #define IPC_MESSAGE_CONTROL4(msg_class, type1, type2, type3, type4) \ msg_class::msg_class(const type1& arg1, const type2& arg2, \ @@ -147,13 +135,7 @@ : IPC::MessageWithTuple< Tuple4<type1, type2, type3, type4> >( \ MSG_ROUTING_CONTROL, ID, MakeRefTuple(arg1, arg2, arg3, arg4)) {} \ \ - msg_class::~msg_class() {} \ - \ - void msg_class::Log(const Message* msg, std::wstring* l) { \ - Param p; \ - if (Read(msg, &p)) \ - IPC::LogParam(p, l); \ - } + IPC_ASYNC_MESSAGE_DTOR_AND_LOG(msg_class) #define IPC_MESSAGE_CONTROL5(msg_class, type1, type2, type3, type4, type5) \ msg_class::msg_class(const type1& arg1, const type2& arg2, \ @@ -163,13 +145,7 @@ MSG_ROUTING_CONTROL, ID, \ MakeRefTuple(arg1, arg2, arg3, arg4, arg5)) {} \ \ - msg_class::~msg_class() {} \ - \ - void msg_class::Log(const Message* msg, std::wstring* l) { \ - Param p; \ - if (Read(msg, &p)) \ - IPC::LogParam(p, l); \ - } + IPC_ASYNC_MESSAGE_DTOR_AND_LOG(msg_class) // This derives from IPC::Message and thus doesn't need us to keep the // implementations in this impl file. @@ -180,26 +156,14 @@ : IPC::MessageWithTuple< Tuple1<type1> >( \ routing_id, ID, MakeRefTuple(arg1)) {} \ \ - msg_class::~msg_class() {} \ - \ - void msg_class::Log(const Message* msg, std::wstring* l) { \ - Param p; \ - if (Read(msg, &p)) \ - IPC::LogParam(p, l); \ - } + IPC_ASYNC_MESSAGE_DTOR_AND_LOG(msg_class) #define IPC_MESSAGE_ROUTED2(msg_class, type1, type2) \ msg_class::msg_class(int32 routing_id, const type1& arg1, const type2& arg2) \ : IPC::MessageWithTuple< Tuple2<type1, type2> >( \ routing_id, ID, MakeRefTuple(arg1, arg2)) {} \ \ - msg_class::~msg_class() {} \ - \ - void msg_class::Log(const Message* msg, std::wstring* l) { \ - Param p; \ - if (Read(msg, &p)) \ - IPC::LogParam(p, l); \ - } + IPC_ASYNC_MESSAGE_DTOR_AND_LOG(msg_class) #define IPC_MESSAGE_ROUTED3(msg_class, type1, type2, type3) \ @@ -208,13 +172,7 @@ : IPC::MessageWithTuple< Tuple3<type1, type2, type3> >( \ routing_id, ID, MakeRefTuple(arg1, arg2, arg3)) {} \ \ - msg_class::~msg_class() {} \ - \ - void msg_class::Log(const Message* msg, std::wstring* l) { \ - Param p; \ - if (Read(msg, &p)) \ - IPC::LogParam(p, l); \ - } + IPC_ASYNC_MESSAGE_DTOR_AND_LOG(msg_class) #define IPC_MESSAGE_ROUTED4(msg_class, type1, type2, type3, type4) \ msg_class::msg_class(int32 routing_id, const type1& arg1, const type2& arg2, \ @@ -222,13 +180,7 @@ : IPC::MessageWithTuple< Tuple4<type1, type2, type3, type4> >( \ routing_id, ID, MakeRefTuple(arg1, arg2, arg3, arg4)) {} \ \ - msg_class::~msg_class() {} \ - \ - void msg_class::Log(const Message* msg, std::wstring* l) { \ - Param p; \ - if (Read(msg, &p)) \ - IPC::LogParam(p, l); \ - } + IPC_ASYNC_MESSAGE_DTOR_AND_LOG(msg_class) #define IPC_MESSAGE_ROUTED5(msg_class, type1, type2, type3, type4, type5) \ msg_class::msg_class(int32 routing_id, const type1& arg1, \ @@ -237,57 +189,475 @@ : IPC::MessageWithTuple< Tuple5<type1, type2, type3, type4, type5> >( \ routing_id, ID, MakeRefTuple(arg1, arg2, arg3, arg4, arg5)) {} \ \ - msg_class::~msg_class() { } \ + IPC_ASYNC_MESSAGE_DTOR_AND_LOG(msg_class) + +// ----------------------------------------------------------------------------- + +// Every class must include a destructor and a log method that is keyed to the +// specific types. +#define IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) \ + msg_class::~msg_class() {} \ \ void msg_class::Log(const Message* msg, std::wstring* l) { \ - Param p; \ - if (Read(msg, &p)) \ - IPC::LogParam(p, l); \ + if (msg->is_sync()) { \ + SendParam p; \ + if (ReadSendParam(msg, &p)) \ + IPC::LogParam(p, l); \ + \ + AddOutputParamsToLog(msg, l); \ + } else { \ + TupleTypes<ReplyParam>::ValueTuple p; \ + if (ReadReplyParam(msg, &p)) \ + IPC::LogParam(p, l); \ + } \ } -// TODO(erg): Fill these in as I go along. -#define IPC_SYNC_MESSAGE_CONTROL0_0(msg_class) -#define IPC_SYNC_MESSAGE_CONTROL0_1(msg_class, type1_out) -#define IPC_SYNC_MESSAGE_CONTROL0_2(msg_class, type1_out, type2_out) -#define IPC_SYNC_MESSAGE_CONTROL0_3(msg_class, type1_out, type2_out, type3_out) -#define IPC_SYNC_MESSAGE_CONTROL1_0(msg_class, type1_in) -#define IPC_SYNC_MESSAGE_CONTROL1_1(msg_class, type1_in, type1_out) -#define IPC_SYNC_MESSAGE_CONTROL1_2(msg_class, type1_in, type1_out, type2_out) -#define IPC_SYNC_MESSAGE_CONTROL1_3(msg_class, type1_in, type1_out, type2_out, type3_out) -#define IPC_SYNC_MESSAGE_CONTROL2_0(msg_class, type1_in, type2_in) -#define IPC_SYNC_MESSAGE_CONTROL2_1(msg_class, type1_in, type2_in, type1_out) -#define IPC_SYNC_MESSAGE_CONTROL2_2(msg_class, type1_in, type2_in, type1_out, type2_out) -#define IPC_SYNC_MESSAGE_CONTROL2_3(msg_class, type1_in, type2_in, type1_out, type2_out, type3_out) -#define IPC_SYNC_MESSAGE_CONTROL3_1(msg_class, type1_in, type2_in, type3_in, type1_out) -#define IPC_SYNC_MESSAGE_CONTROL3_2(msg_class, type1_in, type2_in, type3_in, type1_out, type2_out) -#define IPC_SYNC_MESSAGE_CONTROL3_3(msg_class, type1_in, type2_in, type3_in, type1_out, type2_out, type3_out) -#define IPC_SYNC_MESSAGE_CONTROL4_1(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out) -#define IPC_SYNC_MESSAGE_CONTROL4_2(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out, type2_out) -#define IPC_SYNC_MESSAGE_ROUTED0_0(msg_class) -#define IPC_SYNC_MESSAGE_ROUTED0_1(msg_class, type1_out) -#define IPC_SYNC_MESSAGE_ROUTED0_2(msg_class, type1_out, type2_out) -#define IPC_SYNC_MESSAGE_ROUTED0_3(msg_class, type1_out, type2_out, type3_out) -#define IPC_SYNC_MESSAGE_ROUTED1_0(msg_class, type1_in) -#define IPC_SYNC_MESSAGE_ROUTED1_1(msg_class, type1_in, type1_out) -#define IPC_SYNC_MESSAGE_ROUTED1_2(msg_class, type1_in, type1_out, type2_out) -#define IPC_SYNC_MESSAGE_ROUTED1_3(msg_class, type1_in, type1_out, type2_out, type3_out) -#define IPC_SYNC_MESSAGE_ROUTED1_4(msg_class, type1_in, type1_out, type2_out, type3_out, type4_out) -#define IPC_SYNC_MESSAGE_ROUTED2_0(msg_class, type1_in, type2_in) -#define IPC_SYNC_MESSAGE_ROUTED2_1(msg_class, type1_in, type2_in, type1_out) -#define IPC_SYNC_MESSAGE_ROUTED2_2(msg_class, type1_in, type2_in, type1_out, type2_out) -#define IPC_SYNC_MESSAGE_ROUTED2_3(msg_class, type1_in, type2_in, type1_out, type2_out, type3_out) -#define IPC_SYNC_MESSAGE_ROUTED3_0(msg_class, type1_in, type2_in, type3_in) -#define IPC_SYNC_MESSAGE_ROUTED3_1(msg_class, type1_in, type2_in, type3_in, type1_out) -#define IPC_SYNC_MESSAGE_ROUTED3_2(msg_class, type1_in, type2_in, type3_in, type1_out, type2_out) -#define IPC_SYNC_MESSAGE_ROUTED3_3(msg_class, type1_in, type2_in, type3_in, type1_out, type2_out, type3_out) -#define IPC_SYNC_MESSAGE_ROUTED4_0(msg_class, type1_in, type2_in, type3_in, type4_in) -#define IPC_SYNC_MESSAGE_ROUTED4_1(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out) -#define IPC_SYNC_MESSAGE_ROUTED4_2(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out, type2_out) -#define IPC_SYNC_MESSAGE_ROUTED4_3(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out, type2_out, type3_out) -#define IPC_SYNC_MESSAGE_ROUTED5_0(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in) -#define IPC_SYNC_MESSAGE_ROUTED5_1(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in, type1_out) -#define IPC_SYNC_MESSAGE_ROUTED5_2(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in, type1_out, type2_out) -#define IPC_SYNC_MESSAGE_ROUTED5_3(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in, type1_out, type2_out, type3_out) +#define IPC_SYNC_MESSAGE_CONTROL0_0(msg_class) \ + msg_class::msg_class() \ + : IPC::MessageWithReply<Tuple0, Tuple0 >( \ + MSG_ROUTING_CONTROL, ID, \ + MakeTuple(), MakeTuple()) {} \ + \ + IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) + +#define IPC_SYNC_MESSAGE_CONTROL0_1(msg_class, type1_out) \ + msg_class::msg_class(type1_out* arg1) \ + : IPC::MessageWithReply<Tuple0, Tuple1<type1_out&> >( \ + MSG_ROUTING_CONTROL, ID, \ + MakeTuple(), MakeRefTuple(*arg1)) {} \ + \ + IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) + +#define IPC_SYNC_MESSAGE_CONTROL0_2(msg_class, type1_out, type2_out) \ + msg_class::msg_class(type1_out* arg1, type2_out* arg2) \ + : IPC::MessageWithReply<Tuple0, Tuple2<type1_out&, type2_out&> >( \ + MSG_ROUTING_CONTROL, ID, \ + MakeTuple(), MakeRefTuple(*arg1, *arg2)) {} \ + \ + IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) + +#define IPC_SYNC_MESSAGE_CONTROL0_3(msg_class, type1_out, type2_out, \ + type3_out) \ + msg_class::msg_class(type1_out* arg1, type2_out* arg2, type3_out* arg3) \ + : IPC::MessageWithReply<Tuple0, Tuple3<type1_out&, type2_out&, \ + type3_out&> >( \ + MSG_ROUTING_CONTROL, ID, \ + MakeTuple(), MakeRefTuple(*arg1, *arg2, *arg3)) {} \ + \ + IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) + + +#define IPC_SYNC_MESSAGE_CONTROL1_0(msg_class, type1_in) \ + msg_class::msg_class(const type1_in& arg1) \ + : IPC::MessageWithReply<Tuple1<type1_in>, Tuple0 >( \ + MSG_ROUTING_CONTROL, ID, \ + MakeRefTuple(arg1), MakeTuple()) {} \ + \ + IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) + +#define IPC_SYNC_MESSAGE_CONTROL1_1(msg_class, type1_in, type1_out) \ + msg_class::msg_class(const type1_in& arg1, type1_out* arg2) \ + : IPC::MessageWithReply<Tuple1<type1_in>, Tuple1<type1_out&> >( \ + MSG_ROUTING_CONTROL, ID, \ + MakeRefTuple(arg1), MakeRefTuple(*arg2)) {} \ + \ + IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) + +#define IPC_SYNC_MESSAGE_CONTROL1_2(msg_class, type1_in, type1_out, type2_out) \ + msg_class::msg_class(const type1_in& arg1, type1_out* arg2, type2_out* arg3) \ + : IPC::MessageWithReply<Tuple1<type1_in>, \ + Tuple2<type1_out&, type2_out&> >( \ + MSG_ROUTING_CONTROL, ID, \ + MakeRefTuple(arg1), MakeRefTuple(*arg2, *arg3)) {} \ + \ + IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) + +#define IPC_SYNC_MESSAGE_CONTROL1_3(msg_class, type1_in, type1_out, \ + type2_out, type3_out) \ + msg_class::msg_class(const type1_in& arg1, type1_out* arg2, \ + type2_out* arg3, type3_out* arg4) \ + : IPC::MessageWithReply<Tuple1<type1_in>, \ + Tuple3<type1_out&, type2_out&, type3_out&> >( \ + MSG_ROUTING_CONTROL, ID, \ + MakeRefTuple(arg1), MakeRefTuple(*arg2, *arg3, *arg4)) {} \ + \ + IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) + +#define IPC_SYNC_MESSAGE_CONTROL2_0(msg_class, type1_in, type2_in) \ + msg_class::msg_class(const type1_in& arg1, const type2_in& arg2) \ + : IPC::MessageWithReply<Tuple2<type1_in, type2_in>, Tuple0 >( \ + MSG_ROUTING_CONTROL, ID, \ + MakeRefTuple(arg1, arg2), MakeTuple()) {} \ + \ + IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) + +#define IPC_SYNC_MESSAGE_CONTROL2_1(msg_class, type1_in, type2_in, type1_out) \ + msg_class::msg_class(const type1_in& arg1, const type2_in& arg2, \ + type1_out* arg3) \ + : IPC::MessageWithReply<Tuple2<type1_in, type2_in>, \ + Tuple1<type1_out&> >( \ + MSG_ROUTING_CONTROL, ID, \ + MakeRefTuple(arg1, arg2), MakeRefTuple(*arg3)) {} \ + \ + IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) + + +#define IPC_SYNC_MESSAGE_CONTROL2_2(msg_class, type1_in, type2_in, \ + type1_out, type2_out) \ + msg_class::msg_class(const type1_in& arg1, const type2_in& arg2, \ + type1_out* arg3, type2_out* arg4) \ + : IPC::MessageWithReply<Tuple2<type1_in, type2_in>, \ + Tuple2<type1_out&, type2_out&> >(MSG_ROUTING_CONTROL, ID, \ + MakeRefTuple(arg1, arg2), MakeRefTuple(*arg3, *arg4)) {} \ + \ + IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) + + +#define IPC_SYNC_MESSAGE_CONTROL2_3(msg_class, type1_in, type2_in, \ + type1_out, type2_out, type3_out) \ + msg_class::msg_class(const type1_in& arg1, const type2_in& arg2, \ + type1_out* arg3, type2_out* arg4, type3_out* arg5) \ + : IPC::MessageWithReply<Tuple2<type1_in, type2_in>, \ + Tuple3<type1_out&, type2_out&, type3_out&> >(MSG_ROUTING_CONTROL, \ + ID, \ + MakeRefTuple(arg1, arg2), MakeRefTuple(*arg3, *arg4, *arg5)) {} \ + \ + IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) + + +#define IPC_SYNC_MESSAGE_CONTROL3_1(msg_class, type1_in, type2_in, \ + type3_in, type1_out) \ + msg_class::msg_class(const type1_in& arg1, const type2_in& arg2, \ + const type3_in& arg3, type1_out* arg4) \ + : IPC::MessageWithReply<Tuple3<type1_in, type2_in, type3_in>, \ + Tuple1<type1_out&> >(MSG_ROUTING_CONTROL, ID, \ + MakeRefTuple(arg1, arg2, arg3), MakeRefTuple(*arg4)) {} \ + \ + IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) + +#define IPC_SYNC_MESSAGE_CONTROL3_2(msg_class, type1_in, type2_in, \ + type3_in, type1_out, type2_out) \ + msg_class::msg_class(const type1_in& arg1, const type2_in& arg2, \ + const type3_in& arg3, type1_out* arg4, type2_out* arg5) \ + : IPC::MessageWithReply<Tuple3<type1_in, type2_in, type3_in>, \ + Tuple2<type1_out&, type2_out&> >(MSG_ROUTING_CONTROL, ID, \ + MakeRefTuple(arg1, arg2, arg3), MakeRefTuple(*arg4, *arg5)) {} \ + \ + IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) + + +#define IPC_SYNC_MESSAGE_CONTROL3_3(msg_class, type1_in, type2_in, \ + type3_in, type1_out, type2_out, \ + type3_out) \ + msg_class::msg_class(const type1_in& arg1, const type2_in& arg2, \ + const type3_in& arg3, type1_out* arg4, \ + type2_out* arg5, type3_out* arg6) \ + : IPC::MessageWithReply<Tuple3<type1_in, type2_in, type3_in>, \ + Tuple3<type1_out&, type2_out&, type3_out&> >(MSG_ROUTING_CONTROL, \ + ID, \ + MakeRefTuple(arg1, arg2, arg3), \ + MakeRefTuple(*arg4, *arg5, *arg6)) {} \ + \ + IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) + +#define IPC_SYNC_MESSAGE_CONTROL4_1(msg_class, type1_in, type2_in, \ + type3_in, type4_in, type1_out) \ + msg_class::msg_class(const type1_in& arg1, const type2_in& arg2, \ + const type3_in& arg3, const type4_in& arg4, \ + type1_out* arg6) \ + : IPC::MessageWithReply<Tuple4<type1_in, type2_in, type3_in, type4_in>, \ + Tuple1<type1_out&> >(MSG_ROUTING_CONTROL, ID, \ + MakeRefTuple(arg1, arg2, arg3, arg4), MakeRefTuple(*arg6)) {} \ + \ + IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) + + +#define IPC_SYNC_MESSAGE_CONTROL4_2(msg_class, type1_in, type2_in, \ + type3_in, type4_in, type1_out, \ + type2_out) \ + msg_class::msg_class(const type1_in& arg1, const type2_in& arg2, \ + const type3_in& arg3, const type4_in& arg4, \ + type1_out* arg5, type2_out* arg6) \ + : IPC::MessageWithReply<Tuple4<type1_in, type2_in, type3_in, \ + type4_in>, \ + Tuple2<type1_out&, type2_out&> >(MSG_ROUTING_CONTROL, ID, \ + MakeRefTuple(arg1, arg2, arg3, arg4), \ + MakeRefTuple(*arg5, *arg6)) {} \ + \ + IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) + +#define IPC_SYNC_MESSAGE_ROUTED0_0(msg_class) \ + msg_class::msg_class(int routing_id) \ + : IPC::MessageWithReply<Tuple0, Tuple0>( \ + routing_id, ID, \ + MakeTuple(), MakeTuple()) {} \ + \ + IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) + +#define IPC_SYNC_MESSAGE_ROUTED0_1(msg_class, type1_out) \ + msg_class::msg_class(int routing_id, type1_out* arg1) \ + : IPC::MessageWithReply<Tuple0, Tuple1<type1_out&> >( \ + routing_id, ID, \ + MakeTuple(), MakeRefTuple(*arg1)) {} \ + \ + IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) + +#define IPC_SYNC_MESSAGE_ROUTED0_2(msg_class, type1_out, type2_out) \ + msg_class::msg_class(int routing_id, type1_out* arg1, type2_out* arg2) \ + : IPC::MessageWithReply<Tuple0, Tuple2<type1_out&, type2_out&> >( \ + routing_id, ID, \ + MakeTuple(), MakeRefTuple(*arg1, *arg2)) {} \ + \ + IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) + +#define IPC_SYNC_MESSAGE_ROUTED0_3(msg_class, type1_out, type2_out, \ + type3_out) \ + msg_class::msg_class(int routing_id, type1_out* arg1, type2_out* arg2, \ + type3_out* arg3) \ + : IPC::MessageWithReply<Tuple0, \ + Tuple3<type1_out&, type2_out&, type3_out&> >(routing_id, ID, \ + MakeTuple(), MakeRefTuple(*arg1, *arg2, *arg3)) {} \ + \ + IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) + +#define IPC_SYNC_MESSAGE_ROUTED1_0(msg_class, type1_in) \ + msg_class::msg_class(int routing_id, const type1_in& arg1) \ + : IPC::MessageWithReply<Tuple1<type1_in>, Tuple0 >( \ + routing_id, ID, \ + MakeRefTuple(arg1), MakeTuple()) {} \ + \ + IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) + +#define IPC_SYNC_MESSAGE_ROUTED1_1(msg_class, type1_in, type1_out) \ + msg_class::msg_class(int routing_id, const type1_in& arg1, \ + type1_out* arg2) \ + : IPC::MessageWithReply<Tuple1<type1_in>, Tuple1<type1_out&> >( \ + routing_id, ID, \ + MakeRefTuple(arg1), MakeRefTuple(*arg2)) {} \ + \ + IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) + +#define IPC_SYNC_MESSAGE_ROUTED1_2(msg_class, type1_in, type1_out, \ + type2_out) \ + msg_class::msg_class(int routing_id, const type1_in& arg1, \ + type1_out* arg2, type2_out* arg3) \ + : IPC::MessageWithReply<Tuple1<type1_in>, \ + Tuple2<type1_out&, type2_out&> >( \ + routing_id, ID, \ + MakeRefTuple(arg1), MakeRefTuple(*arg2, *arg3)) {} \ + \ + IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) + +#define IPC_SYNC_MESSAGE_ROUTED1_3(msg_class, type1_in, type1_out, \ + type2_out, type3_out) \ + msg_class::msg_class(int routing_id, const type1_in& arg1, \ + type1_out* arg2, type2_out* arg3, type3_out* arg4) \ + : IPC::MessageWithReply<Tuple1<type1_in>, \ + Tuple3<type1_out&, type2_out&, type3_out&> >(routing_id, ID, \ + MakeRefTuple(arg1), MakeRefTuple(*arg2, *arg3, *arg4)) {} \ + \ + IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) + +#define IPC_SYNC_MESSAGE_ROUTED1_4(msg_class, type1_in, type1_out, \ + type2_out, type3_out, type4_out) \ + msg_class::msg_class(int routing_id, const type1_in& arg1, \ + type1_out* arg2, type2_out* arg3, \ + type3_out* arg4, type4_out* arg5) \ + : IPC::MessageWithReply<Tuple1<type1_in>, \ + Tuple4<type1_out&, type2_out&, type3_out&, type4_out&> >( \ + routing_id, ID, MakeRefTuple(arg1), \ + MakeRefTuple(*arg2, *arg3, *arg4, *arg5)) {} \ + \ + IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) + +#define IPC_SYNC_MESSAGE_ROUTED2_0(msg_class, type1_in, type2_in) \ + msg_class::msg_class(int routing_id, const type1_in& arg1, \ + const type2_in& arg2) \ + : IPC::MessageWithReply<Tuple2<type1_in, type2_in>, Tuple0 >( \ + routing_id, ID, MakeRefTuple(arg1, arg2), MakeTuple()) {} \ + \ + IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) + +#define IPC_SYNC_MESSAGE_ROUTED2_1(msg_class, type1_in, type2_in, \ + type1_out) \ + msg_class::msg_class(int routing_id, const type1_in& arg1, \ + const type2_in& arg2, type1_out* arg3) \ + : IPC::MessageWithReply<Tuple2<type1_in, type2_in>, \ + Tuple1<type1_out&> >(routing_id, ID, \ + MakeRefTuple(arg1, arg2), MakeRefTuple(*arg3)) {} \ + \ + IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) + +#define IPC_SYNC_MESSAGE_ROUTED2_2(msg_class, type1_in, type2_in, \ + type1_out, type2_out) \ + msg_class::msg_class(int routing_id, const type1_in& arg1, \ + const type2_in& arg2, type1_out* arg3, \ + type2_out* arg4) \ + : IPC::MessageWithReply<Tuple2<type1_in, type2_in>, \ + Tuple2<type1_out&, type2_out&> >(routing_id, ID, \ + MakeRefTuple(arg1, arg2), MakeRefTuple(*arg3, *arg4)) {} \ + \ + IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) + +#define IPC_SYNC_MESSAGE_ROUTED2_3(msg_class, type1_in, type2_in, \ + type1_out, type2_out, type3_out) \ + msg_class::msg_class(int routing_id, const type1_in& arg1, \ + const type2_in& arg2, type1_out* arg3, \ + type2_out* arg4, type3_out* arg5) \ + : IPC::MessageWithReply<Tuple2<type1_in, type2_in>, \ + Tuple3<type1_out&, type2_out&, type3_out&> >(routing_id, ID, \ + MakeRefTuple(arg1, arg2), MakeRefTuple(*arg3, *arg4, *arg5)) {} \ + \ + IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) + +#define IPC_SYNC_MESSAGE_ROUTED3_0(msg_class, type1_in, type2_in, \ + type3_in) \ + msg_class::msg_class(int routing_id, const type1_in& arg1, \ + const type2_in& arg2, const type3_in& arg3) \ + : IPC::MessageWithReply<Tuple3<type1_in, type2_in, type3_in>, Tuple0>( \ + routing_id, ID, \ + MakeRefTuple(arg1, arg2, arg3), MakeTuple()) {} \ + \ + IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) + +#define IPC_SYNC_MESSAGE_ROUTED3_1(msg_class, type1_in, type2_in, \ + type3_in, type1_out) \ + msg_class::msg_class(int routing_id, const type1_in& arg1, \ + const type2_in& arg2, const type3_in& arg3, \ + type1_out* arg4) \ + : IPC::MessageWithReply<Tuple3<type1_in, type2_in, type3_in>, \ + Tuple1<type1_out&> >(routing_id, ID, \ + MakeRefTuple(arg1, arg2, arg3), MakeRefTuple(*arg4)) {} \ + \ + IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) + +#define IPC_SYNC_MESSAGE_ROUTED3_2(msg_class, type1_in, type2_in, \ + type3_in, type1_out, type2_out) \ + msg_class::msg_class(int routing_id, const type1_in& arg1, \ + const type2_in& arg2, const type3_in& arg3, \ + type1_out* arg4, type2_out* arg5) \ + : IPC::MessageWithReply<Tuple3<type1_in, type2_in, type3_in>, \ + Tuple2<type1_out&, type2_out&> >(routing_id, ID, \ + MakeRefTuple(arg1, arg2, arg3), MakeRefTuple(*arg4, *arg5)) {} \ + \ + IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) + +#define IPC_SYNC_MESSAGE_ROUTED3_3(msg_class, type1_in, type2_in, \ + type3_in, type1_out, type2_out, \ + type3_out) \ + msg_class::msg_class(int routing_id, const type1_in& arg1, \ + const type2_in& arg2, const type3_in& arg3, \ + type1_out* arg4, type2_out* arg5, type3_out* arg6) \ + : IPC::MessageWithReply<Tuple3<type1_in, type2_in, type3_in>, \ + Tuple3<type1_out&, type2_out&, type3_out&> >(routing_id, ID, \ + MakeRefTuple(arg1, arg2, arg3), MakeRefTuple(*arg4, *arg5, \ + *arg6)) {} \ + \ + IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) + +#define IPC_SYNC_MESSAGE_ROUTED4_0(msg_class, type1_in, type2_in, \ + type3_in, type4_in) \ + msg_class::msg_class(int routing_id, const type1_in& arg1, \ + const type2_in& arg2, const type3_in& arg3, \ + const type4_in& arg4) \ + : IPC::MessageWithReply<Tuple4<type1_in, type2_in, type3_in, \ + type4_in>, Tuple0 >(routing_id, ID, \ + MakeRefTuple(arg1, arg2, arg3, arg4), MakeTuple()) {} \ + \ + IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) + +#define IPC_SYNC_MESSAGE_ROUTED4_1(msg_class, type1_in, type2_in, \ + type3_in, type4_in, type1_out) \ + msg_class::msg_class(int routing_id, const type1_in& arg1, \ + const type2_in& arg2, const type3_in& arg3, \ + const type4_in& arg4, type1_out* arg6) \ + : IPC::MessageWithReply<Tuple4<type1_in, type2_in, type3_in, type4_in>, \ + Tuple1<type1_out&> >(routing_id, ID, \ + MakeRefTuple(arg1, arg2, arg3, arg4), MakeRefTuple(*arg6)) {} \ + \ + IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) + + +#define IPC_SYNC_MESSAGE_ROUTED4_2(msg_class, type1_in, type2_in, \ + type3_in, type4_in, type1_out, \ + type2_out) \ + msg_class::msg_class(int routing_id, const type1_in& arg1, \ + const type2_in& arg2, const type3_in& arg3, \ + const type4_in& arg4, type1_out* arg5, type2_out* arg6) \ + : IPC::MessageWithReply<Tuple4<type1_in, type2_in, type3_in, type4_in>, \ + Tuple2<type1_out&, type2_out&> >(routing_id, ID, \ + MakeRefTuple(arg1, arg2, arg3, arg4), MakeRefTuple(*arg5, *arg6)) {} \ + \ + IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) + + +#define IPC_SYNC_MESSAGE_ROUTED4_3(msg_class, type1_in, type2_in, \ + type3_in, type4_in, type1_out, \ + type2_out, type3_out) \ + msg_class::msg_class(int routing_id, const type1_in& arg1, \ + const type2_in& arg2, const type3_in& arg3, \ + const type4_in& arg4, type1_out* arg5, \ + type2_out* arg6, type3_out* arg7) \ + : IPC::MessageWithReply<Tuple4<type1_in, type2_in, type3_in, type4_in>, \ + Tuple3<type1_out&, type2_out&, type3_out&> >(routing_id, ID, \ + MakeRefTuple(arg1, arg2, arg3, arg4), \ + MakeRefTuple(*arg5, *arg6, *arg7)) {} \ + \ + IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) + +#define IPC_SYNC_MESSAGE_ROUTED5_0(msg_class, type1_in, type2_in, \ + type3_in, type4_in, type5_in) \ + msg_class::msg_class(int routing_id, const type1_in& arg1, \ + const type2_in& arg2, const type3_in& arg3, \ + const type4_in& arg4, const type5_in& arg5) \ + : IPC::MessageWithReply<Tuple5<type1_in, type2_in, type3_in, \ + type4_in, type5_in>, Tuple0 >(routing_id, ID, \ + MakeRefTuple(arg1, arg2, arg3, arg4, arg5), MakeTuple()) {} \ + \ + IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) + +#define IPC_SYNC_MESSAGE_ROUTED5_1(msg_class, type1_in, type2_in, \ + type3_in, type4_in, type5_in, type1_out) \ + msg_class::msg_class(int routing_id, const type1_in& arg1, \ + const type2_in& arg2, const type3_in& arg3, \ + const type4_in& arg4, const type5_in& arg5, \ + type1_out* arg6) \ + : IPC::MessageWithReply<Tuple5<type1_in, type2_in, type3_in, \ + type4_in, type5_in>, Tuple1<type1_out&> >(routing_id, ID, \ + MakeRefTuple(arg1, arg2, arg3, arg4, arg5), \ + MakeRefTuple(*arg6)) {} \ + \ + IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) + +#define IPC_SYNC_MESSAGE_ROUTED5_2(msg_class, type1_in, type2_in, \ + type3_in, type4_in, type5_in, \ + type1_out, type2_out) \ + msg_class::msg_class(int routing_id, const type1_in& arg1, \ + const type2_in& arg2, const type3_in& arg3, \ + const type4_in& arg4, const type4_in& arg5, \ + type1_out* arg6, type2_out* arg7) \ + : IPC::MessageWithReply<Tuple5<type1_in, type2_in, type3_in, \ + type4_in, type5_in>, Tuple2<type1_out&, type2_out&> >( \ + routing_id, ID, MakeRefTuple(arg1, arg2, arg3, arg4, arg5), \ + MakeRefTuple(*arg6, *arg7)) {} \ + \ + IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) + +#define IPC_SYNC_MESSAGE_ROUTED5_3(msg_class, type1_in, type2_in, \ + type3_in, type4_in, type5_in, \ + type1_out, type2_out, type3_out) \ + msg_class::msg_class(int routing_id, const type1_in& arg1, \ + const type2_in& arg2, const type3_in& arg3, \ + const type4_in& arg4, const type4_in& arg5, \ + type1_out* arg6, type2_out* arg7, \ + type3_out* arg8) \ + : IPC::MessageWithReply<Tuple5<type1_in, type2_in, type3_in, \ + type4_in, type5_in>, \ + Tuple3<type1_out&, type2_out&, type3_out&> >(routing_id, ID, \ + MakeRefTuple(arg1, arg2, arg3, arg4, arg5), \ + MakeRefTuple(*arg6, *arg7, *arg8)) {} \ + \ + IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) // Trigger the header guard define in ipc_message_macros.h so we don't get // duplicate including when we include MESSAGES_INTERNAL_FILE again at the end diff --git a/ipc/ipc_message_macros.h b/ipc/ipc_message_macros.h index 3152871f..903d566 100644 --- a/ipc/ipc_message_macros.h +++ b/ipc/ipc_message_macros.h @@ -845,23 +845,20 @@ LogFunction g_log_function_mapping[LastMsgIndex]; #define IPC_SYNC_MESSAGE_CONTROL0_0(msg_class) \ class msg_class : public IPC::MessageWithReply<Tuple0, Tuple0 > { \ - public: \ - enum { ID = msg_class##__ID }; \ - msg_class() \ - : IPC::MessageWithReply<Tuple0, Tuple0 >( \ - MSG_ROUTING_CONTROL, ID, \ - MakeTuple(), MakeTuple()) {} \ + public: \ + enum { ID = msg_class##__ID }; \ + msg_class(); \ + ~msg_class(); \ + static void Log(const Message* msg, std::wstring* l); \ }; -#define IPC_SYNC_MESSAGE_CONTROL0_1(msg_class, type1_out) \ +#define IPC_SYNC_MESSAGE_CONTROL0_1(msg_class, type1_out) \ class msg_class : public IPC::MessageWithReply<Tuple0, Tuple1<type1_out&> > { \ - public: \ - enum { ID = msg_class##__ID }; \ - msg_class(type1_out* arg1) \ - : IPC::MessageWithReply<Tuple0, Tuple1<type1_out&> >( \ - MSG_ROUTING_CONTROL, \ - ID, \ - MakeTuple(), MakeRefTuple(*arg1)) {} \ + public: \ + enum { ID = msg_class##__ID }; \ + msg_class(type1_out* arg1); \ + ~msg_class(); \ + static void Log(const Message* msg, std::wstring* l); \ }; #define IPC_SYNC_MESSAGE_CONTROL0_2(msg_class, type1_out, type2_out) \ @@ -869,11 +866,9 @@ LogFunction g_log_function_mapping[LastMsgIndex]; public IPC::MessageWithReply<Tuple0, Tuple2<type1_out&, type2_out&> > { \ public: \ enum { ID = msg_class##__ID }; \ - msg_class(type1_out* arg1, type2_out* arg2) \ - : IPC::MessageWithReply<Tuple0, Tuple2<type1_out&, type2_out&> >( \ - MSG_ROUTING_CONTROL, \ - ID, \ - MakeTuple(), MakeRefTuple(*arg1, *arg2)) {} \ + msg_class(type1_out* arg1, type2_out* arg2); \ + ~msg_class(); \ + static void Log(const Message* msg, std::wstring* l); \ }; #define IPC_SYNC_MESSAGE_CONTROL0_3(msg_class, type1_out, type2_out, type3_out) \ @@ -882,33 +877,29 @@ LogFunction g_log_function_mapping[LastMsgIndex]; Tuple3<type1_out&, type2_out&, type3_out&> >{ \ public: \ enum { ID = msg_class##__ID }; \ - msg_class(type1_out* arg1, type2_out* arg2, type3_out* arg3) \ - : IPC::MessageWithReply<Tuple0, \ - Tuple3<type1_out&, type2_out&, type3_out&> >(MSG_ROUTING_CONTROL, \ - ID, \ - MakeTuple(), MakeRefTuple(*arg1, *arg2, *arg3)) {} \ + msg_class(type1_out* arg1, type2_out* arg2, type3_out* arg3); \ + ~msg_class(); \ + static void Log(const Message* msg, std::wstring* l); \ }; -#define IPC_SYNC_MESSAGE_CONTROL1_0(msg_class, type1_in) \ - class msg_class : \ - public IPC::MessageWithReply<Tuple1<type1_in>, Tuple0 > { \ - public: \ - enum { ID = msg_class##__ID }; \ - msg_class(const type1_in& arg1) \ - : IPC::MessageWithReply<Tuple1<type1_in>, Tuple0 >( \ - MSG_ROUTING_CONTROL, ID, \ - MakeRefTuple(arg1), MakeTuple()) {} \ +#define IPC_SYNC_MESSAGE_CONTROL1_0(msg_class, type1_in) \ + class msg_class : \ + public IPC::MessageWithReply<Tuple1<type1_in>, Tuple0 > { \ + public: \ + enum { ID = msg_class##__ID }; \ + msg_class(const type1_in& arg1); \ + ~msg_class(); \ + static void Log(const Message* msg, std::wstring* l); \ }; -#define IPC_SYNC_MESSAGE_CONTROL1_1(msg_class, type1_in, type1_out) \ - class msg_class : \ +#define IPC_SYNC_MESSAGE_CONTROL1_1(msg_class, type1_in, type1_out) \ + class msg_class : \ public IPC::MessageWithReply<Tuple1<type1_in>, Tuple1<type1_out&> > { \ - public: \ - enum { ID = msg_class##__ID }; \ - msg_class(const type1_in& arg1, type1_out* arg2) \ - : IPC::MessageWithReply<Tuple1<type1_in>, Tuple1<type1_out&> >( \ - MSG_ROUTING_CONTROL, ID, \ - MakeRefTuple(arg1), MakeRefTuple(*arg2)) {} \ + public: \ + enum { ID = msg_class##__ID }; \ + msg_class(const type1_in& arg1, type1_out* arg2); \ + ~msg_class(); \ + static void Log(const Message* msg, std::wstring* l); \ }; #define IPC_SYNC_MESSAGE_CONTROL1_2(msg_class, type1_in, type1_out, type2_out) \ @@ -916,10 +907,9 @@ LogFunction g_log_function_mapping[LastMsgIndex]; public IPC::MessageWithReply<Tuple1<type1_in>, Tuple2<type1_out&, type2_out&> > { \ public: \ enum { ID = msg_class##__ID }; \ - msg_class(const type1_in& arg1, type1_out* arg2, type2_out* arg3) \ - : IPC::MessageWithReply<Tuple1<type1_in>, Tuple2<type1_out&, type2_out&> >( \ - MSG_ROUTING_CONTROL, ID, \ - MakeRefTuple(arg1), MakeRefTuple(*arg2, *arg3)) {} \ + msg_class(const type1_in& arg1, type1_out* arg2, type2_out* arg3); \ + ~msg_class(); \ + static void Log(const Message* msg, std::wstring* l); \ }; #define IPC_SYNC_MESSAGE_CONTROL1_3(msg_class, type1_in, type1_out, type2_out, type3_out) \ @@ -928,33 +918,29 @@ LogFunction g_log_function_mapping[LastMsgIndex]; Tuple3<type1_out&, type2_out&, type3_out&> >{ \ public: \ enum { ID = msg_class##__ID }; \ - msg_class(const type1_in& arg1, type1_out* arg2, type2_out* arg3, type3_out* arg4) \ - : IPC::MessageWithReply<Tuple1<type1_in>, \ - Tuple3<type1_out&, type2_out&, type3_out&> >(MSG_ROUTING_CONTROL, \ - ID, \ - MakeRefTuple(arg1), MakeRefTuple(*arg2, *arg3, *arg4)) {} \ + msg_class(const type1_in& arg1, type1_out* arg2, type2_out* arg3, type3_out* arg4); \ + ~msg_class(); \ + static void Log(const Message* msg, std::wstring* l); \ }; -#define IPC_SYNC_MESSAGE_CONTROL2_0(msg_class, type1_in, type2_in) \ - class msg_class : \ +#define IPC_SYNC_MESSAGE_CONTROL2_0(msg_class, type1_in, type2_in) \ + class msg_class : \ public IPC::MessageWithReply<Tuple2<type1_in, type2_in>, Tuple0 > { \ - public: \ - enum { ID = msg_class##__ID }; \ - msg_class(const type1_in& arg1, const type2_in& arg2) \ - : IPC::MessageWithReply<Tuple2<type1_in, type2_in>, Tuple0 >( \ - MSG_ROUTING_CONTROL, ID, \ - MakeRefTuple(arg1, arg2), MakeTuple()) {} \ + public: \ + enum { ID = msg_class##__ID }; \ + msg_class(const type1_in& arg1, const type2_in& arg2); \ + ~msg_class(); \ + static void Log(const Message* msg, std::wstring* l); \ }; #define IPC_SYNC_MESSAGE_CONTROL2_1(msg_class, type1_in, type2_in, type1_out) \ - class msg_class : \ + class msg_class : \ public IPC::MessageWithReply<Tuple2<type1_in, type2_in>, Tuple1<type1_out&> > { \ - public: \ - enum { ID = msg_class##__ID }; \ - msg_class(const type1_in& arg1, const type2_in& arg2, type1_out* arg3) \ - : IPC::MessageWithReply<Tuple2<type1_in, type2_in>, Tuple1<type1_out&> >( \ - MSG_ROUTING_CONTROL, ID, \ - MakeRefTuple(arg1, arg2), MakeRefTuple(*arg3)) {} \ + public: \ + enum { ID = msg_class##__ID }; \ + msg_class(const type1_in& arg1, const type2_in& arg2, type1_out* arg3); \ + ~msg_class(); \ + static void Log(const Message* msg, std::wstring* l); \ }; #define IPC_SYNC_MESSAGE_CONTROL2_2(msg_class, type1_in, type2_in, type1_out, type2_out) \ @@ -963,10 +949,9 @@ LogFunction g_log_function_mapping[LastMsgIndex]; Tuple2<type1_out&, type2_out&> > { \ public: \ enum { ID = msg_class##__ID }; \ - msg_class(const type1_in& arg1, const type2_in& arg2, type1_out* arg3, type2_out* arg4) \ - : IPC::MessageWithReply<Tuple2<type1_in, type2_in>, \ - Tuple2<type1_out&, type2_out&> >(MSG_ROUTING_CONTROL, ID, \ - MakeRefTuple(arg1, arg2), MakeRefTuple(*arg3, *arg4)) {} \ + msg_class(const type1_in& arg1, const type2_in& arg2, type1_out* arg3, type2_out* arg4); \ + ~msg_class(); \ + static void Log(const Message* msg, std::wstring* l); \ }; #define IPC_SYNC_MESSAGE_CONTROL2_3(msg_class, type1_in, type2_in, type1_out, type2_out, type3_out) \ @@ -975,11 +960,9 @@ LogFunction g_log_function_mapping[LastMsgIndex]; Tuple3<type1_out&, type2_out&, type3_out&> > { \ public: \ enum { ID = msg_class##__ID }; \ - msg_class(const type1_in& arg1, const type2_in& arg2, type1_out* arg3, type2_out* arg4, type3_out* arg5) \ - : IPC::MessageWithReply<Tuple2<type1_in, type2_in>, \ - Tuple3<type1_out&, type2_out&, type3_out&> >(MSG_ROUTING_CONTROL, \ - ID, \ - MakeRefTuple(arg1, arg2), MakeRefTuple(*arg3, *arg4, *arg5)) {} \ + msg_class(const type1_in& arg1, const type2_in& arg2, type1_out* arg3, type2_out* arg4, type3_out* arg5); \ + ~msg_class(); \ + static void Log(const Message* msg, std::wstring* l); \ }; #define IPC_SYNC_MESSAGE_CONTROL3_1(msg_class, type1_in, type2_in, type3_in, type1_out) \ @@ -988,10 +971,9 @@ LogFunction g_log_function_mapping[LastMsgIndex]; Tuple1<type1_out&> > { \ public: \ enum { ID = msg_class##__ID }; \ - msg_class(const type1_in& arg1, const type2_in& arg2, const type3_in& arg3, type1_out* arg4) \ - : IPC::MessageWithReply<Tuple3<type1_in, type2_in, type3_in>, \ - Tuple1<type1_out&> >(MSG_ROUTING_CONTROL, ID, \ - MakeRefTuple(arg1, arg2, arg3), MakeRefTuple(*arg4)) {} \ + msg_class(const type1_in& arg1, const type2_in& arg2, const type3_in& arg3, type1_out* arg4); \ + ~msg_class(); \ + static void Log(const Message* msg, std::wstring* l); \ }; #define IPC_SYNC_MESSAGE_CONTROL3_2(msg_class, type1_in, type2_in, type3_in, type1_out, type2_out) \ @@ -1000,10 +982,9 @@ LogFunction g_log_function_mapping[LastMsgIndex]; Tuple2<type1_out&, type2_out&> > { \ public: \ enum { ID = msg_class##__ID }; \ - msg_class(const type1_in& arg1, const type2_in& arg2, const type3_in& arg3, type1_out* arg4, type2_out* arg5) \ - : IPC::MessageWithReply<Tuple3<type1_in, type2_in, type3_in>, \ - Tuple2<type1_out&, type2_out&> >(MSG_ROUTING_CONTROL, ID, \ - MakeRefTuple(arg1, arg2, arg3), MakeRefTuple(*arg4, *arg5)) {} \ + msg_class(const type1_in& arg1, const type2_in& arg2, const type3_in& arg3, type1_out* arg4, type2_out* arg5); \ + ~msg_class(); \ + static void Log(const Message* msg, std::wstring* l); \ }; #define IPC_SYNC_MESSAGE_CONTROL3_3(msg_class, type1_in, type2_in, type3_in, type1_out, type2_out, type3_out) \ @@ -1012,11 +993,9 @@ LogFunction g_log_function_mapping[LastMsgIndex]; Tuple3<type1_out&, type2_out&, type3_out&> > { \ public: \ enum { ID = msg_class##__ID }; \ - msg_class(const type1_in& arg1, const type2_in& arg2, const type3_in& arg3, type1_out* arg4, type2_out* arg5, type3_out* arg6) \ - : IPC::MessageWithReply<Tuple3<type1_in, type2_in, type3_in>, \ - Tuple3<type1_out&, type2_out&, type3_out&> >(MSG_ROUTING_CONTROL, \ - ID, \ - MakeRefTuple(arg1, arg2, arg3), MakeRefTuple(*arg4, *arg5, *arg6)) {} \ + msg_class(const type1_in& arg1, const type2_in& arg2, const type3_in& arg3, type1_out* arg4, type2_out* arg5, type3_out* arg6); \ + ~msg_class(); \ + static void Log(const Message* msg, std::wstring* l); \ }; #define IPC_SYNC_MESSAGE_CONTROL4_1(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out) \ @@ -1025,10 +1004,9 @@ LogFunction g_log_function_mapping[LastMsgIndex]; Tuple1<type1_out&> > { \ public: \ enum { ID = msg_class##__ID }; \ - msg_class(const type1_in& arg1, const type2_in& arg2, const type3_in& arg3, const type4_in& arg4, type1_out* arg6) \ - : IPC::MessageWithReply<Tuple4<type1_in, type2_in, type3_in, type4_in>, \ - Tuple1<type1_out&> >(MSG_ROUTING_CONTROL, ID, \ - MakeRefTuple(arg1, arg2, arg3, arg4), MakeRefTuple(*arg6)) {} \ + msg_class(const type1_in& arg1, const type2_in& arg2, const type3_in& arg3, const type4_in& arg4, type1_out* arg6); \ + ~msg_class(); \ + static void Log(const Message* msg, std::wstring* l); \ }; #define IPC_SYNC_MESSAGE_CONTROL4_2(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out, type2_out) \ @@ -1037,30 +1015,27 @@ LogFunction g_log_function_mapping[LastMsgIndex]; Tuple2<type1_out&, type2_out&> > { \ public: \ enum { ID = msg_class##__ID }; \ - msg_class(const type1_in& arg1, const type2_in& arg2, const type3_in& arg3, const type4_in& arg4, type1_out* arg5, type2_out* arg6) \ - : IPC::MessageWithReply<Tuple4<type1_in, type2_in, type3_in, type4_in>, \ - Tuple2<type1_out&, type2_out&> >(MSG_ROUTING_CONTROL, ID, \ - MakeRefTuple(arg1, arg2, arg3, arg4), MakeRefTuple(*arg5, *arg6)) {} \ + msg_class(const type1_in& arg1, const type2_in& arg2, const type3_in& arg3, const type4_in& arg4, type1_out* arg5, type2_out* arg6); \ + ~msg_class(); \ + static void Log(const Message* msg, std::wstring* l); \ }; -#define IPC_SYNC_MESSAGE_ROUTED0_1(msg_class, type1_out) \ - class msg_class : public IPC::MessageWithReply<Tuple0, Tuple1<type1_out&> > { \ +#define IPC_SYNC_MESSAGE_ROUTED0_0(msg_class) \ + class msg_class : public IPC::MessageWithReply<Tuple0, Tuple0 > { \ public: \ enum { ID = msg_class##__ID }; \ - msg_class(int routing_id, type1_out* arg1) \ - : IPC::MessageWithReply<Tuple0, Tuple1<type1_out&> >( \ - routing_id, ID, \ - MakeTuple(), MakeRefTuple(*arg1)) {} \ + msg_class(int routing_id); \ + ~msg_class(); \ + static void Log(const Message* msg, std::wstring* l); \ }; -#define IPC_SYNC_MESSAGE_ROUTED0_0(msg_class) \ - class msg_class : public IPC::MessageWithReply<Tuple0, Tuple0 > { \ +#define IPC_SYNC_MESSAGE_ROUTED0_1(msg_class, type1_out) \ + class msg_class : public IPC::MessageWithReply<Tuple0, Tuple1<type1_out&> > { \ public: \ enum { ID = msg_class##__ID }; \ - msg_class(int routing_id) \ - : IPC::MessageWithReply<Tuple0, Tuple0 >( \ - routing_id, ID, \ - MakeTuple(), MakeTuple()) {} \ + msg_class(int routing_id, type1_out* arg1); \ + ~msg_class(); \ + static void Log(const Message* msg, std::wstring* l); \ }; #define IPC_SYNC_MESSAGE_ROUTED0_2(msg_class, type1_out, type2_out) \ @@ -1068,10 +1043,9 @@ LogFunction g_log_function_mapping[LastMsgIndex]; public IPC::MessageWithReply<Tuple0, Tuple2<type1_out&, type2_out&> > { \ public: \ enum { ID = msg_class##__ID }; \ - msg_class(int routing_id, type1_out* arg1, type2_out* arg2) \ - : IPC::MessageWithReply<Tuple0, Tuple2<type1_out&, type2_out&> >( \ - routing_id, ID, \ - MakeTuple(), MakeRefTuple(*arg1, *arg2)) {} \ + msg_class(int routing_id, type1_out* arg1, type2_out* arg2); \ + ~msg_class(); \ + static void Log(const Message* msg, std::wstring* l); \ }; #define IPC_SYNC_MESSAGE_ROUTED0_3(msg_class, type1_out, type2_out, type3_out) \ @@ -1080,10 +1054,9 @@ LogFunction g_log_function_mapping[LastMsgIndex]; Tuple3<type1_out&, type2_out&, type3_out&> >{ \ public: \ enum { ID = msg_class##__ID }; \ - msg_class(int routing_id, type1_out* arg1, type2_out* arg2, type3_out* arg3) \ - : IPC::MessageWithReply<Tuple0, \ - Tuple3<type1_out&, type2_out&, type3_out&> >(routing_id, ID, \ - MakeTuple(), MakeRefTuple(*arg1, *arg2, *arg3)) {} \ + msg_class(int routing_id, type1_out* arg1, type2_out* arg2, type3_out* arg3); \ + ~msg_class(); \ + static void Log(const Message* msg, std::wstring* l); \ }; #define IPC_SYNC_MESSAGE_ROUTED1_0(msg_class, type1_in) \ @@ -1091,10 +1064,9 @@ LogFunction g_log_function_mapping[LastMsgIndex]; public IPC::MessageWithReply<Tuple1<type1_in>, Tuple0 > { \ public: \ enum { ID = msg_class##__ID }; \ - msg_class(int routing_id, const type1_in& arg1) \ - : IPC::MessageWithReply<Tuple1<type1_in>, Tuple0 >( \ - routing_id, ID, \ - MakeRefTuple(arg1), MakeTuple()) {} \ + msg_class(int routing_id, const type1_in& arg1); \ + ~msg_class(); \ + static void Log(const Message* msg, std::wstring* l); \ }; #define IPC_SYNC_MESSAGE_ROUTED1_1(msg_class, type1_in, type1_out) \ @@ -1102,10 +1074,9 @@ LogFunction g_log_function_mapping[LastMsgIndex]; public IPC::MessageWithReply<Tuple1<type1_in>, Tuple1<type1_out&> > { \ public: \ enum { ID = msg_class##__ID }; \ - msg_class(int routing_id, const type1_in& arg1, type1_out* arg2) \ - : IPC::MessageWithReply<Tuple1<type1_in>, Tuple1<type1_out&> >( \ - routing_id, ID, \ - MakeRefTuple(arg1), MakeRefTuple(*arg2)) {} \ + msg_class(int routing_id, const type1_in& arg1, type1_out* arg2); \ + ~msg_class(); \ + static void Log(const Message* msg, std::wstring* l); \ }; #define IPC_SYNC_MESSAGE_ROUTED1_2(msg_class, type1_in, type1_out, type2_out) \ @@ -1113,10 +1084,9 @@ LogFunction g_log_function_mapping[LastMsgIndex]; public IPC::MessageWithReply<Tuple1<type1_in>, Tuple2<type1_out&, type2_out&> > { \ public: \ enum { ID = msg_class##__ID }; \ - msg_class(int routing_id, const type1_in& arg1, type1_out* arg2, type2_out* arg3) \ - : IPC::MessageWithReply<Tuple1<type1_in>, Tuple2<type1_out&, type2_out&> >( \ - routing_id, ID, \ - MakeRefTuple(arg1), MakeRefTuple(*arg2, *arg3)) {} \ + msg_class(int routing_id, const type1_in& arg1, type1_out* arg2, type2_out* arg3); \ + ~msg_class(); \ + static void Log(const Message* msg, std::wstring* l); \ }; #define IPC_SYNC_MESSAGE_ROUTED1_3(msg_class, type1_in, type1_out, type2_out, type3_out) \ @@ -1125,10 +1095,9 @@ LogFunction g_log_function_mapping[LastMsgIndex]; Tuple3<type1_out&, type2_out&, type3_out&> >{ \ public: \ enum { ID = msg_class##__ID }; \ - msg_class(int routing_id, const type1_in& arg1, type1_out* arg2, type2_out* arg3, type3_out* arg4) \ - : IPC::MessageWithReply<Tuple1<type1_in>, \ - Tuple3<type1_out&, type2_out&, type3_out&> >(routing_id, ID, \ - MakeRefTuple(arg1), MakeRefTuple(*arg2, *arg3, *arg4)) {} \ + msg_class(int routing_id, const type1_in& arg1, type1_out* arg2, type2_out* arg3, type3_out* arg4); \ + ~msg_class(); \ + static void Log(const Message* msg, std::wstring* l); \ }; #define IPC_SYNC_MESSAGE_ROUTED1_4(msg_class, type1_in, type1_out, type2_out, type3_out, type4_out) \ @@ -1137,10 +1106,9 @@ LogFunction g_log_function_mapping[LastMsgIndex]; Tuple4<type1_out&, type2_out&, type3_out&, type4_out&> >{ \ public: \ enum { ID = msg_class##__ID }; \ - msg_class(int routing_id, const type1_in& arg1, type1_out* arg2, type2_out* arg3, type3_out* arg4, type4_out* arg5) \ - : IPC::MessageWithReply<Tuple1<type1_in>, \ - Tuple4<type1_out&, type2_out&, type3_out&, type4_out&> >(routing_id, ID, \ - MakeRefTuple(arg1), MakeRefTuple(*arg2, *arg3, *arg4, *arg5)) {} \ + msg_class(int routing_id, const type1_in& arg1, type1_out* arg2, type2_out* arg3, type3_out* arg4, type4_out* arg5); \ + ~msg_class(); \ + static void Log(const Message* msg, std::wstring* l); \ }; #define IPC_SYNC_MESSAGE_ROUTED2_0(msg_class, type1_in, type2_in) \ @@ -1148,10 +1116,9 @@ LogFunction g_log_function_mapping[LastMsgIndex]; public IPC::MessageWithReply<Tuple2<type1_in, type2_in>, Tuple0 > { \ public: \ enum { ID = msg_class##__ID }; \ - msg_class(int routing_id, const type1_in& arg1, const type2_in& arg2) \ - : IPC::MessageWithReply<Tuple2<type1_in, type2_in>, Tuple0 >( \ - routing_id, ID, \ - MakeRefTuple(arg1, arg2), MakeTuple()) {} \ + msg_class(int routing_id, const type1_in& arg1, const type2_in& arg2); \ + ~msg_class(); \ + static void Log(const Message* msg, std::wstring* l); \ }; #define IPC_SYNC_MESSAGE_ROUTED2_1(msg_class, type1_in, type2_in, type1_out) \ @@ -1159,10 +1126,9 @@ LogFunction g_log_function_mapping[LastMsgIndex]; public IPC::MessageWithReply<Tuple2<type1_in, type2_in>, Tuple1<type1_out&> > { \ public: \ enum { ID = msg_class##__ID }; \ - msg_class(int routing_id, const type1_in& arg1, const type2_in& arg2, type1_out* arg3) \ - : IPC::MessageWithReply<Tuple2<type1_in, type2_in>, Tuple1<type1_out&> >( \ - routing_id, ID, \ - MakeRefTuple(arg1, arg2), MakeRefTuple(*arg3)) {} \ + msg_class(int routing_id, const type1_in& arg1, const type2_in& arg2, type1_out* arg3); \ + ~msg_class(); \ + static void Log(const Message* msg, std::wstring* l); \ }; #define IPC_SYNC_MESSAGE_ROUTED2_2(msg_class, type1_in, type2_in, type1_out, type2_out) \ @@ -1171,10 +1137,9 @@ LogFunction g_log_function_mapping[LastMsgIndex]; Tuple2<type1_out&, type2_out&> > { \ public: \ enum { ID = msg_class##__ID }; \ - msg_class(int routing_id, const type1_in& arg1, const type2_in& arg2, type1_out* arg3, type2_out* arg4) \ - : IPC::MessageWithReply<Tuple2<type1_in, type2_in>, \ - Tuple2<type1_out&, type2_out&> >(routing_id, ID, \ - MakeRefTuple(arg1, arg2), MakeRefTuple(*arg3, *arg4)) {} \ + msg_class(int routing_id, const type1_in& arg1, const type2_in& arg2, type1_out* arg3, type2_out* arg4); \ + ~msg_class(); \ + static void Log(const Message* msg, std::wstring* l); \ }; #define IPC_SYNC_MESSAGE_ROUTED2_3(msg_class, type1_in, type2_in, type1_out, type2_out, type3_out) \ @@ -1183,10 +1148,9 @@ LogFunction g_log_function_mapping[LastMsgIndex]; Tuple3<type1_out&, type2_out&, type3_out&> > { \ public: \ enum { ID = msg_class##__ID }; \ - msg_class(int routing_id, const type1_in& arg1, const type2_in& arg2, type1_out* arg3, type2_out* arg4, type3_out* arg5) \ - : IPC::MessageWithReply<Tuple2<type1_in, type2_in>, \ - Tuple3<type1_out&, type2_out&, type3_out&> >(routing_id, ID, \ - MakeRefTuple(arg1, arg2), MakeRefTuple(*arg3, *arg4, *arg5)) {} \ + msg_class(int routing_id, const type1_in& arg1, const type2_in& arg2, type1_out* arg3, type2_out* arg4, type3_out* arg5); \ + ~msg_class(); \ + static void Log(const Message* msg, std::wstring* l); \ }; #define IPC_SYNC_MESSAGE_ROUTED3_0(msg_class, type1_in, type2_in, type3_in) \ @@ -1194,11 +1158,10 @@ LogFunction g_log_function_mapping[LastMsgIndex]; public IPC::MessageWithReply<Tuple3<type1_in, type2_in, type3_in>, Tuple0 > { \ public: \ enum { ID = msg_class##__ID }; \ - msg_class(int routing_id, const type1_in& arg1, const type2_in& arg2, const type3_in& arg3) \ - : IPC::MessageWithReply<Tuple3<type1_in, type2_in, type3_in>, Tuple0>( \ - routing_id, ID, \ - MakeRefTuple(arg1, arg2, arg3), MakeTuple()) {} \ - }; + msg_class(int routing_id, const type1_in& arg1, const type2_in& arg2, const type3_in& arg3); \ + ~msg_class(); \ + static void Log(const Message* msg, std::wstring* l); \ + }; #define IPC_SYNC_MESSAGE_ROUTED3_1(msg_class, type1_in, type2_in, type3_in, type1_out) \ class msg_class : \ @@ -1206,10 +1169,9 @@ LogFunction g_log_function_mapping[LastMsgIndex]; Tuple1<type1_out&> > { \ public: \ enum { ID = msg_class##__ID }; \ - msg_class(int routing_id, const type1_in& arg1, const type2_in& arg2, const type3_in& arg3, type1_out* arg4) \ - : IPC::MessageWithReply<Tuple3<type1_in, type2_in, type3_in>, \ - Tuple1<type1_out&> >(routing_id, ID, \ - MakeRefTuple(arg1, arg2, arg3), MakeRefTuple(*arg4)) {} \ + msg_class(int routing_id, const type1_in& arg1, const type2_in& arg2, const type3_in& arg3, type1_out* arg4); \ + ~msg_class(); \ + static void Log(const Message* msg, std::wstring* l); \ }; #define IPC_SYNC_MESSAGE_ROUTED3_2(msg_class, type1_in, type2_in, type3_in, type1_out, type2_out) \ @@ -1218,10 +1180,9 @@ LogFunction g_log_function_mapping[LastMsgIndex]; Tuple2<type1_out&, type2_out&> > { \ public: \ enum { ID = msg_class##__ID }; \ - msg_class(int routing_id, const type1_in& arg1, const type2_in& arg2, const type3_in& arg3, type1_out* arg4, type2_out* arg5) \ - : IPC::MessageWithReply<Tuple3<type1_in, type2_in, type3_in>, \ - Tuple2<type1_out&, type2_out&> >(routing_id, ID, \ - MakeRefTuple(arg1, arg2, arg3), MakeRefTuple(*arg4, *arg5)) {} \ + msg_class(int routing_id, const type1_in& arg1, const type2_in& arg2, const type3_in& arg3, type1_out* arg4, type2_out* arg5); \ + ~msg_class(); \ + static void Log(const Message* msg, std::wstring* l); \ }; #define IPC_SYNC_MESSAGE_ROUTED3_3(msg_class, type1_in, type2_in, type3_in, type1_out, type2_out, type3_out) \ @@ -1230,10 +1191,9 @@ LogFunction g_log_function_mapping[LastMsgIndex]; Tuple3<type1_out&, type2_out&, type3_out&> > { \ public: \ enum { ID = msg_class##__ID }; \ - msg_class(int routing_id, const type1_in& arg1, const type2_in& arg2, const type3_in& arg3, type1_out* arg4, type2_out* arg5, type3_out* arg6) \ - : IPC::MessageWithReply<Tuple3<type1_in, type2_in, type3_in>, \ - Tuple3<type1_out&, type2_out&, type3_out&> >(routing_id, ID, \ - MakeRefTuple(arg1, arg2, arg3), MakeRefTuple(*arg4, *arg5, *arg6)) {} \ + msg_class(int routing_id, const type1_in& arg1, const type2_in& arg2, const type3_in& arg3, type1_out* arg4, type2_out* arg5, type3_out* arg6); \ + ~msg_class(); \ + static void Log(const Message* msg, std::wstring* l); \ }; #define IPC_SYNC_MESSAGE_ROUTED4_0(msg_class, type1_in, type2_in, type3_in, type4_in) \ @@ -1242,10 +1202,9 @@ LogFunction g_log_function_mapping[LastMsgIndex]; Tuple0 > { \ public: \ enum { ID = msg_class##__ID }; \ - msg_class(int routing_id, const type1_in& arg1, const type2_in& arg2, const type3_in& arg3, const type4_in& arg4) \ - : IPC::MessageWithReply<Tuple4<type1_in, type2_in, type3_in, type4_in>, \ - Tuple0 >(routing_id, ID, \ - MakeRefTuple(arg1, arg2, arg3, arg4), MakeTuple()) {} \ + msg_class(int routing_id, const type1_in& arg1, const type2_in& arg2, const type3_in& arg3, const type4_in& arg4); \ + ~msg_class(); \ + static void Log(const Message* msg, std::wstring* l); \ }; #define IPC_SYNC_MESSAGE_ROUTED4_1(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out) \ @@ -1254,10 +1213,9 @@ LogFunction g_log_function_mapping[LastMsgIndex]; Tuple1<type1_out&> > { \ public: \ enum { ID = msg_class##__ID }; \ - msg_class(int routing_id, const type1_in& arg1, const type2_in& arg2, const type3_in& arg3, const type4_in& arg4, type1_out* arg6) \ - : IPC::MessageWithReply<Tuple4<type1_in, type2_in, type3_in, type4_in>, \ - Tuple1<type1_out&> >(routing_id, ID, \ - MakeRefTuple(arg1, arg2, arg3, arg4), MakeRefTuple(*arg6)) {} \ + msg_class(int routing_id, const type1_in& arg1, const type2_in& arg2, const type3_in& arg3, const type4_in& arg4, type1_out* arg6); \ + ~msg_class(); \ + static void Log(const Message* msg, std::wstring* l); \ }; #define IPC_SYNC_MESSAGE_ROUTED4_2(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out, type2_out) \ @@ -1266,10 +1224,9 @@ LogFunction g_log_function_mapping[LastMsgIndex]; Tuple2<type1_out&, type2_out&> > { \ public: \ enum { ID = msg_class##__ID }; \ - msg_class(int routing_id, const type1_in& arg1, const type2_in& arg2, const type3_in& arg3, const type4_in& arg4, type1_out* arg5, type2_out* arg6) \ - : IPC::MessageWithReply<Tuple4<type1_in, type2_in, type3_in, type4_in>, \ - Tuple2<type1_out&, type2_out&> >(routing_id, ID, \ - MakeRefTuple(arg1, arg2, arg3, arg4), MakeRefTuple(*arg5, *arg6)) {} \ + msg_class(int routing_id, const type1_in& arg1, const type2_in& arg2, const type3_in& arg3, const type4_in& arg4, type1_out* arg5, type2_out* arg6); \ + ~msg_class(); \ + static void Log(const Message* msg, std::wstring* l); \ }; #define IPC_SYNC_MESSAGE_ROUTED4_3(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out, type2_out, type3_out) \ @@ -1278,10 +1235,9 @@ LogFunction g_log_function_mapping[LastMsgIndex]; Tuple3<type1_out&, type2_out&, type3_out&> > { \ public: \ enum { ID = msg_class##__ID }; \ - msg_class(int routing_id, const type1_in& arg1, const type2_in& arg2, const type3_in& arg3, const type4_in& arg4, type1_out* arg5, type2_out* arg6, type3_out* arg7) \ - : IPC::MessageWithReply<Tuple4<type1_in, type2_in, type3_in, type4_in>, \ - Tuple3<type1_out&, type2_out&, type3_out&> >(routing_id, ID, \ - MakeRefTuple(arg1, arg2, arg3, arg4), MakeRefTuple(*arg5, *arg6, *arg7)) {} \ + msg_class(int routing_id, const type1_in& arg1, const type2_in& arg2, const type3_in& arg3, const type4_in& arg4, type1_out* arg5, type2_out* arg6, type3_out* arg7); \ + ~msg_class(); \ + static void Log(const Message* msg, std::wstring* l); \ }; #define IPC_SYNC_MESSAGE_ROUTED5_0(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in) \ @@ -1290,10 +1246,9 @@ LogFunction g_log_function_mapping[LastMsgIndex]; Tuple0 > { \ public: \ enum { ID = msg_class##__ID }; \ - msg_class(int routing_id, const type1_in& arg1, const type2_in& arg2, const type3_in& arg3, const type4_in& arg4, const type5_in& arg5) \ - : IPC::MessageWithReply<Tuple5<type1_in, type2_in, type3_in, type4_in, type5_in>, \ - Tuple0 >(routing_id, ID, \ - MakeRefTuple(arg1, arg2, arg3, arg4, arg5), MakeTuple()) {} \ + msg_class(int routing_id, const type1_in& arg1, const type2_in& arg2, const type3_in& arg3, const type4_in& arg4, const type5_in& arg5); \ + ~msg_class(); \ + static void Log(const Message* msg, std::wstring* l); \ }; #define IPC_SYNC_MESSAGE_ROUTED5_1(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in, type1_out) \ @@ -1302,10 +1257,9 @@ LogFunction g_log_function_mapping[LastMsgIndex]; Tuple1<type1_out&> > { \ public: \ enum { ID = msg_class##__ID }; \ - msg_class(int routing_id, const type1_in& arg1, const type2_in& arg2, const type3_in& arg3, const type4_in& arg4, const type5_in& arg5, type1_out* arg6) \ - : IPC::MessageWithReply<Tuple5<type1_in, type2_in, type3_in, type4_in, type5_in>, \ - Tuple1<type1_out&> >(routing_id, ID, \ - MakeRefTuple(arg1, arg2, arg3, arg4, arg5), MakeRefTuple(*arg6)) {} \ + msg_class(int routing_id, const type1_in& arg1, const type2_in& arg2, const type3_in& arg3, const type4_in& arg4, const type5_in& arg5, type1_out* arg6); \ + ~msg_class(); \ + static void Log(const Message* msg, std::wstring* l); \ }; #define IPC_SYNC_MESSAGE_ROUTED5_2(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in, type1_out, type2_out) \ @@ -1314,10 +1268,9 @@ LogFunction g_log_function_mapping[LastMsgIndex]; Tuple2<type1_out&, type2_out&> > { \ public: \ enum { ID = msg_class##__ID }; \ - msg_class(int routing_id, const type1_in& arg1, const type2_in& arg2, const type3_in& arg3, const type4_in& arg4, const type4_in& arg5, type1_out* arg6, type2_out* arg7) \ - : IPC::MessageWithReply<Tuple5<type1_in, type2_in, type3_in, type4_in, type5_in>, \ - Tuple2<type1_out&, type2_out&> >(routing_id, ID, \ - MakeRefTuple(arg1, arg2, arg3, arg4, arg5), MakeRefTuple(*arg6, *arg7)) {} \ + msg_class(int routing_id, const type1_in& arg1, const type2_in& arg2, const type3_in& arg3, const type4_in& arg4, const type4_in& arg5, type1_out* arg6, type2_out* arg7); \ + ~msg_class(); \ + static void Log(const Message* msg, std::wstring* l); \ }; #define IPC_SYNC_MESSAGE_ROUTED5_3(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in, type1_out, type2_out, type3_out) \ @@ -1326,10 +1279,9 @@ LogFunction g_log_function_mapping[LastMsgIndex]; Tuple3<type1_out&, type2_out&, type3_out&> > { \ public: \ enum { ID = msg_class##__ID }; \ - msg_class(int routing_id, const type1_in& arg1, const type2_in& arg2, const type3_in& arg3, const type4_in& arg4, const type4_in& arg5, type1_out* arg6, type2_out* arg7, type3_out* arg8) \ - : IPC::MessageWithReply<Tuple5<type1_in, type2_in, type3_in, type4_in, type5_in>, \ - Tuple3<type1_out&, type2_out&, type3_out&> >(routing_id, ID, \ - MakeRefTuple(arg1, arg2, arg3, arg4, arg5), MakeRefTuple(*arg6, *arg7, *arg8)) {} \ + msg_class(int routing_id, const type1_in& arg1, const type2_in& arg2, const type3_in& arg3, const type4_in& arg4, const type4_in& arg5, type1_out* arg6, type2_out* arg7, type3_out* arg8); \ + ~msg_class(); \ + static void Log(const Message* msg, std::wstring* l); \ }; #endif // #if defined() diff --git a/ipc/ipc_message_utils.h b/ipc/ipc_message_utils.h index cdad102..4882688 100644 --- a/ipc/ipc_message_utils.h +++ b/ipc/ipc_message_utils.h @@ -1164,8 +1164,54 @@ class MessageWithTuple : public Message { } }; +// defined in ipc_logging.cc +void GenerateLogData(const std::string& channel, const Message& message, + LogData* data); + + +#if defined(IPC_MESSAGE_LOG_ENABLED) +inline void AddOutputParamsToLog(const Message* msg, std::wstring* l) { + const std::wstring& output_params = msg->output_params(); + if (!l->empty() && !output_params.empty()) + l->append(L", "); + + l->append(output_params); +} + +template <class ReplyParamType> +inline void LogReplyParamsToMessage(const ReplyParamType& reply_params, + const Message* msg) { + if (msg->received_time() != 0) { + std::wstring output_params; + LogParam(reply_params, &output_params); + msg->set_output_params(output_params); + } +} + +inline void ConnectMessageAndReply(const Message* msg, Message* reply) { + if (msg->sent_time()) { + // Don't log the sync message after dispatch, as we don't have the + // output parameters at that point. Instead, save its data and log it + // with the outgoing reply message when it's sent. + LogData* data = new LogData; + GenerateLogData("", *msg, data); + msg->set_dont_log(); + reply->set_sync_log_data(data); + } +} +#else +inline void AddOutputParamsToLog(const Message* msg, std::wstring* l) {} + +template <class ReplyParamType> +inline void LogReplyParamsToMessage(const ReplyParamType& reply_params, + const Message* msg) {} + +inline void ConnectMessageAndReply(const Message* msg, Message* reply) {} +#endif + // This class assumes that its template argument is a RefTuple (a Tuple with -// reference elements). +// reference elements). This would go into ipc_message_utils_impl.h, but it is +// also used by chrome_frame. template <class RefTuple> class ParamDeserializer : public MessageReplyDeserializer { public: @@ -1178,10 +1224,6 @@ class ParamDeserializer : public MessageReplyDeserializer { RefTuple out_; }; -// defined in ipc_logging.cc -void GenerateLogData(const std::string& channel, const Message& message, - LogData* data); - // Used for synchronous messages. template <class SendParamType, class ReplyParamType> class MessageWithReply : public SyncMessage { @@ -1191,54 +1233,33 @@ class MessageWithReply : public SyncMessage { typedef ReplyParamType ReplyParam; MessageWithReply(int32 routing_id, uint32 type, - const RefSendParam& send, const ReplyParam& reply) - : SyncMessage(routing_id, type, PRIORITY_NORMAL, - new ParamDeserializer<ReplyParam>(reply)) { - WriteParam(this, send); - } - - static void Log(const Message* msg, std::wstring* l) { - if (msg->is_sync()) { - SendParam p; - void* iter = SyncMessage::GetDataIterator(msg); - if (ReadParam(msg, &iter, &p)) - LogParam(p, l); + const RefSendParam& send, const ReplyParam& reply); -#if defined(IPC_MESSAGE_LOG_ENABLED) - const std::wstring& output_params = msg->output_params(); - if (!l->empty() && !output_params.empty()) - l->append(L", "); + // TODO(erg): Migrate these ReadSendParam/ReadReplyParam() methods to + // ipc_message_utils_impl.h once I figure out how to get the linkage correct + // in the release builds. + static bool ReadSendParam(const Message* msg, SendParam* p) { + void* iter = SyncMessage::GetDataIterator(msg); + return ReadParam(msg, &iter, p); + } - l->append(output_params); -#endif - } else { - // This is an outgoing reply. Now that we have the output parameters, we - // can finally log the message. - typename TupleTypes<ReplyParam>::ValueTuple p; - void* iter = SyncMessage::GetDataIterator(msg); - if (ReadParam(msg, &iter, &p)) - LogParam(p, l); - } + static bool ReadReplyParam(const Message* msg, + typename TupleTypes<ReplyParam>::ValueTuple* p) { + void* iter = SyncMessage::GetDataIterator(msg); + return ReadParam(msg, &iter, p); } template<class T, class Method> static bool Dispatch(const Message* msg, T* obj, Method func) { SendParam send_params; - void* iter = GetDataIterator(msg); Message* reply = GenerateReply(msg); bool error; - if (ReadParam(msg, &iter, &send_params)) { + if (ReadSendParam(msg, &send_params)) { typename TupleTypes<ReplyParam>::ValueTuple reply_params; DispatchToMethod(obj, func, send_params, &reply_params); WriteParam(reply, reply_params); error = false; -#ifdef IPC_MESSAGE_LOG_ENABLED - if (msg->received_time() != 0) { - std::wstring output_params; - LogParam(reply_params, &output_params); - msg->set_output_params(output_params); - } -#endif + LogReplyParamsToMessage(reply_params, msg); } else { NOTREACHED() << "Error deserializing message " << msg->type(); reply->set_reply_error(); @@ -1252,23 +1273,11 @@ class MessageWithReply : public SyncMessage { template<class T, class Method> static bool DispatchDelayReply(const Message* msg, T* obj, Method func) { SendParam send_params; - void* iter = GetDataIterator(msg); Message* reply = GenerateReply(msg); bool error; - if (ReadParam(msg, &iter, &send_params)) { + if (ReadSendParam(msg, &send_params)) { Tuple1<Message&> t = MakeRefTuple(*reply); - -#ifdef IPC_MESSAGE_LOG_ENABLED - if (msg->sent_time()) { - // Don't log the sync message after dispatch, as we don't have the - // output parameters at that point. Instead, save its data and log it - // with the outgoing reply message when it's sent. - LogData* data = new LogData; - GenerateLogData("", *msg, data); - msg->set_dont_log(); - reply->set_sync_log_data(data); - } -#endif + ConnectMessageAndReply(msg, reply); DispatchToMethod(obj, func, send_params, &t); error = false; } else { diff --git a/ipc/ipc_message_utils_impl.h b/ipc/ipc_message_utils_impl.h index ba11990..53c7986 100644 --- a/ipc/ipc_message_utils_impl.h +++ b/ipc/ipc_message_utils_impl.h @@ -25,6 +25,19 @@ MessageWithTuple<ParamType>::MessageWithTuple( // subclass needs to have Log() to call Read(), which instantiates the above // template. +template <class SendParamType, class ReplyParamType> +MessageWithReply<SendParamType, ReplyParamType>::MessageWithReply( + int32 routing_id, uint32 type, + const RefSendParam& send, + const ReplyParam& reply) + : SyncMessage(routing_id, type, PRIORITY_NORMAL, + new ParamDeserializer<ReplyParam>(reply)) { + WriteParam(this, send); +} + +// TODO(erg): Migrate ReadSendParam()/ReadReplyParam() here when we can force +// the visibility/linkage. + } // namespace IPC #endif // IPC_IPC_MESSAGE_UTILS_IMPL_H_ diff --git a/ipc/ipc_sync_channel_unittest.cc b/ipc/ipc_sync_channel_unittest.cc index 87e9773..a3b757a 100644 --- a/ipc/ipc_sync_channel_unittest.cc +++ b/ipc/ipc_sync_channel_unittest.cc @@ -26,6 +26,10 @@ #define MESSAGES_INTERNAL_FILE "ipc/ipc_sync_message_unittest.h" #include "ipc/ipc_message_macros.h" +// Definition of IPC Messages used for this test. +#define MESSAGES_INTERNAL_IMPL_FILE "ipc/ipc_sync_message_unittest.h" +#include "ipc/ipc_message_impl_macros.h" + using namespace IPC; using base::WaitableEvent; |