OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 #ifndef IPC_IPC_MESSAGE_MACROS_H_ | 176 #ifndef IPC_IPC_MESSAGE_MACROS_H_ |
177 #define IPC_IPC_MESSAGE_MACROS_H_ | 177 #define IPC_IPC_MESSAGE_MACROS_H_ |
178 | 178 |
179 #include "ipc/ipc_message_utils.h" | 179 #include "ipc/ipc_message_utils.h" |
180 #include "ipc/param_traits_macros.h" | 180 #include "ipc/param_traits_macros.h" |
181 | 181 |
182 #if defined(IPC_MESSAGE_IMPL) | 182 #if defined(IPC_MESSAGE_IMPL) |
183 #include "ipc/ipc_message_utils_impl.h" | 183 #include "ipc/ipc_message_utils_impl.h" |
184 #endif | 184 #endif |
185 | 185 |
| 186 // Override this to force message classes to be exported. |
| 187 #ifndef IPC_MESSAGE_EXPORT |
| 188 #define IPC_MESSAGE_EXPORT |
| 189 #endif |
| 190 |
186 // Macros for defining structs. May be subsequently redefined. | 191 // Macros for defining structs. May be subsequently redefined. |
187 #define IPC_STRUCT_BEGIN(struct_name) \ | 192 #define IPC_STRUCT_BEGIN(struct_name) \ |
188 struct struct_name; \ | 193 struct struct_name; \ |
189 IPC_STRUCT_TRAITS_BEGIN(struct_name) \ | 194 IPC_STRUCT_TRAITS_BEGIN(struct_name) \ |
190 IPC_STRUCT_TRAITS_END() \ | 195 IPC_STRUCT_TRAITS_END() \ |
191 struct struct_name : IPC::NoParams { \ | 196 struct IPC_MESSAGE_EXPORT struct_name : IPC::NoParams { \ |
192 struct_name(); \ | 197 struct_name(); \ |
193 ~struct_name(); | 198 ~struct_name(); |
194 #define IPC_STRUCT_MEMBER(type, name) type name; | 199 #define IPC_STRUCT_MEMBER(type, name) type name; |
195 #define IPC_STRUCT_END() }; | 200 #define IPC_STRUCT_END() }; |
196 | 201 |
197 // Override this to force message classes to be exported. | |
198 #ifndef IPC_MESSAGE_EXPORT | |
199 #define IPC_MESSAGE_EXPORT | |
200 #endif | |
201 | |
202 // Message macros collect specific numbers of arguments and funnel them into | 202 // Message macros collect specific numbers of arguments and funnel them into |
203 // the common message generation macro. These should never be redefined. | 203 // the common message generation macro. These should never be redefined. |
204 #define IPC_MESSAGE_CONTROL0(msg_class) \ | 204 #define IPC_MESSAGE_CONTROL0(msg_class) \ |
205 IPC_MESSAGE_DECL(EMPTY, CONTROL, msg_class, 0, 0, (), ()) | 205 IPC_MESSAGE_DECL(EMPTY, CONTROL, msg_class, 0, 0, (), ()) |
206 | 206 |
207 #define IPC_MESSAGE_CONTROL1(msg_class, type1) \ | 207 #define IPC_MESSAGE_CONTROL1(msg_class, type1) \ |
208 IPC_MESSAGE_DECL(ASYNC, CONTROL, msg_class, 1, 0, (type1), ()) | 208 IPC_MESSAGE_DECL(ASYNC, CONTROL, msg_class, 1, 0, (type1), ()) |
209 | 209 |
210 #define IPC_MESSAGE_CONTROL2(msg_class, type1, type2) \ | 210 #define IPC_MESSAGE_CONTROL2(msg_class, type1, type2) \ |
211 IPC_MESSAGE_DECL(ASYNC, CONTROL, msg_class, 2, 0, (type1, type2), ()) | 211 IPC_MESSAGE_DECL(ASYNC, CONTROL, msg_class, 2, 0, (type1, type2), ()) |
(...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
985 // This corresponds to an enum value from IPCMessageStart. | 985 // This corresponds to an enum value from IPCMessageStart. |
986 #define IPC_MESSAGE_CLASS(message) \ | 986 #define IPC_MESSAGE_CLASS(message) \ |
987 IPC_MESSAGE_ID_CLASS(message.type()) | 987 IPC_MESSAGE_ID_CLASS(message.type()) |
988 | 988 |
989 #endif // IPC_IPC_MESSAGE_MACROS_H_ | 989 #endif // IPC_IPC_MESSAGE_MACROS_H_ |
990 | 990 |
991 // Clean up IPC_MESSAGE_START in this unguarded section so that the | 991 // Clean up IPC_MESSAGE_START in this unguarded section so that the |
992 // XXX_messages.h files need not do so themselves. This makes the | 992 // XXX_messages.h files need not do so themselves. This makes the |
993 // XXX_messages.h files easier to write. | 993 // XXX_messages.h files easier to write. |
994 #undef IPC_MESSAGE_START | 994 #undef IPC_MESSAGE_START |
OLD | NEW |