diff options
author | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-17 18:38:24 +0000 |
---|---|---|
committer | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-17 18:38:24 +0000 |
commit | 7a4de7a6cefa6c56d42e6abe17f815b048269354 (patch) | |
tree | ee80ec60dfb6853c323238e714cc970297ee70ab /ipc | |
parent | 17e5f7d53a09582719e9e0a942643463944fb749 (diff) | |
download | chromium_src-7a4de7a6cefa6c56d42e6abe17f815b048269354.zip chromium_src-7a4de7a6cefa6c56d42e6abe17f815b048269354.tar.gz chromium_src-7a4de7a6cefa6c56d42e6abe17f815b048269354.tar.bz2 |
Reapplies all the IPC system work (reverts the revert r56272).
That patch wasn't what caused the regression in the page cycler.
BUG=51411,52103
TEST=still compiles
Review URL: http://codereview.chromium.org/3106018
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@56390 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ipc')
-rw-r--r-- | ipc/ipc_fuzzing_tests.cc | 1 | ||||
-rw-r--r-- | ipc/ipc_message_impl_macros.h | 674 | ||||
-rw-r--r-- | ipc/ipc_message_macros.h | 633 | ||||
-rw-r--r-- | ipc/ipc_message_utils.cc | 127 | ||||
-rw-r--r-- | ipc/ipc_message_utils.h | 291 | ||||
-rw-r--r-- | ipc/ipc_message_utils_impl.h | 60 | ||||
-rw-r--r-- | ipc/ipc_send_fds_test.cc | 1 | ||||
-rw-r--r-- | ipc/ipc_sync_channel_unittest.cc | 4 | ||||
-rw-r--r-- | ipc/sync_socket_unittest.cc | 1 |
9 files changed, 1326 insertions, 466 deletions
diff --git a/ipc/ipc_fuzzing_tests.cc b/ipc/ipc_fuzzing_tests.cc index f9340e6..9817ade 100644 --- a/ipc/ipc_fuzzing_tests.cc +++ b/ipc/ipc_fuzzing_tests.cc @@ -12,6 +12,7 @@ #include "ipc/ipc_channel.h" #include "ipc/ipc_channel_proxy.h" #include "ipc/ipc_message_utils.h" +#include "ipc/ipc_message_utils_impl.h" #include "ipc/ipc_tests.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/multiprocess_func_list.h" diff --git a/ipc/ipc_message_impl_macros.h b/ipc/ipc_message_impl_macros.h new file mode 100644 index 0000000..f9eede9 --- /dev/null +++ b/ipc/ipc_message_impl_macros.h @@ -0,0 +1,674 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// The file ipc_messsage_macros.h defines the classes for individual +// messages. This file works similarly, except that it defines the +// 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. + +#ifndef IPC_IPC_MESSAGE_IMPL_MACROS_H_ +#define IPC_IPC_MESSAGE_IMPL_MACROS_H_ + +#include "ipc/ipc_message_utils.h" +#include "ipc/ipc_message_utils_impl.h" + +#ifndef MESSAGES_INTERNAL_IMPL_FILE +#error This file should only be included by X_messages.cc, which needs to define MESSAGES_INTERNAL_IMPL_FILE first. +#endif + +// Trick scons and xcode into seeing the possible real dependencies since they +// don't understand #include MESSAGES_INTERNAL_FILE. See http://crbug.com/7828 +#if 0 +#include "ipc/ipc_sync_message_unittest.h" +#include "chrome/common/plugin_messages_internal.h" +#include "chrome/common/render_messages_internal.h" +#include "chrome/common/devtools_messages_internal.h" +#include "chrome/test/automation/automation_messages_internal.h" +#include "chrome/common/worker_messages_internal.h" +#endif + +// These are probalby still defined because of ipc_message_macros.h should be +// included before us for the class/method declarations. +#undef IPC_BEGIN_MESSAGES +#undef IPC_END_MESSAGES +#undef IPC_MESSAGE_CONTROL0 +#undef IPC_MESSAGE_CONTROL1 +#undef IPC_MESSAGE_CONTROL2 +#undef IPC_MESSAGE_CONTROL3 +#undef IPC_MESSAGE_CONTROL4 +#undef IPC_MESSAGE_CONTROL5 +#undef IPC_MESSAGE_ROUTED0 +#undef IPC_MESSAGE_ROUTED1 +#undef IPC_MESSAGE_ROUTED2 +#undef IPC_MESSAGE_ROUTED3 +#undef IPC_MESSAGE_ROUTED4 +#undef IPC_MESSAGE_ROUTED5 +#undef IPC_SYNC_MESSAGE_CONTROL0_0 +#undef IPC_SYNC_MESSAGE_CONTROL0_1 +#undef IPC_SYNC_MESSAGE_CONTROL0_2 +#undef IPC_SYNC_MESSAGE_CONTROL0_3 +#undef IPC_SYNC_MESSAGE_CONTROL1_0 +#undef IPC_SYNC_MESSAGE_CONTROL1_1 +#undef IPC_SYNC_MESSAGE_CONTROL1_2 +#undef IPC_SYNC_MESSAGE_CONTROL1_3 +#undef IPC_SYNC_MESSAGE_CONTROL2_0 +#undef IPC_SYNC_MESSAGE_CONTROL2_1 +#undef IPC_SYNC_MESSAGE_CONTROL2_2 +#undef IPC_SYNC_MESSAGE_CONTROL2_3 +#undef IPC_SYNC_MESSAGE_CONTROL3_1 +#undef IPC_SYNC_MESSAGE_CONTROL3_2 +#undef IPC_SYNC_MESSAGE_CONTROL3_3 +#undef IPC_SYNC_MESSAGE_CONTROL4_1 +#undef IPC_SYNC_MESSAGE_CONTROL4_2 +#undef IPC_SYNC_MESSAGE_ROUTED0_0 +#undef IPC_SYNC_MESSAGE_ROUTED0_1 +#undef IPC_SYNC_MESSAGE_ROUTED0_2 +#undef IPC_SYNC_MESSAGE_ROUTED0_3 +#undef IPC_SYNC_MESSAGE_ROUTED1_0 +#undef IPC_SYNC_MESSAGE_ROUTED1_1 +#undef IPC_SYNC_MESSAGE_ROUTED1_2 +#undef IPC_SYNC_MESSAGE_ROUTED1_3 +#undef IPC_SYNC_MESSAGE_ROUTED1_4 +#undef IPC_SYNC_MESSAGE_ROUTED2_0 +#undef IPC_SYNC_MESSAGE_ROUTED2_1 +#undef IPC_SYNC_MESSAGE_ROUTED2_2 +#undef IPC_SYNC_MESSAGE_ROUTED2_3 +#undef IPC_SYNC_MESSAGE_ROUTED3_0 +#undef IPC_SYNC_MESSAGE_ROUTED3_1 +#undef IPC_SYNC_MESSAGE_ROUTED3_2 +#undef IPC_SYNC_MESSAGE_ROUTED3_3 +#undef IPC_SYNC_MESSAGE_ROUTED4_0 +#undef IPC_SYNC_MESSAGE_ROUTED4_1 +#undef IPC_SYNC_MESSAGE_ROUTED4_2 +#undef IPC_SYNC_MESSAGE_ROUTED4_3 +#undef IPC_SYNC_MESSAGE_ROUTED5_0 +#undef IPC_SYNC_MESSAGE_ROUTED5_1 +#undef IPC_SYNC_MESSAGE_ROUTED5_2 +#undef IPC_SYNC_MESSAGE_ROUTED5_3 + +// These don't do anything during this pass. +#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) + +#define IPC_MESSAGE_CONTROL1(msg_class, type1) \ + msg_class::msg_class(const type1& arg1) \ + : IPC::MessageWithTuple< Tuple1<type1> >( \ + MSG_ROUTING_CONTROL, ID, MakeRefTuple(arg1)) {} \ + \ + 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)) {} \ + \ + 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, \ + const type3& arg3) \ + : IPC::MessageWithTuple< Tuple3<type1, type2, type3> >( \ + MSG_ROUTING_CONTROL, ID, MakeRefTuple(arg1, arg2, arg3)) {} \ + \ + 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, \ + const type3& arg3, const type4& arg4) \ + : IPC::MessageWithTuple< Tuple4<type1, type2, type3, type4> >( \ + MSG_ROUTING_CONTROL, ID, MakeRefTuple(arg1, arg2, arg3, arg4)) {} \ + \ + 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, \ + const type3& arg3, const type4& arg4, \ + const type5& arg5) \ + : IPC::MessageWithTuple< Tuple5<type1, type2, type3, type4, type5> >( \ + MSG_ROUTING_CONTROL, ID, \ + MakeRefTuple(arg1, arg2, arg3, arg4, arg5)) {} \ + \ + 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. +#define IPC_MESSAGE_ROUTED0(msg_class) + +#define IPC_MESSAGE_ROUTED1(msg_class, type1) \ + msg_class::msg_class(int32 routing_id, const type1& arg1) \ + : IPC::MessageWithTuple< Tuple1<type1> >( \ + routing_id, ID, MakeRefTuple(arg1)) {} \ + \ + 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)) {} \ + \ + IPC_ASYNC_MESSAGE_DTOR_AND_LOG(msg_class) + + +#define IPC_MESSAGE_ROUTED3(msg_class, type1, type2, type3) \ + msg_class::msg_class(int32 routing_id, const type1& arg1, \ + const type2& arg2, const type3& arg3) \ + : IPC::MessageWithTuple< Tuple3<type1, type2, type3> >( \ + routing_id, ID, MakeRefTuple(arg1, arg2, arg3)) {} \ + \ + 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, \ + const type3& arg3, const type4& arg4) \ + : IPC::MessageWithTuple< Tuple4<type1, type2, type3, type4> >( \ + routing_id, ID, MakeRefTuple(arg1, arg2, arg3, arg4)) {} \ + \ + 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, \ + const type2& arg2, const type3& arg3, \ + const type4& arg4, const type5& arg5) \ + : IPC::MessageWithTuple< Tuple5<type1, type2, type3, type4, type5> >( \ + routing_id, ID, MakeRefTuple(arg1, arg2, arg3, arg4, arg5)) {} \ + \ + 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) { \ + if (msg->is_sync()) { \ + TupleTypes<SendParam>::ValueTuple 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); \ + } \ + } + +#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 +// of this file. +#define IPC_MESSAGE_MACROS_INCLUDE_BLOCK + +// Redefine MESSAGES_INTERNAL_FILE just for the header check in +// ipc_messages_macros.h that happens before it breaks on the header guard. +#define MESSAGES_INTERNAL_FILE MESSAGES_INTERNAL_IMPL_FILE + +// Include our INTERNAL file first to get the normal expansion. +#include MESSAGES_INTERNAL_IMPL_FILE + +#endif // IPC_IPC_MESSAGE_IMPL_MACROS_H_ diff --git a/ipc/ipc_message_macros.h b/ipc/ipc_message_macros.h index d14f545..903d566 100644 --- a/ipc/ipc_message_macros.h +++ b/ipc/ipc_message_macros.h @@ -79,6 +79,9 @@ #endif +#if defined(IPC_MESSAGE_MACROS_ENUMS) +#undef IPC_MESSAGE_MACROS_ENUMS + // Undefine the macros from the previous pass (if any). #undef IPC_BEGIN_MESSAGES @@ -138,9 +141,6 @@ #undef IPC_SYNC_MESSAGE_ROUTED5_2 #undef IPC_SYNC_MESSAGE_ROUTED5_3 -#if defined(IPC_MESSAGE_MACROS_ENUMS) -#undef IPC_MESSAGE_MACROS_ENUMS - // We're using the lowest 16 bits of type for the message id, and the highest // 16 bits for the channel type. // @@ -399,6 +399,65 @@ void class_name::OnMessageReceived(const IPC::Message& msg) \ #elif defined(IPC_MESSAGE_MACROS_LOG) #undef IPC_MESSAGE_MACROS_LOG + +// Undefine the macros from the previous pass (if any). +#undef IPC_BEGIN_MESSAGES +#undef IPC_END_MESSAGES +#undef IPC_MESSAGE_CONTROL0 +#undef IPC_MESSAGE_CONTROL1 +#undef IPC_MESSAGE_CONTROL2 +#undef IPC_MESSAGE_CONTROL3 +#undef IPC_MESSAGE_CONTROL4 +#undef IPC_MESSAGE_CONTROL5 +#undef IPC_MESSAGE_ROUTED0 +#undef IPC_MESSAGE_ROUTED1 +#undef IPC_MESSAGE_ROUTED2 +#undef IPC_MESSAGE_ROUTED3 +#undef IPC_MESSAGE_ROUTED4 +#undef IPC_MESSAGE_ROUTED5 +#undef IPC_SYNC_MESSAGE_CONTROL0_0 +#undef IPC_SYNC_MESSAGE_CONTROL0_1 +#undef IPC_SYNC_MESSAGE_CONTROL0_2 +#undef IPC_SYNC_MESSAGE_CONTROL0_3 +#undef IPC_SYNC_MESSAGE_CONTROL1_0 +#undef IPC_SYNC_MESSAGE_CONTROL1_1 +#undef IPC_SYNC_MESSAGE_CONTROL1_2 +#undef IPC_SYNC_MESSAGE_CONTROL1_3 +#undef IPC_SYNC_MESSAGE_CONTROL2_0 +#undef IPC_SYNC_MESSAGE_CONTROL2_1 +#undef IPC_SYNC_MESSAGE_CONTROL2_2 +#undef IPC_SYNC_MESSAGE_CONTROL2_3 +#undef IPC_SYNC_MESSAGE_CONTROL3_1 +#undef IPC_SYNC_MESSAGE_CONTROL3_2 +#undef IPC_SYNC_MESSAGE_CONTROL3_3 +#undef IPC_SYNC_MESSAGE_CONTROL4_1 +#undef IPC_SYNC_MESSAGE_CONTROL4_2 +#undef IPC_SYNC_MESSAGE_ROUTED0_0 +#undef IPC_SYNC_MESSAGE_ROUTED0_1 +#undef IPC_SYNC_MESSAGE_ROUTED0_2 +#undef IPC_SYNC_MESSAGE_ROUTED0_3 +#undef IPC_SYNC_MESSAGE_ROUTED1_0 +#undef IPC_SYNC_MESSAGE_ROUTED1_1 +#undef IPC_SYNC_MESSAGE_ROUTED1_2 +#undef IPC_SYNC_MESSAGE_ROUTED1_3 +#undef IPC_SYNC_MESSAGE_ROUTED1_4 +#undef IPC_SYNC_MESSAGE_ROUTED2_0 +#undef IPC_SYNC_MESSAGE_ROUTED2_1 +#undef IPC_SYNC_MESSAGE_ROUTED2_2 +#undef IPC_SYNC_MESSAGE_ROUTED2_3 +#undef IPC_SYNC_MESSAGE_ROUTED3_0 +#undef IPC_SYNC_MESSAGE_ROUTED3_1 +#undef IPC_SYNC_MESSAGE_ROUTED3_2 +#undef IPC_SYNC_MESSAGE_ROUTED3_3 +#undef IPC_SYNC_MESSAGE_ROUTED4_0 +#undef IPC_SYNC_MESSAGE_ROUTED4_1 +#undef IPC_SYNC_MESSAGE_ROUTED4_2 +#undef IPC_SYNC_MESSAGE_ROUTED4_3 +#undef IPC_SYNC_MESSAGE_ROUTED5_0 +#undef IPC_SYNC_MESSAGE_ROUTED5_1 +#undef IPC_SYNC_MESSAGE_ROUTED5_2 +#undef IPC_SYNC_MESSAGE_ROUTED5_3 + #ifndef IPC_LOG_TABLE_CREATED #define IPC_LOG_TABLE_CREATED typedef void (*LogFunction)(uint32 type, @@ -601,6 +660,65 @@ LogFunction g_log_function_mapping[LastMsgIndex]; #elif defined(IPC_MESSAGE_MACROS_CLASSES) #undef IPC_MESSAGE_MACROS_CLASSES + +// Undefine the macros from the previous pass (if any). +#undef IPC_BEGIN_MESSAGES +#undef IPC_END_MESSAGES +#undef IPC_MESSAGE_CONTROL0 +#undef IPC_MESSAGE_CONTROL1 +#undef IPC_MESSAGE_CONTROL2 +#undef IPC_MESSAGE_CONTROL3 +#undef IPC_MESSAGE_CONTROL4 +#undef IPC_MESSAGE_CONTROL5 +#undef IPC_MESSAGE_ROUTED0 +#undef IPC_MESSAGE_ROUTED1 +#undef IPC_MESSAGE_ROUTED2 +#undef IPC_MESSAGE_ROUTED3 +#undef IPC_MESSAGE_ROUTED4 +#undef IPC_MESSAGE_ROUTED5 +#undef IPC_SYNC_MESSAGE_CONTROL0_0 +#undef IPC_SYNC_MESSAGE_CONTROL0_1 +#undef IPC_SYNC_MESSAGE_CONTROL0_2 +#undef IPC_SYNC_MESSAGE_CONTROL0_3 +#undef IPC_SYNC_MESSAGE_CONTROL1_0 +#undef IPC_SYNC_MESSAGE_CONTROL1_1 +#undef IPC_SYNC_MESSAGE_CONTROL1_2 +#undef IPC_SYNC_MESSAGE_CONTROL1_3 +#undef IPC_SYNC_MESSAGE_CONTROL2_0 +#undef IPC_SYNC_MESSAGE_CONTROL2_1 +#undef IPC_SYNC_MESSAGE_CONTROL2_2 +#undef IPC_SYNC_MESSAGE_CONTROL2_3 +#undef IPC_SYNC_MESSAGE_CONTROL3_1 +#undef IPC_SYNC_MESSAGE_CONTROL3_2 +#undef IPC_SYNC_MESSAGE_CONTROL3_3 +#undef IPC_SYNC_MESSAGE_CONTROL4_1 +#undef IPC_SYNC_MESSAGE_CONTROL4_2 +#undef IPC_SYNC_MESSAGE_ROUTED0_0 +#undef IPC_SYNC_MESSAGE_ROUTED0_1 +#undef IPC_SYNC_MESSAGE_ROUTED0_2 +#undef IPC_SYNC_MESSAGE_ROUTED0_3 +#undef IPC_SYNC_MESSAGE_ROUTED1_0 +#undef IPC_SYNC_MESSAGE_ROUTED1_1 +#undef IPC_SYNC_MESSAGE_ROUTED1_2 +#undef IPC_SYNC_MESSAGE_ROUTED1_3 +#undef IPC_SYNC_MESSAGE_ROUTED1_4 +#undef IPC_SYNC_MESSAGE_ROUTED2_0 +#undef IPC_SYNC_MESSAGE_ROUTED2_1 +#undef IPC_SYNC_MESSAGE_ROUTED2_2 +#undef IPC_SYNC_MESSAGE_ROUTED2_3 +#undef IPC_SYNC_MESSAGE_ROUTED3_0 +#undef IPC_SYNC_MESSAGE_ROUTED3_1 +#undef IPC_SYNC_MESSAGE_ROUTED3_2 +#undef IPC_SYNC_MESSAGE_ROUTED3_3 +#undef IPC_SYNC_MESSAGE_ROUTED4_0 +#undef IPC_SYNC_MESSAGE_ROUTED4_1 +#undef IPC_SYNC_MESSAGE_ROUTED4_2 +#undef IPC_SYNC_MESSAGE_ROUTED4_3 +#undef IPC_SYNC_MESSAGE_ROUTED5_0 +#undef IPC_SYNC_MESSAGE_ROUTED5_1 +#undef IPC_SYNC_MESSAGE_ROUTED5_2 +#undef IPC_SYNC_MESSAGE_ROUTED5_3 + #define IPC_BEGIN_MESSAGES(label) #define IPC_END_MESSAGES(label) @@ -616,61 +734,52 @@ LogFunction g_log_function_mapping[LastMsgIndex]; #define IPC_MESSAGE_CONTROL1(msg_class, type1) \ class msg_class : public IPC::MessageWithTuple< Tuple1<type1> > { \ - public: \ - enum { ID = msg_class##__ID }; \ - msg_class(const type1& arg1) \ - : IPC::MessageWithTuple< Tuple1<type1> >(MSG_ROUTING_CONTROL, \ - ID, \ - MakeRefTuple(arg1)) {} \ + public: \ + enum { ID = msg_class##__ID }; \ + msg_class(const type1& arg1); \ + ~msg_class(); \ + static void Log(const Message* msg, std::wstring* l); \ }; -#define IPC_MESSAGE_CONTROL2(msg_class, type1, type2) \ +#define IPC_MESSAGE_CONTROL2(msg_class, type1, type2) \ class msg_class : public IPC::MessageWithTuple< Tuple2<type1, type2> > { \ - public: \ - enum { ID = msg_class##__ID }; \ - msg_class(const type1& arg1, const type2& arg2) \ - : IPC::MessageWithTuple< Tuple2<type1, type2> >( \ - MSG_ROUTING_CONTROL, \ - ID, \ - MakeRefTuple(arg1, arg2)) {} \ + public: \ + enum { ID = msg_class##__ID }; \ + msg_class(const type1& arg1, const type2& arg2); \ + ~msg_class(); \ + static void Log(const Message* msg, std::wstring* l); \ }; -#define IPC_MESSAGE_CONTROL3(msg_class, type1, type2, type3) \ - class msg_class : \ - public IPC::MessageWithTuple< Tuple3<type1, type2, type3> > { \ - public: \ - enum { ID = msg_class##__ID }; \ - msg_class(const type1& arg1, const type2& arg2, const type3& arg3) \ - : IPC::MessageWithTuple< Tuple3<type1, type2, type3> >( \ - MSG_ROUTING_CONTROL, \ - ID, \ - MakeRefTuple(arg1, arg2, arg3)) {} \ +#define IPC_MESSAGE_CONTROL3(msg_class, type1, type2, type3) \ + class msg_class : \ + public IPC::MessageWithTuple< Tuple3<type1, type2, type3> > { \ + public: \ + enum { ID = msg_class##__ID }; \ + msg_class(const type1& arg1, const type2& arg2, const type3& arg3); \ + ~msg_class(); \ + static void Log(const Message* msg, std::wstring* l); \ }; -#define IPC_MESSAGE_CONTROL4(msg_class, type1, type2, type3, type4) \ - class msg_class : \ +#define IPC_MESSAGE_CONTROL4(msg_class, type1, type2, type3, type4) \ + class msg_class : \ public IPC::MessageWithTuple< Tuple4<type1, type2, type3, type4> > { \ - public: \ - enum { ID = msg_class##__ID }; \ - msg_class(const type1& arg1, const type2& arg2, const type3& arg3, \ - const type4& arg4) \ - : IPC::MessageWithTuple< Tuple4<type1, type2, type3, type4> >( \ - MSG_ROUTING_CONTROL, \ - ID, \ - MakeRefTuple(arg1, arg2, arg3, arg4)) {} \ + public: \ + enum { ID = msg_class##__ID }; \ + msg_class(const type1& arg1, const type2& arg2, const type3& arg3, \ + const type4& arg4); \ + ~msg_class(); \ + static void Log(const Message* msg, std::wstring* l); \ }; #define IPC_MESSAGE_CONTROL5(msg_class, type1, type2, type3, type4, type5) \ - class msg_class : \ + class msg_class : \ public IPC::MessageWithTuple< Tuple5<type1, type2, type3, type4, type5> > { \ - public: \ - enum { ID = msg_class##__ID }; \ - msg_class(const type1& arg1, const type2& arg2, \ - const type3& arg3, const type4& arg4, const type5& arg5) \ - : IPC::MessageWithTuple< Tuple5<type1, type2, type3, type4, type5> >( \ - MSG_ROUTING_CONTROL, \ - ID, \ - MakeRefTuple(arg1, arg2, arg3, arg4, arg5)) {} \ + public: \ + enum { ID = msg_class##__ID }; \ + msg_class(const type1& arg1, const type2& arg2, \ + const type3& arg3, const type4& arg4, const type5& arg5); \ + ~msg_class(); \ + static void Log(const Message* msg, std::wstring* l); \ }; #define IPC_MESSAGE_ROUTED0(msg_class) \ @@ -682,75 +791,74 @@ LogFunction g_log_function_mapping[LastMsgIndex]; }; #define IPC_MESSAGE_ROUTED1(msg_class, type1) \ - class msg_class : public IPC::MessageWithTuple< Tuple1<type1> > { \ - public: \ - enum { ID = msg_class##__ID }; \ - msg_class(int32 routing_id, const type1& arg1) \ - : IPC::MessageWithTuple< Tuple1<type1> >(routing_id, ID, \ - MakeRefTuple(arg1)) {} \ + class msg_class : public IPC::MessageWithTuple< Tuple1<type1> > { \ + public: \ + enum { ID = msg_class##__ID }; \ + msg_class(int32 routing_id, const type1& arg1); \ + ~msg_class(); \ + static void Log(const Message* msg, std::wstring* l); \ }; -#define IPC_MESSAGE_ROUTED2(msg_class, type1, type2) \ - class msg_class : public IPC::MessageWithTuple< Tuple2<type1, type2> > { \ - public: \ - enum { ID = msg_class##__ID }; \ - msg_class(int32 routing_id, const type1& arg1, const type2& arg2) \ - : IPC::MessageWithTuple< Tuple2<type1, type2> >( \ - routing_id, ID, MakeRefTuple(arg1, arg2)) {} \ +#define IPC_MESSAGE_ROUTED2(msg_class, type1, type2) \ + class msg_class \ + : public IPC::MessageWithTuple< Tuple2<type1, type2> > { \ + public: \ + enum { ID = msg_class##__ID }; \ + msg_class(int32 routing_id, const type1& arg1, const type2& arg2); \ + ~msg_class(); \ + static void Log(const Message* msg, std::wstring* l); \ }; -#define IPC_MESSAGE_ROUTED3(msg_class, type1, type2, type3) \ - class msg_class : \ - public IPC::MessageWithTuple< Tuple3<type1, type2, type3> > { \ - public: \ - enum { ID = msg_class##__ID }; \ - msg_class(int32 routing_id, const type1& arg1, const type2& arg2, \ - const type3& arg3) \ - : IPC::MessageWithTuple< Tuple3<type1, type2, type3> >( \ - routing_id, ID, MakeRefTuple(arg1, arg2, arg3)) {} \ +#define IPC_MESSAGE_ROUTED3(msg_class, type1, type2, type3) \ + class msg_class \ + : public IPC::MessageWithTuple< Tuple3<type1, type2, type3> > { \ + public: \ + enum { ID = msg_class##__ID }; \ + msg_class(int32 routing_id, const type1& arg1, const type2& arg2, \ + const type3& arg3); \ + ~msg_class(); \ + static void Log(const Message* msg, std::wstring* l); \ }; -#define IPC_MESSAGE_ROUTED4(msg_class, type1, type2, type3, type4) \ - class msg_class : \ - public IPC::MessageWithTuple< Tuple4<type1, type2, type3, type4> > { \ - public: \ - enum { ID = msg_class##__ID }; \ - msg_class(int32 routing_id, const type1& arg1, const type2& arg2, \ - const type3& arg3, const type4& arg4) \ - : IPC::MessageWithTuple< Tuple4<type1, type2, type3, type4> >( \ - routing_id, ID, MakeRefTuple(arg1, arg2, arg3, arg4)) {} \ +#define IPC_MESSAGE_ROUTED4(msg_class, type1, type2, type3, type4) \ + class msg_class \ + : public IPC::MessageWithTuple< Tuple4<type1, type2, type3, type4> > { \ + public: \ + enum { ID = msg_class##__ID }; \ + msg_class(int32 routing_id, const type1& arg1, const type2& arg2, \ + const type3& arg3, const type4& arg4); \ + ~msg_class(); \ + static void Log(const Message* msg, std::wstring* l); \ }; #define IPC_MESSAGE_ROUTED5(msg_class, type1, type2, type3, type4, type5) \ - class msg_class : \ - public IPC::MessageWithTuple< Tuple5<type1, type2, type3, type4, type5> > { \ - public: \ - enum { ID = msg_class##__ID }; \ - msg_class(int32 routing_id, const type1& arg1, const type2& arg2, \ - const type3& arg3, const type4& arg4, const type5& arg5) \ - : IPC::MessageWithTuple< Tuple5<type1, type2, type3, type4, type5> >( \ - routing_id, ID, MakeRefTuple(arg1, arg2, arg3, arg4, arg5)) {} \ + class msg_class \ + : public IPC::MessageWithTuple< Tuple5<type1, type2, type3, type4, \ + type5> > { \ + public: \ + enum { ID = msg_class##__ID }; \ + msg_class(int32 routing_id, const type1& arg1, const type2& arg2, \ + const type3& arg3, const type4& arg4, const type5& arg5); \ + ~msg_class(); \ + static void Log(const Message* msg, std::wstring* l); \ }; #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) \ @@ -758,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) \ @@ -771,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) \ @@ -805,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) \ @@ -817,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) \ @@ -852,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) \ @@ -864,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) \ @@ -877,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) \ @@ -889,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) \ @@ -901,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) \ @@ -914,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) \ @@ -926,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) \ @@ -957,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) \ @@ -969,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) \ @@ -980,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) \ @@ -991,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) \ @@ -1002,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) \ @@ -1014,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) \ @@ -1026,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) \ @@ -1037,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) \ @@ -1048,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) \ @@ -1060,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) \ @@ -1072,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) \ @@ -1083,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 : \ @@ -1095,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) \ @@ -1107,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) \ @@ -1119,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) \ @@ -1131,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) \ @@ -1143,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) \ @@ -1155,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) \ @@ -1167,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) \ @@ -1179,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) \ @@ -1191,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) \ @@ -1203,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) \ @@ -1215,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.cc b/ipc/ipc_message_utils.cc index 41fbde7..93f192ed 100644 --- a/ipc/ipc_message_utils.cc +++ b/ipc/ipc_message_utils.cc @@ -4,10 +4,16 @@ #include "ipc/ipc_message_utils.h" +#include "base/file_path.h" #include "base/json/json_writer.h" +#include "base/nullable_string16.h" #include "base/scoped_ptr.h" #include "base/time.h" #include "base/values.h" +#if defined(OS_POSIX) +#include "ipc/file_descriptor_set_posix.h" +#endif +#include "ipc/ipc_channel_handle.h" namespace IPC { @@ -201,6 +207,24 @@ static bool ReadValue(const Message* m, void** iter, Value** value, return true; } + +void ParamTraits<base::Time>::Write(Message* m, const param_type& p) { + ParamTraits<int64>::Write(m, p.ToInternalValue()); +} + +bool ParamTraits<base::Time>::Read(const Message* m, void** iter, + param_type* r) { + int64 value; + if (!ParamTraits<int64>::Read(m, iter, &value)) + return false; + *r = base::Time::FromInternalValue(value); + return true; +} + +void ParamTraits<base::Time>::Log(const param_type& p, std::wstring* l) { + ParamTraits<int64>::Log(p.ToInternalValue(), l); +} + void ParamTraits<DictionaryValue>::Write(Message* m, const param_type& p) { WriteValue(m, &p, 0); } @@ -238,4 +262,107 @@ void ParamTraits<ListValue>::Log(const param_type& p, std::wstring* l) { base::JSONWriter::Write(&p, false, &json); l->append(UTF8ToWide(json)); } + +void ParamTraits<NullableString16>::Write(Message* m, const param_type& p) { + WriteParam(m, p.string()); + WriteParam(m, p.is_null()); +} + +bool ParamTraits<NullableString16>::Read(const Message* m, void** iter, + param_type* r) { + string16 string; + if (!ReadParam(m, iter, &string)) + return false; + bool is_null; + if (!ReadParam(m, iter, &is_null)) + return false; + *r = NullableString16(string, is_null); + return true; +} + +void ParamTraits<NullableString16>::Log(const param_type& p, std::wstring* l) { + l->append(L"("); + LogParam(p.string(), l); + l->append(L", "); + LogParam(p.is_null(), l); + l->append(L")"); +} + +void ParamTraits<FilePath>::Write(Message* m, const param_type& p) { + ParamTraits<FilePath::StringType>::Write(m, p.value()); +} + +bool ParamTraits<FilePath>::Read(const Message* m, void** iter, param_type* r) { + FilePath::StringType value; + if (!ParamTraits<FilePath::StringType>::Read(m, iter, &value)) + return false; + *r = FilePath(value); + return true; +} + +void ParamTraits<FilePath>::Log(const param_type& p, std::wstring* l) { + ParamTraits<FilePath::StringType>::Log(p.value(), l); +} + +#if defined(OS_POSIX) +void ParamTraits<base::FileDescriptor>::Write(Message* m, const param_type& p) { + const bool valid = p.fd >= 0; + WriteParam(m, valid); + + if (valid) { + if (!m->WriteFileDescriptor(p)) + NOTREACHED(); + } +} + +bool ParamTraits<base::FileDescriptor>::Read(const Message* m, void** iter, + param_type* r) { + bool valid; + if (!ReadParam(m, iter, &valid)) + return false; + + if (!valid) { + r->fd = -1; + r->auto_close = false; + return true; + } + + return m->ReadFileDescriptor(iter, r); +} + +void ParamTraits<base::FileDescriptor>::Log(const param_type& p, + std::wstring* l) { + if (p.auto_close) { + l->append(StringPrintf(L"FD(%d auto-close)", p.fd)); + } else { + l->append(StringPrintf(L"FD(%d)", p.fd)); + } +} +#endif // defined(OS_POSIX) + +void ParamTraits<IPC::ChannelHandle>::Write(Message* m, const param_type& p) { + WriteParam(m, p.name); +#if defined(OS_POSIX) + WriteParam(m, p.socket); +#endif +} + +bool ParamTraits<IPC::ChannelHandle>::Read(const Message* m, void** iter, + param_type* r) { + return ReadParam(m, iter, &r->name) +#if defined(OS_POSIX) + && ReadParam(m, iter, &r->socket) +#endif + ; +} + +void ParamTraits<IPC::ChannelHandle>::Log(const param_type& p, + std::wstring* l) { + l->append(ASCIIToWide(StringPrintf("ChannelHandle(%s", p.name.c_str()))); +#if defined(OS_POSIX) + ParamTraits<base::FileDescriptor>::Log(p.socket, l); +#endif + l->append(L")"); +} + } // namespace IPC diff --git a/ipc/ipc_message_utils.h b/ipc/ipc_message_utils.h index 4667d4b..05d3916 100644 --- a/ipc/ipc_message_utils.h +++ b/ipc/ipc_message_utils.h @@ -12,22 +12,29 @@ #include <map> #include <set> -#include "base/file_path.h" #include "base/format_macros.h" -#include "base/nullable_string16.h" #include "base/string16.h" #include "base/string_number_conversions.h" #include "base/string_util.h" -#include "base/time.h" #include "base/tuple.h" #include "base/utf_string_conversions.h" -#include "base/values.h" -#if defined(OS_POSIX) -#include "ipc/file_descriptor_set_posix.h" -#endif -#include "ipc/ipc_channel_handle.h" #include "ipc/ipc_sync_message.h" +#if defined(COMPILER_GCC) +// GCC "helpfully" tries to inline template methods in release mode. Except we +// want the majority of the template junk being expanded once in the +// implementation file (and only provide the definitions in +// ipc_message_utils_impl.h in those files) and exported, instead of expanded +// at every call site. Special note: GCC happily accepts the attribute before +// the method declaration, but only acts on it if it is after. +#define IPC_MSG_NOINLINE __attribute__((noinline)); +#elif defined(COMPILER_MSVC) +// MSVC++ doesn't do this. +#define IPC_MSG_NOINLINE +#else +#error "Please add the noinline property for your new compiler here." +#endif + // Used by IPC_BEGIN_MESSAGES so that each message class starts from a unique // base. Messages have unique IDs across channels in order for the IPC logging // code to figure out the message class from its ID. @@ -67,8 +74,20 @@ enum IPCMessageStart { LastMsgIndex }; +class DictionaryValue; +class FilePath; +class ListValue; +class NullableString16; + +namespace base { +class Time; +struct FileDescriptor; +} + namespace IPC { +struct ChannelHandle; + //----------------------------------------------------------------------------- // An iterator class for reading the fields contained within a Message. @@ -306,19 +325,9 @@ struct ParamTraits<wchar_t> { template <> struct ParamTraits<base::Time> { typedef base::Time param_type; - static void Write(Message* m, const param_type& p) { - ParamTraits<int64>::Write(m, p.ToInternalValue()); - } - static bool Read(const Message* m, void** iter, param_type* r) { - int64 value; - if (!ParamTraits<int64>::Read(m, iter, &value)) - return false; - *r = base::Time::FromInternalValue(value); - return true; - } - static void Log(const param_type& p, std::wstring* l) { - ParamTraits<int64>::Log(p.ToInternalValue(), l); - } + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* r); + static void Log(const param_type& p, std::wstring* l); }; #if defined(OS_WIN) @@ -365,6 +374,9 @@ struct ParamTraits<MSG> { return result; } + static void Log(const param_type& p, std::wstring* l) { + l->append(L"<MSG>"); + } }; #endif // defined(OS_WIN) @@ -598,27 +610,9 @@ struct ParamTraits<std::pair<A, B> > { template <> struct ParamTraits<NullableString16> { typedef NullableString16 param_type; - static void Write(Message* m, const param_type& p) { - WriteParam(m, p.string()); - WriteParam(m, p.is_null()); - } - static bool Read(const Message* m, void** iter, param_type* r) { - string16 string; - if (!ReadParam(m, iter, &string)) - return false; - bool is_null; - if (!ReadParam(m, iter, &is_null)) - return false; - *r = NullableString16(string, is_null); - return true; - } - static void Log(const param_type& p, std::wstring* l) { - l->append(L"("); - LogParam(p.string(), l); - l->append(L", "); - LogParam(p.is_null(), l); - l->append(L")"); - } + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* r); + static void Log(const param_type& p, std::wstring* l); }; // If WCHAR_T_IS_UTF16 is defined, then string16 is a std::wstring so we don't @@ -709,19 +703,9 @@ struct ParamTraits<POINT> { template <> struct ParamTraits<FilePath> { typedef FilePath param_type; - static void Write(Message* m, const param_type& p) { - ParamTraits<FilePath::StringType>::Write(m, p.value()); - } - static bool Read(const Message* m, void** iter, param_type* r) { - FilePath::StringType value; - if (!ParamTraits<FilePath::StringType>::Read(m, iter, &value)) - return false; - *r = FilePath(value); - return true; - } - static void Log(const param_type& p, std::wstring* l) { - ParamTraits<FilePath::StringType>::Log(p.value(), l); - } + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* r); + static void Log(const param_type& p, std::wstring* l); }; #if defined(OS_POSIX) @@ -743,35 +727,9 @@ struct ParamTraits<FilePath> { template<> struct ParamTraits<base::FileDescriptor> { typedef base::FileDescriptor param_type; - static void Write(Message* m, const param_type& p) { - const bool valid = p.fd >= 0; - WriteParam(m, valid); - - if (valid) { - if (!m->WriteFileDescriptor(p)) - NOTREACHED(); - } - } - static bool Read(const Message* m, void** iter, param_type* r) { - bool valid; - if (!ReadParam(m, iter, &valid)) - return false; - - if (!valid) { - r->fd = -1; - r->auto_close = false; - return true; - } - - return m->ReadFileDescriptor(iter, r); - } - static void Log(const param_type& p, std::wstring* l) { - if (p.auto_close) { - l->append(StringPrintf(L"FD(%d auto-close)", p.fd)); - } else { - l->append(StringPrintf(L"FD(%d)", p.fd)); - } - } + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* r); + static void Log(const param_type& p, std::wstring* l); }; #endif // defined(OS_POSIX) @@ -781,26 +739,9 @@ struct ParamTraits<base::FileDescriptor> { template<> struct ParamTraits<IPC::ChannelHandle> { typedef ChannelHandle param_type; - static void Write(Message* m, const param_type& p) { - WriteParam(m, p.name); -#if defined(OS_POSIX) - WriteParam(m, p.socket); -#endif - } - static bool Read(const Message* m, void** iter, param_type* r) { - return ReadParam(m, iter, &r->name) -#if defined(OS_POSIX) - && ReadParam(m, iter, &r->socket) -#endif - ; - } - static void Log(const param_type& p, std::wstring* l) { - l->append(ASCIIToWide(StringPrintf("ChannelHandle(%s", p.name.c_str()))); -#if defined(OS_POSIX) - ParamTraits<base::FileDescriptor>::Log(p.socket, l); -#endif - l->append(L")"); - } + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* r); + static void Log(const param_type& p, std::wstring* l); }; #if defined(OS_WIN) @@ -1026,20 +967,15 @@ template <class ParamType> class MessageWithTuple : public Message { public: typedef ParamType Param; - typedef typename ParamType::ParamTuple RefParam; + typedef typename TupleTypes<ParamType>::ParamTuple RefParam; - MessageWithTuple(int32 routing_id, uint32 type, const RefParam& p) - : Message(routing_id, type, PRIORITY_NORMAL) { - WriteParam(this, p); - } + // The constructor and the Read() method's templated implementations are in + // ipc_message_utils_impl.h. The subclass constructor and Log() methods call + // the templated versions of these and make sure there are instantiations in + // those translation units. + MessageWithTuple(int32 routing_id, uint32 type, const RefParam& p); - static bool Read(const Message* msg, Param* p) { - void* iter = NULL; - if (ReadParam(msg, &iter, p)) - return true; - NOTREACHED() << "Error deserializing message " << msg->type(); - return false; - } + static bool Read(const Message* msg, Param* p) IPC_MSG_NOINLINE; // Generic dispatcher. Should cover most cases. template<class T, class Method> @@ -1111,12 +1047,6 @@ class MessageWithTuple : public Message { return false; } - static void Log(const Message* msg, std::wstring* l) { - Param p; - if (Read(msg, &p)) - LogParam(p, l); - } - // Functions used to do manual unpacking. Only used by the automation code, // these should go away once that code uses SyncChannel. template<typename TA, typename TB> @@ -1166,8 +1096,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: @@ -1180,67 +1156,32 @@ 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 { public: typedef SendParamType SendParam; - typedef typename SendParam::ParamTuple RefSendParam; + typedef typename TupleTypes<SendParam>::ParamTuple RefSendParam; 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); - -#if defined(IPC_MESSAGE_LOG_ENABLED) - const std::wstring& output_params = msg->output_params(); - if (!l->empty() && !output_params.empty()) - l->append(L", "); - - 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 ReplyParam::ValueTuple p; - void* iter = SyncMessage::GetDataIterator(msg); - if (ReadParam(msg, &iter, &p)) - LogParam(p, l); - } - } + const RefSendParam& send, const ReplyParam& reply); + static bool ReadSendParam(const Message* msg, SendParam* p) IPC_MSG_NOINLINE; + static bool ReadReplyParam( + const Message* msg, + typename TupleTypes<ReplyParam>::ValueTuple* p) IPC_MSG_NOINLINE; 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)) { - typename ReplyParam::ValueTuple reply_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(); @@ -1254,23 +1195,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 new file mode 100644 index 0000000..715df8f --- /dev/null +++ b/ipc/ipc_message_utils_impl.h @@ -0,0 +1,60 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// This file contains templates forward declared (but not defined) in +// ipc_message_utils.h so that they are only instantiated in certain files, +// notably ipc_message_impl_macros.h and a few IPC unit tests. + +#ifndef IPC_IPC_MESSAGE_UTILS_IMPL_H_ +#define IPC_IPC_MESSAGE_UTILS_IMPL_H_ + +namespace IPC { + +template <class ParamType> +MessageWithTuple<ParamType>::MessageWithTuple( + int32 routing_id, uint32 type, const RefParam& p) + : Message(routing_id, type, PRIORITY_NORMAL) { + WriteParam(this, p); +} + +template <class ParamType> +bool MessageWithTuple<ParamType>::Read(const Message* msg, Param* p) { + void* iter = NULL; + if (ReadParam(msg, &iter, p)) + return true; + NOTREACHED() << "Error deserializing message " << msg->type(); + return false; +} + +// We can't migrate the template for Log() to MessageWithTuple, because each +// 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); +} + +template <class SendParamType, class ReplyParamType> +bool MessageWithReply<SendParamType, ReplyParamType>::ReadSendParam( + const Message* msg, SendParam* p) { + void* iter = SyncMessage::GetDataIterator(msg); + return ReadParam(msg, &iter, p); +} + +template <class SendParamType, class ReplyParamType> +bool MessageWithReply<SendParamType, ReplyParamType>::ReadReplyParam( + const Message* msg, typename TupleTypes<ReplyParam>::ValueTuple* p) { + void* iter = SyncMessage::GetDataIterator(msg); + return ReadParam(msg, &iter, p); +} + +} // namespace IPC + +#endif // IPC_IPC_MESSAGE_UTILS_IMPL_H_ diff --git a/ipc/ipc_send_fds_test.cc b/ipc/ipc_send_fds_test.cc index 5f399da..f6d315f 100644 --- a/ipc/ipc_send_fds_test.cc +++ b/ipc/ipc_send_fds_test.cc @@ -20,6 +20,7 @@ extern "C" { #include "ipc/ipc_message_utils.h" #if defined(OS_POSIX) +#include "base/file_descriptor_posix.h" namespace { 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; diff --git a/ipc/sync_socket_unittest.cc b/ipc/sync_socket_unittest.cc index d37247d..5775d9b 100644 --- a/ipc/sync_socket_unittest.cc +++ b/ipc/sync_socket_unittest.cc @@ -16,6 +16,7 @@ #include "ipc/ipc_channel.h" #include "ipc/ipc_channel_proxy.h" #include "ipc/ipc_message_utils.h" +#include "ipc/ipc_message_utils_impl.h" #include "ipc/ipc_tests.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/multiprocess_func_list.h" |