diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-08 23:34:16 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-08 23:34:16 +0000 |
commit | 21fa3a157739a857f1882072179f1bd3d978c368 (patch) | |
tree | 731cee107cd53590baf4f6f97e273d5378e03e7e /ipc | |
parent | 6df403010254c73428c83e553654ce5dafa7dc00 (diff) | |
download | chromium_src-21fa3a157739a857f1882072179f1bd3d978c368.zip chromium_src-21fa3a157739a857f1882072179f1bd3d978c368.tar.gz chromium_src-21fa3a157739a857f1882072179f1bd3d978c368.tar.bz2 |
ipc: Simplify the magic required to create IPC message headers.This gets rid of having to include the files in a magic place because of xcode dependency issues, and just makes it simpler to create new IPC message classes. It also gets rid of including the X_messages_internal.h file multiple times, which simplifies things and should make the build a little faster.
In a future change, I will remove the "internal.h" files since they're no longer needed.
Review URL: http://codereview.chromium.org/5526008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@68664 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ipc')
-rw-r--r-- | ipc/ipc_fuzzing_tests.cc | 3 | ||||
-rw-r--r-- | ipc/ipc_logging.cc | 26 | ||||
-rw-r--r-- | ipc/ipc_logging.h | 24 | ||||
-rw-r--r-- | ipc/ipc_message.h | 2 | ||||
-rw-r--r-- | ipc/ipc_message_impl_macros.h | 224 | ||||
-rw-r--r-- | ipc/ipc_message_macros.h | 1463 | ||||
-rw-r--r-- | ipc/ipc_message_utils.h | 30 | ||||
-rw-r--r-- | ipc/ipc_sync_channel_unittest.cc | 9 | ||||
-rw-r--r-- | ipc/ipc_sync_message_unittest.cc | 5 | ||||
-rw-r--r-- | ipc/ipc_sync_message_unittest.h | 145 | ||||
-rw-r--r-- | ipc/sync_socket_unittest.cc | 3 |
11 files changed, 760 insertions, 1174 deletions
diff --git a/ipc/ipc_fuzzing_tests.cc b/ipc/ipc_fuzzing_tests.cc index 8c4dbe3..4b5e938 100644 --- a/ipc/ipc_fuzzing_tests.cc +++ b/ipc/ipc_fuzzing_tests.cc @@ -98,8 +98,7 @@ TEST(IPCMessageIntegrity, ReadVectorTooLarge2) { // We don't actually use the messages defined in this file, but we do this // to get to the IPC macros. -#define MESSAGES_INTERNAL_FILE "ipc/ipc_sync_message_unittest.h" -#include "ipc/ipc_message_macros.h" +#include "ipc/ipc_sync_message_unittest.h" enum IPCMessageIds { UNUSED_IPC_TYPE, diff --git a/ipc/ipc_logging.cc b/ipc/ipc_logging.cc index 905f097..3b26cdc 100644 --- a/ipc/ipc_logging.cc +++ b/ipc/ipc_logging.cc @@ -5,7 +5,6 @@ #include "ipc/ipc_logging.h" #ifdef IPC_MESSAGE_LOG_ENABLED -// This will cause render_messages.h etc to define ViewMsgLog and friends. #define IPC_MESSAGE_MACROS_LOG_ENABLED #endif @@ -13,6 +12,7 @@ #include "base/logging.h" #include "base/message_loop.h" #include "base/process_util.h" +#include "base/string_number_conversions.h" #include "base/string_util.h" #include "base/thread.h" #include "base/time.h" @@ -38,7 +38,7 @@ const int kLogSendDelayMs = 100; // We use a pointer to the function table to avoid any linker dependencies on // all the traits used as IPC message parameters. -Logging::LogFunction *Logging::log_function_mapping_; +LogFunctionMap* Logging::log_function_map_; Logging::Logging() : enabled_(false), @@ -70,10 +70,6 @@ Logging* Logging::current() { return Singleton<Logging>::get(); } -void Logging::SetLoggerFunctions(LogFunction *functions) { - log_function_mapping_ = functions; -} - void Logging::SetConsumer(Consumer* consumer) { consumer_ = consumer; } @@ -164,16 +160,20 @@ void Logging::OnPostDispatchMessage(const Message& message, void Logging::GetMessageText(uint32 type, std::string* name, const Message* message, std::string* params) { - if (!log_function_mapping_) + if (!log_function_map_) return; - int message_class = type >> 16; - if (log_function_mapping_[message_class] != NULL) { - log_function_mapping_[message_class](type, name, message, params); - } else { - DVLOG(1) << "No logger function associated with message class " - << message_class; + LogFunctionMap::iterator it = log_function_map_->find(type); + if (it == log_function_map_->end()) { + if (name) { + *name = "[UNKNOWN MSG "; + *name += base::IntToString(type); + *name += " ]"; + } + return; } + + (*it->second)(name, message, params); } void Logging::Log(const LogData& data) { diff --git a/ipc/ipc_logging.h b/ipc/ipc_logging.h index 36e584a..ee2f62b 100644 --- a/ipc/ipc_logging.h +++ b/ipc/ipc_logging.h @@ -12,10 +12,19 @@ #include <vector> +#include "base/hash_tables.h" #include "base/message_loop.h" #include "base/scoped_ptr.h" #include "base/singleton.h" +// Logging function. |name| is a string in ASCII and |params| is a string in +// UTF-8. +typedef void (*LogFunction)(std::string* name, + const IPC::Message* msg, + std::string* params); + +typedef base::hash_map<uint32, LogFunction > LogFunctionMap; + namespace IPC { class Message; @@ -71,14 +80,13 @@ class Logging { static void GetMessageText(uint32 type, std::string* name, const Message* message, std::string* params); - // Logging function. |name| is a string in ASCII and |params| is a string in - // UTF-8. - typedef void (*LogFunction)(uint32 type, - std::string* name, - const Message* msg, - std::string* params); + static void set_log_function_map(LogFunctionMap* functions) { + log_function_map_ = functions; + } - static void SetLoggerFunctions(LogFunction *functions); + static LogFunctionMap* log_function_map() { + return log_function_map_; + } private: friend struct DefaultSingletonTraits<Logging>; @@ -98,7 +106,7 @@ class Logging { Consumer* consumer_; - static LogFunction *log_function_mapping_; + static LogFunctionMap* log_function_map_; }; } // namespace IPC diff --git a/ipc/ipc_message.h b/ipc/ipc_message.h index bff0ff70..5ffddde 100644 --- a/ipc/ipc_message.h +++ b/ipc/ipc_message.h @@ -157,7 +157,7 @@ class Message : public Pickle { } // Used for async messages with no parameters. - static void Log(const Message* msg, std::string* l) { + static void Log(std::string* name, const Message* msg, std::string* l) { } // Find the end of the message data that starts at range_start. Returns NULL diff --git a/ipc/ipc_message_impl_macros.h b/ipc/ipc_message_impl_macros.h index 3fa8978..b6b6278 100644 --- a/ipc/ipc_message_impl_macros.h +++ b/ipc/ipc_message_impl_macros.h @@ -6,7 +6,7 @@ // 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. +// file right before including XXX_messages_internal.h. #ifndef IPC_IPC_MESSAGE_IMPL_MACROS_H_ #define IPC_IPC_MESSAGE_IMPL_MACROS_H_ @@ -14,97 +14,16 @@ #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 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/automation_messages_internal.h" -#include "chrome/common/devtools_messages_internal.h" -#include "chrome/common/gpu_messages_internal.h" -#include "chrome/common/nacl_messages_internal.h" -#include "chrome/common/plugin_messages_internal.h" -#include "chrome/common/render_messages_internal.h" -#include "chrome/common/service_messages_internal.h" -#include "chrome/common/utility_messages_internal.h" -#include "chrome/common/worker_messages_internal.h" -#include "ppapi/proxy/ppapi_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_CONTROL3_4 -#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_ROUTED3_4 -#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::string* l) { \ + void msg_class::Log(std::string* name, const Message* msg, std::string* l) { \ + if (name) \ + *name = #msg_class; \ + if (!msg || !l) \ + return; \ Param p; \ if (Read(msg, &p)) \ IPC::LogParam(p, l); \ @@ -112,23 +31,23 @@ // 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_CONTROL0_EXTRA(msg_class) -#define IPC_MESSAGE_CONTROL1(msg_class, type1) \ +#define IPC_MESSAGE_CONTROL1_EXTRA(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) \ +#define IPC_MESSAGE_CONTROL2_EXTRA(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) \ +#define IPC_MESSAGE_CONTROL3_EXTRA(msg_class, type1, type2, type3) \ msg_class::msg_class(const type1& arg1, const type2& arg2, \ const type3& arg3) \ : IPC::MessageWithTuple< Tuple3<type1, type2, type3> >( \ @@ -136,7 +55,7 @@ \ IPC_ASYNC_MESSAGE_DTOR_AND_LOG(msg_class) -#define IPC_MESSAGE_CONTROL4(msg_class, type1, type2, type3, type4) \ +#define IPC_MESSAGE_CONTROL4_EXTRA(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> >( \ @@ -144,7 +63,7 @@ \ IPC_ASYNC_MESSAGE_DTOR_AND_LOG(msg_class) -#define IPC_MESSAGE_CONTROL5(msg_class, type1, type2, type3, type4, type5) \ +#define IPC_MESSAGE_CONTROL5_EXTRA(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) \ @@ -156,16 +75,16 @@ // 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_ROUTED0_EXTRA(msg_class) -#define IPC_MESSAGE_ROUTED1(msg_class, type1) \ +#define IPC_MESSAGE_ROUTED1_EXTRA(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) \ +#define IPC_MESSAGE_ROUTED2_EXTRA(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)) {} \ @@ -173,7 +92,7 @@ IPC_ASYNC_MESSAGE_DTOR_AND_LOG(msg_class) -#define IPC_MESSAGE_ROUTED3(msg_class, type1, type2, type3) \ +#define IPC_MESSAGE_ROUTED3_EXTRA(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> >( \ @@ -181,7 +100,7 @@ \ IPC_ASYNC_MESSAGE_DTOR_AND_LOG(msg_class) -#define IPC_MESSAGE_ROUTED4(msg_class, type1, type2, type3, type4) \ +#define IPC_MESSAGE_ROUTED4_EXTRA(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> >( \ @@ -189,7 +108,7 @@ \ IPC_ASYNC_MESSAGE_DTOR_AND_LOG(msg_class) -#define IPC_MESSAGE_ROUTED5(msg_class, type1, type2, type3, type4, type5) \ +#define IPC_MESSAGE_ROUTED5_EXTRA(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) \ @@ -205,12 +124,15 @@ #define IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) \ msg_class::~msg_class() {} \ \ - void msg_class::Log(const Message* msg, std::string* l) { \ + void msg_class::Log(std::string* name, const Message* msg, std::string* l) { \ + if (name) \ + *name = #msg_class; \ + if (!msg || !l) \ + return; \ if (msg->is_sync()) { \ TupleTypes<SendParam>::ValueTuple p; \ if (ReadSendParam(msg, &p)) \ IPC::LogParam(p, l); \ - \ AddOutputParamsToLog(msg, l); \ } else { \ TupleTypes<ReplyParam>::ValueTuple p; \ @@ -219,7 +141,7 @@ } \ } -#define IPC_SYNC_MESSAGE_CONTROL0_0(msg_class) \ +#define IPC_SYNC_MESSAGE_CONTROL0_0_EXTRA(msg_class) \ msg_class::msg_class() \ : IPC::MessageWithReply<Tuple0, Tuple0 >( \ MSG_ROUTING_CONTROL, ID, \ @@ -227,7 +149,7 @@ \ IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) -#define IPC_SYNC_MESSAGE_CONTROL0_1(msg_class, type1_out) \ +#define IPC_SYNC_MESSAGE_CONTROL0_1_EXTRA(msg_class, type1_out) \ msg_class::msg_class(type1_out* arg1) \ : IPC::MessageWithReply<Tuple0, Tuple1<type1_out&> >( \ MSG_ROUTING_CONTROL, ID, \ @@ -235,7 +157,7 @@ \ IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) -#define IPC_SYNC_MESSAGE_CONTROL0_2(msg_class, type1_out, type2_out) \ +#define IPC_SYNC_MESSAGE_CONTROL0_2_EXTRA(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, \ @@ -243,7 +165,7 @@ \ IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) -#define IPC_SYNC_MESSAGE_CONTROL0_3(msg_class, type1_out, type2_out, \ +#define IPC_SYNC_MESSAGE_CONTROL0_3_EXTRA(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&, \ @@ -254,7 +176,7 @@ IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) -#define IPC_SYNC_MESSAGE_CONTROL1_0(msg_class, type1_in) \ +#define IPC_SYNC_MESSAGE_CONTROL1_0_EXTRA(msg_class, type1_in) \ msg_class::msg_class(const type1_in& arg1) \ : IPC::MessageWithReply<Tuple1<type1_in>, Tuple0 >( \ MSG_ROUTING_CONTROL, ID, \ @@ -262,7 +184,7 @@ \ IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) -#define IPC_SYNC_MESSAGE_CONTROL1_1(msg_class, type1_in, type1_out) \ +#define IPC_SYNC_MESSAGE_CONTROL1_1_EXTRA(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, \ @@ -270,7 +192,7 @@ \ IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) -#define IPC_SYNC_MESSAGE_CONTROL1_2(msg_class, type1_in, type1_out, type2_out) \ +#define IPC_SYNC_MESSAGE_CONTROL1_2_EXTRA(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&> >( \ @@ -279,7 +201,7 @@ \ IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) -#define IPC_SYNC_MESSAGE_CONTROL1_3(msg_class, type1_in, type1_out, \ +#define IPC_SYNC_MESSAGE_CONTROL1_3_EXTRA(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) \ @@ -290,7 +212,7 @@ \ IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) -#define IPC_SYNC_MESSAGE_CONTROL2_0(msg_class, type1_in, type2_in) \ +#define IPC_SYNC_MESSAGE_CONTROL2_0_EXTRA(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, \ @@ -298,7 +220,7 @@ \ IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) -#define IPC_SYNC_MESSAGE_CONTROL2_1(msg_class, type1_in, type2_in, type1_out) \ +#define IPC_SYNC_MESSAGE_CONTROL2_1_EXTRA(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>, \ @@ -309,7 +231,7 @@ IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) -#define IPC_SYNC_MESSAGE_CONTROL2_2(msg_class, type1_in, type2_in, \ +#define IPC_SYNC_MESSAGE_CONTROL2_2_EXTRA(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) \ @@ -320,7 +242,7 @@ IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) -#define IPC_SYNC_MESSAGE_CONTROL2_3(msg_class, type1_in, type2_in, \ +#define IPC_SYNC_MESSAGE_CONTROL2_3_EXTRA(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) \ @@ -332,7 +254,7 @@ IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) -#define IPC_SYNC_MESSAGE_CONTROL3_1(msg_class, type1_in, type2_in, \ +#define IPC_SYNC_MESSAGE_CONTROL3_1_EXTRA(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) \ @@ -342,7 +264,7 @@ \ IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) -#define IPC_SYNC_MESSAGE_CONTROL3_2(msg_class, type1_in, type2_in, \ +#define IPC_SYNC_MESSAGE_CONTROL3_2_EXTRA(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) \ @@ -353,7 +275,7 @@ IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) -#define IPC_SYNC_MESSAGE_CONTROL3_3(msg_class, type1_in, type2_in, \ +#define IPC_SYNC_MESSAGE_CONTROL3_3_EXTRA(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, \ @@ -367,7 +289,7 @@ \ IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) -#define IPC_SYNC_MESSAGE_CONTROL3_4(msg_class, type1_in, type2_in, \ +#define IPC_SYNC_MESSAGE_CONTROL3_4_EXTRA(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, \ @@ -382,7 +304,7 @@ \ IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) -#define IPC_SYNC_MESSAGE_CONTROL4_1(msg_class, type1_in, type2_in, \ +#define IPC_SYNC_MESSAGE_CONTROL4_1_EXTRA(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, \ @@ -394,7 +316,7 @@ IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) -#define IPC_SYNC_MESSAGE_CONTROL4_2(msg_class, type1_in, type2_in, \ +#define IPC_SYNC_MESSAGE_CONTROL4_2_EXTRA(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, \ @@ -408,7 +330,7 @@ \ IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) -#define IPC_SYNC_MESSAGE_ROUTED0_0(msg_class) \ +#define IPC_SYNC_MESSAGE_ROUTED0_0_EXTRA(msg_class) \ msg_class::msg_class(int routing_id) \ : IPC::MessageWithReply<Tuple0, Tuple0>( \ routing_id, ID, \ @@ -416,7 +338,7 @@ \ IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) -#define IPC_SYNC_MESSAGE_ROUTED0_1(msg_class, type1_out) \ +#define IPC_SYNC_MESSAGE_ROUTED0_1_EXTRA(msg_class, type1_out) \ msg_class::msg_class(int routing_id, type1_out* arg1) \ : IPC::MessageWithReply<Tuple0, Tuple1<type1_out&> >( \ routing_id, ID, \ @@ -424,7 +346,7 @@ \ IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) -#define IPC_SYNC_MESSAGE_ROUTED0_2(msg_class, type1_out, type2_out) \ +#define IPC_SYNC_MESSAGE_ROUTED0_2_EXTRA(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, \ @@ -432,7 +354,7 @@ \ IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) -#define IPC_SYNC_MESSAGE_ROUTED0_3(msg_class, type1_out, type2_out, \ +#define IPC_SYNC_MESSAGE_ROUTED0_3_EXTRA(msg_class, type1_out, type2_out, \ type3_out) \ msg_class::msg_class(int routing_id, type1_out* arg1, type2_out* arg2, \ type3_out* arg3) \ @@ -442,7 +364,7 @@ \ IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) -#define IPC_SYNC_MESSAGE_ROUTED1_0(msg_class, type1_in) \ +#define IPC_SYNC_MESSAGE_ROUTED1_0_EXTRA(msg_class, type1_in) \ msg_class::msg_class(int routing_id, const type1_in& arg1) \ : IPC::MessageWithReply<Tuple1<type1_in>, Tuple0 >( \ routing_id, ID, \ @@ -450,7 +372,7 @@ \ IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) -#define IPC_SYNC_MESSAGE_ROUTED1_1(msg_class, type1_in, type1_out) \ +#define IPC_SYNC_MESSAGE_ROUTED1_1_EXTRA(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&> >( \ @@ -459,7 +381,7 @@ \ IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) -#define IPC_SYNC_MESSAGE_ROUTED1_2(msg_class, type1_in, type1_out, \ +#define IPC_SYNC_MESSAGE_ROUTED1_2_EXTRA(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) \ @@ -470,7 +392,7 @@ \ IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) -#define IPC_SYNC_MESSAGE_ROUTED1_3(msg_class, type1_in, type1_out, \ +#define IPC_SYNC_MESSAGE_ROUTED1_3_EXTRA(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) \ @@ -480,7 +402,7 @@ \ IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) -#define IPC_SYNC_MESSAGE_ROUTED1_4(msg_class, type1_in, type1_out, \ +#define IPC_SYNC_MESSAGE_ROUTED1_4_EXTRA(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, \ @@ -492,7 +414,7 @@ \ IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) -#define IPC_SYNC_MESSAGE_ROUTED2_0(msg_class, type1_in, type2_in) \ +#define IPC_SYNC_MESSAGE_ROUTED2_0_EXTRA(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 >( \ @@ -500,7 +422,7 @@ \ IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) -#define IPC_SYNC_MESSAGE_ROUTED2_1(msg_class, type1_in, type2_in, \ +#define IPC_SYNC_MESSAGE_ROUTED2_1_EXTRA(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) \ @@ -510,7 +432,7 @@ \ IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) -#define IPC_SYNC_MESSAGE_ROUTED2_2(msg_class, type1_in, type2_in, \ +#define IPC_SYNC_MESSAGE_ROUTED2_2_EXTRA(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, \ @@ -521,7 +443,7 @@ \ IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) -#define IPC_SYNC_MESSAGE_ROUTED2_3(msg_class, type1_in, type2_in, \ +#define IPC_SYNC_MESSAGE_ROUTED2_3_EXTRA(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, \ @@ -532,7 +454,7 @@ \ IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) -#define IPC_SYNC_MESSAGE_ROUTED3_0(msg_class, type1_in, type2_in, \ +#define IPC_SYNC_MESSAGE_ROUTED3_0_EXTRA(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) \ @@ -542,7 +464,7 @@ \ IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) -#define IPC_SYNC_MESSAGE_ROUTED3_1(msg_class, type1_in, type2_in, \ +#define IPC_SYNC_MESSAGE_ROUTED3_1_EXTRA(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, \ @@ -553,7 +475,7 @@ \ IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) -#define IPC_SYNC_MESSAGE_ROUTED3_2(msg_class, type1_in, type2_in, \ +#define IPC_SYNC_MESSAGE_ROUTED3_2_EXTRA(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, \ @@ -564,7 +486,7 @@ \ IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) -#define IPC_SYNC_MESSAGE_ROUTED3_3(msg_class, type1_in, type2_in, \ +#define IPC_SYNC_MESSAGE_ROUTED3_3_EXTRA(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, \ @@ -577,7 +499,7 @@ \ IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) -#define IPC_SYNC_MESSAGE_ROUTED3_4(msg_class, type1_in, type2_in, \ +#define IPC_SYNC_MESSAGE_ROUTED3_4_EXTRA(msg_class, type1_in, type2_in, \ type3_in, type1_out, type2_out, \ type3_out, type4_out) \ msg_class::msg_class(int routing_id, const type1_in& arg1, \ @@ -591,7 +513,7 @@ \ IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) -#define IPC_SYNC_MESSAGE_ROUTED4_0(msg_class, type1_in, type2_in, \ +#define IPC_SYNC_MESSAGE_ROUTED4_0_EXTRA(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, \ @@ -602,7 +524,7 @@ \ IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) -#define IPC_SYNC_MESSAGE_ROUTED4_1(msg_class, type1_in, type2_in, \ +#define IPC_SYNC_MESSAGE_ROUTED4_1_EXTRA(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, \ @@ -614,7 +536,7 @@ IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) -#define IPC_SYNC_MESSAGE_ROUTED4_2(msg_class, type1_in, type2_in, \ +#define IPC_SYNC_MESSAGE_ROUTED4_2_EXTRA(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, \ @@ -627,7 +549,7 @@ IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) -#define IPC_SYNC_MESSAGE_ROUTED4_3(msg_class, type1_in, type2_in, \ +#define IPC_SYNC_MESSAGE_ROUTED4_3_EXTRA(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, \ @@ -641,7 +563,7 @@ \ IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) -#define IPC_SYNC_MESSAGE_ROUTED5_0(msg_class, type1_in, type2_in, \ +#define IPC_SYNC_MESSAGE_ROUTED5_0_EXTRA(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, \ @@ -652,7 +574,7 @@ \ IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) -#define IPC_SYNC_MESSAGE_ROUTED5_1(msg_class, type1_in, type2_in, \ +#define IPC_SYNC_MESSAGE_ROUTED5_1_EXTRA(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, \ @@ -665,7 +587,7 @@ \ IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) -#define IPC_SYNC_MESSAGE_ROUTED5_2(msg_class, type1_in, type2_in, \ +#define IPC_SYNC_MESSAGE_ROUTED5_2_EXTRA(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, \ @@ -679,7 +601,7 @@ \ IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) -#define IPC_SYNC_MESSAGE_ROUTED5_3(msg_class, type1_in, type2_in, \ +#define IPC_SYNC_MESSAGE_ROUTED5_3_EXTRA(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, \ @@ -695,16 +617,4 @@ \ 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 6ce275c..ab07192 100644 --- a/ipc/ipc_message_macros.h +++ b/ipc/ipc_message_macros.h @@ -5,15 +5,13 @@ // This header is meant to be included in multiple passes, hence no traditional // header guard. // -// In the first pass, IPC_MESSAGE_MACROS_ENUMS should be defined, which will -// create enums for each of the messages defined with the IPC_MESSAGE_* macros. -// -// In the second pass, either IPC_MESSAGE_MACROS_DEBUGSTRINGS or -// IPC_MESSAGE_MACROS_CLASSES should be defined (if both, DEBUGSTRINGS takes -// precedence). Only one .cc file should have DEBUGSTRINGS defined, as this -// will create helper functions mapping message types to strings. Having -// CLASSES defined will create classes for each of the messages defined with -// the IPC_MESSAGE_* macros. +// In your XXX_messages_internal.h file, before defining any messages do: +// #define IPC_MESSAGE_START XMsgStart +// XMstStart value is from the IPCMessageStart enum in ipc_message_utils.h, and +// needs to be unique for each different file. +// In your XXX_messages.cc file, after all the includes for param types: +// #define IPC_MESSAGE_IMPL +// #include "X_messages.h" // // "Sync" messages are just synchronous calls, the Send() call doesn't return // until a reply comes back. Input parameters are first (const TYPE&), and @@ -42,1291 +40,994 @@ #include "ipc/ipc_message_utils.h" +// In case a file includes several X_messages.h files, we don't want to get +// errors because each X_messages_internal.h file will define this. +#undef IPC_MESSAGE_START -#ifndef MESSAGES_INTERNAL_FILE -#error This file should only be included by X_messages.h, which needs to define\ - MESSAGES_INTERNAL_FILE first. -#endif - -// Trick 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/automation_messages_internal.h" -#include "chrome/common/devtools_messages_internal.h" -#include "chrome/common/plugin_messages_internal.h" -#include "chrome/common/render_messages_internal.h" -#include "chrome/common/worker_messages_internal.h" -#include "ppapi/proxy/ppapi_messages_internal.h" -#endif - -#ifndef IPC_MESSAGE_MACROS_INCLUDE_BLOCK -#define IPC_MESSAGE_MACROS_INCLUDE_BLOCK - -// Multi-pass include of X_messages_internal.h. Preprocessor magic allows -// us to use 1 header to define the enums and classes for our render messages. -#define IPC_MESSAGE_MACROS_ENUMS -#include MESSAGES_INTERNAL_FILE - -#define IPC_MESSAGE_MACROS_CLASSES -#include MESSAGES_INTERNAL_FILE - -#ifdef IPC_MESSAGE_MACROS_LOG_ENABLED -#define IPC_MESSAGE_MACROS_LOG -#include MESSAGES_INTERNAL_FILE -#endif - -#undef MESSAGES_INTERNAL_FILE -#undef IPC_MESSAGE_MACROS_INCLUDE_BLOCK - -#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 -#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_CONTROL3_4 -#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_ROUTED3_4 -#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 - -// We're using the lowest 16 bits of type for the message id, and the highest -// 16 bits for the channel type. -// -// Do label##PreStart so that automation messages keep the same id as before. -#define IPC_BEGIN_MESSAGES(label) \ - enum label##MsgType { \ - label##Start = label##MsgStart << 16, \ - label##PreStart = (label##MsgStart << 16) - 1, - -#define IPC_END_MESSAGES(label) \ - label##End \ - }; - -#define IPC_MESSAGE_CONTROL0(msg_class) \ - msg_class##__ID, - -#define IPC_MESSAGE_CONTROL1(msg_class, type1) \ - msg_class##__ID, - -#define IPC_MESSAGE_CONTROL2(msg_class, type1, type2) \ - msg_class##__ID, - -#define IPC_MESSAGE_CONTROL3(msg_class, type1, type2, type3) \ - msg_class##__ID, - -#define IPC_MESSAGE_CONTROL4(msg_class, type1, type2, type3, type4) \ - msg_class##__ID, - -#define IPC_MESSAGE_CONTROL5(msg_class, type1, type2, type3, type4, type5) \ - msg_class##__ID, - -#define IPC_MESSAGE_ROUTED0(msg_class) \ - msg_class##__ID, - -#define IPC_MESSAGE_ROUTED1(msg_class, type1) \ - msg_class##__ID, - -#define IPC_MESSAGE_ROUTED2(msg_class, type1, type2) \ - msg_class##__ID, - -#define IPC_MESSAGE_ROUTED3(msg_class, type1, type2, type3) \ - msg_class##__ID, - -#define IPC_MESSAGE_ROUTED4(msg_class, type1, type2, type3, type4) \ - msg_class##__ID, - -#define IPC_MESSAGE_ROUTED5(msg_class, type1, type2, type3, type4, type5) \ - msg_class##__ID, - -#define IPC_SYNC_MESSAGE_CONTROL0_0(msg_class) \ - msg_class##__ID, - -#define IPC_SYNC_MESSAGE_CONTROL0_1(msg_class, type1_out) \ - msg_class##__ID, - -#define IPC_SYNC_MESSAGE_CONTROL0_2(msg_class, type1_out, type2_out) \ - msg_class##__ID, - -#define IPC_SYNC_MESSAGE_CONTROL0_3(msg_class, type1_out, type2_out, type3_out) \ - msg_class##__ID, - -#define IPC_SYNC_MESSAGE_CONTROL1_0(msg_class, type1_in) \ - msg_class##__ID, - -#define IPC_SYNC_MESSAGE_CONTROL1_1(msg_class, type1_in, type1_out) \ - msg_class##__ID, - -#define IPC_SYNC_MESSAGE_CONTROL1_2(msg_class, type1_in, type1_out, type2_out) \ - msg_class##__ID, - -#define IPC_SYNC_MESSAGE_CONTROL1_3(msg_class, type1_in, type1_out, type2_out, type3_out) \ - msg_class##__ID, - -#define IPC_SYNC_MESSAGE_CONTROL2_0(msg_class, type1_in, type2_in) \ - msg_class##__ID, - -#define IPC_SYNC_MESSAGE_CONTROL2_1(msg_class, type1_in, type2_in, type1_out) \ - msg_class##__ID, - -#define IPC_SYNC_MESSAGE_CONTROL2_2(msg_class, type1_in, type2_in, type1_out, type2_out) \ - msg_class##__ID, - -#define IPC_SYNC_MESSAGE_CONTROL2_3(msg_class, type1_in, type2_in, type1_out, type2_out, type3_out) \ - msg_class##__ID, - -#define IPC_SYNC_MESSAGE_CONTROL3_1(msg_class, type1_in, type2_in, type3_in, type1_out) \ - msg_class##__ID, - -#define IPC_SYNC_MESSAGE_CONTROL3_2(msg_class, type1_in, type2_in, type3_in, type1_out, type2_out) \ - msg_class##__ID, - -#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, - -#define IPC_SYNC_MESSAGE_CONTROL4_2(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out, type2_out) \ - msg_class##__ID, - -#define IPC_SYNC_MESSAGE_ROUTED0_0(msg_class) \ - msg_class##__ID, - -#define IPC_SYNC_MESSAGE_ROUTED0_1(msg_class, type1_out) \ - msg_class##__ID, - -#define IPC_SYNC_MESSAGE_ROUTED0_2(msg_class, type1_out, type2_out) \ - msg_class##__ID, - -#define IPC_SYNC_MESSAGE_ROUTED0_3(msg_class, type1_out, type2_out, type3_out) \ - msg_class##__ID, - -#define IPC_SYNC_MESSAGE_ROUTED1_0(msg_class, type1_in) \ - msg_class##__ID, - -#define IPC_SYNC_MESSAGE_ROUTED1_1(msg_class, type1_in, type1_out) \ - msg_class##__ID, - -#define IPC_SYNC_MESSAGE_ROUTED1_2(msg_class, type1_in, type1_out, type2_out) \ - msg_class##__ID, - -#define IPC_SYNC_MESSAGE_ROUTED1_3(msg_class, type1_in, type1_out, type2_out, type3_out) \ - msg_class##__ID, - -#define IPC_SYNC_MESSAGE_ROUTED1_4(msg_class, type1_in, type1_out, type2_out, type3_out, type4_out) \ - msg_class##__ID, - -#define IPC_SYNC_MESSAGE_ROUTED2_0(msg_class, type1_in, type2_in) \ - msg_class##__ID, - -#define IPC_SYNC_MESSAGE_ROUTED2_1(msg_class, type1_in, type2_in, type1_out) \ - msg_class##__ID, - -#define IPC_SYNC_MESSAGE_ROUTED2_2(msg_class, type1_in, type2_in, type1_out, type2_out) \ - msg_class##__ID, - -#define IPC_SYNC_MESSAGE_ROUTED2_3(msg_class, type1_in, type2_in, type1_out, type2_out, type3_out) \ - msg_class##__ID, - -#define IPC_SYNC_MESSAGE_ROUTED3_0(msg_class, type1_in, type2_in, type3_in) \ - msg_class##__ID, - -#define IPC_SYNC_MESSAGE_ROUTED3_1(msg_class, type1_in, type2_in, type3_in, type1_out) \ - msg_class##__ID, - -#define IPC_SYNC_MESSAGE_ROUTED3_2(msg_class, type1_in, type2_in, type3_in, type1_out, type2_out) \ - msg_class##__ID, - -#define IPC_SYNC_MESSAGE_ROUTED3_3(msg_class, type1_in, type2_in, type3_in, type1_out, type2_out, type3_out) \ - msg_class##__ID, - -#define IPC_SYNC_MESSAGE_ROUTED3_4(msg_class, type1_in, type2_in, type3_in, type1_out, type2_out, type3_out, type4_out) \ - msg_class##__ID, - -#define IPC_SYNC_MESSAGE_ROUTED4_0(msg_class, type1_in, type2_in, type3_in, type4_in) \ - msg_class##__ID, - -#define IPC_SYNC_MESSAGE_ROUTED4_1(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out) \ - msg_class##__ID, - -#define IPC_SYNC_MESSAGE_ROUTED4_2(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out, type2_out) \ - msg_class##__ID, - -#define IPC_SYNC_MESSAGE_ROUTED4_3(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out, type2_out, type3_out) \ - msg_class##__ID, - -#define IPC_SYNC_MESSAGE_ROUTED5_0(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in) \ - msg_class##__ID, - -#define IPC_SYNC_MESSAGE_ROUTED5_1(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in, type1_out) \ - msg_class##__ID, - -#define IPC_SYNC_MESSAGE_ROUTED5_2(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in, type1_out, type2_out) \ - msg_class##__ID, - -#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##__ID, - -// Message crackers and handlers. -// Prefer to use the IPC_BEGIN_MESSAGE_MAP_EX to the older macros since they -// allow you to detect when a message could not be de-serialized. Usage: -// -// void MyClass::OnMessageReceived(const IPC::Message& msg) { -// bool msg_is_good = false; -// IPC_BEGIN_MESSAGE_MAP_EX(MyClass, msg, msg_is_good) -// IPC_MESSAGE_HANDLER(MsgClassOne, OnMsgClassOne) -// ...more handlers here ... -// IPC_MESSAGE_HANDLER(MsgClassTen, OnMsgClassTen) -// IPC_END_MESSAGE_MAP_EX() -// if (!msg_is_good) { -// // Signal error here or terminate offending process. -// } -// } - -#define IPC_DEFINE_MESSAGE_MAP(class_name) \ -void class_name::OnMessageReceived(const IPC::Message& msg) \ - IPC_BEGIN_MESSAGE_MAP(class_name, msg) - -#define IPC_BEGIN_MESSAGE_MAP_EX(class_name, msg, msg_is_ok) \ - { \ - typedef class_name _IpcMessageHandlerClass; \ - const IPC::Message& ipc_message__ = msg; \ - bool& msg_is_ok__ = msg_is_ok; \ - switch (ipc_message__.type()) { \ - -#define IPC_BEGIN_MESSAGE_MAP(class_name, msg) \ - { \ - typedef class_name _IpcMessageHandlerClass; \ - const IPC::Message& ipc_message__ = msg; \ - bool msg_is_ok__ = true; \ - switch (ipc_message__.type()) { \ - -#define IPC_MESSAGE_FORWARD(msg_class, obj, member_func) \ - case msg_class::ID: \ - msg_is_ok__ = msg_class::Dispatch(&ipc_message__, obj, &member_func); \ - break; - -#define IPC_MESSAGE_HANDLER(msg_class, member_func) \ - IPC_MESSAGE_FORWARD(msg_class, this, _IpcMessageHandlerClass::member_func) +#if defined(IPC_MESSAGE_IMPL) +#include "ipc/ipc_message_impl_macros.h" +#elif defined(IPC_MESSAGE_MACROS_LOG_ENABLED) -#define IPC_MESSAGE_FORWARD_DELAY_REPLY(msg_class, obj, member_func) \ - case msg_class::ID: \ - msg_class::DispatchDelayReply(&ipc_message__, obj, &member_func); \ - break; - -#define IPC_MESSAGE_HANDLER_DELAY_REPLY(msg_class, member_func) \ - IPC_MESSAGE_FORWARD_DELAY_REPLY(msg_class, this, \ - _IpcMessageHandlerClass::member_func) - -#define IPC_MESSAGE_HANDLER_GENERIC(msg_class, code) \ - case msg_class::ID: \ - code; \ - break; - -#define IPC_REPLY_HANDLER(func) \ - case IPC_REPLY_ID: \ - func(ipc_message__); \ - break; - - -#define IPC_MESSAGE_UNHANDLED(code) \ - default: \ - code; \ - break; - -#define IPC_MESSAGE_UNHANDLED_ERROR() \ - IPC_MESSAGE_UNHANDLED(NOTREACHED() << \ - "Invalid message with type = " << \ - ipc_message__.type()) - -#define IPC_END_MESSAGE_MAP() \ - DCHECK(msg_is_ok__); \ - } \ -} +#ifndef IPC_LOG_TABLE_CREATED +#define IPC_LOG_TABLE_CREATED -#define IPC_END_MESSAGE_MAP_EX() \ - } \ -} +#include "base/hash_tables.h" -#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_CONTROL3_4 -#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_ROUTED3_4 -#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 +typedef void (*LogFunction)(std::string* name, + const IPC::Message* msg, + std::string* params); -#ifndef IPC_LOG_TABLE_CREATED -#define IPC_LOG_TABLE_CREATED -typedef void (*LogFunction)(uint32 type, - std::string* name, - const IPC::Message* msg, - std::string* params); +typedef base::hash_map<uint32, LogFunction > LogFunctionMap; +LogFunctionMap g_log_function_mapping; -LogFunction g_log_function_mapping[LastMsgIndex]; #endif -#define IPC_BEGIN_MESSAGES(label) \ - void label##MsgLog(uint32 type, std::string* name, const IPC::Message* msg, \ - std::string* params) { \ - switch (type) { - -#define IPC_END_MESSAGES(label) \ - default: \ - if (name) \ - *name = "[UNKNOWN " #label " MSG]"; \ - } \ - } \ - class LoggerRegisterHelper##label { \ +#define IPC_MESSAGE_LOG(msg_class) \ + class LoggerRegisterHelper##msg_class { \ public: \ - LoggerRegisterHelper##label() { \ - g_log_function_mapping[label##MsgStart] = label##MsgLog; \ + LoggerRegisterHelper##msg_class() { \ + g_log_function_mapping[msg_class::ID] = msg_class::Log; \ } \ }; \ - LoggerRegisterHelper##label g_LoggerRegisterHelper##label; - -#define IPC_MESSAGE_LOG(msg_class) \ - case msg_class##__ID: \ - if (name) \ - *name = #msg_class; \ - if (msg && params) \ - msg_class::Log(msg, params); \ - break; + LoggerRegisterHelper##msg_class g_LoggerRegisterHelper##msg_class; -#define IPC_MESSAGE_CONTROL0(msg_class) \ +#define IPC_MESSAGE_CONTROL0_EXTRA(msg_class) \ IPC_MESSAGE_LOG(msg_class) -#define IPC_MESSAGE_CONTROL1(msg_class, type1) \ +#define IPC_MESSAGE_CONTROL1_EXTRA(msg_class, type1) \ IPC_MESSAGE_LOG(msg_class) -#define IPC_MESSAGE_CONTROL2(msg_class, type1, type2) \ +#define IPC_MESSAGE_CONTROL2_EXTRA(msg_class, type1, type2) \ IPC_MESSAGE_LOG(msg_class) -#define IPC_MESSAGE_CONTROL3(msg_class, type1, type2, type3) \ +#define IPC_MESSAGE_CONTROL3_EXTRA(msg_class, type1, type2, type3) \ IPC_MESSAGE_LOG(msg_class) -#define IPC_MESSAGE_CONTROL4(msg_class, type1, type2, type3, type4) \ +#define IPC_MESSAGE_CONTROL4_EXTRA(msg_class, type1, type2, type3, type4) \ IPC_MESSAGE_LOG(msg_class) -#define IPC_MESSAGE_CONTROL5(msg_class, type1, type2, type3, type4, type5) \ +#define IPC_MESSAGE_CONTROL5_EXTRA(msg_class, type1, type2, type3, type4, type5) \ IPC_MESSAGE_LOG(msg_class) -#define IPC_MESSAGE_ROUTED0(msg_class) \ +#define IPC_MESSAGE_ROUTED0_EXTRA(msg_class) \ IPC_MESSAGE_LOG(msg_class) -#define IPC_MESSAGE_ROUTED1(msg_class, type1) \ +#define IPC_MESSAGE_ROUTED1_EXTRA(msg_class, type1) \ IPC_MESSAGE_LOG(msg_class) -#define IPC_MESSAGE_ROUTED2(msg_class, type1, type2) \ +#define IPC_MESSAGE_ROUTED2_EXTRA(msg_class, type1, type2) \ IPC_MESSAGE_LOG(msg_class) -#define IPC_MESSAGE_ROUTED3(msg_class, type1, type2, type3) \ +#define IPC_MESSAGE_ROUTED3_EXTRA(msg_class, type1, type2, type3) \ IPC_MESSAGE_LOG(msg_class) -#define IPC_MESSAGE_ROUTED4(msg_class, type1, type2, type3, type4) \ +#define IPC_MESSAGE_ROUTED4_EXTRA(msg_class, type1, type2, type3, type4) \ IPC_MESSAGE_LOG(msg_class) -#define IPC_MESSAGE_ROUTED5(msg_class, type1, type2, type3, type4, type5) \ +#define IPC_MESSAGE_ROUTED5_EXTRA(msg_class, type1, type2, type3, type4, type5) \ IPC_MESSAGE_LOG(msg_class) -#define IPC_SYNC_MESSAGE_CONTROL0_0(msg_class) \ +#define IPC_SYNC_MESSAGE_CONTROL0_0_EXTRA(msg_class) \ IPC_MESSAGE_LOG(msg_class) -#define IPC_SYNC_MESSAGE_CONTROL0_1(msg_class, type1_out) \ +#define IPC_SYNC_MESSAGE_CONTROL0_1_EXTRA(msg_class, type1_out) \ IPC_MESSAGE_LOG(msg_class) -#define IPC_SYNC_MESSAGE_CONTROL0_2(msg_class, type1_out, type2_out) \ +#define IPC_SYNC_MESSAGE_CONTROL0_2_EXTRA(msg_class, type1_out, type2_out) \ IPC_MESSAGE_LOG(msg_class) -#define IPC_SYNC_MESSAGE_CONTROL0_3(msg_class, type1_out, type2_out, type3_out) \ +#define IPC_SYNC_MESSAGE_CONTROL0_3_EXTRA(msg_class, type1_out, type2_out, type3_out) \ IPC_MESSAGE_LOG(msg_class) -#define IPC_SYNC_MESSAGE_CONTROL1_0(msg_class, type1_in) \ +#define IPC_SYNC_MESSAGE_CONTROL1_0_EXTRA(msg_class, type1_in) \ IPC_MESSAGE_LOG(msg_class) -#define IPC_SYNC_MESSAGE_CONTROL1_1(msg_class, type1_in, type1_out) \ +#define IPC_SYNC_MESSAGE_CONTROL1_1_EXTRA(msg_class, type1_in, type1_out) \ IPC_MESSAGE_LOG(msg_class) -#define IPC_SYNC_MESSAGE_CONTROL1_2(msg_class, type1_in, type1_out, type2_out) \ +#define IPC_SYNC_MESSAGE_CONTROL1_2_EXTRA(msg_class, type1_in, type1_out, type2_out) \ IPC_MESSAGE_LOG(msg_class) -#define IPC_SYNC_MESSAGE_CONTROL1_3(msg_class, type1_in, type1_out, type2_out, type3_out) \ +#define IPC_SYNC_MESSAGE_CONTROL1_3_EXTRA(msg_class, type1_in, type1_out, type2_out, type3_out) \ IPC_MESSAGE_LOG(msg_class) -#define IPC_SYNC_MESSAGE_CONTROL2_0(msg_class, type1_in, type2_in) \ +#define IPC_SYNC_MESSAGE_CONTROL2_0_EXTRA(msg_class, type1_in, type2_in) \ IPC_MESSAGE_LOG(msg_class) -#define IPC_SYNC_MESSAGE_CONTROL2_1(msg_class, type1_in, type2_in, type1_out) \ +#define IPC_SYNC_MESSAGE_CONTROL2_1_EXTRA(msg_class, type1_in, type2_in, type1_out) \ IPC_MESSAGE_LOG(msg_class) -#define IPC_SYNC_MESSAGE_CONTROL2_2(msg_class, type1_in, type2_in, type1_out, type2_out) \ +#define IPC_SYNC_MESSAGE_CONTROL2_2_EXTRA(msg_class, type1_in, type2_in, type1_out, type2_out) \ IPC_MESSAGE_LOG(msg_class) -#define IPC_SYNC_MESSAGE_CONTROL2_3(msg_class, type1_in, type2_in, type1_out, type2_out, type3_out) \ +#define IPC_SYNC_MESSAGE_CONTROL2_3_EXTRA(msg_class, type1_in, type2_in, type1_out, type2_out, type3_out) \ IPC_MESSAGE_LOG(msg_class) -#define IPC_SYNC_MESSAGE_CONTROL3_1(msg_class, type1_in, type2_in, type3_in, type1_out) \ +#define IPC_SYNC_MESSAGE_CONTROL3_1_EXTRA(msg_class, type1_in, type2_in, type3_in, type1_out) \ IPC_MESSAGE_LOG(msg_class) -#define IPC_SYNC_MESSAGE_CONTROL3_2(msg_class, type1_in, type2_in, type3_in, type1_out, type2_out) \ +#define IPC_SYNC_MESSAGE_CONTROL3_2_EXTRA(msg_class, type1_in, type2_in, type3_in, type1_out, type2_out) \ IPC_MESSAGE_LOG(msg_class) -#define IPC_SYNC_MESSAGE_CONTROL3_3(msg_class, type1_in, type2_in, type3_in, type1_out, type2_out, type3_out) \ +#define IPC_SYNC_MESSAGE_CONTROL3_3_EXTRA(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) \ +#define IPC_SYNC_MESSAGE_CONTROL3_4_EXTRA(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) \ +#define IPC_SYNC_MESSAGE_CONTROL4_1_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out) \ IPC_MESSAGE_LOG(msg_class) -#define IPC_SYNC_MESSAGE_CONTROL4_2(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out, type2_out) \ +#define IPC_SYNC_MESSAGE_CONTROL4_2_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out, type2_out) \ IPC_MESSAGE_LOG(msg_class) -#define IPC_SYNC_MESSAGE_ROUTED0_0(msg_class) \ +#define IPC_SYNC_MESSAGE_ROUTED0_0_EXTRA(msg_class) \ IPC_MESSAGE_LOG(msg_class) -#define IPC_SYNC_MESSAGE_ROUTED0_1(msg_class, type1_out) \ +#define IPC_SYNC_MESSAGE_ROUTED0_1_EXTRA(msg_class, type1_out) \ IPC_MESSAGE_LOG(msg_class) -#define IPC_SYNC_MESSAGE_ROUTED0_2(msg_class, type1_out, type2_out) \ +#define IPC_SYNC_MESSAGE_ROUTED0_2_EXTRA(msg_class, type1_out, type2_out) \ IPC_MESSAGE_LOG(msg_class) -#define IPC_SYNC_MESSAGE_ROUTED0_3(msg_class, type1_out, type2_out, type3_out) \ +#define IPC_SYNC_MESSAGE_ROUTED0_3_EXTRA(msg_class, type1_out, type2_out, type3_out) \ IPC_MESSAGE_LOG(msg_class) -#define IPC_SYNC_MESSAGE_ROUTED1_0(msg_class, type1_in) \ +#define IPC_SYNC_MESSAGE_ROUTED1_0_EXTRA(msg_class, type1_in) \ IPC_MESSAGE_LOG(msg_class) -#define IPC_SYNC_MESSAGE_ROUTED1_1(msg_class, type1_in, type1_out) \ +#define IPC_SYNC_MESSAGE_ROUTED1_1_EXTRA(msg_class, type1_in, type1_out) \ IPC_MESSAGE_LOG(msg_class) -#define IPC_SYNC_MESSAGE_ROUTED1_2(msg_class, type1_in, type1_out, type2_out) \ +#define IPC_SYNC_MESSAGE_ROUTED1_2_EXTRA(msg_class, type1_in, type1_out, type2_out) \ IPC_MESSAGE_LOG(msg_class) -#define IPC_SYNC_MESSAGE_ROUTED1_3(msg_class, type1_in, type1_out, type2_out, type3_out) \ +#define IPC_SYNC_MESSAGE_ROUTED1_3_EXTRA(msg_class, type1_in, type1_out, type2_out, type3_out) \ IPC_MESSAGE_LOG(msg_class) -#define IPC_SYNC_MESSAGE_ROUTED1_4(msg_class, type1_in, type1_out, type2_out, type3_out, type4_out) \ +#define IPC_SYNC_MESSAGE_ROUTED1_4_EXTRA(msg_class, type1_in, type1_out, type2_out, type3_out, type4_out) \ IPC_MESSAGE_LOG(msg_class) -#define IPC_SYNC_MESSAGE_ROUTED2_0(msg_class, type1_in, type2_in) \ +#define IPC_SYNC_MESSAGE_ROUTED2_0_EXTRA(msg_class, type1_in, type2_in) \ IPC_MESSAGE_LOG(msg_class) -#define IPC_SYNC_MESSAGE_ROUTED2_1(msg_class, type1_in, type2_in, type1_out) \ +#define IPC_SYNC_MESSAGE_ROUTED2_1_EXTRA(msg_class, type1_in, type2_in, type1_out) \ IPC_MESSAGE_LOG(msg_class) -#define IPC_SYNC_MESSAGE_ROUTED2_2(msg_class, type1_in, type2_in, type1_out, type2_out) \ +#define IPC_SYNC_MESSAGE_ROUTED2_2_EXTRA(msg_class, type1_in, type2_in, type1_out, type2_out) \ IPC_MESSAGE_LOG(msg_class) -#define IPC_SYNC_MESSAGE_ROUTED2_3(msg_class, type1_in, type2_in, type1_out, type2_out, type3_out) \ +#define IPC_SYNC_MESSAGE_ROUTED2_3_EXTRA(msg_class, type1_in, type2_in, type1_out, type2_out, type3_out) \ IPC_MESSAGE_LOG(msg_class) -#define IPC_SYNC_MESSAGE_ROUTED3_0(msg_class, type1_in, type2_in, type3_in) \ +#define IPC_SYNC_MESSAGE_ROUTED3_0_EXTRA(msg_class, type1_in, type2_in, type3_in) \ IPC_MESSAGE_LOG(msg_class) -#define IPC_SYNC_MESSAGE_ROUTED3_1(msg_class, type1_in, type2_in, type3_in, type1_out) \ +#define IPC_SYNC_MESSAGE_ROUTED3_1_EXTRA(msg_class, type1_in, type2_in, type3_in, type1_out) \ IPC_MESSAGE_LOG(msg_class) -#define IPC_SYNC_MESSAGE_ROUTED3_2(msg_class, type1_in, type2_in, type3_in, type1_out, type2_out) \ +#define IPC_SYNC_MESSAGE_ROUTED3_2_EXTRA(msg_class, type1_in, type2_in, type3_in, type1_out, type2_out) \ IPC_MESSAGE_LOG(msg_class) -#define IPC_SYNC_MESSAGE_ROUTED3_3(msg_class, type1_in, type2_in, type3_in, type1_out, type2_out, type3_out) \ +#define IPC_SYNC_MESSAGE_ROUTED3_3_EXTRA(msg_class, type1_in, type2_in, type3_in, type1_out, type2_out, type3_out) \ IPC_MESSAGE_LOG(msg_class) -#define IPC_SYNC_MESSAGE_ROUTED3_4(msg_class, type1_in, type2_in, type3_in, type1_out, type2_out, type3_out, type4_out) \ +#define IPC_SYNC_MESSAGE_ROUTED3_4_EXTRA(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_ROUTED4_0(msg_class, type1_in, type2_in, type3_in, type4_in) \ +#define IPC_SYNC_MESSAGE_ROUTED4_0_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in) \ IPC_MESSAGE_LOG(msg_class) -#define IPC_SYNC_MESSAGE_ROUTED4_1(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out) \ +#define IPC_SYNC_MESSAGE_ROUTED4_1_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out) \ IPC_MESSAGE_LOG(msg_class) -#define IPC_SYNC_MESSAGE_ROUTED4_2(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out, type2_out) \ +#define IPC_SYNC_MESSAGE_ROUTED4_2_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out, type2_out) \ IPC_MESSAGE_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) \ +#define IPC_SYNC_MESSAGE_ROUTED4_3_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out, type2_out, type3_out) \ IPC_MESSAGE_LOG(msg_class) -#define IPC_SYNC_MESSAGE_ROUTED5_0(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in) \ +#define IPC_SYNC_MESSAGE_ROUTED5_0_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in) \ IPC_MESSAGE_LOG(msg_class) -#define IPC_SYNC_MESSAGE_ROUTED5_1(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in, type1_out) \ +#define IPC_SYNC_MESSAGE_ROUTED5_1_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in, type1_out) \ IPC_MESSAGE_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) \ +#define IPC_SYNC_MESSAGE_ROUTED5_2_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in, type1_out, type2_out) \ IPC_MESSAGE_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) \ +#define IPC_SYNC_MESSAGE_ROUTED5_3_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in, type1_out, type2_out, type3_out) \ IPC_MESSAGE_LOG(msg_class) -#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_CONTROL3_4 -#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_ROUTED3_4 -#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) +#else + +#define IPC_MESSAGE_CONTROL0_EXTRA(msg_class) +#define IPC_MESSAGE_CONTROL1_EXTRA(msg_class, type1) +#define IPC_MESSAGE_CONTROL2_EXTRA(msg_class, type1, type2) +#define IPC_MESSAGE_CONTROL3_EXTRA(msg_class, type1, type2, type3) +#define IPC_MESSAGE_CONTROL4_EXTRA(msg_class, type1, type2, type3, type4) +#define IPC_MESSAGE_CONTROL5_EXTRA(msg_class, type1, type2, type3, type4, type5) +#define IPC_MESSAGE_ROUTED0_EXTRA(msg_class) +#define IPC_MESSAGE_ROUTED1_EXTRA(msg_class, type1) +#define IPC_MESSAGE_ROUTED2_EXTRA(msg_class, type1, type2) +#define IPC_MESSAGE_ROUTED3_EXTRA(msg_class, type1, type2, type3) +#define IPC_MESSAGE_ROUTED4_EXTRA(msg_class, type1, type2, type3, type4) +#define IPC_MESSAGE_ROUTED5_EXTRA(msg_class, type1, type2, type3, type4, type5) +#define IPC_SYNC_MESSAGE_CONTROL0_0_EXTRA(msg_class) +#define IPC_SYNC_MESSAGE_CONTROL0_1_EXTRA(msg_class, type1_out) +#define IPC_SYNC_MESSAGE_CONTROL0_2_EXTRA(msg_class, type1_out, type2_out) +#define IPC_SYNC_MESSAGE_CONTROL0_3_EXTRA(msg_class, type1_out, type2_out, type3_out) +#define IPC_SYNC_MESSAGE_CONTROL1_0_EXTRA(msg_class, type1_in) +#define IPC_SYNC_MESSAGE_CONTROL1_1_EXTRA(msg_class, type1_in, type1_out) +#define IPC_SYNC_MESSAGE_CONTROL1_2_EXTRA(msg_class, type1_in, type1_out, type2_out) +#define IPC_SYNC_MESSAGE_CONTROL1_3_EXTRA(msg_class, type1_in, type1_out, type2_out, type3_out) +#define IPC_SYNC_MESSAGE_CONTROL2_0_EXTRA(msg_class, type1_in, type2_in) +#define IPC_SYNC_MESSAGE_CONTROL2_1_EXTRA(msg_class, type1_in, type2_in, type1_out) +#define IPC_SYNC_MESSAGE_CONTROL2_2_EXTRA(msg_class, type1_in, type2_in, type1_out, type2_out) +#define IPC_SYNC_MESSAGE_CONTROL2_3_EXTRA(msg_class, type1_in, type2_in, type1_out, type2_out, type3_out) +#define IPC_SYNC_MESSAGE_CONTROL3_1_EXTRA(msg_class, type1_in, type2_in, type3_in, type1_out) +#define IPC_SYNC_MESSAGE_CONTROL3_2_EXTRA(msg_class, type1_in, type2_in, type3_in, type1_out, type2_out) +#define IPC_SYNC_MESSAGE_CONTROL3_3_EXTRA(msg_class, type1_in, type2_in, type3_in, type1_out, type2_out, type3_out) +#define IPC_SYNC_MESSAGE_CONTROL3_4_EXTRA(msg_class, type1_in, type2_in, type3_in, type1_out, type2_out, type3_out, type4_out) +#define IPC_SYNC_MESSAGE_CONTROL4_1_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out) +#define IPC_SYNC_MESSAGE_CONTROL4_2_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out, type2_out) +#define IPC_SYNC_MESSAGE_ROUTED0_0_EXTRA(msg_class) +#define IPC_SYNC_MESSAGE_ROUTED0_1_EXTRA(msg_class, type1_out) +#define IPC_SYNC_MESSAGE_ROUTED0_2_EXTRA(msg_class, type1_out, type2_out) +#define IPC_SYNC_MESSAGE_ROUTED0_3_EXTRA(msg_class, type1_out, type2_out, type3_out) +#define IPC_SYNC_MESSAGE_ROUTED1_0_EXTRA(msg_class, type1_in) +#define IPC_SYNC_MESSAGE_ROUTED1_1_EXTRA(msg_class, type1_in, type1_out) +#define IPC_SYNC_MESSAGE_ROUTED1_2_EXTRA(msg_class, type1_in, type1_out, type2_out) +#define IPC_SYNC_MESSAGE_ROUTED1_3_EXTRA(msg_class, type1_in, type1_out, type2_out, type3_out) +#define IPC_SYNC_MESSAGE_ROUTED1_4_EXTRA(msg_class, type1_in, type1_out, type2_out, type3_out, type4_out) +#define IPC_SYNC_MESSAGE_ROUTED2_0_EXTRA(msg_class, type1_in, type2_in) +#define IPC_SYNC_MESSAGE_ROUTED2_1_EXTRA(msg_class, type1_in, type2_in, type1_out) +#define IPC_SYNC_MESSAGE_ROUTED2_2_EXTRA(msg_class, type1_in, type2_in, type1_out, type2_out) +#define IPC_SYNC_MESSAGE_ROUTED2_3_EXTRA(msg_class, type1_in, type2_in, type1_out, type2_out, type3_out) +#define IPC_SYNC_MESSAGE_ROUTED3_0_EXTRA(msg_class, type1_in, type2_in, type3_in) +#define IPC_SYNC_MESSAGE_ROUTED3_1_EXTRA(msg_class, type1_in, type2_in, type3_in, type1_out) +#define IPC_SYNC_MESSAGE_ROUTED3_2_EXTRA(msg_class, type1_in, type2_in, type3_in, type1_out, type2_out) +#define IPC_SYNC_MESSAGE_ROUTED3_3_EXTRA(msg_class, type1_in, type2_in, type3_in, type1_out, type2_out, type3_out) +#define IPC_SYNC_MESSAGE_ROUTED3_4_EXTRA(msg_class, type1_in, type2_in, type3_in, type1_out, type2_out, type3_out, type4_out) +#define IPC_SYNC_MESSAGE_ROUTED4_0_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in) +#define IPC_SYNC_MESSAGE_ROUTED4_1_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out) +#define IPC_SYNC_MESSAGE_ROUTED4_2_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out, type2_out) +#define IPC_SYNC_MESSAGE_ROUTED4_3_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out, type2_out, type3_out) +#define IPC_SYNC_MESSAGE_ROUTED5_0_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in) +#define IPC_SYNC_MESSAGE_ROUTED5_1_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in, type1_out) +#define IPC_SYNC_MESSAGE_ROUTED5_2_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in, type1_out, type2_out) +#define IPC_SYNC_MESSAGE_ROUTED5_3_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in, type1_out, type2_out, type3_out) + +#endif + +// Note: we currently use __LINE__ to give unique IDs to messages within a file. +// They're globally unique since each file defines its own IPC_MESSAGE_START. +// Ideally, we wouldn't use line numbers, but instead use the __COUNTER__ macro, +// but it needs gcc 4.3 and xcode doesn't use it yet. When that happens, switch +// to it. #define IPC_MESSAGE_CONTROL0(msg_class) \ class msg_class : public IPC::Message { \ public: \ - enum { ID = msg_class##__ID }; \ + enum { ID = (IPC_MESSAGE_START << 16) + __LINE__ }; \ msg_class() \ : IPC::Message(MSG_ROUTING_CONTROL, \ ID, \ PRIORITY_NORMAL) {} \ - }; + }; \ + IPC_MESSAGE_CONTROL0_EXTRA(msg_class) #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); \ - ~msg_class(); \ - static void Log(const Message* msg, std::string* l); \ - }; + public: \ + enum { ID = (IPC_MESSAGE_START << 16) + __LINE__ }; \ + msg_class(const type1& arg1); \ + ~msg_class(); \ + static void Log(std::string* name, const Message* msg, std::string* l); \ + }; \ + IPC_MESSAGE_CONTROL1_EXTRA(msg_class, type1) #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); \ - ~msg_class(); \ - static void Log(const Message* msg, std::string* l); \ - }; + public: \ + enum { ID = (IPC_MESSAGE_START << 16) + __LINE__ }; \ + msg_class(const type1& arg1, const type2& arg2); \ + ~msg_class(); \ + static void Log(std::string* name, const Message* msg, std::string* l); \ + }; \ + IPC_MESSAGE_CONTROL2_EXTRA(msg_class, type1, type2) #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::string* l); \ - }; + public: \ + enum { ID = (IPC_MESSAGE_START << 16) + __LINE__ }; \ + msg_class(const type1& arg1, const type2& arg2, const type3& arg3); \ + ~msg_class(); \ + static void Log(std::string* name, const Message* msg, std::string* l); \ + }; \ + IPC_MESSAGE_CONTROL3_EXTRA(msg_class, type1, type2, type3) #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); \ - ~msg_class(); \ - static void Log(const Message* msg, std::string* l); \ - }; + public: \ + enum { ID = (IPC_MESSAGE_START << 16) + __LINE__ }; \ + msg_class(const type1& arg1, const type2& arg2, const type3& arg3, \ + const type4& arg4); \ + ~msg_class(); \ + static void Log(std::string* name, const Message* msg, std::string* l); \ + }; \ + IPC_MESSAGE_CONTROL4_EXTRA(msg_class, type1, type2, type3, type4) #define IPC_MESSAGE_CONTROL5(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(const type1& arg1, const type2& arg2, \ - const type3& arg3, const type4& arg4, const type5& arg5); \ - ~msg_class(); \ - static void Log(const Message* msg, std::string* l); \ - }; + public: \ + enum { ID = (IPC_MESSAGE_START << 16) + __LINE__ }; \ + msg_class(const type1& arg1, const type2& arg2, \ + const type3& arg3, const type4& arg4, const type5& arg5); \ + ~msg_class(); \ + static void Log(std::string* name, const Message* msg, std::string* l); \ + }; \ + IPC_MESSAGE_CONTROL5_EXTRA(msg_class, type1, type2, type3, type4, type5) #define IPC_MESSAGE_ROUTED0(msg_class) \ class msg_class : public IPC::Message { \ public: \ - enum { ID = msg_class##__ID }; \ + enum { ID = (IPC_MESSAGE_START << 16) + __LINE__ }; \ msg_class(int32 routing_id) \ : IPC::Message(routing_id, ID, PRIORITY_NORMAL) {} \ - }; + }; \ + IPC_MESSAGE_ROUTED0_EXTRA(msg_class) #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); \ - ~msg_class(); \ - static void Log(const Message* msg, std::string* l); \ - }; + public: \ + enum { ID = (IPC_MESSAGE_START << 16) + __LINE__ }; \ + msg_class(int32 routing_id, const type1& arg1); \ + ~msg_class(); \ + static void Log(std::string* name, const Message* msg, std::string* l); \ + }; \ + IPC_MESSAGE_ROUTED1_EXTRA(msg_class, type1) #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::string* l); \ - }; + public: \ + enum { ID = (IPC_MESSAGE_START << 16) + __LINE__ }; \ + msg_class(int32 routing_id, const type1& arg1, const type2& arg2); \ + ~msg_class(); \ + static void Log(std::string* name, const Message* msg, std::string* l); \ + }; \ + IPC_MESSAGE_ROUTED2_EXTRA(msg_class, type1, type2) #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::string* l); \ - }; + public: \ + enum { ID = (IPC_MESSAGE_START << 16) + __LINE__ }; \ + msg_class(int32 routing_id, const type1& arg1, const type2& arg2, \ + const type3& arg3); \ + ~msg_class(); \ + static void Log(std::string* name, const Message* msg, std::string* l); \ + }; \ + IPC_MESSAGE_ROUTED3_EXTRA(msg_class, type1, type2, type3) #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::string* l); \ - }; + public: \ + enum { ID = (IPC_MESSAGE_START << 16) + __LINE__ }; \ + msg_class(int32 routing_id, const type1& arg1, const type2& arg2, \ + const type3& arg3, const type4& arg4); \ + ~msg_class(); \ + static void Log(std::string* name, const Message* msg, std::string* l); \ + }; \ + IPC_MESSAGE_ROUTED4_EXTRA(msg_class, type1, type2, type3, type4) #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); \ - ~msg_class(); \ - static void Log(const Message* msg, std::string* l); \ - }; + public: \ + enum { ID = (IPC_MESSAGE_START << 16) + __LINE__ }; \ + 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(std::string* name, const Message* msg, std::string* l); \ + }; \ + IPC_MESSAGE_ROUTED5_EXTRA(msg_class, type1, type2, type3, type4, type5) #define IPC_SYNC_MESSAGE_CONTROL0_0(msg_class) \ class msg_class : public IPC::MessageWithReply<Tuple0, Tuple0 > { \ - public: \ - enum { ID = msg_class##__ID }; \ - msg_class(); \ - ~msg_class(); \ - static void Log(const Message* msg, std::string* l); \ - }; + public: \ + enum { ID = (IPC_MESSAGE_START << 16) + __LINE__ }; \ + msg_class(); \ + ~msg_class(); \ + static void Log(std::string* name, const Message* msg, std::string* l); \ + }; \ + IPC_SYNC_MESSAGE_CONTROL0_0_EXTRA(msg_class) #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); \ - ~msg_class(); \ - static void Log(const Message* msg, std::string* l); \ - }; + public: \ + enum { ID = (IPC_MESSAGE_START << 16) + __LINE__ }; \ + msg_class(type1_out* arg1); \ + ~msg_class(); \ + static void Log(std::string* name, const Message* msg, std::string* l); \ + }; \ + IPC_SYNC_MESSAGE_CONTROL0_1_EXTRA(msg_class, type1_out) #define IPC_SYNC_MESSAGE_CONTROL0_2(msg_class, type1_out, type2_out) \ class msg_class : \ public IPC::MessageWithReply<Tuple0, Tuple2<type1_out&, type2_out&> > { \ public: \ - enum { ID = msg_class##__ID }; \ - msg_class(type1_out* arg1, type2_out* arg2); \ - ~msg_class(); \ - static void Log(const Message* msg, std::string* l); \ - }; + enum { ID = (IPC_MESSAGE_START << 16) + __LINE__ }; \ + msg_class(type1_out* arg1, type2_out* arg2); \ + ~msg_class(); \ + static void Log(std::string* name, const Message* msg, std::string* l); \ + }; \ + IPC_SYNC_MESSAGE_CONTROL0_2_EXTRA(msg_class, type1_out, type2_out) #define IPC_SYNC_MESSAGE_CONTROL0_3(msg_class, type1_out, type2_out, type3_out) \ class msg_class : \ public IPC::MessageWithReply<Tuple0, \ Tuple3<type1_out&, type2_out&, type3_out&> >{ \ public: \ - enum { ID = msg_class##__ID }; \ - msg_class(type1_out* arg1, type2_out* arg2, type3_out* arg3); \ - ~msg_class(); \ - static void Log(const Message* msg, std::string* l); \ - }; + enum { ID = (IPC_MESSAGE_START << 16) + __LINE__ }; \ + msg_class(type1_out* arg1, type2_out* arg2, type3_out* arg3); \ + ~msg_class(); \ + static void Log(std::string* name, const Message* msg, std::string* l); \ + }; \ + IPC_SYNC_MESSAGE_CONTROL0_3_EXTRA(msg_class, type1_out, type2_out, type3_out) #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::string* l); \ - }; + public: \ + enum { ID = (IPC_MESSAGE_START << 16) + __LINE__ }; \ + msg_class(const type1_in& arg1); \ + ~msg_class(); \ + static void Log(std::string* name, const Message* msg, std::string* l); \ + }; \ + IPC_SYNC_MESSAGE_CONTROL1_0_EXTRA(msg_class, type1_in) #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); \ - ~msg_class(); \ - static void Log(const Message* msg, std::string* l); \ - }; + public: \ + enum { ID = (IPC_MESSAGE_START << 16) + __LINE__ }; \ + msg_class(const type1_in& arg1, type1_out* arg2); \ + ~msg_class(); \ + static void Log(std::string* name, const Message* msg, std::string* l); \ + }; \ + IPC_SYNC_MESSAGE_CONTROL1_1_EXTRA(msg_class, type1_in, type1_out) #define IPC_SYNC_MESSAGE_CONTROL1_2(msg_class, type1_in, type1_out, type2_out) \ class msg_class : \ 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); \ - ~msg_class(); \ - static void Log(const Message* msg, std::string* l); \ - }; + enum { ID = (IPC_MESSAGE_START << 16) + __LINE__ }; \ + msg_class(const type1_in& arg1, type1_out* arg2, type2_out* arg3); \ + ~msg_class(); \ + static void Log(std::string* name, const Message* msg, std::string* l); \ + }; \ + IPC_SYNC_MESSAGE_CONTROL1_2_EXTRA(msg_class, type1_in, type1_out, type2_out) #define IPC_SYNC_MESSAGE_CONTROL1_3(msg_class, type1_in, type1_out, type2_out, type3_out) \ class msg_class : \ public IPC::MessageWithReply<Tuple1<type1_in>, \ 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); \ - ~msg_class(); \ - static void Log(const Message* msg, std::string* l); \ - }; + enum { ID = (IPC_MESSAGE_START << 16) + __LINE__ }; \ + msg_class(const type1_in& arg1, type1_out* arg2, type2_out* arg3, type3_out* arg4); \ + ~msg_class(); \ + static void Log(std::string* name, const Message* msg, std::string* l); \ + }; \ + IPC_SYNC_MESSAGE_CONTROL1_3_EXTRA(msg_class, type1_in, type1_out, type2_out, type3_out) #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); \ - ~msg_class(); \ - static void Log(const Message* msg, std::string* l); \ - }; + public: \ + enum { ID = (IPC_MESSAGE_START << 16) + __LINE__ }; \ + msg_class(const type1_in& arg1, const type2_in& arg2); \ + ~msg_class(); \ + static void Log(std::string* name, const Message* msg, std::string* l); \ + }; \ + IPC_SYNC_MESSAGE_CONTROL2_0_EXTRA(msg_class, type1_in, type2_in) #define IPC_SYNC_MESSAGE_CONTROL2_1(msg_class, type1_in, type2_in, type1_out) \ 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); \ - ~msg_class(); \ - static void Log(const Message* msg, std::string* l); \ - }; + public: \ + enum { ID = (IPC_MESSAGE_START << 16) + __LINE__ }; \ + msg_class(const type1_in& arg1, const type2_in& arg2, type1_out* arg3); \ + ~msg_class(); \ + static void Log(std::string* name, const Message* msg, std::string* l); \ + }; \ + IPC_SYNC_MESSAGE_CONTROL2_1_EXTRA(msg_class, type1_in, type2_in, type1_out) #define IPC_SYNC_MESSAGE_CONTROL2_2(msg_class, type1_in, type2_in, type1_out, type2_out) \ class msg_class : \ public IPC::MessageWithReply<Tuple2<type1_in, type2_in>, \ 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); \ - ~msg_class(); \ - static void Log(const Message* msg, std::string* l); \ - }; + enum { ID = (IPC_MESSAGE_START << 16) + __LINE__ }; \ + msg_class(const type1_in& arg1, const type2_in& arg2, type1_out* arg3, type2_out* arg4); \ + ~msg_class(); \ + static void Log(std::string* name, const Message* msg, std::string* l); \ + }; \ + IPC_SYNC_MESSAGE_CONTROL2_2_EXTRA(msg_class, type1_in, type2_in, type1_out, type2_out) #define IPC_SYNC_MESSAGE_CONTROL2_3(msg_class, type1_in, type2_in, type1_out, type2_out, type3_out) \ class msg_class : \ public IPC::MessageWithReply<Tuple2<type1_in, type2_in>, \ 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); \ - ~msg_class(); \ - static void Log(const Message* msg, std::string* l); \ - }; + enum { ID = (IPC_MESSAGE_START << 16) + __LINE__ }; \ + msg_class(const type1_in& arg1, const type2_in& arg2, type1_out* arg3, type2_out* arg4, type3_out* arg5); \ + ~msg_class(); \ + static void Log(std::string* name, const Message* msg, std::string* l); \ + }; \ + IPC_SYNC_MESSAGE_CONTROL2_3_EXTRA(msg_class, type1_in, type2_in, type1_out, type2_out, type3_out) #define IPC_SYNC_MESSAGE_CONTROL3_1(msg_class, type1_in, type2_in, type3_in, type1_out) \ class msg_class : \ public IPC::MessageWithReply<Tuple3<type1_in, type2_in, type3_in>, \ 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); \ - ~msg_class(); \ - static void Log(const Message* msg, std::string* l); \ - }; + enum { ID = (IPC_MESSAGE_START << 16) + __LINE__ }; \ + msg_class(const type1_in& arg1, const type2_in& arg2, const type3_in& arg3, type1_out* arg4); \ + ~msg_class(); \ + static void Log(std::string* name, const Message* msg, std::string* l); \ + }; \ + IPC_SYNC_MESSAGE_CONTROL3_1_EXTRA(msg_class, type1_in, type2_in, type3_in, type1_out) #define IPC_SYNC_MESSAGE_CONTROL3_2(msg_class, type1_in, type2_in, type3_in, type1_out, type2_out) \ class msg_class : \ public IPC::MessageWithReply<Tuple3<type1_in, type2_in, type3_in>, \ 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); \ - ~msg_class(); \ - static void Log(const Message* msg, std::string* l); \ - }; + enum { ID = (IPC_MESSAGE_START << 16) + __LINE__ }; \ + 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(std::string* name, const Message* msg, std::string* l); \ + }; \ + IPC_SYNC_MESSAGE_CONTROL3_2_EXTRA(msg_class, type1_in, type2_in, type3_in, type1_out, type2_out) #define IPC_SYNC_MESSAGE_CONTROL3_3(msg_class, type1_in, type2_in, type3_in, type1_out, type2_out, type3_out) \ class msg_class : \ public IPC::MessageWithReply<Tuple3<type1_in, type2_in, type3_in>, \ 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); \ - ~msg_class(); \ - static void Log(const Message* msg, std::string* l); \ - }; + enum { ID = (IPC_MESSAGE_START << 16) + __LINE__ }; \ + 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(std::string* name, const Message* msg, std::string* l); \ + }; \ + IPC_SYNC_MESSAGE_CONTROL3_3_EXTRA(msg_class, type1_in, type2_in, type3_in, type1_out, type2_out, type3_out) #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); \ - }; + enum { ID = (IPC_MESSAGE_START << 16) + __LINE__ }; \ + 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(std::string* name, const Message* msg, std::string* l); \ + }; \ + IPC_SYNC_MESSAGE_CONTROL3_4_EXTRA(msg_class, type1_in, type2_in, type3_in, type1_out, type2_out, type3_out, type4_out) #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>, \ 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); \ - ~msg_class(); \ - static void Log(const Message* msg, std::string* l); \ - }; + enum { ID = (IPC_MESSAGE_START << 16) + __LINE__ }; \ + 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(std::string* name, const Message* msg, std::string* l); \ + }; \ + IPC_SYNC_MESSAGE_CONTROL4_1_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out) #define IPC_SYNC_MESSAGE_CONTROL4_2(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out, type2_out) \ class msg_class : \ public IPC::MessageWithReply<Tuple4<type1_in, type2_in, type3_in, type4_in>, \ 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); \ - ~msg_class(); \ - static void Log(const Message* msg, std::string* l); \ - }; + enum { ID = (IPC_MESSAGE_START << 16) + __LINE__ }; \ + 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(std::string* name, const Message* msg, std::string* l); \ + }; \ + IPC_SYNC_MESSAGE_CONTROL4_2_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out, type2_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); \ - ~msg_class(); \ - static void Log(const Message* msg, std::string* l); \ - }; + enum { ID = (IPC_MESSAGE_START << 16) + __LINE__ }; \ + msg_class(int routing_id); \ + ~msg_class(); \ + static void Log(std::string* name, const Message* msg, std::string* l); \ + }; \ + IPC_SYNC_MESSAGE_ROUTED0_0_EXTRA(msg_class) #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, type1_out* arg1); \ - ~msg_class(); \ - static void Log(const Message* msg, std::string* l); \ - }; + enum { ID = (IPC_MESSAGE_START << 16) + __LINE__ }; \ + msg_class(int routing_id, type1_out* arg1); \ + ~msg_class(); \ + static void Log(std::string* name, const Message* msg, std::string* l); \ + }; \ + IPC_SYNC_MESSAGE_ROUTED0_1_EXTRA(msg_class, type1_out) #define IPC_SYNC_MESSAGE_ROUTED0_2(msg_class, type1_out, type2_out) \ class msg_class : \ 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); \ - ~msg_class(); \ - static void Log(const Message* msg, std::string* l); \ - }; + enum { ID = (IPC_MESSAGE_START << 16) + __LINE__ }; \ + msg_class(int routing_id, type1_out* arg1, type2_out* arg2); \ + ~msg_class(); \ + static void Log(std::string* name, const Message* msg, std::string* l); \ + }; \ + IPC_SYNC_MESSAGE_ROUTED0_2_EXTRA(msg_class, type1_out, type2_out) #define IPC_SYNC_MESSAGE_ROUTED0_3(msg_class, type1_out, type2_out, type3_out) \ class msg_class : \ public IPC::MessageWithReply<Tuple0, \ 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); \ - ~msg_class(); \ - static void Log(const Message* msg, std::string* l); \ - }; + enum { ID = (IPC_MESSAGE_START << 16) + __LINE__ }; \ + msg_class(int routing_id, type1_out* arg1, type2_out* arg2, type3_out* arg3); \ + ~msg_class(); \ + static void Log(std::string* name, const Message* msg, std::string* l); \ + }; \ + IPC_SYNC_MESSAGE_ROUTED0_3_EXTRA(msg_class, type1_out, type2_out, type3_out) #define IPC_SYNC_MESSAGE_ROUTED1_0(msg_class, type1_in) \ class msg_class : \ public IPC::MessageWithReply<Tuple1<type1_in>, Tuple0 > { \ public: \ - enum { ID = msg_class##__ID }; \ - msg_class(int routing_id, const type1_in& arg1); \ - ~msg_class(); \ - static void Log(const Message* msg, std::string* l); \ - }; + enum { ID = (IPC_MESSAGE_START << 16) + __LINE__ }; \ + msg_class(int routing_id, const type1_in& arg1); \ + ~msg_class(); \ + static void Log(std::string* name, const Message* msg, std::string* l); \ + }; \ + IPC_SYNC_MESSAGE_ROUTED1_0_EXTRA(msg_class, type1_in) #define IPC_SYNC_MESSAGE_ROUTED1_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(int routing_id, const type1_in& arg1, type1_out* arg2); \ - ~msg_class(); \ - static void Log(const Message* msg, std::string* l); \ - }; + enum { ID = (IPC_MESSAGE_START << 16) + __LINE__ }; \ + msg_class(int routing_id, const type1_in& arg1, type1_out* arg2); \ + ~msg_class(); \ + static void Log(std::string* name, const Message* msg, std::string* l); \ + }; \ + IPC_SYNC_MESSAGE_ROUTED1_1_EXTRA(msg_class, type1_in, type1_out) #define IPC_SYNC_MESSAGE_ROUTED1_2(msg_class, type1_in, type1_out, type2_out) \ class msg_class : \ 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); \ - ~msg_class(); \ - static void Log(const Message* msg, std::string* l); \ - }; + enum { ID = (IPC_MESSAGE_START << 16) + __LINE__ }; \ + msg_class(int routing_id, const type1_in& arg1, type1_out* arg2, type2_out* arg3); \ + ~msg_class(); \ + static void Log(std::string* name, const Message* msg, std::string* l); \ + }; \ + IPC_SYNC_MESSAGE_ROUTED1_2_EXTRA(msg_class, type1_in, type1_out, type2_out) #define IPC_SYNC_MESSAGE_ROUTED1_3(msg_class, type1_in, type1_out, type2_out, type3_out) \ class msg_class : \ public IPC::MessageWithReply<Tuple1<type1_in>, \ 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); \ - ~msg_class(); \ - static void Log(const Message* msg, std::string* l); \ - }; + enum { ID = (IPC_MESSAGE_START << 16) + __LINE__ }; \ + msg_class(int routing_id, const type1_in& arg1, type1_out* arg2, type2_out* arg3, type3_out* arg4); \ + ~msg_class(); \ + static void Log(std::string* name, const Message* msg, std::string* l); \ + }; \ + IPC_SYNC_MESSAGE_ROUTED1_3_EXTRA(msg_class, type1_in, type1_out, type2_out, type3_out) #define IPC_SYNC_MESSAGE_ROUTED1_4(msg_class, type1_in, type1_out, type2_out, type3_out, type4_out) \ class msg_class : \ public IPC::MessageWithReply<Tuple1<type1_in>, \ 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); \ - ~msg_class(); \ - static void Log(const Message* msg, std::string* l); \ - }; + enum { ID = (IPC_MESSAGE_START << 16) + __LINE__ }; \ + 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(std::string* name, const Message* msg, std::string* l); \ + }; \ + IPC_SYNC_MESSAGE_ROUTED1_4_EXTRA(msg_class, type1_in, type1_out, type2_out, type3_out, type4_out) #define IPC_SYNC_MESSAGE_ROUTED2_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(int routing_id, const type1_in& arg1, const type2_in& arg2); \ - ~msg_class(); \ - static void Log(const Message* msg, std::string* l); \ - }; + enum { ID = (IPC_MESSAGE_START << 16) + __LINE__ }; \ + msg_class(int routing_id, const type1_in& arg1, const type2_in& arg2); \ + ~msg_class(); \ + static void Log(std::string* name, const Message* msg, std::string* l); \ + }; \ + IPC_SYNC_MESSAGE_ROUTED2_0_EXTRA(msg_class, type1_in, type2_in) #define IPC_SYNC_MESSAGE_ROUTED2_1(msg_class, type1_in, type2_in, type1_out) \ class msg_class : \ 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); \ - ~msg_class(); \ - static void Log(const Message* msg, std::string* l); \ - }; + enum { ID = (IPC_MESSAGE_START << 16) + __LINE__ }; \ + msg_class(int routing_id, const type1_in& arg1, const type2_in& arg2, type1_out* arg3); \ + ~msg_class(); \ + static void Log(std::string* name, const Message* msg, std::string* l); \ + }; \ + IPC_SYNC_MESSAGE_ROUTED2_1_EXTRA(msg_class, type1_in, type2_in, type1_out) #define IPC_SYNC_MESSAGE_ROUTED2_2(msg_class, type1_in, type2_in, type1_out, type2_out) \ class msg_class : \ public IPC::MessageWithReply<Tuple2<type1_in, type2_in>, \ 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); \ - ~msg_class(); \ - static void Log(const Message* msg, std::string* l); \ - }; + enum { ID = (IPC_MESSAGE_START << 16) + __LINE__ }; \ + msg_class(int routing_id, const type1_in& arg1, const type2_in& arg2, type1_out* arg3, type2_out* arg4); \ + ~msg_class(); \ + static void Log(std::string* name, const Message* msg, std::string* l); \ + }; \ + IPC_SYNC_MESSAGE_ROUTED2_2_EXTRA(msg_class, type1_in, type2_in, type1_out, type2_out) #define IPC_SYNC_MESSAGE_ROUTED2_3(msg_class, type1_in, type2_in, type1_out, type2_out, type3_out) \ class msg_class : \ public IPC::MessageWithReply<Tuple2<type1_in, type2_in>, \ 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); \ - ~msg_class(); \ - static void Log(const Message* msg, std::string* l); \ - }; + enum { ID = (IPC_MESSAGE_START << 16) + __LINE__ }; \ + 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(std::string* name, const Message* msg, std::string* l); \ + }; \ + IPC_SYNC_MESSAGE_ROUTED2_3_EXTRA(msg_class, type1_in, type2_in, type1_out, type2_out, type3_out) #define IPC_SYNC_MESSAGE_ROUTED3_0(msg_class, type1_in, type2_in, type3_in) \ class msg_class : \ 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); \ - ~msg_class(); \ - static void Log(const Message* msg, std::string* l); \ - }; + enum { ID = (IPC_MESSAGE_START << 16) + __LINE__ }; \ + msg_class(int routing_id, const type1_in& arg1, const type2_in& arg2, const type3_in& arg3); \ + ~msg_class(); \ + static void Log(std::string* name, const Message* msg, std::string* l); \ + }; \ + IPC_SYNC_MESSAGE_ROUTED3_0_EXTRA(msg_class, type1_in, type2_in, type3_in) #define IPC_SYNC_MESSAGE_ROUTED3_1(msg_class, type1_in, type2_in, type3_in, type1_out) \ class msg_class : \ public IPC::MessageWithReply<Tuple3<type1_in, type2_in, type3_in>, \ 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); \ - ~msg_class(); \ - static void Log(const Message* msg, std::string* l); \ - }; + enum { ID = (IPC_MESSAGE_START << 16) + __LINE__ }; \ + 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(std::string* name, const Message* msg, std::string* l); \ + }; \ + IPC_SYNC_MESSAGE_ROUTED3_1_EXTRA(msg_class, type1_in, type2_in, type3_in, type1_out) #define IPC_SYNC_MESSAGE_ROUTED3_2(msg_class, type1_in, type2_in, type3_in, type1_out, type2_out) \ class msg_class : \ public IPC::MessageWithReply<Tuple3<type1_in, type2_in, type3_in>, \ 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); \ - ~msg_class(); \ - static void Log(const Message* msg, std::string* l); \ - }; + enum { ID = (IPC_MESSAGE_START << 16) + __LINE__ }; \ + 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(std::string* name, const Message* msg, std::string* l); \ + }; \ + IPC_SYNC_MESSAGE_ROUTED3_2_EXTRA(msg_class, type1_in, type2_in, type3_in, type1_out, type2_out) #define IPC_SYNC_MESSAGE_ROUTED3_3(msg_class, type1_in, type2_in, type3_in, type1_out, type2_out, type3_out) \ class msg_class : \ public IPC::MessageWithReply<Tuple3<type1_in, type2_in, type3_in>, \ 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); \ - ~msg_class(); \ - static void Log(const Message* msg, std::string* l); \ - }; + enum { ID = (IPC_MESSAGE_START << 16) + __LINE__ }; \ + 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(std::string* name, const Message* msg, std::string* l); \ + }; \ + IPC_SYNC_MESSAGE_ROUTED3_3_EXTRA(msg_class, type1_in, type2_in, type3_in, type1_out, type2_out, type3_out) #define IPC_SYNC_MESSAGE_ROUTED3_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(int routing_id, 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); \ - }; + enum { ID = (IPC_MESSAGE_START << 16) + __LINE__ }; \ + 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, type4_out* arg7); \ + ~msg_class(); \ + static void Log(std::string* name, const Message* msg, std::string* l); \ + }; \ + IPC_SYNC_MESSAGE_ROUTED3_4_EXTRA(msg_class, type1_in, type2_in, type3_in, type1_out, type2_out, type3_out, type4_out) #define IPC_SYNC_MESSAGE_ROUTED4_0(msg_class, type1_in, type2_in, type3_in, type4_in) \ class msg_class : \ public IPC::MessageWithReply<Tuple4<type1_in, type2_in, type3_in, type4_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, const type4_in& arg4); \ - ~msg_class(); \ - static void Log(const Message* msg, std::string* l); \ - }; + enum { ID = (IPC_MESSAGE_START << 16) + __LINE__ }; \ + 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(std::string* name, const Message* msg, std::string* l); \ + }; \ + IPC_SYNC_MESSAGE_ROUTED4_0_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in) #define IPC_SYNC_MESSAGE_ROUTED4_1(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out) \ class msg_class : \ public IPC::MessageWithReply<Tuple4<type1_in, type2_in, type3_in, type4_in>, \ 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); \ - ~msg_class(); \ - static void Log(const Message* msg, std::string* l); \ - }; + enum { ID = (IPC_MESSAGE_START << 16) + __LINE__ }; \ + 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(std::string* name, const Message* msg, std::string* l); \ + }; \ + IPC_SYNC_MESSAGE_ROUTED4_1_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out) #define IPC_SYNC_MESSAGE_ROUTED4_2(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out, type2_out) \ class msg_class : \ public IPC::MessageWithReply<Tuple4<type1_in, type2_in, type3_in, type4_in>, \ 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); \ - ~msg_class(); \ - static void Log(const Message* msg, std::string* l); \ - }; + enum { ID = (IPC_MESSAGE_START << 16) + __LINE__ }; \ + 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(std::string* name, const Message* msg, std::string* l); \ + }; \ + IPC_SYNC_MESSAGE_ROUTED4_2_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out, type2_out) #define IPC_SYNC_MESSAGE_ROUTED4_3(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out, type2_out, type3_out) \ class msg_class : \ public IPC::MessageWithReply<Tuple4<type1_in, type2_in, type3_in, type4_in>, \ 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); \ - ~msg_class(); \ - static void Log(const Message* msg, std::string* l); \ - }; + enum { ID = (IPC_MESSAGE_START << 16) + __LINE__ }; \ + 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(std::string* name, const Message* msg, std::string* l); \ + }; \ + IPC_SYNC_MESSAGE_ROUTED4_3_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out, type2_out, type3_out) #define IPC_SYNC_MESSAGE_ROUTED5_0(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in) \ class msg_class : \ public IPC::MessageWithReply<Tuple5<type1_in, type2_in, type3_in, type4_in, type5_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, const type4_in& arg4, const type5_in& arg5); \ - ~msg_class(); \ - static void Log(const Message* msg, std::string* l); \ - }; + enum { ID = (IPC_MESSAGE_START << 16) + __LINE__ }; \ + 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(std::string* name, const Message* msg, std::string* l); \ + }; \ + IPC_SYNC_MESSAGE_ROUTED5_0_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in) #define IPC_SYNC_MESSAGE_ROUTED5_1(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in, type1_out) \ class msg_class : \ public IPC::MessageWithReply<Tuple5<type1_in, type2_in, type3_in, type4_in, type5_in>, \ 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); \ - ~msg_class(); \ - static void Log(const Message* msg, std::string* l); \ - }; + enum { ID = (IPC_MESSAGE_START << 16) + __LINE__ }; \ + 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(std::string* name, const Message* msg, std::string* l); \ + }; \ + IPC_SYNC_MESSAGE_ROUTED5_1_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in, type1_out) #define IPC_SYNC_MESSAGE_ROUTED5_2(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in, type1_out, type2_out) \ class msg_class : \ public IPC::MessageWithReply<Tuple5<type1_in, type2_in, type3_in, type4_in, type5_in>, \ 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); \ - ~msg_class(); \ - static void Log(const Message* msg, std::string* l); \ - }; + enum { ID = (IPC_MESSAGE_START << 16) + __LINE__ }; \ + 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(std::string* name, const Message* msg, std::string* l); \ + }; \ + IPC_SYNC_MESSAGE_ROUTED5_2_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in, type1_out, type2_out) #define IPC_SYNC_MESSAGE_ROUTED5_3(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in, type1_out, type2_out, type3_out) \ class msg_class : \ public IPC::MessageWithReply<Tuple5<type1_in, type2_in, type3_in, type4_in, type5_in>, \ 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); \ - ~msg_class(); \ - static void Log(const Message* msg, std::string* l); \ - }; + enum { ID = (IPC_MESSAGE_START << 16) + __LINE__ }; \ + 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(std::string* name, const Message* msg, std::string* l); \ + }; \ + IPC_SYNC_MESSAGE_ROUTED5_3_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in, type1_out, type2_out, type3_out) + + + +// Message crackers and handlers. +// Prefer to use the IPC_BEGIN_MESSAGE_MAP_EX to the older macros since they +// allow you to detect when a message could not be de-serialized. Usage: +// +// void MyClass::OnMessageReceived(const IPC::Message& msg) { +// bool msg_is_good = false; +// IPC_BEGIN_MESSAGE_MAP_EX(MyClass, msg, msg_is_good) +// IPC_MESSAGE_HANDLER(MsgClassOne, OnMsgClassOne) +// ...more handlers here ... +// IPC_MESSAGE_HANDLER(MsgClassTen, OnMsgClassTen) +// IPC_END_MESSAGE_MAP_EX() +// if (!msg_is_good) { +// // Signal error here or terminate offending process. +// } +// } + + +#define IPC_DEFINE_MESSAGE_MAP(class_name) \ +void class_name::OnMessageReceived(const IPC::Message& msg) \ + IPC_BEGIN_MESSAGE_MAP(class_name, msg) + +#define IPC_BEGIN_MESSAGE_MAP_EX(class_name, msg, msg_is_ok) \ + { \ + typedef class_name _IpcMessageHandlerClass; \ + const IPC::Message& ipc_message__ = msg; \ + bool& msg_is_ok__ = msg_is_ok; \ + switch (ipc_message__.type()) { \ + +#define IPC_BEGIN_MESSAGE_MAP(class_name, msg) \ + { \ + typedef class_name _IpcMessageHandlerClass; \ + const IPC::Message& ipc_message__ = msg; \ + bool msg_is_ok__ = true; \ + switch (ipc_message__.type()) { \ -#endif // #if defined() +#define IPC_MESSAGE_FORWARD(msg_class, obj, member_func) \ + case msg_class::ID: \ + msg_is_ok__ = msg_class::Dispatch(&ipc_message__, obj, &member_func); \ + break; + +#define IPC_MESSAGE_HANDLER(msg_class, member_func) \ + IPC_MESSAGE_FORWARD(msg_class, this, _IpcMessageHandlerClass::member_func) + +#define IPC_MESSAGE_FORWARD_DELAY_REPLY(msg_class, obj, member_func) \ + case msg_class::ID: \ + msg_class::DispatchDelayReply(&ipc_message__, obj, &member_func); \ + break; + +#define IPC_MESSAGE_HANDLER_DELAY_REPLY(msg_class, member_func) \ + IPC_MESSAGE_FORWARD_DELAY_REPLY(msg_class, this, \ + _IpcMessageHandlerClass::member_func) + +#define IPC_MESSAGE_HANDLER_GENERIC(msg_class, code) \ + case msg_class::ID: \ + code; \ + break; + +#define IPC_REPLY_HANDLER(func) \ + case IPC_REPLY_ID: \ + func(ipc_message__); \ + break; + + +#define IPC_MESSAGE_UNHANDLED(code) \ + default: \ + code; \ + break; + +#define IPC_MESSAGE_UNHANDLED_ERROR() \ + IPC_MESSAGE_UNHANDLED(NOTREACHED() << \ + "Invalid message with type = " << \ + ipc_message__.type()) + +#define IPC_END_MESSAGE_MAP() \ + DCHECK(msg_is_ok__); \ + } \ +} + +#define IPC_END_MESSAGE_MAP_EX() \ + } \ +}
\ No newline at end of file diff --git a/ipc/ipc_message_utils.h b/ipc/ipc_message_utils.h index 7d8cf4f..8e0f670 100644 --- a/ipc/ipc_message_utils.h +++ b/ipc/ipc_message_utils.h @@ -46,41 +46,19 @@ // base. Messages have unique IDs across channels in order for the IPC logging // code to figure out the message class from its ID. enum IPCMessageStart { - // By using a start value of 0 for automation messages, we keep backward - // compatibility with old builds. AutomationMsgStart = 0, ViewMsgStart, - ViewHostMsgStart, - PluginProcessMsgStart, - PluginProcessHostMsgStart, PluginMsgStart, - PluginHostMsgStart, - ProfileImportProcessMsgStart, - ProfileImportProcessHostMsgStart, - NPObjectMsgStart, + ProfileImportMsgStart, TestMsgStart, - DevToolsAgentMsgStart, - DevToolsClientMsgStart, - WorkerProcessMsgStart, - WorkerProcessHostMsgStart, + DevToolsMsgStart, WorkerMsgStart, - WorkerHostMsgStart, - NaClProcessMsgStart, - GpuCommandBufferMsgStart, + NaClMsgStart, UtilityMsgStart, - UtilityHostMsgStart, GpuMsgStart, - GpuHostMsgStart, - GpuChannelMsgStart, - GpuVideoDecoderHostMsgStart, - GpuVideoDecoderMsgStart, ServiceMsgStart, - ServiceHostMsgStart, PpapiMsgStart, - PpapiHostMsgStart, - // NOTE: When you add a new message class, also update - // IPCStatusView::IPCStatusView to ensure logging works. - LastMsgIndex + FirefoxImporterUnittestMsgStart, }; class DictionaryValue; diff --git a/ipc/ipc_sync_channel_unittest.cc b/ipc/ipc_sync_channel_unittest.cc index bf21917..5617146 100644 --- a/ipc/ipc_sync_channel_unittest.cc +++ b/ipc/ipc_sync_channel_unittest.cc @@ -20,16 +20,9 @@ #include "ipc/ipc_message.h" #include "ipc/ipc_sync_channel.h" #include "ipc/ipc_sync_message_filter.h" +#include "ipc/ipc_sync_message_unittest.h" #include "testing/gtest/include/gtest/gtest.h" - -#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/ipc_sync_message_unittest.cc b/ipc/ipc_sync_message_unittest.cc index d214cfc..e64e0c3 100644 --- a/ipc/ipc_sync_message_unittest.cc +++ b/ipc/ipc_sync_message_unittest.cc @@ -14,9 +14,8 @@ #include "base/logging.h" #include "testing/gtest/include/gtest/gtest.h" - -#define MESSAGES_INTERNAL_FILE "ipc/ipc_sync_message_unittest.h" -#include "ipc/ipc_message_macros.h" +#define IPC_MESSAGE_IMPL +#include "ipc/ipc_sync_message_unittest.h" static IPC::Message* g_reply; diff --git a/ipc/ipc_sync_message_unittest.h b/ipc/ipc_sync_message_unittest.h index d247428..d5c6905 100644 --- a/ipc/ipc_sync_message_unittest.h +++ b/ipc/ipc_sync_message_unittest.h @@ -6,107 +6,106 @@ #include "ipc/ipc_message_macros.h" -IPC_BEGIN_MESSAGES(Test) - IPC_SYNC_MESSAGE_CONTROL0_0(SyncChannelTestMsg_NoArgs) +#define IPC_MESSAGE_START TestMsgStart - IPC_SYNC_MESSAGE_CONTROL0_1(SyncChannelTestMsg_AnswerToLife, - int /* answer */) +IPC_SYNC_MESSAGE_CONTROL0_0(SyncChannelTestMsg_NoArgs) - IPC_SYNC_MESSAGE_CONTROL1_1(SyncChannelTestMsg_Double, - int /* in */, - int /* out */) +IPC_SYNC_MESSAGE_CONTROL0_1(SyncChannelTestMsg_AnswerToLife, + int /* answer */) - IPC_SYNC_MESSAGE_CONTROL0_1(SyncChannelNestedTestMsg_String, - std::string) +IPC_SYNC_MESSAGE_CONTROL1_1(SyncChannelTestMsg_Double, + int /* in */, + int /* out */) - // out1 is false - IPC_SYNC_MESSAGE_CONTROL0_1(Msg_C_0_1, bool) +IPC_SYNC_MESSAGE_CONTROL0_1(SyncChannelNestedTestMsg_String, + std::string) - // out1 is true, out2 is 2 - IPC_SYNC_MESSAGE_CONTROL0_2(Msg_C_0_2, bool, int) +// out1 is false +IPC_SYNC_MESSAGE_CONTROL0_1(Msg_C_0_1, bool) - // out1 is false, out2 is 3, out3 is "0_3" - IPC_SYNC_MESSAGE_CONTROL0_3(Msg_C_0_3, bool, int, std::string) +// out1 is true, out2 is 2 +IPC_SYNC_MESSAGE_CONTROL0_2(Msg_C_0_2, bool, int) - // in1 must be 1, out1 is true - IPC_SYNC_MESSAGE_CONTROL1_1(Msg_C_1_1, int, bool) +// out1 is false, out2 is 3, out3 is "0_3" +IPC_SYNC_MESSAGE_CONTROL0_3(Msg_C_0_3, bool, int, std::string) - // in1 must be false, out1 is true, out2 is 12 - IPC_SYNC_MESSAGE_CONTROL1_2(Msg_C_1_2, bool, bool, int) +// in1 must be 1, out1 is true +IPC_SYNC_MESSAGE_CONTROL1_1(Msg_C_1_1, int, bool) - // in1 must be 3, out1 is "1_3", out2 is 13, out3 is false - IPC_SYNC_MESSAGE_CONTROL1_3(Msg_C_1_3, int, std::string, int, bool) +// in1 must be false, out1 is true, out2 is 12 +IPC_SYNC_MESSAGE_CONTROL1_2(Msg_C_1_2, bool, bool, int) - // in1 must be 1, in2 must be false, out1 is true - IPC_SYNC_MESSAGE_CONTROL2_1(Msg_C_2_1, int, bool, bool) +// in1 must be 3, out1 is "1_3", out2 is 13, out3 is false +IPC_SYNC_MESSAGE_CONTROL1_3(Msg_C_1_3, int, std::string, int, bool) - // in1 must be false, in2 must be 2, out1 is true, out2 is 22 - IPC_SYNC_MESSAGE_CONTROL2_2(Msg_C_2_2, bool, int, bool, int) +// in1 must be 1, in2 must be false, out1 is true +IPC_SYNC_MESSAGE_CONTROL2_1(Msg_C_2_1, int, bool, bool) - // in1 must be 3, in2 must be true, out1 is "2_3", out2 is 23, out3 is false - IPC_SYNC_MESSAGE_CONTROL2_3(Msg_C_2_3, int, bool, std::string, int, bool) +// in1 must be false, in2 must be 2, out1 is true, out2 is 22 +IPC_SYNC_MESSAGE_CONTROL2_2(Msg_C_2_2, bool, int, bool, int) - // in1 must be 1, in2 must be false, in3 must be "3_1", out1 is true - IPC_SYNC_MESSAGE_CONTROL3_1(Msg_C_3_1, int, bool, std::string, bool) +// in1 must be 3, in2 must be true, out1 is "2_3", out2 is 23, out3 is false +IPC_SYNC_MESSAGE_CONTROL2_3(Msg_C_2_3, int, bool, std::string, int, bool) - // in1 must be "3_3", in2 must be false, in3 must be 2, out1 is true, out2 is - // 32 - IPC_SYNC_MESSAGE_CONTROL3_2(Msg_C_3_2, std::string, bool, int, bool, int) +// in1 must be 1, in2 must be false, in3 must be "3_1", out1 is true +IPC_SYNC_MESSAGE_CONTROL3_1(Msg_C_3_1, int, bool, std::string, bool) - // in1 must be 3, in2 must be "3_3", in3 must be true, out1 is "3_3", out2 is - // 33, out3 is false - IPC_SYNC_MESSAGE_CONTROL3_3(Msg_C_3_3, int, std::string, bool, std::string, - int, bool) +// in1 must be "3_3", in2 must be false, in3 must be 2, out1 is true, out2 is +// 32 +IPC_SYNC_MESSAGE_CONTROL3_2(Msg_C_3_2, std::string, bool, int, bool, int) - // 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) +// in1 must be 3, in2 must be "3_3", in3 must be true, out1 is "3_3", out2 is +// 33, out3 is false +IPC_SYNC_MESSAGE_CONTROL3_3(Msg_C_3_3, int, std::string, bool, std::string, + int, bool) - // NOTE: routed messages are just a copy of the above... +// 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) - // out1 is false - IPC_SYNC_MESSAGE_ROUTED0_1(Msg_R_0_1, bool) +// NOTE: routed messages are just a copy of the above... - // out1 is true, out2 is 2 - IPC_SYNC_MESSAGE_ROUTED0_2(Msg_R_0_2, bool, int) +// out1 is false +IPC_SYNC_MESSAGE_ROUTED0_1(Msg_R_0_1, bool) - // out1 is false, out2 is 3, out3 is "0_3" - IPC_SYNC_MESSAGE_ROUTED0_3(Msg_R_0_3, bool, int, std::string) +// out1 is true, out2 is 2 +IPC_SYNC_MESSAGE_ROUTED0_2(Msg_R_0_2, bool, int) - // in1 must be 1, out1 is true - IPC_SYNC_MESSAGE_ROUTED1_1(Msg_R_1_1, int, bool) +// out1 is false, out2 is 3, out3 is "0_3" +IPC_SYNC_MESSAGE_ROUTED0_3(Msg_R_0_3, bool, int, std::string) - // in1 must be false, out1 is true, out2 is 12 - IPC_SYNC_MESSAGE_ROUTED1_2(Msg_R_1_2, bool, bool, int) +// in1 must be 1, out1 is true +IPC_SYNC_MESSAGE_ROUTED1_1(Msg_R_1_1, int, bool) - // in1 must be 3, out1 is "1_3", out2 is 13, out3 is false - IPC_SYNC_MESSAGE_ROUTED1_3(Msg_R_1_3, int, std::string, int, bool) +// in1 must be false, out1 is true, out2 is 12 +IPC_SYNC_MESSAGE_ROUTED1_2(Msg_R_1_2, bool, bool, int) - // in1 must be 1, in2 must be false, out1 is true - IPC_SYNC_MESSAGE_ROUTED2_1(Msg_R_2_1, int, bool, bool) +// in1 must be 3, out1 is "1_3", out2 is 13, out3 is false +IPC_SYNC_MESSAGE_ROUTED1_3(Msg_R_1_3, int, std::string, int, bool) - // in1 must be false, in2 must be 2, out1 is true, out2 is 22 - IPC_SYNC_MESSAGE_ROUTED2_2(Msg_R_2_2, bool, int, bool, int) +// in1 must be 1, in2 must be false, out1 is true +IPC_SYNC_MESSAGE_ROUTED2_1(Msg_R_2_1, int, bool, bool) - // in1 must be 3, in2 must be true, out1 is "2_3", out2 is 23, out3 is false - IPC_SYNC_MESSAGE_ROUTED2_3(Msg_R_2_3, int, bool, std::string, int, bool) +// in1 must be false, in2 must be 2, out1 is true, out2 is 22 +IPC_SYNC_MESSAGE_ROUTED2_2(Msg_R_2_2, bool, int, bool, int) - // in1 must be 1, in2 must be false, in3 must be "3_1", out1 is true - IPC_SYNC_MESSAGE_ROUTED3_1(Msg_R_3_1, int, bool, std::string, bool) +// in1 must be 3, in2 must be true, out1 is "2_3", out2 is 23, out3 is false +IPC_SYNC_MESSAGE_ROUTED2_3(Msg_R_2_3, int, bool, std::string, int, bool) - // in1 must be "3_3", in2 must be false, in3 must be 2, out1 is true, out2 - // is 32 - IPC_SYNC_MESSAGE_ROUTED3_2(Msg_R_3_2, std::string, bool, int, bool, int) +// in1 must be 1, in2 must be false, in3 must be "3_1", out1 is true +IPC_SYNC_MESSAGE_ROUTED3_1(Msg_R_3_1, int, bool, std::string, bool) - // in1 must be 3, in2 must be "3_3", in3 must be true, out1 is "3_3", out2 is - // 33, out3 is false - IPC_SYNC_MESSAGE_ROUTED3_3(Msg_R_3_3, int, std::string, bool, std::string, - int, bool) +// in1 must be "3_3", in2 must be false, in3 must be 2, out1 is true, out2 +// is 32 +IPC_SYNC_MESSAGE_ROUTED3_2(Msg_R_3_2, std::string, bool, int, bool, int) - // in1 must be true, in2 must be 3, in3 must be "3_4", out1 is 34, out2 is - // true, out3 is "3_4", out4 is false - IPC_SYNC_MESSAGE_ROUTED3_4(Msg_R_3_4, bool, int, std::string, int, bool, - std::string, bool) +// in1 must be 3, in2 must be "3_3", in3 must be true, out1 is "3_3", out2 is +// 33, out3 is false +IPC_SYNC_MESSAGE_ROUTED3_3(Msg_R_3_3, int, std::string, bool, std::string, + int, bool) -IPC_END_MESSAGES(Test) +// in1 must be true, in2 must be 3, in3 must be "3_4", out1 is 34, out2 is +// true, out3 is "3_4", out4 is false +IPC_SYNC_MESSAGE_ROUTED3_4(Msg_R_3_4, bool, int, std::string, int, bool, + std::string, bool) diff --git a/ipc/sync_socket_unittest.cc b/ipc/sync_socket_unittest.cc index 5775d9b..9448487 100644 --- a/ipc/sync_socket_unittest.cc +++ b/ipc/sync_socket_unittest.cc @@ -24,8 +24,7 @@ // We don't actually use the messages defined in this file, but we do this // to get to the IPC macros. -#define MESSAGES_INTERNAL_FILE "ipc/ipc_sync_message_unittest.h" -#include "ipc/ipc_message_macros.h" +#include "ipc/ipc_sync_message_unittest.h" enum IPCMessageIds { UNUSED_IPC_TYPE, |