[email protected] | 7de8404 | 2012-02-21 16:04:50 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
license.bot | bf09a50 | 2008-08-24 00:55:55 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 4 | |
[email protected] | 6476c72c | 2011-02-11 18:46:19 | [diff] [blame] | 5 | // Defining IPC Messages |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 6 | // |
[email protected] | 6476c72c | 2011-02-11 18:46:19 | [diff] [blame] | 7 | // Your IPC messages will be defined by macros inside of an XXX_messages.h |
| 8 | // header file. Most of the time, the system can automatically generate all |
| 9 | // of messaging mechanism from these definitions, but sometimes some manual |
| 10 | // coding is required. In these cases, you will also have an XXX_messages.cc |
philipj | b3b3f8e | 2015-08-12 08:30:01 | [diff] [blame] | 11 | // implementation file as well. |
[email protected] | 6476c72c | 2011-02-11 18:46:19 | [diff] [blame] | 12 | // |
| 13 | // The senders of your messages will include your XXX_messages.h file to |
| 14 | // get the full set of definitions they need to send your messages. |
| 15 | // |
| 16 | // Each XXX_messages.h file must be registered with the IPC system. This |
| 17 | // requires adding two things: |
[email protected] | f950981 | 2012-10-23 23:03:35 | [diff] [blame] | 18 | // - An XXXMsgStart value to the IPCMessageStart enum in ipc_message_start.h |
[email protected] | 6476c72c | 2011-02-11 18:46:19 | [diff] [blame] | 19 | // - An inclusion of XXX_messages.h file in a message generator .h file |
| 20 | // |
| 21 | // The XXXMsgStart value is an enumeration that ensures uniqueness for |
| 22 | // each different message file. Later, you will use this inside your |
[email protected] | e86a255 | 2011-11-11 00:21:02 | [diff] [blame] | 23 | // XXX_messages.h file before invoking message declaration macros: |
[email protected] | 6476c72c | 2011-02-11 18:46:19 | [diff] [blame] | 24 | // #define IPC_MESSAGE_START XXXMsgStart |
| 25 | // ( ... your macro invocations go here ... ) |
| 26 | // |
| 27 | // Message Generator Files |
| 28 | // |
| 29 | // A message generator .h header file pulls in all other message-declaring |
| 30 | // headers for a given component. It is included by a message generator |
| 31 | // .cc file, which is where all the generated code will wind up. Typically, |
[email protected] | d7a5e3e | 2011-03-12 16:28:36 | [diff] [blame] | 32 | // you will use an existing generator (e.g. common_message_generator.cc |
| 33 | // in /chrome/common), but there are circumstances where you may add a |
| 34 | // new one. |
[email protected] | 6476c72c | 2011-02-11 18:46:19 | [diff] [blame] | 35 | // |
philipj | b3b3f8e | 2015-08-12 08:30:01 | [diff] [blame] | 36 | // In the rare circumstances where you can't re-use an existing file, |
[email protected] | 6476c72c | 2011-02-11 18:46:19 | [diff] [blame] | 37 | // your YYY_message_generator.cc file for a component YYY would contain |
| 38 | // the following code: |
| 39 | // // Get basic type definitions. |
[email protected] | 21fa3a1 | 2010-12-08 23:34:16 | [diff] [blame] | 40 | // #define IPC_MESSAGE_IMPL |
[email protected] | 6476c72c | 2011-02-11 18:46:19 | [diff] [blame] | 41 | // #include "path/to/YYY_message_generator.h" |
| 42 | // // Generate constructors. |
| 43 | // #include "ipc/struct_constructor_macros.h" |
| 44 | // #include "path/to/YYY_message_generator.h" |
| 45 | // // Generate destructors. |
| 46 | // #include "ipc/struct_destructor_macros.h" |
| 47 | // #include "path/to/YYY_message_generator.h" |
rockot | 0457af10 | 2016-02-05 02:12:32 | [diff] [blame] | 48 | // // Generate param traits size methods. |
| 49 | // #include "ipc/param_traits_size_macros.h" |
| 50 | // namespace IPC { |
| 51 | // #include "path/to/YYY_message_generator.h" |
| 52 | // } // namespace IPC |
[email protected] | 6476c72c | 2011-02-11 18:46:19 | [diff] [blame] | 53 | // // Generate param traits write methods. |
| 54 | // #include "ipc/param_traits_write_macros.h" |
[email protected] | d7a5e3e | 2011-03-12 16:28:36 | [diff] [blame] | 55 | // namespace IPC { |
[email protected] | 6476c72c | 2011-02-11 18:46:19 | [diff] [blame] | 56 | // #include "path/to/YYY_message_generator.h" |
[email protected] | d7a5e3e | 2011-03-12 16:28:36 | [diff] [blame] | 57 | // } // namespace IPC |
[email protected] | 6476c72c | 2011-02-11 18:46:19 | [diff] [blame] | 58 | // // Generate param traits read methods. |
| 59 | // #include "ipc/param_traits_read_macros.h" |
[email protected] | d7a5e3e | 2011-03-12 16:28:36 | [diff] [blame] | 60 | // namespace IPC { |
[email protected] | 6476c72c | 2011-02-11 18:46:19 | [diff] [blame] | 61 | // #include "path/to/YYY_message_generator.h" |
[email protected] | d7a5e3e | 2011-03-12 16:28:36 | [diff] [blame] | 62 | // } // namespace IPC |
[email protected] | 6476c72c | 2011-02-11 18:46:19 | [diff] [blame] | 63 | // // Generate param traits log methods. |
| 64 | // #include "ipc/param_traits_log_macros.h" |
[email protected] | d7a5e3e | 2011-03-12 16:28:36 | [diff] [blame] | 65 | // namespace IPC { |
[email protected] | 6476c72c | 2011-02-11 18:46:19 | [diff] [blame] | 66 | // #include "path/to/YYY_message_generator.h" |
| 67 | // } // namespace IPC |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 68 | // |
[email protected] | 6476c72c | 2011-02-11 18:46:19 | [diff] [blame] | 69 | // In cases where manual generation is required, in your XXX_messages.cc |
| 70 | // file, put the following after all the includes for param types: |
| 71 | // #define IPC_MESSAGE_IMPL |
| 72 | // #include "XXX_messages.h" |
| 73 | // (... implementation of traits not auto-generated ...) |
| 74 | // |
| 75 | // Multiple Inclusion |
| 76 | // |
| 77 | // The XXX_messages.h file will be multiply-included by the |
| 78 | // YYY_message_generator.cc file, so your XXX_messages file can't be |
| 79 | // guarded in the usual manner. Ideally, there will be no need for any |
philipj | b3b3f8e | 2015-08-12 08:30:01 | [diff] [blame] | 80 | // inclusion guard, since the XXX_messages.h file should consist solely |
[email protected] | 6476c72c | 2011-02-11 18:46:19 | [diff] [blame] | 81 | // of inclusions of other headers (which are self-guarding) and IPC |
| 82 | // macros (which are multiply evaluating). |
| 83 | // |
[email protected] | 01c86ec | 2012-07-11 19:01:43 | [diff] [blame] | 84 | // Note that #pragma once cannot be used here; doing so would mark the whole |
[email protected] | 6476c72c | 2011-02-11 18:46:19 | [diff] [blame] | 85 | // file as being singly-included. Since your XXX_messages.h file is only |
| 86 | // partially-guarded, care must be taken to ensure that it is only included |
| 87 | // by other .cc files (and the YYY_message_generator.h file). Including an |
| 88 | // XXX_messages.h file in some other .h file may result in duplicate |
| 89 | // declarations and a compilation failure. |
| 90 | // |
| 91 | // Type Declarations |
| 92 | // |
| 93 | // It is generally a bad idea to have type definitions in a XXX_messages.h |
| 94 | // file; most likely the typedef will then be used in the message, as opposed |
philipj | b3b3f8e | 2015-08-12 08:30:01 | [diff] [blame] | 95 | // to the struct itself. Later, an IPC message dispatcher will need to call |
[email protected] | 6476c72c | 2011-02-11 18:46:19 | [diff] [blame] | 96 | // a function taking that type, and that function is declared in some other |
| 97 | // header. Thus, in order to get the type definition, the other header |
| 98 | // would have to include the XXX_messages.h file, violating the rule above |
| 99 | // about not including XXX_messages.h file in other .h files. |
| 100 | // |
| 101 | // One approach here is to move these type definitions to another (guarded) |
| 102 | // .h file and include this second .h in your XXX_messages.h file. This |
| 103 | // is still less than ideal, because the dispatched function would have to |
| 104 | // redeclare the typedef or include this second header. This may be |
| 105 | // reasonable in a few cases. |
| 106 | // |
| 107 | // Failing all of the above, then you will want to bracket the smallest |
| 108 | // possible section of your XXX_messages.h file containing these types |
| 109 | // with an include guard macro. Be aware that providing an incomplete |
| 110 | // class type declaration to avoid pulling in a long chain of headers is |
| 111 | // acceptable when your XXX_messages.h header is being included by the |
| 112 | // message sending caller's code, but not when the YYY_message_generator.c |
philipj | b3b3f8e | 2015-08-12 08:30:01 | [diff] [blame] | 113 | // is building the messages. In addition, due to the multiple inclusion |
[email protected] | 6476c72c | 2011-02-11 18:46:19 | [diff] [blame] | 114 | // restriction, these type ought to be guarded. Follow a convention like: |
| 115 | // #ifndef SOME_GUARD_MACRO |
| 116 | // #define SOME_GUARD_MACRO |
| 117 | // class some_class; // One incomplete class declaration |
| 118 | // class_some_other_class; // Another incomplete class declaration |
| 119 | // #endif // SOME_GUARD_MACRO |
| 120 | // #ifdef IPC_MESSAGE_IMPL |
[email protected] | c13849c | 2014-06-18 17:32:42 | [diff] [blame] | 121 | // #include "path/to/some_class.h" // Full class declaration |
| 122 | // #include "path/to/some_other_class.h" // Full class declaration |
[email protected] | 6476c72c | 2011-02-11 18:46:19 | [diff] [blame] | 123 | // #endif // IPC_MESSAGE_IMPL |
| 124 | // (.. IPC macros using some_class and some_other_class ...) |
| 125 | // |
| 126 | // Macro Invocations |
| 127 | // |
| 128 | // You will use IPC message macro invocations for three things: |
| 129 | // - New struct definitions for IPC |
| 130 | // - Registering existing struct and enum definitions with IPC |
| 131 | // - Defining the messages themselves |
| 132 | // |
| 133 | // New structs are defined with IPC_STRUCT_BEGIN(), IPC_STRUCT_MEMBER(), |
| 134 | // IPC_STRUCT_END() family of macros. These cause the XXX_messages.h |
| 135 | // to proclaim equivalent struct declarations for use by callers, as well |
| 136 | // as later registering the type with the message generation. Note that |
| 137 | // IPC_STRUCT_MEMBER() is only permitted inside matching calls to |
[email protected] | dedd0a9 | 2013-06-04 07:20:32 | [diff] [blame] | 138 | // IPC_STRUCT_BEGIN() / IPC_STRUCT_END(). There is also an |
| 139 | // IPC_STRUCT_BEGIN_WITH_PARENT(), which behaves like IPC_STRUCT_BEGIN(), |
philipj | b3b3f8e | 2015-08-12 08:30:01 | [diff] [blame] | 140 | // but also accommodates structs that inherit from other structs. |
[email protected] | 6476c72c | 2011-02-11 18:46:19 | [diff] [blame] | 141 | // |
| 142 | // Externally-defined structs are registered with IPC_STRUCT_TRAITS_BEGIN(), |
| 143 | // IPC_STRUCT_TRAITS_MEMBER(), and IPC_STRUCT_TRAITS_END() macros. These |
[email protected] | 94dc971d | 2011-03-05 19:08:32 | [diff] [blame] | 144 | // cause registration of the types with message generation only. |
| 145 | // There's also IPC_STRUCT_TRAITS_PARENT, which is used to register a parent |
| 146 | // class (whose own traits are already defined). Note that |
| 147 | // IPC_STRUCT_TRAITS_MEMBER() and IPC_STRUCT_TRAITS_PARENT are only permitted |
[email protected] | e503a12 | 2011-03-17 18:20:52 | [diff] [blame] | 148 | // inside matching calls to IPC_STRUCT_TRAITS_BEGIN() / |
| 149 | // IPC_STRUCT_TRAITS_END(). |
[email protected] | 6476c72c | 2011-02-11 18:46:19 | [diff] [blame] | 150 | // |
[email protected] | dedd0a9 | 2013-06-04 07:20:32 | [diff] [blame] | 151 | // Enum types are registered with a single IPC_ENUM_TRAITS_VALIDATE() macro. |
| 152 | // There is no need to enumerate each value to the IPC mechanism. Instead, |
| 153 | // pass an expression in terms of the parameter |value| to provide |
| 154 | // range-checking. For convenience, the IPC_ENUM_TRAITS() is provided which |
| 155 | // performs no checking, passing everything including out-of-range values. |
| 156 | // Its use is discouraged. The IPC_ENUM_TRAITS_MAX_VALUE() macro can be used |
| 157 | // for the typical case where the enum must be in the range 0..maxvalue |
| 158 | // inclusive. The IPC_ENUM_TRAITS_MIN_MAX_VALUE() macro can be used for the |
| 159 | // less typical case where the enum must be in the range minvalue..maxvalue |
| 160 | // inclusive. |
[email protected] | 6476c72c | 2011-02-11 18:46:19 | [diff] [blame] | 161 | // |
[email protected] | e503a12 | 2011-03-17 18:20:52 | [diff] [blame] | 162 | // Do not place semicolons following these IPC_ macro invocations. There |
| 163 | // is no reason to expect that their expansion corresponds one-to-one with |
| 164 | // C++ statements. |
| 165 | // |
[email protected] | 6476c72c | 2011-02-11 18:46:19 | [diff] [blame] | 166 | // Once the types have been declared / registered, message definitions follow. |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 167 | // "Sync" messages are just synchronous calls, the Send() call doesn't return |
[email protected] | 7f99418 | 2011-08-23 10:18:10 | [diff] [blame] | 168 | // until a reply comes back. To declare a sync message, use the IPC_SYNC_ |
| 169 | // macros. The numbers at the end show how many input/output parameters there |
| 170 | // are (i.e. 1_2 is 1 in, 2 out). Input parameters are first, followed by |
| 171 | // output parameters. The caller uses Send([route id, ], in1, &out1, &out2). |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 172 | // The receiver's handler function will be |
| 173 | // void OnSyncMessageName(const type1& in1, type2* out1, type3* out2) |
| 174 | // |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 175 | // A caller can also send a synchronous message, while the receiver can respond |
[email protected] | d424035 | 2009-12-10 17:32:31 | [diff] [blame] | 176 | // at a later time. This is transparent from the sender's side. The receiver |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 177 | // needs to use a different handler that takes in a IPC::Message* as the output |
| 178 | // type, stash the message, and when it has the data it can Send the message. |
| 179 | // |
| 180 | // Use the IPC_MESSAGE_HANDLER_DELAY_REPLY macro instead of IPC_MESSAGE_HANDLER |
[email protected] | d321644 | 2009-03-05 21:07:27 | [diff] [blame] | 181 | // IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_SyncMessageName, |
| 182 | // OnSyncMessageName) |
thestig | cb959ce | 2016-11-17 05:56:32 | [diff] [blame^] | 183 | // Unlike IPC_MESSAGE_HANDLER which works with IPC_BEGIN_MESSAGE_MAP as well as |
| 184 | // IPC_BEGIN_MESSAGE_MAP_WITH_PARAM, one needs to use |
| 185 | // IPC_MESSAGE_HANDLER_WITH_PARAM_DELAY_REPLY to properly handle the param. |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 186 | // |
| 187 | // The handler function will look like: |
| 188 | // void OnSyncMessageName(const type1& in1, IPC::Message* reply_msg); |
| 189 | // |
| 190 | // Receiver stashes the IPC::Message* pointer, and when it's ready, it does: |
| 191 | // ViewHostMsg_SyncMessageName::WriteReplyParams(reply_msg, out1, out2); |
| 192 | // Send(reply_msg); |
| 193 | |
[email protected] | 7de8404 | 2012-02-21 16:04:50 | [diff] [blame] | 194 | // Files that want to export their ipc messages should do |
| 195 | // #undef IPC_MESSAGE_EXPORT |
| 196 | // #define IPC_MESSAGE_EXPORT VISIBILITY_MACRO |
| 197 | // after including this header, but before using any of the macros below. |
| 198 | // (This needs to be before the include guard.) |
| 199 | #undef IPC_MESSAGE_EXPORT |
| 200 | #define IPC_MESSAGE_EXPORT |
| 201 | |
[email protected] | 6476c72c | 2011-02-11 18:46:19 | [diff] [blame] | 202 | #ifndef IPC_IPC_MESSAGE_MACROS_H_ |
| 203 | #define IPC_IPC_MESSAGE_MACROS_H_ |
[email protected] | 82e5ee8 | 2009-04-03 02:29:45 | [diff] [blame] | 204 | |
tfarina | 10a5c06 | 2015-09-04 18:47:57 | [diff] [blame] | 205 | #include <stdint.h> |
| 206 | |
tzik | 55e3e4d | 2016-03-08 05:47:44 | [diff] [blame] | 207 | #include <tuple> |
| 208 | |
[email protected] | e86a255 | 2011-11-11 00:21:02 | [diff] [blame] | 209 | #include "base/profiler/scoped_profile.h" |
mdempsky | 8a51904 | 2016-02-09 05:41:47 | [diff] [blame] | 210 | #include "ipc/export_template.h" |
| 211 | #include "ipc/ipc_message_templates.h" |
[email protected] | 6476c72c | 2011-02-11 18:46:19 | [diff] [blame] | 212 | #include "ipc/ipc_message_utils.h" |
| 213 | #include "ipc/param_traits_macros.h" |
[email protected] | f91cb99 | 2009-02-04 20:10:12 | [diff] [blame] | 214 | |
[email protected] | 600cdb7c | 2013-11-05 04:24:58 | [diff] [blame] | 215 | // Convenience macro for defining structs without inheritance. Should not need |
[email protected] | dedd0a9 | 2013-06-04 07:20:32 | [diff] [blame] | 216 | // to be subsequently redefined. |
[email protected] | 8a8c9c7 | 2011-03-01 20:35:47 | [diff] [blame] | 217 | #define IPC_STRUCT_BEGIN(struct_name) \ |
[email protected] | 6766b17 | 2011-11-21 18:29:36 | [diff] [blame] | 218 | IPC_STRUCT_BEGIN_WITH_PARENT(struct_name, IPC::NoParams) |
[email protected] | dedd0a9 | 2013-06-04 07:20:32 | [diff] [blame] | 219 | |
| 220 | // Macros for defining structs. Will be subsequently redefined. |
[email protected] | 6766b17 | 2011-11-21 18:29:36 | [diff] [blame] | 221 | #define IPC_STRUCT_BEGIN_WITH_PARENT(struct_name, parent) \ |
[email protected] | 8a8c9c7 | 2011-03-01 20:35:47 | [diff] [blame] | 222 | struct struct_name; \ |
| 223 | IPC_STRUCT_TRAITS_BEGIN(struct_name) \ |
| 224 | IPC_STRUCT_TRAITS_END() \ |
[email protected] | 6766b17 | 2011-11-21 18:29:36 | [diff] [blame] | 225 | struct IPC_MESSAGE_EXPORT struct_name : parent { \ |
[email protected] | 8a8c9c7 | 2011-03-01 20:35:47 | [diff] [blame] | 226 | struct_name(); \ |
| 227 | ~struct_name(); |
[email protected] | 01cca004 | 2012-04-16 19:13:02 | [diff] [blame] | 228 | // Optional variadic parameters specify the default value for this struct |
| 229 | // member. They are passed through to the constructor for |type|. |
| 230 | #define IPC_STRUCT_MEMBER(type, name, ...) type name; |
[email protected] | 8a8c9c7 | 2011-03-01 20:35:47 | [diff] [blame] | 231 | #define IPC_STRUCT_END() }; |
| 232 | |
mdempsky | 8a51904 | 2016-02-09 05:41:47 | [diff] [blame] | 233 | // Message macros collect arguments and funnel them into the common message |
| 234 | // generation macro. These should never be redefined. |
[email protected] | 8a8c9c7 | 2011-03-01 20:35:47 | [diff] [blame] | 235 | |
mdempsky | 8a51904 | 2016-02-09 05:41:47 | [diff] [blame] | 236 | // Asynchronous messages have only in parameters and are declared like: |
| 237 | // IPC_MESSAGE_CONTROL(FooMsg, int, float) |
| 238 | #define IPC_MESSAGE_CONTROL(msg_class, ...) \ |
| 239 | IPC_MESSAGE_DECL(msg_class, CONTROL, IPC_TUPLE(__VA_ARGS__), void) |
| 240 | #define IPC_MESSAGE_ROUTED(msg_class, ...) \ |
| 241 | IPC_MESSAGE_DECL(msg_class, ROUTED, IPC_TUPLE(__VA_ARGS__), void) |
[email protected] | 8a8c9c7 | 2011-03-01 20:35:47 | [diff] [blame] | 242 | |
mdempsky | 8a51904 | 2016-02-09 05:41:47 | [diff] [blame] | 243 | // Synchronous messages have both in and out parameters, so the lists need to |
| 244 | // be parenthesized to disambiguate: |
| 245 | // IPC_SYNC_MESSAGE_CONTROL(BarMsg, (int, int), (bool)) |
| 246 | // |
| 247 | // Implementation detail: The parentheses supplied by the caller for |
| 248 | // disambiguation are also used to trigger the IPC_TUPLE invocations below, |
| 249 | // so "IPC_TUPLE in" and "IPC_TUPLE out" are intentional. |
| 250 | #define IPC_SYNC_MESSAGE_CONTROL(msg_class, in, out) \ |
| 251 | IPC_MESSAGE_DECL(msg_class, CONTROL, IPC_TUPLE in, IPC_TUPLE out) |
| 252 | #define IPC_SYNC_MESSAGE_ROUTED(msg_class, in, out) \ |
| 253 | IPC_MESSAGE_DECL(msg_class, ROUTED, IPC_TUPLE in, IPC_TUPLE out) |
[email protected] | 8a8c9c7 | 2011-03-01 20:35:47 | [diff] [blame] | 254 | |
dskiba | 2bc8946 | 2016-04-06 15:51:06 | [diff] [blame] | 255 | #define IPC_TUPLE(...) IPC::CheckedTuple<__VA_ARGS__>::Tuple |
[email protected] | 8a8c9c7 | 2011-03-01 20:35:47 | [diff] [blame] | 256 | |
mdempsky | 8a51904 | 2016-02-09 05:41:47 | [diff] [blame] | 257 | #define IPC_MESSAGE_DECL(msg_name, kind, in_tuple, out_tuple) \ |
| 258 | struct IPC_MESSAGE_EXPORT msg_name##_Meta { \ |
| 259 | using InTuple = in_tuple; \ |
| 260 | using OutTuple = out_tuple; \ |
| 261 | enum { ID = IPC_MESSAGE_ID() }; \ |
| 262 | static const IPC::MessageKind kKind = IPC::MessageKind::kind; \ |
| 263 | static const char kName[]; \ |
| 264 | }; \ |
| 265 | extern template class EXPORT_TEMPLATE_DECLARE(IPC_MESSAGE_EXPORT) \ |
| 266 | IPC::MessageT<msg_name##_Meta>; \ |
| 267 | using msg_name = IPC::MessageT<msg_name##_Meta>; \ |
| 268 | IPC_MESSAGE_EXTRA(msg_name) |
[email protected] | 8a8c9c7 | 2011-03-01 20:35:47 | [diff] [blame] | 269 | |
| 270 | #if defined(IPC_MESSAGE_IMPL) |
| 271 | |
mdempsky | 8a51904 | 2016-02-09 05:41:47 | [diff] [blame] | 272 | // "Implementation" inclusion provides the explicit template definition |
| 273 | // for msg_name. |
| 274 | #define IPC_MESSAGE_EXTRA(msg_name) \ |
| 275 | const char msg_name##_Meta::kName[] = #msg_name; \ |
| 276 | IPC_MESSAGE_DEFINE_KIND(msg_name) \ |
| 277 | template class EXPORT_TEMPLATE_DEFINE(IPC_MESSAGE_EXPORT) \ |
| 278 | IPC::MessageT<msg_name##_Meta>; |
[email protected] | 8a8c9c7 | 2011-03-01 20:35:47 | [diff] [blame] | 279 | |
mdempsky | 8a51904 | 2016-02-09 05:41:47 | [diff] [blame] | 280 | // MSVC has an intentionally non-compliant "feature" that results in LNK2005 |
| 281 | // ("symbol already defined") errors if we provide an out-of-line definition |
| 282 | // for kKind. Microsoft's official response is to test for _MSC_EXTENSIONS: |
| 283 | // https://connect.microsoft.com/VisualStudio/feedback/details/786583/ |
| 284 | #if defined(_MSC_EXTENSIONS) |
| 285 | #define IPC_MESSAGE_DEFINE_KIND(msg_name) |
| 286 | #else |
| 287 | #define IPC_MESSAGE_DEFINE_KIND(msg_name) \ |
| 288 | const IPC::MessageKind msg_name##_Meta::kKind; |
| 289 | #endif |
[email protected] | 8a8c9c7 | 2011-03-01 20:35:47 | [diff] [blame] | 290 | |
[email protected] | 21fa3a1 | 2010-12-08 23:34:16 | [diff] [blame] | 291 | #elif defined(IPC_MESSAGE_MACROS_LOG_ENABLED) |
[email protected] | f91cb99 | 2009-02-04 20:10:12 | [diff] [blame] | 292 | |
[email protected] | 4f68ed7 | 2012-10-30 05:24:07 | [diff] [blame] | 293 | #ifndef IPC_LOG_TABLE_ADD_ENTRY |
| 294 | #error You need to define IPC_LOG_TABLE_ADD_ENTRY(msg_id, logger) |
| 295 | #endif |
[email protected] | f91cb99 | 2009-02-04 20:10:12 | [diff] [blame] | 296 | |
[email protected] | 8a8c9c7 | 2011-03-01 20:35:47 | [diff] [blame] | 297 | // "Log table" inclusion produces extra logging registration code. |
mdempsky | 8a51904 | 2016-02-09 05:41:47 | [diff] [blame] | 298 | #define IPC_MESSAGE_EXTRA(msg_name) \ |
| 299 | class LoggerRegisterHelper##msg_name { \ |
| 300 | public: \ |
| 301 | LoggerRegisterHelper##msg_name() { \ |
| 302 | const uint32_t msg_id = static_cast<uint32_t>(msg_name::ID); \ |
| 303 | IPC_LOG_TABLE_ADD_ENTRY(msg_id, msg_name::Log); \ |
| 304 | } \ |
| 305 | }; \ |
| 306 | LoggerRegisterHelper##msg_name g_LoggerRegisterHelper##msg_name; |
[email protected] | f91cb99 | 2009-02-04 20:10:12 | [diff] [blame] | 307 | |
[email protected] | 8a8c9c7 | 2011-03-01 20:35:47 | [diff] [blame] | 308 | #else |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 309 | |
[email protected] | 8a8c9c7 | 2011-03-01 20:35:47 | [diff] [blame] | 310 | // Normal inclusion produces nothing extra. |
mdempsky | 8a51904 | 2016-02-09 05:41:47 | [diff] [blame] | 311 | #define IPC_MESSAGE_EXTRA(msg_name) |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 312 | |
mdempsky | 8a51904 | 2016-02-09 05:41:47 | [diff] [blame] | 313 | #endif // defined(IPC_MESSAGE_IMPL) |
[email protected] | 6d8ffc9f | 2010-03-12 18:27:53 | [diff] [blame] | 314 | |
[email protected] | d7a5e3e | 2011-03-12 16:28:36 | [diff] [blame] | 315 | // Message IDs |
| 316 | // Note: we currently use __LINE__ to give unique IDs to messages within |
| 317 | // a file. They're globally unique since each file defines its own |
[email protected] | 3b3ec721 | 2011-10-21 17:35:08 | [diff] [blame] | 318 | // IPC_MESSAGE_START. |
[email protected] | d7a5e3e | 2011-03-12 16:28:36 | [diff] [blame] | 319 | #define IPC_MESSAGE_ID() ((IPC_MESSAGE_START << 16) + __LINE__) |
| 320 | #define IPC_MESSAGE_ID_CLASS(id) ((id) >> 16) |
| 321 | #define IPC_MESSAGE_ID_LINE(id) ((id) & 0xffff) |
| 322 | |
[email protected] | e44d134 | 2014-05-16 21:29:33 | [diff] [blame] | 323 | // Message crackers and handlers. Usage: |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 324 | // |
[email protected] | a95986a8 | 2010-12-24 06:19:28 | [diff] [blame] | 325 | // bool MyClass::OnMessageReceived(const IPC::Message& msg) { |
| 326 | // bool handled = true; |
[email protected] | e44d134 | 2014-05-16 21:29:33 | [diff] [blame] | 327 | // IPC_BEGIN_MESSAGE_MAP(MyClass, msg) |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 328 | // IPC_MESSAGE_HANDLER(MsgClassOne, OnMsgClassOne) |
| 329 | // ...more handlers here ... |
| 330 | // IPC_MESSAGE_HANDLER(MsgClassTen, OnMsgClassTen) |
[email protected] | a95986a8 | 2010-12-24 06:19:28 | [diff] [blame] | 331 | // IPC_MESSAGE_UNHANDLED(handled = false) |
[email protected] | e44d134 | 2014-05-16 21:29:33 | [diff] [blame] | 332 | // IPC_END_MESSAGE_MAP() |
[email protected] | a95986a8 | 2010-12-24 06:19:28 | [diff] [blame] | 333 | // return handled; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 334 | // } |
| 335 | |
[email protected] | 21fa3a1 | 2010-12-08 23:34:16 | [diff] [blame] | 336 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 337 | #define IPC_BEGIN_MESSAGE_MAP(class_name, msg) \ |
| 338 | { \ |
pkasting | 99867ef | 2014-10-16 23:49:24 | [diff] [blame] | 339 | typedef class_name _IpcMessageHandlerClass ALLOW_UNUSED_TYPE; \ |
[email protected] | 9d77dd412 | 2014-05-14 21:43:59 | [diff] [blame] | 340 | void* param__ = NULL; \ |
sunnyps | b3c862b | 2016-02-05 01:55:08 | [diff] [blame] | 341 | (void)param__; \ |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 342 | const IPC::Message& ipc_message__ = msg; \ |
[email protected] | 9d77dd412 | 2014-05-14 21:43:59 | [diff] [blame] | 343 | switch (ipc_message__.type()) { |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 344 | |
pkasting | 99867ef | 2014-10-16 23:49:24 | [diff] [blame] | 345 | #define IPC_BEGIN_MESSAGE_MAP_WITH_PARAM(class_name, msg, param) \ |
| 346 | { \ |
| 347 | typedef class_name _IpcMessageHandlerClass ALLOW_UNUSED_TYPE; \ |
thakis | e6e95d9 | 2014-10-29 22:04:47 | [diff] [blame] | 348 | decltype(param) param__ = param; \ |
pkasting | 99867ef | 2014-10-16 23:49:24 | [diff] [blame] | 349 | const IPC::Message& ipc_message__ = msg; \ |
[email protected] | 9d77dd412 | 2014-05-14 21:43:59 | [diff] [blame] | 350 | switch (ipc_message__.type()) { |
[email protected] | 5636d90 | 2014-05-13 23:19:10 | [diff] [blame] | 351 | |
[email protected] | e86a255 | 2011-11-11 00:21:02 | [diff] [blame] | 352 | #define IPC_MESSAGE_FORWARD(msg_class, obj, member_func) \ |
| 353 | case msg_class::ID: { \ |
vadimt | a19e4877 | 2014-09-25 22:08:59 | [diff] [blame] | 354 | TRACK_RUN_IN_THIS_SCOPED_REGION(member_func); \ |
[email protected] | e44d134 | 2014-05-16 21:29:33 | [diff] [blame] | 355 | if (!msg_class::Dispatch(&ipc_message__, obj, this, param__, \ |
| 356 | &member_func)) \ |
[email protected] | ef2f6ba | 2014-05-15 23:06:07 | [diff] [blame] | 357 | ipc_message__.set_dispatch_error(); \ |
[email protected] | e86a255 | 2011-11-11 00:21:02 | [diff] [blame] | 358 | } \ |
| 359 | break; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 360 | |
| 361 | #define IPC_MESSAGE_HANDLER(msg_class, member_func) \ |
| 362 | IPC_MESSAGE_FORWARD(msg_class, this, _IpcMessageHandlerClass::member_func) |
| 363 | |
[email protected] | e86a255 | 2011-11-11 00:21:02 | [diff] [blame] | 364 | #define IPC_MESSAGE_FORWARD_DELAY_REPLY(msg_class, obj, member_func) \ |
| 365 | case msg_class::ID: { \ |
vadimt | a19e4877 | 2014-09-25 22:08:59 | [diff] [blame] | 366 | TRACK_RUN_IN_THIS_SCOPED_REGION(member_func); \ |
[email protected] | e44d134 | 2014-05-16 21:29:33 | [diff] [blame] | 367 | if (!msg_class::DispatchDelayReply(&ipc_message__, obj, param__, \ |
| 368 | &member_func)) \ |
[email protected] | ef2f6ba | 2014-05-15 23:06:07 | [diff] [blame] | 369 | ipc_message__.set_dispatch_error(); \ |
[email protected] | e86a255 | 2011-11-11 00:21:02 | [diff] [blame] | 370 | } \ |
| 371 | break; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 372 | |
[email protected] | e86a255 | 2011-11-11 00:21:02 | [diff] [blame] | 373 | #define IPC_MESSAGE_HANDLER_DELAY_REPLY(msg_class, member_func) \ |
| 374 | IPC_MESSAGE_FORWARD_DELAY_REPLY(msg_class, this, \ |
| 375 | _IpcMessageHandlerClass::member_func) |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 376 | |
thestig | cb959ce | 2016-11-17 05:56:32 | [diff] [blame^] | 377 | #define IPC_MESSAGE_FORWARD_WITH_PARAM_DELAY_REPLY(msg_class, obj, \ |
| 378 | member_func) \ |
| 379 | case msg_class::ID: { \ |
| 380 | TRACK_RUN_IN_THIS_SCOPED_REGION(member_func); \ |
| 381 | if (!msg_class::DispatchWithParamDelayReply(&ipc_message__, obj, param__, \ |
| 382 | &member_func)) \ |
| 383 | ipc_message__.set_dispatch_error(); \ |
| 384 | } \ |
| 385 | break; |
| 386 | |
| 387 | #define IPC_MESSAGE_HANDLER_WITH_PARAM_DELAY_REPLY(msg_class, member_func) \ |
| 388 | IPC_MESSAGE_FORWARD_WITH_PARAM_DELAY_REPLY( \ |
| 389 | msg_class, this, _IpcMessageHandlerClass::member_func) |
| 390 | |
[email protected] | 56201634 | 2011-11-15 17:51:43 | [diff] [blame] | 391 | // TODO(jar): fix chrome frame to always supply |code| argument. |
[email protected] | e86a255 | 2011-11-11 00:21:02 | [diff] [blame] | 392 | #define IPC_MESSAGE_HANDLER_GENERIC(msg_class, code) \ |
| 393 | case msg_class::ID: { \ |
vadimt | a19e4877 | 2014-09-25 22:08:59 | [diff] [blame] | 394 | /* TRACK_RUN_IN_THIS_SCOPED_REGION(code); TODO(jar) */ \ |
[email protected] | e86a255 | 2011-11-11 00:21:02 | [diff] [blame] | 395 | code; \ |
| 396 | } \ |
| 397 | break; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 398 | |
[email protected] | e86a255 | 2011-11-11 00:21:02 | [diff] [blame] | 399 | #define IPC_REPLY_HANDLER(func) \ |
| 400 | case IPC_REPLY_ID: { \ |
vadimt | a19e4877 | 2014-09-25 22:08:59 | [diff] [blame] | 401 | TRACK_RUN_IN_THIS_SCOPED_REGION(func); \ |
[email protected] | e86a255 | 2011-11-11 00:21:02 | [diff] [blame] | 402 | func(ipc_message__); \ |
| 403 | } \ |
| 404 | break; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 405 | |
| 406 | |
[email protected] | e86a255 | 2011-11-11 00:21:02 | [diff] [blame] | 407 | #define IPC_MESSAGE_UNHANDLED(code) \ |
| 408 | default: { \ |
[email protected] | e86a255 | 2011-11-11 00:21:02 | [diff] [blame] | 409 | code; \ |
| 410 | } \ |
| 411 | break; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 412 | |
| 413 | #define IPC_MESSAGE_UNHANDLED_ERROR() \ |
| 414 | IPC_MESSAGE_UNHANDLED(NOTREACHED() << \ |
| 415 | "Invalid message with type = " << \ |
| 416 | ipc_message__.type()) |
| 417 | |
| 418 | #define IPC_END_MESSAGE_MAP() \ |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 419 | } \ |
[email protected] | 8d70d5f | 2010-12-08 23:41:08 | [diff] [blame] | 420 | } |
[email protected] | 9f547bf | 2010-12-13 17:00:42 | [diff] [blame] | 421 | |
| 422 | // This corresponds to an enum value from IPCMessageStart. |
lfg | db5c4ed | 2016-03-04 23:09:07 | [diff] [blame] | 423 | #define IPC_MESSAGE_CLASS(message) IPC_MESSAGE_ID_CLASS((message).type()) |
[email protected] | 6476c72c | 2011-02-11 18:46:19 | [diff] [blame] | 424 | |
mdempsky | 8a51904 | 2016-02-09 05:41:47 | [diff] [blame] | 425 | // Deprecated legacy macro names. |
| 426 | // TODO(mdempsky): Replace uses with generic names. |
| 427 | |
| 428 | #define IPC_MESSAGE_CONTROL0(msg) IPC_MESSAGE_CONTROL(msg) |
| 429 | #define IPC_MESSAGE_CONTROL1(msg, a) IPC_MESSAGE_CONTROL(msg, a) |
| 430 | #define IPC_MESSAGE_CONTROL2(msg, a, b) IPC_MESSAGE_CONTROL(msg, a, b) |
| 431 | #define IPC_MESSAGE_CONTROL3(msg, a, b, c) IPC_MESSAGE_CONTROL(msg, a, b, c) |
| 432 | #define IPC_MESSAGE_CONTROL4(msg, a, b, c, d) \ |
| 433 | IPC_MESSAGE_CONTROL(msg, a, b, c, d) |
| 434 | #define IPC_MESSAGE_CONTROL5(msg, a, b, c, d, e) \ |
| 435 | IPC_MESSAGE_CONTROL(msg, a, b, c, d, e) |
| 436 | |
| 437 | #define IPC_MESSAGE_ROUTED0(msg) IPC_MESSAGE_ROUTED(msg) |
| 438 | #define IPC_MESSAGE_ROUTED1(msg, a) IPC_MESSAGE_ROUTED(msg, a) |
| 439 | #define IPC_MESSAGE_ROUTED2(msg, a, b) IPC_MESSAGE_ROUTED(msg, a, b) |
| 440 | #define IPC_MESSAGE_ROUTED3(msg, a, b, c) IPC_MESSAGE_ROUTED(msg, a, b, c) |
| 441 | #define IPC_MESSAGE_ROUTED4(msg, a, b, c, d) IPC_MESSAGE_ROUTED(msg, a, b, c, d) |
| 442 | #define IPC_MESSAGE_ROUTED5(msg, a, b, c, d, e) \ |
| 443 | IPC_MESSAGE_ROUTED(msg, a, b, c, d, e) |
| 444 | |
| 445 | #define IPC_SYNC_MESSAGE_CONTROL0_0(msg) IPC_SYNC_MESSAGE_CONTROL(msg, (), ()) |
| 446 | #define IPC_SYNC_MESSAGE_CONTROL0_1(msg, a) \ |
| 447 | IPC_SYNC_MESSAGE_CONTROL(msg, (), (a)) |
| 448 | #define IPC_SYNC_MESSAGE_CONTROL0_2(msg, a, b) \ |
| 449 | IPC_SYNC_MESSAGE_CONTROL(msg, (), (a, b)) |
| 450 | #define IPC_SYNC_MESSAGE_CONTROL0_3(msg, a, b, c) \ |
| 451 | IPC_SYNC_MESSAGE_CONTROL(msg, (), (a, b, c)) |
| 452 | #define IPC_SYNC_MESSAGE_CONTROL0_4(msg, a, b, c, d) \ |
| 453 | IPC_SYNC_MESSAGE_CONTROL(msg, (), (a, b, c, d)) |
| 454 | #define IPC_SYNC_MESSAGE_CONTROL1_0(msg, a) \ |
| 455 | IPC_SYNC_MESSAGE_CONTROL(msg, (a), ()) |
| 456 | #define IPC_SYNC_MESSAGE_CONTROL1_1(msg, a, b) \ |
| 457 | IPC_SYNC_MESSAGE_CONTROL(msg, (a), (b)) |
| 458 | #define IPC_SYNC_MESSAGE_CONTROL1_2(msg, a, b, c) \ |
| 459 | IPC_SYNC_MESSAGE_CONTROL(msg, (a), (b, c)) |
| 460 | #define IPC_SYNC_MESSAGE_CONTROL1_3(msg, a, b, c, d) \ |
| 461 | IPC_SYNC_MESSAGE_CONTROL(msg, (a), (b, c, d)) |
| 462 | #define IPC_SYNC_MESSAGE_CONTROL1_4(msg, a, b, c, d, e) \ |
| 463 | IPC_SYNC_MESSAGE_CONTROL(msg, (a), (b, c, d, e)) |
| 464 | #define IPC_SYNC_MESSAGE_CONTROL2_0(msg, a, b) \ |
| 465 | IPC_SYNC_MESSAGE_CONTROL(msg, (a, b), ()) |
| 466 | #define IPC_SYNC_MESSAGE_CONTROL2_1(msg, a, b, c) \ |
| 467 | IPC_SYNC_MESSAGE_CONTROL(msg, (a, b), (c)) |
| 468 | #define IPC_SYNC_MESSAGE_CONTROL2_2(msg, a, b, c, d) \ |
| 469 | IPC_SYNC_MESSAGE_CONTROL(msg, (a, b), (c, d)) |
| 470 | #define IPC_SYNC_MESSAGE_CONTROL2_3(msg, a, b, c, d, e) \ |
| 471 | IPC_SYNC_MESSAGE_CONTROL(msg, (a, b), (c, d, e)) |
| 472 | #define IPC_SYNC_MESSAGE_CONTROL2_4(msg, a, b, c, d, e, f) \ |
| 473 | IPC_SYNC_MESSAGE_CONTROL(msg, (a, b), (c, d, e, f)) |
| 474 | #define IPC_SYNC_MESSAGE_CONTROL3_0(msg, a, b, c) \ |
| 475 | IPC_SYNC_MESSAGE_CONTROL(msg, (a, b, c), ()) |
| 476 | #define IPC_SYNC_MESSAGE_CONTROL3_1(msg, a, b, c, d) \ |
| 477 | IPC_SYNC_MESSAGE_CONTROL(msg, (a, b, c), (d)) |
| 478 | #define IPC_SYNC_MESSAGE_CONTROL3_2(msg, a, b, c, d, e) \ |
| 479 | IPC_SYNC_MESSAGE_CONTROL(msg, (a, b, c), (d, e)) |
| 480 | #define IPC_SYNC_MESSAGE_CONTROL3_3(msg, a, b, c, d, e, f) \ |
| 481 | IPC_SYNC_MESSAGE_CONTROL(msg, (a, b, c), (d, e, f)) |
| 482 | #define IPC_SYNC_MESSAGE_CONTROL3_4(msg, a, b, c, d, e, f, g) \ |
| 483 | IPC_SYNC_MESSAGE_CONTROL(msg, (a, b, c), (d, e, f, g)) |
| 484 | #define IPC_SYNC_MESSAGE_CONTROL4_0(msg, a, b, c, d) \ |
| 485 | IPC_SYNC_MESSAGE_CONTROL(msg, (a, b, c, d), ()) |
| 486 | #define IPC_SYNC_MESSAGE_CONTROL4_1(msg, a, b, c, d, e) \ |
| 487 | IPC_SYNC_MESSAGE_CONTROL(msg, (a, b, c, d), (e)) |
| 488 | #define IPC_SYNC_MESSAGE_CONTROL4_2(msg, a, b, c, d, e, f) \ |
| 489 | IPC_SYNC_MESSAGE_CONTROL(msg, (a, b, c, d), (e, f)) |
| 490 | #define IPC_SYNC_MESSAGE_CONTROL4_3(msg, a, b, c, d, e, f, g) \ |
| 491 | IPC_SYNC_MESSAGE_CONTROL(msg, (a, b, c, d), (e, f, g)) |
| 492 | #define IPC_SYNC_MESSAGE_CONTROL4_4(msg, a, b, c, d, e, f, g, h) \ |
| 493 | IPC_SYNC_MESSAGE_CONTROL(msg, (a, b, c, d), (e, f, g, h)) |
| 494 | #define IPC_SYNC_MESSAGE_CONTROL5_0(msg, a, b, c, d, e) \ |
| 495 | IPC_SYNC_MESSAGE_CONTROL(msg, (a, b, c, d, e), ()) |
| 496 | #define IPC_SYNC_MESSAGE_CONTROL5_1(msg, a, b, c, d, e, f) \ |
| 497 | IPC_SYNC_MESSAGE_CONTROL(msg, (a, b, c, d, e), (f)) |
| 498 | #define IPC_SYNC_MESSAGE_CONTROL5_2(msg, a, b, c, d, e, f, g) \ |
| 499 | IPC_SYNC_MESSAGE_CONTROL(msg, (a, b, c, d, e), (f, g)) |
| 500 | #define IPC_SYNC_MESSAGE_CONTROL5_3(msg, a, b, c, d, e, f, g, h) \ |
| 501 | IPC_SYNC_MESSAGE_CONTROL(msg, (a, b, c, d, e), (f, g, h)) |
| 502 | #define IPC_SYNC_MESSAGE_CONTROL5_4(msg, a, b, c, d, e, f, g, h, i) \ |
| 503 | IPC_SYNC_MESSAGE_CONTROL(msg, (a, b, c, d, e), (f, g, h, i)) |
| 504 | |
| 505 | #define IPC_SYNC_MESSAGE_ROUTED0_0(msg) IPC_SYNC_MESSAGE_ROUTED(msg, (), ()) |
| 506 | #define IPC_SYNC_MESSAGE_ROUTED0_1(msg, a) IPC_SYNC_MESSAGE_ROUTED(msg, (), (a)) |
| 507 | #define IPC_SYNC_MESSAGE_ROUTED0_2(msg, a, b) \ |
| 508 | IPC_SYNC_MESSAGE_ROUTED(msg, (), (a, b)) |
| 509 | #define IPC_SYNC_MESSAGE_ROUTED0_3(msg, a, b, c) \ |
| 510 | IPC_SYNC_MESSAGE_ROUTED(msg, (), (a, b, c)) |
| 511 | #define IPC_SYNC_MESSAGE_ROUTED0_4(msg, a, b, c, d) \ |
| 512 | IPC_SYNC_MESSAGE_ROUTED(msg, (), (a, b, c, d)) |
| 513 | #define IPC_SYNC_MESSAGE_ROUTED1_0(msg, a) IPC_SYNC_MESSAGE_ROUTED(msg, (a), ()) |
| 514 | #define IPC_SYNC_MESSAGE_ROUTED1_1(msg, a, b) \ |
| 515 | IPC_SYNC_MESSAGE_ROUTED(msg, (a), (b)) |
| 516 | #define IPC_SYNC_MESSAGE_ROUTED1_2(msg, a, b, c) \ |
| 517 | IPC_SYNC_MESSAGE_ROUTED(msg, (a), (b, c)) |
| 518 | #define IPC_SYNC_MESSAGE_ROUTED1_3(msg, a, b, c, d) \ |
| 519 | IPC_SYNC_MESSAGE_ROUTED(msg, (a), (b, c, d)) |
| 520 | #define IPC_SYNC_MESSAGE_ROUTED1_4(msg, a, b, c, d, e) \ |
| 521 | IPC_SYNC_MESSAGE_ROUTED(msg, (a), (b, c, d, e)) |
| 522 | #define IPC_SYNC_MESSAGE_ROUTED2_0(msg, a, b) \ |
| 523 | IPC_SYNC_MESSAGE_ROUTED(msg, (a, b), ()) |
| 524 | #define IPC_SYNC_MESSAGE_ROUTED2_1(msg, a, b, c) \ |
| 525 | IPC_SYNC_MESSAGE_ROUTED(msg, (a, b), (c)) |
| 526 | #define IPC_SYNC_MESSAGE_ROUTED2_2(msg, a, b, c, d) \ |
| 527 | IPC_SYNC_MESSAGE_ROUTED(msg, (a, b), (c, d)) |
| 528 | #define IPC_SYNC_MESSAGE_ROUTED2_3(msg, a, b, c, d, e) \ |
| 529 | IPC_SYNC_MESSAGE_ROUTED(msg, (a, b), (c, d, e)) |
| 530 | #define IPC_SYNC_MESSAGE_ROUTED2_4(msg, a, b, c, d, e, f) \ |
| 531 | IPC_SYNC_MESSAGE_ROUTED(msg, (a, b), (c, d, e, f)) |
| 532 | #define IPC_SYNC_MESSAGE_ROUTED3_0(msg, a, b, c) \ |
| 533 | IPC_SYNC_MESSAGE_ROUTED(msg, (a, b, c), ()) |
| 534 | #define IPC_SYNC_MESSAGE_ROUTED3_1(msg, a, b, c, d) \ |
| 535 | IPC_SYNC_MESSAGE_ROUTED(msg, (a, b, c), (d)) |
| 536 | #define IPC_SYNC_MESSAGE_ROUTED3_2(msg, a, b, c, d, e) \ |
| 537 | IPC_SYNC_MESSAGE_ROUTED(msg, (a, b, c), (d, e)) |
| 538 | #define IPC_SYNC_MESSAGE_ROUTED3_3(msg, a, b, c, d, e, f) \ |
| 539 | IPC_SYNC_MESSAGE_ROUTED(msg, (a, b, c), (d, e, f)) |
| 540 | #define IPC_SYNC_MESSAGE_ROUTED3_4(msg, a, b, c, d, e, f, g) \ |
| 541 | IPC_SYNC_MESSAGE_ROUTED(msg, (a, b, c), (d, e, f, g)) |
| 542 | #define IPC_SYNC_MESSAGE_ROUTED4_0(msg, a, b, c, d) \ |
| 543 | IPC_SYNC_MESSAGE_ROUTED(msg, (a, b, c, d), ()) |
| 544 | #define IPC_SYNC_MESSAGE_ROUTED4_1(msg, a, b, c, d, e) \ |
| 545 | IPC_SYNC_MESSAGE_ROUTED(msg, (a, b, c, d), (e)) |
| 546 | #define IPC_SYNC_MESSAGE_ROUTED4_2(msg, a, b, c, d, e, f) \ |
| 547 | IPC_SYNC_MESSAGE_ROUTED(msg, (a, b, c, d), (e, f)) |
| 548 | #define IPC_SYNC_MESSAGE_ROUTED4_3(msg, a, b, c, d, e, f, g) \ |
| 549 | IPC_SYNC_MESSAGE_ROUTED(msg, (a, b, c, d), (e, f, g)) |
| 550 | #define IPC_SYNC_MESSAGE_ROUTED4_4(msg, a, b, c, d, e, f, g, h) \ |
| 551 | IPC_SYNC_MESSAGE_ROUTED(msg, (a, b, c, d), (e, f, g, h)) |
| 552 | #define IPC_SYNC_MESSAGE_ROUTED5_0(msg, a, b, c, d, e) \ |
| 553 | IPC_SYNC_MESSAGE_ROUTED(msg, (a, b, c, d, e), ()) |
| 554 | #define IPC_SYNC_MESSAGE_ROUTED5_1(msg, a, b, c, d, e, f) \ |
| 555 | IPC_SYNC_MESSAGE_ROUTED(msg, (a, b, c, d, e), (f)) |
| 556 | #define IPC_SYNC_MESSAGE_ROUTED5_2(msg, a, b, c, d, e, f, g) \ |
| 557 | IPC_SYNC_MESSAGE_ROUTED(msg, (a, b, c, d, e), (f, g)) |
| 558 | #define IPC_SYNC_MESSAGE_ROUTED5_3(msg, a, b, c, d, e, f, g, h) \ |
| 559 | IPC_SYNC_MESSAGE_ROUTED(msg, (a, b, c, d, e), (f, g, h)) |
| 560 | #define IPC_SYNC_MESSAGE_ROUTED5_4(msg, a, b, c, d, e, f, g, h, i) \ |
| 561 | IPC_SYNC_MESSAGE_ROUTED(msg, (a, b, c, d, e), (f, g, h, i)) |
| 562 | |
[email protected] | 6476c72c | 2011-02-11 18:46:19 | [diff] [blame] | 563 | #endif // IPC_IPC_MESSAGE_MACROS_H_ |
| 564 | |
| 565 | // Clean up IPC_MESSAGE_START in this unguarded section so that the |
| 566 | // XXX_messages.h files need not do so themselves. This makes the |
| 567 | // XXX_messages.h files easier to write. |
| 568 | #undef IPC_MESSAGE_START |