OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 // This header is meant to be included in multiple passes, hence no traditional | 5 // This header is meant to be included in multiple passes, hence no traditional |
6 // header guard. | 6 // header guard. |
7 // | 7 // |
8 // In your XXX_messages_internal.h file, before defining any messages do: | 8 // In your XXX_messages_internal.h file, before defining any messages do: |
9 // #define IPC_MESSAGE_START XMsgStart | 9 // #define IPC_MESSAGE_START XMsgStart |
10 // XMstStart value is from the IPCMessageStart enum in ipc_message_utils.h, and | 10 // XMstStart value is from the IPCMessageStart enum in ipc_message_utils.h, and |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 #define IPC_SYNC_MESSAGE_ROUTED5_4_EXTRA(msg_class, type1_in, type2_in, type3_in
, type4_in, type5_in, type1_out, type2_out, type4_out) | 353 #define IPC_SYNC_MESSAGE_ROUTED5_4_EXTRA(msg_class, type1_in, type2_in, type3_in
, type4_in, type5_in, type1_out, type2_out, type4_out) |
354 | 354 |
355 #endif | 355 #endif |
356 | 356 |
357 // Note: we currently use __LINE__ to give unique IDs to messages within a file. | 357 // Note: we currently use __LINE__ to give unique IDs to messages within a file. |
358 // They're globally unique since each file defines its own IPC_MESSAGE_START. | 358 // They're globally unique since each file defines its own IPC_MESSAGE_START. |
359 // Ideally, we wouldn't use line numbers, but instead use the __COUNTER__ macro, | 359 // Ideally, we wouldn't use line numbers, but instead use the __COUNTER__ macro, |
360 // but it needs gcc 4.3 and xcode doesn't use it yet. When that happens, switch | 360 // but it needs gcc 4.3 and xcode doesn't use it yet. When that happens, switch |
361 // to it. | 361 // to it. |
362 | 362 |
| 363 #define IPC_STRUCT_FIRST(type, name, init) \ |
| 364 struct IPC_STRUCT_NAME { IPC_STRUCT_NAME (); ~IPC_STRUCT_NAME (); \ |
| 365 IPC_STRUCT_MEMBER(type, name) |
| 366 #define IPC_STRUCT_NEXT(type, name, init) \ |
| 367 IPC_STRUCT_MEMBER(type, name) |
| 368 #define IPC_STRUCT_LAST(type, name, init) \ |
| 369 IPC_STRUCT_MEMBER(type, name) \ |
| 370 }; \ |
| 371 namespace IPC { \ |
| 372 template <> \ |
| 373 struct ParamTraits<IPC_STRUCT_NAME> { \ |
| 374 typedef IPC_STRUCT_NAME param_type; \ |
| 375 static void Write(Message* m, const param_type& p); \ |
| 376 static bool Read(const Message* m, void** iter, param_type* p); \ |
| 377 static void Log(const param_type& p, std::string* l); \ |
| 378 }; \ |
| 379 } |
| 380 #define IPC_STRUCT_MEMBER(type, name) type name; |
| 381 |
363 #define IPC_MESSAGE_CONTROL0(msg_class) \ | 382 #define IPC_MESSAGE_CONTROL0(msg_class) \ |
364 class msg_class : public IPC::Message { \ | 383 class msg_class : public IPC::Message { \ |
365 public: \ | 384 public: \ |
366 enum { ID = (IPC_MESSAGE_START << 16) + __LINE__ }; \ | 385 enum { ID = (IPC_MESSAGE_START << 16) + __LINE__ }; \ |
367 msg_class() \ | 386 msg_class() \ |
368 : IPC::Message(MSG_ROUTING_CONTROL, \ | 387 : IPC::Message(MSG_ROUTING_CONTROL, \ |
369 ID, \ | 388 ID, \ |
370 PRIORITY_NORMAL) {} \ | 389 PRIORITY_NORMAL) {} \ |
371 }; \ | 390 }; \ |
372 IPC_MESSAGE_CONTROL0_EXTRA(msg_class) | 391 IPC_MESSAGE_CONTROL0_EXTRA(msg_class) |
(...skipping 863 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1236 } \ | 1255 } \ |
1237 } | 1256 } |
1238 | 1257 |
1239 #define IPC_END_MESSAGE_MAP_EX() \ | 1258 #define IPC_END_MESSAGE_MAP_EX() \ |
1240 } \ | 1259 } \ |
1241 } | 1260 } |
1242 | 1261 |
1243 // This corresponds to an enum value from IPCMessageStart. | 1262 // This corresponds to an enum value from IPCMessageStart. |
1244 #define IPC_MESSAGE_CLASS(message) \ | 1263 #define IPC_MESSAGE_CLASS(message) \ |
1245 message.type() >> 16 | 1264 message.type() >> 16 |
OLD | NEW |