diff options
Diffstat (limited to 'ipc')
-rw-r--r-- | ipc/ipc_message_impl_macros.h | 16 | ||||
-rw-r--r-- | ipc/ipc_message_macros.h | 20 | ||||
-rw-r--r-- | ipc/ipc_sync_message_unittest.cc | 15 | ||||
-rw-r--r-- | ipc/ipc_sync_message_unittest.h | 4 |
4 files changed, 55 insertions, 0 deletions
diff --git a/ipc/ipc_message_impl_macros.h b/ipc/ipc_message_impl_macros.h index e2325a5..0e66cea 100644 --- a/ipc/ipc_message_impl_macros.h +++ b/ipc/ipc_message_impl_macros.h @@ -60,6 +60,7 @@ #undef IPC_SYNC_MESSAGE_CONTROL3_1 #undef IPC_SYNC_MESSAGE_CONTROL3_2 #undef IPC_SYNC_MESSAGE_CONTROL3_3 +#undef IPC_SYNC_MESSAGE_CONTROL3_4 #undef IPC_SYNC_MESSAGE_CONTROL4_1 #undef IPC_SYNC_MESSAGE_CONTROL4_2 #undef IPC_SYNC_MESSAGE_ROUTED0_0 @@ -360,6 +361,21 @@ \ IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) +#define IPC_SYNC_MESSAGE_CONTROL3_4(msg_class, type1_in, type2_in, \ + type3_in, type1_out, type2_out, \ + type3_out, type4_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, type4_out* arg7) \ + : IPC::MessageWithReply<Tuple3<type1_in, type2_in, type3_in>, \ + Tuple4<type1_out&, type2_out&, type3_out&, type4_out&> >( \ + MSG_ROUTING_CONTROL, \ + ID, \ + MakeRefTuple(arg1, arg2, arg3), \ + MakeRefTuple(*arg4, *arg5, *arg6, *arg7)) {} \ + \ + 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, \ diff --git a/ipc/ipc_message_macros.h b/ipc/ipc_message_macros.h index ebfd7c6..39c4e38 100644 --- a/ipc/ipc_message_macros.h +++ b/ipc/ipc_message_macros.h @@ -113,6 +113,7 @@ #undef IPC_SYNC_MESSAGE_CONTROL3_1 #undef IPC_SYNC_MESSAGE_CONTROL3_2 #undef IPC_SYNC_MESSAGE_CONTROL3_3 +#undef IPC_SYNC_MESSAGE_CONTROL3_4 #undef IPC_SYNC_MESSAGE_CONTROL4_1 #undef IPC_SYNC_MESSAGE_CONTROL4_2 #undef IPC_SYNC_MESSAGE_ROUTED0_0 @@ -235,6 +236,9 @@ #define IPC_SYNC_MESSAGE_CONTROL3_3(msg_class, type1_in, type2_in, type3_in, type1_out, type2_out, type3_out) \ msg_class##__ID, +#define IPC_SYNC_MESSAGE_CONTROL3_4(msg_class, type1_in, type2_in, type3_in, type1_out, type2_out, type3_out, type4_out) \ + msg_class##__ID, + #define IPC_SYNC_MESSAGE_CONTROL4_1(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out) \ msg_class##__ID, @@ -430,6 +434,7 @@ void class_name::OnMessageReceived(const IPC::Message& msg) \ #undef IPC_SYNC_MESSAGE_CONTROL3_1 #undef IPC_SYNC_MESSAGE_CONTROL3_2 #undef IPC_SYNC_MESSAGE_CONTROL3_3 +#undef IPC_SYNC_MESSAGE_CONTROL3_4 #undef IPC_SYNC_MESSAGE_CONTROL4_1 #undef IPC_SYNC_MESSAGE_CONTROL4_2 #undef IPC_SYNC_MESSAGE_ROUTED0_0 @@ -576,6 +581,9 @@ LogFunction g_log_function_mapping[LastMsgIndex]; #define IPC_SYNC_MESSAGE_CONTROL3_3(msg_class, type1_in, type2_in, type3_in, type1_out, type2_out, type3_out) \ IPC_MESSAGE_LOG(msg_class) +#define IPC_SYNC_MESSAGE_CONTROL3_4(msg_class, type1_in, type2_in, type3_in, type1_out, type2_out, type3_out, type4_out) \ + IPC_MESSAGE_LOG(msg_class) + #define IPC_SYNC_MESSAGE_CONTROL4_1(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out) \ IPC_MESSAGE_LOG(msg_class) @@ -691,6 +699,7 @@ LogFunction g_log_function_mapping[LastMsgIndex]; #undef IPC_SYNC_MESSAGE_CONTROL3_1 #undef IPC_SYNC_MESSAGE_CONTROL3_2 #undef IPC_SYNC_MESSAGE_CONTROL3_3 +#undef IPC_SYNC_MESSAGE_CONTROL3_4 #undef IPC_SYNC_MESSAGE_CONTROL4_1 #undef IPC_SYNC_MESSAGE_CONTROL4_2 #undef IPC_SYNC_MESSAGE_ROUTED0_0 @@ -998,6 +1007,17 @@ LogFunction g_log_function_mapping[LastMsgIndex]; static void Log(const Message* msg, std::string* l); \ }; +#define IPC_SYNC_MESSAGE_CONTROL3_4(msg_class, type1_in, type2_in, type3_in, type1_out, type2_out, type3_out, type4_out) \ + class msg_class : \ + public IPC::MessageWithReply<Tuple3<type1_in, type2_in, type3_in>, \ + Tuple4<type1_out&, type2_out&, type3_out&, type4_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, type4_out* arg7); \ + ~msg_class(); \ + static void Log(const Message* msg, std::string* l); \ + }; + #define IPC_SYNC_MESSAGE_CONTROL4_1(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out) \ class msg_class : \ public IPC::MessageWithReply<Tuple4<type1_in, type2_in, type3_in, type4_in>, \ diff --git a/ipc/ipc_sync_message_unittest.cc b/ipc/ipc_sync_message_unittest.cc index 1c92574..506f4c0 100644 --- a/ipc/ipc_sync_message_unittest.cc +++ b/ipc/ipc_sync_message_unittest.cc @@ -93,6 +93,15 @@ class TestMessageReceiver { *out3 = false; } + void On_3_4(bool in1, int in2, std::string in3, int* out1, bool* out2, + std::string* out3, bool* out4) { + DCHECK(in1 && in2 == 3 && in3 == "3_4"); + *out1 = 34; + *out2 = true; + *out3 = "3_4"; + *out4 = false; + } + bool Send(IPC::Message* message) { // gets the reply message, stash in global DCHECK(g_reply == NULL); @@ -114,6 +123,7 @@ class TestMessageReceiver { IPC_MESSAGE_HANDLER(Msg_C_3_1, On_3_1) IPC_MESSAGE_HANDLER(Msg_C_3_2, On_3_2) IPC_MESSAGE_HANDLER(Msg_C_3_3, On_3_3) + IPC_MESSAGE_HANDLER(Msg_C_3_4, On_3_4) IPC_MESSAGE_HANDLER(Msg_R_0_1, On_0_1) IPC_MESSAGE_HANDLER(Msg_R_0_2, On_0_2) IPC_MESSAGE_HANDLER(Msg_R_0_3, On_0_3) @@ -201,6 +211,11 @@ TEST(IPCSyncMessageTest, Main) { Send(new Msg_C_3_3(3, "3_3", true, &string1, &int1, &bool1)); DCHECK(string1 == "3_3" && int1 == 33 && !bool1); + bool1 = false; + bool bool2 = true; + Send(new Msg_C_3_4(true, 3, "3_4", &int1, &bool1, &string1, &bool2)); + DCHECK(int1 == 34 && bool1 && string1 == "3_4" && !bool2); + // Routed messages, just a copy of the above but with extra routing paramater Send(new Msg_R_0_1(0, &bool1)); DCHECK(!bool1); diff --git a/ipc/ipc_sync_message_unittest.h b/ipc/ipc_sync_message_unittest.h index f4e98c1..1aa857a 100644 --- a/ipc/ipc_sync_message_unittest.h +++ b/ipc/ipc_sync_message_unittest.h @@ -58,6 +58,10 @@ IPC_BEGIN_MESSAGES(Test) IPC_SYNC_MESSAGE_CONTROL3_3(Msg_C_3_3, int, std::string, bool, std::string, int, bool) + // in1 must be true, in2 must be 3, in3 must be "3_4", out1 is 34, out2 is + // true, out3 is "3_4", out3 is false + IPC_SYNC_MESSAGE_CONTROL3_4(Msg_C_3_4, bool, int, std::string, int, bool, + std::string, bool) // NOTE: routed messages are just a copy of the above... |