1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // Defining IPC Messages
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
11 // implemation file as well.
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.
16 // Each XXX_messages.h file must be registered with the IPC system. This
17 // requires adding two things:
18 // - An XXXMsgStart value to the IPCMessageStart enum in ipc_message_utils.h
19 // - An inclusion of XXX_messages.h file in a message generator .h file
21 // The XXXMsgStart value is an enumeration that ensures uniqueness for
22 // each different message file. Later, you will use this inside your
23 // XXX_messages.h file before invoking message declatation macros:
24 // #define IPC_MESSAGE_START XXXMsgStart
25 // ( ... your macro invocations go here ... )
27 // Message Generator Files
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,
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
36 // In the rare cicrucmstances where you can't re-use an existing file,
37 // your YYY_message_generator.cc file for a component YYY would contain
38 // the following code:
39 // // Get basic type definitions.
40 // #define IPC_MESSAGE_IMPL
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"
48 // // Generate param traits write methods.
49 // #include "ipc/param_traits_write_macros.h"
51 // #include "path/to/YYY_message_generator.h"
53 // // Generate param traits read methods.
54 // #include "ipc/param_traits_read_macros.h"
56 // #include "path/to/YYY_message_generator.h"
58 // // Generate param traits log methods.
59 // #include "ipc/param_traits_log_macros.h"
61 // #include "path/to/YYY_message_generator.h"
64 // In cases where manual generation is required, in your XXX_messages.cc
65 // file, put the following after all the includes for param types:
66 // #define IPC_MESSAGE_IMPL
67 // #include "XXX_messages.h"
68 // (... implementation of traits not auto-generated ...)
72 // The XXX_messages.h file will be multiply-included by the
73 // YYY_message_generator.cc file, so your XXX_messages file can't be
74 // guarded in the usual manner. Ideally, there will be no need for any
75 // inclusion guard, since the XXX_messages.h file should consist soley
76 // of inclusions of other headers (which are self-guarding) and IPC
77 // macros (which are multiply evaluating).
79 // Note that there is no #pragma once either; doing so would mark the whole
80 // file as being singly-included. Since your XXX_messages.h file is only
81 // partially-guarded, care must be taken to ensure that it is only included
82 // by other .cc files (and the YYY_message_generator.h file). Including an
83 // XXX_messages.h file in some other .h file may result in duplicate
84 // declarations and a compilation failure.
88 // It is generally a bad idea to have type definitions in a XXX_messages.h
89 // file; most likely the typedef will then be used in the message, as opposed
90 // to the struct iself. Later, an IPC message dispatcher wil need to call
91 // a function taking that type, and that function is declared in some other
92 // header. Thus, in order to get the type definition, the other header
93 // would have to include the XXX_messages.h file, violating the rule above
94 // about not including XXX_messages.h file in other .h files.
96 // One approach here is to move these type definitions to another (guarded)
97 // .h file and include this second .h in your XXX_messages.h file. This
98 // is still less than ideal, because the dispatched function would have to
99 // redeclare the typedef or include this second header. This may be
100 // reasonable in a few cases.
102 // Failing all of the above, then you will want to bracket the smallest
103 // possible section of your XXX_messages.h file containing these types
104 // with an include guard macro. Be aware that providing an incomplete
105 // class type declaration to avoid pulling in a long chain of headers is
106 // acceptable when your XXX_messages.h header is being included by the
107 // message sending caller's code, but not when the YYY_message_generator.c
108 // is building the messages. In addtion, due to the multiple inclusion
109 // restriction, these type ought to be guarded. Follow a convention like:
110 // #ifndef SOME_GUARD_MACRO
111 // #define SOME_GUARD_MACRO
112 // class some_class; // One incomplete class declaration
113 // class_some_other_class; // Another incomplete class declaration
114 // #endif // SOME_GUARD_MACRO
115 // #ifdef IPC_MESSAGE_IMPL
116 // #inlcude "path/to/some_class.h" // Full class declaration
117 // #inlcude "path/to/some_other_class.h" // Full class declaration
118 // #endif // IPC_MESSAGE_IMPL
119 // (.. IPC macros using some_class and some_other_class ...)
123 // You will use IPC message macro invocations for three things:
124 // - New struct definitions for IPC
125 // - Registering existing struct and enum definitions with IPC
126 // - Defining the messages themselves
128 // New structs are defined with IPC_STRUCT_BEGIN(), IPC_STRUCT_MEMBER(),
129 // IPC_STRUCT_END() family of macros. These cause the XXX_messages.h
130 // to proclaim equivalent struct declarations for use by callers, as well
131 // as later registering the type with the message generation. Note that
132 // IPC_STRUCT_MEMBER() is only permitted inside matching calls to
133 // IPC_STRUCT_BEGIN() / IPC_STRUCT_END().
135 // Externally-defined structs are registered with IPC_STRUCT_TRAITS_BEGIN(),
136 // IPC_STRUCT_TRAITS_MEMBER(), and IPC_STRUCT_TRAITS_END() macros. These
137 // cause registration of the types with message generation only.
138 // There's also IPC_STRUCT_TRAITS_PARENT, which is used to register a parent
139 // class (whose own traits are already defined). Note that
140 // IPC_STRUCT_TRAITS_MEMBER() and IPC_STRUCT_TRAITS_PARENT are only permitted
141 // inside matching calls to IPC_STRUCT_TRAITS_BEGIN() /
142 // IPC_STRUCT_TRAITS_END().
144 // Enum types are registered with a single IPC_ENUM_TRAITS() macro. There
145 // is no need to enumerate each value to the IPC mechanism.
147 // Do not place semicolons following these IPC_ macro invocations. There
148 // is no reason to expect that their expansion corresponds one-to-one with
151 // Once the types have been declared / registered, message definitions follow.
152 // "Sync" messages are just synchronous calls, the Send() call doesn't return
153 // until a reply comes back. Input parameters are first (const TYPE&), and
154 // To declare a sync message, use the IPC_SYNC_ macros. The numbers at the
155 // end show how many input/output parameters there are (i.e. 1_2 is 1 in, 2
156 // out). The caller does a Send([route id, ], in1, &out1, &out2).
157 // The receiver's handler function will be
158 // void OnSyncMessageName(const type1& in1, type2* out1, type3* out2)
160 // A caller can also send a synchronous message, while the receiver can respond
161 // at a later time. This is transparent from the sender's side. The receiver
162 // needs to use a different handler that takes in a IPC::Message* as the output
163 // type, stash the message, and when it has the data it can Send the message.
165 // Use the IPC_MESSAGE_HANDLER_DELAY_REPLY macro instead of IPC_MESSAGE_HANDLER
166 // IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_SyncMessageName,
167 // OnSyncMessageName)
169 // The handler function will look like:
170 // void OnSyncMessageName(const type1& in1, IPC::Message* reply_msg);
172 // Receiver stashes the IPC::Message* pointer, and when it's ready, it does:
173 // ViewHostMsg_SyncMessageName::WriteReplyParams(reply_msg, out1, out2);
176 #ifndef IPC_IPC_MESSAGE_MACROS_H_
177 #define IPC_IPC_MESSAGE_MACROS_H_
179 #include "ipc/ipc_message_utils.h"
180 #include "ipc/param_traits_macros.h"
182 #if defined(IPC_MESSAGE_IMPL)
183 #include "ipc/ipc_message_utils_impl.h"
186 // Macros for defining structs. May be subsequently redefined.
187 #define IPC_STRUCT_BEGIN(struct_name) \
188 struct struct_name; \
189 IPC_STRUCT_TRAITS_BEGIN(struct_name) \
190 IPC_STRUCT_TRAITS_END() \
191 struct struct_name : IPC::NoParams { \
194 #define IPC_STRUCT_MEMBER(type, name) type name;
195 #define IPC_STRUCT_END() };
197 // Message macros collect specific numbers of arguments and funnel them into
198 // the common message generation macro. These should never be redefined.
199 #define IPC_MESSAGE_CONTROL0(msg_class) \
200 IPC_MESSAGE_DECL(EMPTY, CONTROL, msg_class, 0, 0, (), ())
202 #define IPC_MESSAGE_CONTROL1(msg_class, type1) \
203 IPC_MESSAGE_DECL(ASYNC, CONTROL, msg_class, 1, 0, (type1), ())
205 #define IPC_MESSAGE_CONTROL2(msg_class, type1, type2) \
206 IPC_MESSAGE_DECL(ASYNC, CONTROL, msg_class, 2, 0, (type1, type2), ())
208 #define IPC_MESSAGE_CONTROL3(msg_class, type1, type2, type3) \
209 IPC_MESSAGE_DECL(ASYNC, CONTROL, msg_class, 3, 0, (type1, type2, type3), ())
211 #define IPC_MESSAGE_CONTROL4(msg_class, type1, type2, type3, type4) \
212 IPC_MESSAGE_DECL(ASYNC, CONTROL, msg_class, 4, 0, (type1, type2, type3, type4), ())
214 #define IPC_MESSAGE_CONTROL5(msg_class, type1, type2, type3, type4, type5) \
215 IPC_MESSAGE_DECL(ASYNC, CONTROL, msg_class, 5, 0, (type1, type2, type3, type4, type5), ())
217 #define IPC_MESSAGE_CONTROL6(msg_class, type1, type2, type3, type4, type5, type6) \
218 IPC_MESSAGE_DECL(ASYNC, CONTROL, msg_class, 6, 0, (type1, type2, type3, type4, type5, type6), ())
221 #define IPC_MESSAGE_ROUTED0(msg_class) \
222 IPC_MESSAGE_DECL(EMPTY, ROUTED, msg_class, 0, 0, (), ())
224 #define IPC_MESSAGE_ROUTED1(msg_class, type1) \
225 IPC_MESSAGE_DECL(ASYNC, ROUTED, msg_class, 1, 0, (type1), ())
227 #define IPC_MESSAGE_ROUTED2(msg_class, type1, type2) \
228 IPC_MESSAGE_DECL(ASYNC, ROUTED, msg_class, 2, 0, (type1, type2), ())
230 #define IPC_MESSAGE_ROUTED3(msg_class, type1, type2, type3) \
231 IPC_MESSAGE_DECL(ASYNC, ROUTED, msg_class, 3, 0, (type1, type2, type3), ())
233 #define IPC_MESSAGE_ROUTED4(msg_class, type1, type2, type3, type4) \
234 IPC_MESSAGE_DECL(ASYNC, ROUTED, msg_class, 4, 0, (type1, type2, type3, type4), ())
236 #define IPC_MESSAGE_ROUTED5(msg_class, type1, type2, type3, type4, type5) \
237 IPC_MESSAGE_DECL(ASYNC, ROUTED, msg_class, 5, 0, (type1, type2, type3, type4, type5), ())
239 #define IPC_MESSAGE_ROUTED6(msg_class, type1, type2, type3, type4, type5, type6) \
240 IPC_MESSAGE_DECL(ASYNC, ROUTED, msg_class, 6, 0, (type1, type2, type3, type4, type5, type6), ())
242 #define IPC_SYNC_MESSAGE_CONTROL0_0(msg_class) \
243 IPC_MESSAGE_DECL(SYNC, CONTROL, msg_class, 0, 0, (), ())
245 #define IPC_SYNC_MESSAGE_CONTROL0_1(msg_class, type1_out) \
246 IPC_MESSAGE_DECL(SYNC, CONTROL, msg_class, 0, 1, (), (type1_out))
248 #define IPC_SYNC_MESSAGE_CONTROL0_2(msg_class, type1_out, type2_out) \
249 IPC_MESSAGE_DECL(SYNC, CONTROL, msg_class, 0, 2, (), (type1_out, type2_out))
251 #define IPC_SYNC_MESSAGE_CONTROL0_3(msg_class, type1_out, type2_out, type3_out) \
252 IPC_MESSAGE_DECL(SYNC, CONTROL, msg_class, 0, 3, (), (type1_out, type2_out, type3_out))
254 #define IPC_SYNC_MESSAGE_CONTROL0_4(msg_class, type1_out, type2_out, type3_out, type4_out) \
255 IPC_MESSAGE_DECL(SYNC, CONTROL, msg_class, 0, 4, (), (type1_out, type2_out, type3_out, type4_out))
257 #define IPC_SYNC_MESSAGE_CONTROL1_0(msg_class, type1_in) \
258 IPC_MESSAGE_DECL(SYNC, CONTROL, msg_class, 1, 0, (type1_in), ())
260 #define IPC_SYNC_MESSAGE_CONTROL1_1(msg_class, type1_in, type1_out) \
261 IPC_MESSAGE_DECL(SYNC, CONTROL, msg_class, 1, 1, (type1_in), (type1_out))
263 #define IPC_SYNC_MESSAGE_CONTROL1_2(msg_class, type1_in, type1_out, type2_out) \
264 IPC_MESSAGE_DECL(SYNC, CONTROL, msg_class, 1, 2, (type1_in), (type1_out, type2_out))
266 #define IPC_SYNC_MESSAGE_CONTROL1_3(msg_class, type1_in, type1_out, type2_out, type3_out) \
267 IPC_MESSAGE_DECL(SYNC, CONTROL, msg_class, 1, 3, (type1_in), (type1_out, type2_out, type3_out))
269 #define IPC_SYNC_MESSAGE_CONTROL1_4(msg_class, type1_in, type1_out, type2_out, type3_out, type4_out) \
270 IPC_MESSAGE_DECL(SYNC, CONTROL, msg_class, 1, 4, (type1_in), (type1_out, type2_out, type3_out, type4_out))
272 #define IPC_SYNC_MESSAGE_CONTROL2_0(msg_class, type1_in, type2_in) \
273 IPC_MESSAGE_DECL(SYNC, CONTROL, msg_class, 2, 0, (type1_in, type2_in), ())
275 #define IPC_SYNC_MESSAGE_CONTROL2_1(msg_class, type1_in, type2_in, type1_out) \
276 IPC_MESSAGE_DECL(SYNC, CONTROL, msg_class, 2, 1, (type1_in, type2_in), (type1_out))
278 #define IPC_SYNC_MESSAGE_CONTROL2_2(msg_class, type1_in, type2_in, type1_out, type2_out) \
279 IPC_MESSAGE_DECL(SYNC, CONTROL, msg_class, 2, 2, (type1_in, type2_in), (type1_out, type2_out))
281 #define IPC_SYNC_MESSAGE_CONTROL2_3(msg_class, type1_in, type2_in, type1_out, type2_out, type3_out) \
282 IPC_MESSAGE_DECL(SYNC, CONTROL, msg_class, 2, 3, (type1_in, type2_in), (type1_out, type2_out, type3_out))
284 #define IPC_SYNC_MESSAGE_CONTROL2_4(msg_class, type1_in, type2_in, type1_out, type2_out, type3_out, type4_out) \
285 IPC_MESSAGE_DECL(SYNC, CONTROL, msg_class, 2, 4, (type1_in, type2_in), (type1_out, type2_out, type3_out, type4_out))
287 #define IPC_SYNC_MESSAGE_CONTROL3_0(msg_class, type1_in, type2_in, type3_in) \
288 IPC_MESSAGE_DECL(SYNC, CONTROL, msg_class, 3, 0, (type1_in, type2_in, type3_in), ())
290 #define IPC_SYNC_MESSAGE_CONTROL3_1(msg_class, type1_in, type2_in, type3_in, type1_out) \
291 IPC_MESSAGE_DECL(SYNC, CONTROL, msg_class, 3, 1, (type1_in, type2_in, type3_in), (type1_out))
293 #define IPC_SYNC_MESSAGE_CONTROL3_2(msg_class, type1_in, type2_in, type3_in, type1_out, type2_out) \
294 IPC_MESSAGE_DECL(SYNC, CONTROL, msg_class, 3, 2, (type1_in, type2_in, type3_in), (type1_out, type2_out))
296 #define IPC_SYNC_MESSAGE_CONTROL3_3(msg_class, type1_in, type2_in, type3_in, type1_out, type2_out, type3_out) \
297 IPC_MESSAGE_DECL(SYNC, CONTROL, msg_class, 3, 3, (type1_in, type2_in, type3_in), (type1_out, type2_out, type3_out))
299 #define IPC_SYNC_MESSAGE_CONTROL3_4(msg_class, type1_in, type2_in, type3_in, type1_out, type2_out, type3_out, type4_out) \
300 IPC_MESSAGE_DECL(SYNC, CONTROL, msg_class, 3, 4, (type1_in, type2_in, type3_in), (type1_out, type2_out, type3_out, type4_out))
302 #define IPC_SYNC_MESSAGE_CONTROL4_0(msg_class, type1_in, type2_in, type3_in, type4_in) \
303 IPC_MESSAGE_DECL(SYNC, CONTROL, msg_class, 4, 0, (type1_in, type2_in, type3_in, type4_in), ())
305 #define IPC_SYNC_MESSAGE_CONTROL4_1(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out) \
306 IPC_MESSAGE_DECL(SYNC, CONTROL, msg_class, 4, 1, (type1_in, type2_in, type3_in, type4_in), (type1_out))
308 #define IPC_SYNC_MESSAGE_CONTROL4_2(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out, type2_out) \
309 IPC_MESSAGE_DECL(SYNC, CONTROL, msg_class, 4, 2, (type1_in, type2_in, type3_in, type4_in), (type1_out, type2_out))
311 #define IPC_SYNC_MESSAGE_CONTROL4_3(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out, type2_out, type3_out) \
312 IPC_MESSAGE_DECL(SYNC, CONTROL, msg_class, 4, 3, (type1_in, type2_in, type3_in, type4_in), (type1_out, type2_out, type3_out))
314 #define IPC_SYNC_MESSAGE_CONTROL4_4(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out, type2_out, type3_out, type4_out) \
315 IPC_MESSAGE_DECL(SYNC, CONTROL, msg_class, 4, 4, (type1_in, type2_in, type3_in, type4_in), (type1_out, type2_out, type3_out, type4_out))
317 #define IPC_SYNC_MESSAGE_CONTROL5_0(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in) \
318 IPC_MESSAGE_DECL(SYNC, CONTROL, msg_class, 5, 0, (type1_in, type2_in, type3_in, type4_in, type5_in), ())
320 #define IPC_SYNC_MESSAGE_CONTROL5_1(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in, type1_out) \
321 IPC_MESSAGE_DECL(SYNC, CONTROL, msg_class, 5, 1, (type1_in, type2_in, type3_in, type4_in, type5_in), (type1_out))
323 #define IPC_SYNC_MESSAGE_CONTROL5_2(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in, type1_out, type2_out) \
324 IPC_MESSAGE_DECL(SYNC, CONTROL, msg_class, 5, 2, (type1_in, type2_in, type3_in, type4_in, type5_in), (type1_out, type2_out))
326 #define IPC_SYNC_MESSAGE_CONTROL5_3(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in, type1_out, type2_out, type3_out) \
327 IPC_MESSAGE_DECL(SYNC, CONTROL, msg_class, 5, 3, (type1_in, type2_in, type3_in, type4_in, type5_in), (type1_out, type2_out, type3_out))
329 #define IPC_SYNC_MESSAGE_CONTROL5_4(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in, type1_out, type2_out, type3_out, type4_out) \
330 IPC_MESSAGE_DECL(SYNC, CONTROL, msg_class, 5, 4, (type1_in, type2_in, type3_in, type4_in, type5_in), (type1_out, type2_out, type3_out, type4_out))
332 #define IPC_SYNC_MESSAGE_CONTROL6_0(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in, type6_in) \
333 IPC_MESSAGE_DECL(SYNC, CONTROL, msg_class, 6, 0, (type1_in, type2_in, type3_in, type4_in, type5_in, type6_in), ())
335 #define IPC_SYNC_MESSAGE_CONTROL6_1(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in, type6_in, type1_out) \
336 IPC_MESSAGE_DECL(SYNC, CONTROL, msg_class, 6, 1, (type1_in, type2_in, type3_in, type4_in, type5_in, type6_in), (type1_out))
338 #define IPC_SYNC_MESSAGE_ROUTED0_0(msg_class) \
339 IPC_MESSAGE_DECL(SYNC, ROUTED, msg_class, 0, 0, (), ())
341 #define IPC_SYNC_MESSAGE_ROUTED0_1(msg_class, type1_out) \
342 IPC_MESSAGE_DECL(SYNC, ROUTED, msg_class, 0, 1, (), (type1_out))
344 #define IPC_SYNC_MESSAGE_ROUTED0_2(msg_class, type1_out, type2_out) \
345 IPC_MESSAGE_DECL(SYNC, ROUTED, msg_class, 0, 2, (), (type1_out, type2_out))
347 #define IPC_SYNC_MESSAGE_ROUTED0_3(msg_class, type1_out, type2_out, type3_out) \
348 IPC_MESSAGE_DECL(SYNC, ROUTED, msg_class, 0, 3, (), (type1_out, type2_out, type3_out))
350 #define IPC_SYNC_MESSAGE_ROUTED0_4(msg_class, type1_out, type2_out, type3_out, type4_out) \
351 IPC_MESSAGE_DECL(SYNC, ROUTED, msg_class, 0, 4, (), (type1_out, type2_out, type3_out, type4_out))
353 #define IPC_SYNC_MESSAGE_ROUTED1_0(msg_class, type1_in) \
354 IPC_MESSAGE_DECL(SYNC, ROUTED, msg_class, 1, 0, (type1_in), ())
356 #define IPC_SYNC_MESSAGE_ROUTED1_1(msg_class, type1_in, type1_out) \
357 IPC_MESSAGE_DECL(SYNC, ROUTED, msg_class, 1, 1, (type1_in), (type1_out))
359 #define IPC_SYNC_MESSAGE_ROUTED1_2(msg_class, type1_in, type1_out, type2_out) \
360 IPC_MESSAGE_DECL(SYNC, ROUTED, msg_class, 1, 2, (type1_in), (type1_out, type2_out))
362 #define IPC_SYNC_MESSAGE_ROUTED1_3(msg_class, type1_in, type1_out, type2_out, type3_out) \
363 IPC_MESSAGE_DECL(SYNC, ROUTED, msg_class, 1, 3, (type1_in), (type1_out, type2_out, type3_out))
365 #define IPC_SYNC_MESSAGE_ROUTED1_4(msg_class, type1_in, type1_out, type2_out, type3_out, type4_out) \
366 IPC_MESSAGE_DECL(SYNC, ROUTED, msg_class, 1, 4, (type1_in), (type1_out, type2_out, type3_out, type4_out))
368 #define IPC_SYNC_MESSAGE_ROUTED2_0(msg_class, type1_in, type2_in) \
369 IPC_MESSAGE_DECL(SYNC, ROUTED, msg_class, 2, 0, (type1_in, type2_in), ())
371 #define IPC_SYNC_MESSAGE_ROUTED2_1(msg_class, type1_in, type2_in, type1_out) \
372 IPC_MESSAGE_DECL(SYNC, ROUTED, msg_class, 2, 1, (type1_in, type2_in), (type1_out))
374 #define IPC_SYNC_MESSAGE_ROUTED2_2(msg_class, type1_in, type2_in, type1_out, type2_out) \
375 IPC_MESSAGE_DECL(SYNC, ROUTED, msg_class, 2, 2, (type1_in, type2_in), (type1_out, type2_out))
377 #define IPC_SYNC_MESSAGE_ROUTED2_3(msg_class, type1_in, type2_in, type1_out, type2_out, type3_out) \
378 IPC_MESSAGE_DECL(SYNC, ROUTED, msg_class, 2, 3, (type1_in, type2_in), (type1_out, type2_out, type3_out))
380 #define IPC_SYNC_MESSAGE_ROUTED2_4(msg_class, type1_in, type2_in, type1_out, type2_out, type3_out, type4_out) \
381 IPC_MESSAGE_DECL(SYNC, ROUTED, msg_class, 2, 4, (type1_in, type2_in), (type1_out, type2_out, type3_out, type4_out))
383 #define IPC_SYNC_MESSAGE_ROUTED3_0(msg_class, type1_in, type2_in, type3_in) \
384 IPC_MESSAGE_DECL(SYNC, ROUTED, msg_class, 3, 0, (type1_in, type2_in, type3_in), ())
386 #define IPC_SYNC_MESSAGE_ROUTED3_1(msg_class, type1_in, type2_in, type3_in, type1_out) \
387 IPC_MESSAGE_DECL(SYNC, ROUTED, msg_class, 3, 1, (type1_in, type2_in, type3_in), (type1_out))
389 #define IPC_SYNC_MESSAGE_ROUTED3_2(msg_class, type1_in, type2_in, type3_in, type1_out, type2_out) \
390 IPC_MESSAGE_DECL(SYNC, ROUTED, msg_class, 3, 2, (type1_in, type2_in, type3_in), (type1_out, type2_out))
392 #define IPC_SYNC_MESSAGE_ROUTED3_3(msg_class, type1_in, type2_in, type3_in, type1_out, type2_out, type3_out) \
393 IPC_MESSAGE_DECL(SYNC, ROUTED, msg_class, 3, 3, (type1_in, type2_in, type3_in), (type1_out, type2_out, type3_out))
395 #define IPC_SYNC_MESSAGE_ROUTED3_4(msg_class, type1_in, type2_in, type3_in, type1_out, type2_out, type3_out, type4_out) \
396 IPC_MESSAGE_DECL(SYNC, ROUTED, msg_class, 3, 4, (type1_in, type2_in, type3_in), (type1_out, type2_out, type3_out, type4_out))
398 #define IPC_SYNC_MESSAGE_ROUTED4_0(msg_class, type1_in, type2_in, type3_in, type4_in) \
399 IPC_MESSAGE_DECL(SYNC, ROUTED, msg_class, 4, 1, (type1_in, type2_in, type3_in, type4_in), ())
401 #define IPC_SYNC_MESSAGE_ROUTED4_1(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out) \
402 IPC_MESSAGE_DECL(SYNC, ROUTED, msg_class, 4, 1, (type1_in, type2_in, type3_in, type4_in), (type1_out))
404 #define IPC_SYNC_MESSAGE_ROUTED4_2(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out, type2_out) \
405 IPC_MESSAGE_DECL(SYNC, ROUTED, msg_class, 4, 2, (type1_in, type2_in, type3_in, type4_in), (type1_out, type2_out))
407 #define IPC_SYNC_MESSAGE_ROUTED4_3(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out, type2_out, type3_out) \
408 IPC_MESSAGE_DECL(SYNC, ROUTED, msg_class, 4, 3, (type1_in, type2_in, type3_in, type4_in), (type1_out, type2_out, type3_out))
410 #define IPC_SYNC_MESSAGE_ROUTED4_4(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out, type2_out, type3_out, type4_out) \
411 IPC_MESSAGE_DECL(SYNC, ROUTED, msg_class, 4, 4, (type1_in, type2_in, type3_in, type4_in), (type1_out, type2_out, type3_out, type4_out))
413 #define IPC_SYNC_MESSAGE_ROUTED5_0(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in) \
414 IPC_MESSAGE_DECL(SYNC, ROUTED, msg_class, 5, 1, (type1_in, type2_in, type3_in, type4_in, type5_in), ())
416 #define IPC_SYNC_MESSAGE_ROUTED5_1(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in, type1_out) \
417 IPC_MESSAGE_DECL(SYNC, ROUTED, msg_class, 5, 1, (type1_in, type2_in, type3_in, type4_in, type5_in), (type1_out))
419 #define IPC_SYNC_MESSAGE_ROUTED5_2(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in, type1_out, type2_out) \
420 IPC_MESSAGE_DECL(SYNC, ROUTED, msg_class, 5, 2, (type1_in, type2_in, type3_in, type4_in, type5_in), (type1_out, type2_out))
422 #define IPC_SYNC_MESSAGE_ROUTED5_3(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in, type1_out, type2_out, type3_out) \
423 IPC_MESSAGE_DECL(SYNC, ROUTED, msg_class, 5, 3, (type1_in, type2_in, type3_in, type4_in, type5_in), (type1_out, type2_out, type3_out))
425 #define IPC_SYNC_MESSAGE_ROUTED5_4(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in, type1_out, type2_out, type3_out, type4_out) \
426 IPC_MESSAGE_DECL(SYNC, ROUTED, msg_class, 5, 4, (type1_in, type2_in, type3_in, type4_in, type5_in), (type1_out, type2_out, type3_out, type4_out))
428 // Common message macro which dispatches into one of the 6 (sync x kind)
429 // routines. There is a way that these 6 cases can be lumped together,
430 // but the macros get very complicated in that case.
431 // Note: intended be redefined to generate other information.
432 #define IPC_MESSAGE_DECL(sync, kind, msg_class, \
433 in_cnt, out_cnt, in_list, out_list) \
434 IPC_##sync##_##kind##_DECL(msg_class, in_cnt, out_cnt, in_list, out_list) \
435 IPC_MESSAGE_EXTRA(sync, kind, msg_class, in_cnt, out_cnt, in_list, out_list)
437 #define IPC_EMPTY_CONTROL_DECL(msg_class, in_cnt, out_cnt, in_list, out_list) \
438 class __attribute__((visibility("default"))) msg_class : public IPC::Message\
441 enum { ID = IPC_MESSAGE_ID() }; \
442 msg_class() : IPC::Message(MSG_ROUTING_CONTROL, ID, PRIORITY_NORMAL) {} \
445 #define IPC_EMPTY_ROUTED_DECL(msg_class, in_cnt, out_cnt, in_list, out_list) \
446 class __attribute__((visibility("default"))) msg_class : public IPC::Message\
449 enum { ID = IPC_MESSAGE_ID() }; \
450 msg_class(int32 routing_id) \
451 : IPC::Message(routing_id, ID, PRIORITY_NORMAL) {} \
454 #define IPC_ASYNC_CONTROL_DECL(msg_class, in_cnt, out_cnt, in_list, out_list) \
455 class __attribute__((visibility("default"))) msg_class : \
456 public IPC::MessageWithTuple<IPC_TUPLE_IN_##in_cnt in_list> { \
458 enum { ID = IPC_MESSAGE_ID() }; \
459 msg_class(IPC_TYPE_IN_##in_cnt in_list); \
460 virtual ~msg_class(); \
461 static void Log(std::string* name, const Message* msg, std::string* l); \
464 #define IPC_ASYNC_ROUTED_DECL(msg_class, in_cnt, out_cnt, in_list, out_list) \
465 class __attribute__((visibility("default"))) msg_class : \
466 public IPC::MessageWithTuple<IPC_TUPLE_IN_##in_cnt in_list> { \
468 enum { ID = IPC_MESSAGE_ID() }; \
469 msg_class(int32 routing_id IPC_COMMA_##in_cnt \
470 IPC_TYPE_IN_##in_cnt in_list); \
471 virtual ~msg_class(); \
472 static void Log(std::string* name, const Message* msg, std::string* l); \
475 #define IPC_SYNC_CONTROL_DECL(msg_class, in_cnt, out_cnt, in_list, out_list) \
476 class __attribute__((visibility("default"))) msg_class : \
477 public IPC::MessageWithReply<IPC_TUPLE_IN_##in_cnt in_list, \
478 IPC_TUPLE_OUT_##out_cnt out_list> { \
480 enum { ID = IPC_MESSAGE_ID() }; \
481 msg_class(IPC_TYPE_IN_##in_cnt in_list \
482 IPC_COMMA_AND_##in_cnt(IPC_COMMA_##out_cnt) \
483 IPC_TYPE_OUT_##out_cnt out_list); \
484 virtual ~msg_class(); \
485 static void Log(std::string* name, const Message* msg, std::string* l); \
488 #define IPC_SYNC_ROUTED_DECL(msg_class, in_cnt, out_cnt, in_list, out_list) \
489 class __attribute__((visibility("default"))) msg_class : \
490 public IPC::MessageWithReply<IPC_TUPLE_IN_##in_cnt in_list, \
491 IPC_TUPLE_OUT_##out_cnt out_list> { \
493 enum { ID = IPC_MESSAGE_ID() }; \
494 msg_class(int32 routing_id \
495 IPC_COMMA_OR_##in_cnt(IPC_COMMA_##out_cnt) \
496 IPC_TYPE_IN_##in_cnt in_list \
497 IPC_COMMA_AND_##in_cnt(IPC_COMMA_##out_cnt) \
498 IPC_TYPE_OUT_##out_cnt out_list); \
499 virtual ~msg_class(); \
500 static void Log(std::string* name, const Message* msg, std::string* l); \
503 #if defined(IPC_MESSAGE_IMPL)
505 // "Implementation" inclusion produces constructors, destructors, and
506 // logging functions, except for the no-arg special cases, where the
507 // implementation occurs in the declaration, and there is no special
509 #define IPC_MESSAGE_EXTRA(sync, kind, msg_class, \
510 in_cnt, out_cnt, in_list, out_list) \
511 IPC_##sync##_##kind##_IMPL(msg_class, in_cnt, out_cnt, in_list, out_list) \
512 IPC_##sync##_MESSAGE_LOG(msg_class)
514 #define IPC_EMPTY_CONTROL_IMPL(msg_class, in_cnt, out_cnt, in_list, out_list)
515 #define IPC_EMPTY_ROUTED_IMPL(msg_class, in_cnt, out_cnt, in_list, out_list)
517 #define IPC_ASYNC_CONTROL_IMPL(msg_class, in_cnt, out_cnt, in_list, out_list) \
518 msg_class::msg_class(IPC_TYPE_IN_##in_cnt in_list) : \
519 IPC::MessageWithTuple<IPC_TUPLE_IN_##in_cnt in_list> \
520 (MSG_ROUTING_CONTROL, ID, IPC_NAME_IN_##in_cnt in_list) \
522 msg_class::~msg_class() {}
524 #define IPC_ASYNC_ROUTED_IMPL(msg_class, in_cnt, out_cnt, in_list, out_list) \
525 msg_class::msg_class(int32 routing_id IPC_COMMA_##in_cnt \
526 IPC_TYPE_IN_##in_cnt in_list) : \
527 IPC::MessageWithTuple<IPC_TUPLE_IN_##in_cnt in_list> \
528 (routing_id, ID, IPC_NAME_IN_##in_cnt in_list) \
530 msg_class::~msg_class() {}
532 #define IPC_SYNC_CONTROL_IMPL(msg_class, in_cnt, out_cnt, in_list, out_list) \
533 msg_class::msg_class(IPC_TYPE_IN_##in_cnt in_list \
534 IPC_COMMA_AND_##in_cnt(IPC_COMMA_##out_cnt) \
535 IPC_TYPE_OUT_##out_cnt out_list) : \
536 IPC::MessageWithReply<IPC_TUPLE_IN_##in_cnt in_list, \
537 IPC_TUPLE_OUT_##out_cnt out_list> \
538 (MSG_ROUTING_CONTROL, ID, \
539 IPC_NAME_IN_##in_cnt in_list, \
540 IPC_NAME_OUT_##out_cnt out_list) \
543 msg_class::~msg_class() {}
545 #define IPC_SYNC_ROUTED_IMPL(msg_class, in_cnt, out_cnt, in_list, out_list) \
546 msg_class::msg_class(int32 routing_id \
547 IPC_COMMA_OR_##in_cnt(IPC_COMMA_##out_cnt) \
548 IPC_TYPE_IN_##in_cnt in_list \
549 IPC_COMMA_AND_##in_cnt(IPC_COMMA_##out_cnt) \
550 IPC_TYPE_OUT_##out_cnt out_list) : \
551 IPC::MessageWithReply<IPC_TUPLE_IN_##in_cnt in_list, \
552 IPC_TUPLE_OUT_##out_cnt out_list> \
554 IPC_NAME_IN_##in_cnt in_list, \
555 IPC_NAME_OUT_##out_cnt out_list) \
557 msg_class::~msg_class() {}
559 #define IPC_EMPTY_MESSAGE_LOG(msg_class)
561 #define IPC_ASYNC_MESSAGE_LOG(msg_class) \
562 void msg_class::Log(std::string* name, \
563 const Message* msg, \
567 *name = #msg_class; \
576 IPC::LogParam(p, l); \
580 #define IPC_SYNC_MESSAGE_LOG(msg_class) \
581 void msg_class::Log(std::string* name, \
582 const Message* msg, \
586 *name = #msg_class; \
592 if (msg->is_sync()) { \
593 TupleTypes<SendParam>::ValueTuple p; \
594 if (ReadSendParam(msg, &p)) \
596 IPC::LogParam(p, l); \
598 AddOutputParamsToLog(msg, l); \
600 TupleTypes<ReplyParam>::ValueTuple p; \
601 if (ReadReplyParam(msg, &p)) \
603 IPC::LogParam(p, l); \
608 #elif defined(IPC_MESSAGE_MACROS_LOG_ENABLED)
610 #ifndef IPC_LOG_TABLE_CREATED
611 #define IPC_LOG_TABLE_CREATED
613 #include "base/hash_tables.h"
615 typedef void (*LogFunction)(std::string* name,
616 const IPC::Message* msg,
617 std::string* params);
619 typedef base::hash_map<uint32, LogFunction > LogFunctionMap;
620 LogFunctionMap g_log_function_mapping;
622 #endif // IPC_LOG_TABLE_CREATED
624 // "Log table" inclusion produces extra logging registration code.
625 #define IPC_MESSAGE_EXTRA(sync, kind, msg_class, \
626 in_cnt, out_cnt, in_list, out_list) \
627 class __attribute__((visibility("default"))) LoggerRegisterHelper##msg_class { \
629 LoggerRegisterHelper##msg_class() { \
630 g_log_function_mapping[msg_class::ID] = msg_class::Log; \
633 LoggerRegisterHelper##msg_class g_LoggerRegisterHelper##msg_class;
637 // Normal inclusion produces nothing extra.
638 #define IPC_MESSAGE_EXTRA(sync, kind, msg_class, \
639 in_cnt, out_cnt, in_list, out_list)
641 #endif // defined(IPC_MESSAGE_IMPL)
643 // Handle variable sized argument lists. These are usually invoked by token
644 // pasting against the argument counts.
645 #define IPC_TYPE_IN_0()
646 #define IPC_TYPE_IN_1(t1) const t1& arg1
647 #define IPC_TYPE_IN_2(t1, t2) const t1& arg1, const t2& arg2
648 #define IPC_TYPE_IN_3(t1, t2, t3) const t1& arg1, const t2& arg2, const t3& arg3
649 #define IPC_TYPE_IN_4(t1, t2, t3, t4) const t1& arg1, const t2& arg2, const t3& arg3, const t4& arg4
650 #define IPC_TYPE_IN_5(t1, t2, t3, t4, t5) const t1& arg1, const t2& arg2, const t3& arg3, const t4& arg4, const t5& arg5
651 #define IPC_TYPE_IN_6(t1, t2, t3, t4, t5, t6) const t1& arg1, const t2& arg2, const t3& arg3, const t4& arg4, const t5& arg5, const t6& arg6
653 #define IPC_TYPE_OUT_0()
654 #define IPC_TYPE_OUT_1(t1) t1* arg7
655 #define IPC_TYPE_OUT_2(t1, t2) t1* arg7, t2* arg8
656 #define IPC_TYPE_OUT_3(t1, t2, t3) t1* arg7, t2* arg8, t3* arg9
657 #define IPC_TYPE_OUT_4(t1, t2, t3, t4) t1* arg7, t2* arg8, t3* arg9, t4* arg10
659 #define IPC_TUPLE_IN_0() Tuple0
660 #define IPC_TUPLE_IN_1(t1) Tuple1<t1>
661 #define IPC_TUPLE_IN_2(t1, t2) Tuple2<t1, t2>
662 #define IPC_TUPLE_IN_3(t1, t2, t3) Tuple3<t1, t2, t3>
663 #define IPC_TUPLE_IN_4(t1, t2, t3, t4) Tuple4<t1, t2, t3, t4>
664 #define IPC_TUPLE_IN_5(t1, t2, t3, t4, t5) Tuple5<t1, t2, t3, t4, t5>
665 #define IPC_TUPLE_IN_6(t1, t2, t3, t4, t5, t6) Tuple6<t1, t2, t3, t4, t5, t6>
667 #define IPC_TUPLE_OUT_0() Tuple0
668 #define IPC_TUPLE_OUT_1(t1) Tuple1<t1&>
669 #define IPC_TUPLE_OUT_2(t1, t2) Tuple2<t1&, t2&>
670 #define IPC_TUPLE_OUT_3(t1, t2, t3) Tuple3<t1&, t2&, t3&>
671 #define IPC_TUPLE_OUT_4(t1, t2, t3, t4) Tuple4<t1&, t2&, t3&, t4&>
673 #define IPC_NAME_IN_0() MakeTuple()
674 #define IPC_NAME_IN_1(t1) MakeRefTuple(arg1)
675 #define IPC_NAME_IN_2(t1, t2) MakeRefTuple(arg1, arg2)
676 #define IPC_NAME_IN_3(t1, t2, t3) MakeRefTuple(arg1, arg2, arg3)
677 #define IPC_NAME_IN_4(t1, t2, t3, t4) MakeRefTuple(arg1, arg2, arg3, arg4)
678 #define IPC_NAME_IN_5(t1, t2, t3, t4, t5) MakeRefTuple(arg1, arg2, arg3, arg4, arg5)
679 #define IPC_NAME_IN_6(t1, t2, t3, t4, t5, t6) MakeRefTuple(arg1, arg2, arg3, arg4, arg5, arg6)
681 #define IPC_NAME_OUT_0() MakeTuple()
682 #define IPC_NAME_OUT_1(t1) MakeRefTuple(*arg7)
683 #define IPC_NAME_OUT_2(t1, t2) MakeRefTuple(*arg7, *arg8)
684 #define IPC_NAME_OUT_3(t1, t2, t3) MakeRefTuple(*arg7, *arg8, *arg9)
685 #define IPC_NAME_OUT_4(t1, t2, t3, t4) MakeRefTuple(*arg7, *arg8, *arg9, *arg10)
687 // There are places where the syntax requires a comma if there are input args,
688 // if there are input args and output args, or if there are input args or
689 // output args. These macros allow generation of the comma as needed; invoke
690 // by token pasting against the argument counts.
692 #define IPC_COMMA_1 ,
693 #define IPC_COMMA_2 ,
694 #define IPC_COMMA_3 ,
695 #define IPC_COMMA_4 ,
696 #define IPC_COMMA_5 ,
697 #define IPC_COMMA_6 ,
699 #define IPC_COMMA_AND_0(x)
700 #define IPC_COMMA_AND_1(x) x
701 #define IPC_COMMA_AND_2(x) x
702 #define IPC_COMMA_AND_3(x) x
703 #define IPC_COMMA_AND_4(x) x
704 #define IPC_COMMA_AND_5(x) x
705 #define IPC_COMMA_AND_6(x) x
707 #define IPC_COMMA_OR_0(x) x
708 #define IPC_COMMA_OR_1(x) ,
709 #define IPC_COMMA_OR_2(x) ,
710 #define IPC_COMMA_OR_3(x) ,
711 #define IPC_COMMA_OR_4(x) ,
712 #define IPC_COMMA_OR_5(x) ,
713 #define IPC_COMMA_OR_6(x) ,
716 // Note: we currently use __LINE__ to give unique IDs to messages within
717 // a file. They're globally unique since each file defines its own
718 // IPC_MESSAGE_START. Ideally, we wouldn't use line numbers (a possibility
719 // is to instead use the __COUNTER__ macro, but it needs gcc 4.3 and xcode
720 // doesn't use it yet).
721 #define IPC_MESSAGE_ID() ((IPC_MESSAGE_START << 16) + __LINE__)
722 #define IPC_MESSAGE_ID_CLASS(id) ((id) >> 16)
723 #define IPC_MESSAGE_ID_LINE(id) ((id) & 0xffff)
725 // Message crackers and handlers.
726 // Prefer to use the IPC_BEGIN_MESSAGE_MAP_EX to the older macros since they
727 // allow you to detect when a message could not be de-serialized. Usage:
729 // bool MyClass::OnMessageReceived(const IPC::Message& msg) {
730 // bool handled = true;
731 // bool msg_is_good = false;
732 // IPC_BEGIN_MESSAGE_MAP_EX(MyClass, msg, msg_is_good)
733 // IPC_MESSAGE_HANDLER(MsgClassOne, OnMsgClassOne)
734 // ...more handlers here ...
735 // IPC_MESSAGE_HANDLER(MsgClassTen, OnMsgClassTen)
736 // IPC_MESSAGE_UNHANDLED(handled = false)
737 // IPC_END_MESSAGE_MAP_EX()
738 // if (!msg_is_good) {
739 // // Signal error here or terminate offending process.
745 #define IPC_BEGIN_MESSAGE_MAP_EX(class_name, msg, msg_is_ok) \
747 typedef class_name _IpcMessageHandlerClass; \
748 const IPC::Message& ipc_message__ = msg; \
749 bool& msg_is_ok__ = msg_is_ok; \
750 switch (ipc_message__.type()) { \
752 #define IPC_BEGIN_MESSAGE_MAP(class_name, msg) \
754 typedef class_name _IpcMessageHandlerClass; \
755 const IPC::Message& ipc_message__ = msg; \
756 bool msg_is_ok__ = true; \
757 switch (ipc_message__.type()) { \
759 #define IPC_MESSAGE_FORWARD(msg_class, obj, member_func) \
760 case msg_class::ID: \
761 msg_is_ok__ = msg_class::Dispatch(&ipc_message__, obj, this, &member_func); \
764 #define IPC_MESSAGE_FORWARD_EX(msg_class, obj, sender, member_func) \
765 case msg_class::ID: \
766 msg_is_ok__ = msg_class::Dispatch(&ipc_message__, obj, sender, &member_func); \
769 #define IPC_MESSAGE_HANDLER(msg_class, member_func, sender) \
770 IPC_MESSAGE_FORWARD_EX(msg_class, this, sender, _IpcMessageHandlerClass::member_func)
772 #define IPC_MESSAGE_HANDLER_EX(msg_class, sender, member_func) \
773 IPC_MESSAGE_FORWARD_EX(msg_class, this, sender, _IpcMessageHandlerClass::member_func)
775 #define IPC_MESSAGE_FORWARD_DELAY_REPLY(msg_class, obj, member_func) \
776 case msg_class::ID: \
777 msg_is_ok__ = msg_class::DispatchDelayReply(&ipc_message__, obj, &member_func); \
780 #define IPC_MESSAGE_HANDLER_DELAY_REPLY(msg_class, member_func) \
781 IPC_MESSAGE_FORWARD_DELAY_REPLY(msg_class, this, \
782 _IpcMessageHandlerClass::member_func)
784 #define IPC_MESSAGE_HANDLER_GENERIC(msg_class, code) \
785 case msg_class::ID: \
789 #define IPC_REPLY_HANDLER(func) \
791 func(ipc_message__); \
795 #define IPC_MESSAGE_UNHANDLED(code) \
800 #define IPC_MESSAGE_UNHANDLED_ERROR() \
801 IPC_MESSAGE_UNHANDLED(NOTREACHED() << \
802 "Invalid message with type = " << \
803 ipc_message__.type())
805 #define IPC_END_MESSAGE_MAP() \
809 #define IPC_END_MESSAGE_MAP_EX() \
813 // This corresponds to an enum value from IPCMessageStart.
814 #define IPC_MESSAGE_CLASS(message) \
815 IPC_MESSAGE_ID_CLASS(message.type())
817 #endif // IPC_IPC_MESSAGE_MACROS_H_
819 // Clean up IPC_MESSAGE_START in this unguarded section so that the
820 // XXX_messages.h files need not do so themselves. This makes the
821 // XXX_messages.h files easier to write.
822 #undef IPC_MESSAGE_START