OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Defining IPC Messages | 5 // Defining IPC Messages |
6 // | 6 // |
7 // Your IPC messages will be defined by macros inside of an XXX_messages.h | 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 | 8 // header file. Most of the time, the system can automatically generate all |
9 // of messaging mechanism from these definitions, but sometimes some manual | 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 | 10 // coding is required. In these cases, you will also have an XXX_messages.cc |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 // Macros for defining structs. May be subsequently redefined. | 195 // Macros for defining structs. May be subsequently redefined. |
196 #define IPC_STRUCT_BEGIN(struct_name) \ | 196 #define IPC_STRUCT_BEGIN(struct_name) \ |
197 IPC_STRUCT_BEGIN_WITH_PARENT(struct_name, IPC::NoParams) | 197 IPC_STRUCT_BEGIN_WITH_PARENT(struct_name, IPC::NoParams) |
198 #define IPC_STRUCT_BEGIN_WITH_PARENT(struct_name, parent) \ | 198 #define IPC_STRUCT_BEGIN_WITH_PARENT(struct_name, parent) \ |
199 struct struct_name; \ | 199 struct struct_name; \ |
200 IPC_STRUCT_TRAITS_BEGIN(struct_name) \ | 200 IPC_STRUCT_TRAITS_BEGIN(struct_name) \ |
201 IPC_STRUCT_TRAITS_END() \ | 201 IPC_STRUCT_TRAITS_END() \ |
202 struct IPC_MESSAGE_EXPORT struct_name : parent { \ | 202 struct IPC_MESSAGE_EXPORT struct_name : parent { \ |
203 struct_name(); \ | 203 struct_name(); \ |
204 ~struct_name(); | 204 ~struct_name(); |
205 #define IPC_STRUCT_MEMBER(type, name) type name; | 205 // Optional variadic parameters specify the default value for this struct |
| 206 // member. They are passed through to the constructor for |type|. |
| 207 #define IPC_STRUCT_MEMBER(type, name, ...) type name; |
206 #define IPC_STRUCT_END() }; | 208 #define IPC_STRUCT_END() }; |
207 | 209 |
208 // Message macros collect specific numbers of arguments and funnel them into | 210 // Message macros collect specific numbers of arguments and funnel them into |
209 // the common message generation macro. These should never be redefined. | 211 // the common message generation macro. These should never be redefined. |
210 #define IPC_MESSAGE_CONTROL0(msg_class) \ | 212 #define IPC_MESSAGE_CONTROL0(msg_class) \ |
211 IPC_MESSAGE_DECL(EMPTY, CONTROL, msg_class, 0, 0, (), ()) | 213 IPC_MESSAGE_DECL(EMPTY, CONTROL, msg_class, 0, 0, (), ()) |
212 | 214 |
213 #define IPC_MESSAGE_CONTROL1(msg_class, type1) \ | 215 #define IPC_MESSAGE_CONTROL1(msg_class, type1) \ |
214 IPC_MESSAGE_DECL(ASYNC, CONTROL, msg_class, 1, 0, (type1), ()) | 216 IPC_MESSAGE_DECL(ASYNC, CONTROL, msg_class, 1, 0, (type1), ()) |
215 | 217 |
(...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1008 // This corresponds to an enum value from IPCMessageStart. | 1010 // This corresponds to an enum value from IPCMessageStart. |
1009 #define IPC_MESSAGE_CLASS(message) \ | 1011 #define IPC_MESSAGE_CLASS(message) \ |
1010 IPC_MESSAGE_ID_CLASS(message.type()) | 1012 IPC_MESSAGE_ID_CLASS(message.type()) |
1011 | 1013 |
1012 #endif // IPC_IPC_MESSAGE_MACROS_H_ | 1014 #endif // IPC_IPC_MESSAGE_MACROS_H_ |
1013 | 1015 |
1014 // Clean up IPC_MESSAGE_START in this unguarded section so that the | 1016 // Clean up IPC_MESSAGE_START in this unguarded section so that the |
1015 // XXX_messages.h files need not do so themselves. This makes the | 1017 // XXX_messages.h files need not do so themselves. This makes the |
1016 // XXX_messages.h files easier to write. | 1018 // XXX_messages.h files easier to write. |
1017 #undef IPC_MESSAGE_START | 1019 #undef IPC_MESSAGE_START |
OLD | NEW |