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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 // IPC_SYNC_MESSAGE_CONTROL(BarMsg, (int, int), (bool)) | 242 // IPC_SYNC_MESSAGE_CONTROL(BarMsg, (int, int), (bool)) |
243 // | 243 // |
244 // Implementation detail: The parentheses supplied by the caller for | 244 // Implementation detail: The parentheses supplied by the caller for |
245 // disambiguation are also used to trigger the IPC_TUPLE invocations below, | 245 // disambiguation are also used to trigger the IPC_TUPLE invocations below, |
246 // so "IPC_TUPLE in" and "IPC_TUPLE out" are intentional. | 246 // so "IPC_TUPLE in" and "IPC_TUPLE out" are intentional. |
247 #define IPC_SYNC_MESSAGE_CONTROL(msg_class, in, out) \ | 247 #define IPC_SYNC_MESSAGE_CONTROL(msg_class, in, out) \ |
248 IPC_MESSAGE_DECL(msg_class, CONTROL, IPC_TUPLE in, IPC_TUPLE out) | 248 IPC_MESSAGE_DECL(msg_class, CONTROL, IPC_TUPLE in, IPC_TUPLE out) |
249 #define IPC_SYNC_MESSAGE_ROUTED(msg_class, in, out) \ | 249 #define IPC_SYNC_MESSAGE_ROUTED(msg_class, in, out) \ |
250 IPC_MESSAGE_DECL(msg_class, ROUTED, IPC_TUPLE in, IPC_TUPLE out) | 250 IPC_MESSAGE_DECL(msg_class, ROUTED, IPC_TUPLE in, IPC_TUPLE out) |
251 | 251 |
252 #define IPC_TUPLE(...) std::tuple<__VA_ARGS__> | 252 #define IPC_TUPLE(...) IPC::CheckedTuple<__VA_ARGS__>::Tuple |
253 | 253 |
254 #define IPC_MESSAGE_DECL(msg_name, kind, in_tuple, out_tuple) \ | 254 #define IPC_MESSAGE_DECL(msg_name, kind, in_tuple, out_tuple) \ |
255 struct IPC_MESSAGE_EXPORT msg_name##_Meta { \ | 255 struct IPC_MESSAGE_EXPORT msg_name##_Meta { \ |
256 using InTuple = in_tuple; \ | 256 using InTuple = in_tuple; \ |
257 using OutTuple = out_tuple; \ | 257 using OutTuple = out_tuple; \ |
258 enum { ID = IPC_MESSAGE_ID() }; \ | 258 enum { ID = IPC_MESSAGE_ID() }; \ |
259 static const IPC::MessageKind kKind = IPC::MessageKind::kind; \ | 259 static const IPC::MessageKind kKind = IPC::MessageKind::kind; \ |
260 static const char kName[]; \ | 260 static const char kName[]; \ |
261 }; \ | 261 }; \ |
262 extern template class EXPORT_TEMPLATE_DECLARE(IPC_MESSAGE_EXPORT) \ | 262 extern template class EXPORT_TEMPLATE_DECLARE(IPC_MESSAGE_EXPORT) \ |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
542 IPC_SYNC_MESSAGE_ROUTED(msg, (a, b, c, d, e), (f, g, h)) | 542 IPC_SYNC_MESSAGE_ROUTED(msg, (a, b, c, d, e), (f, g, h)) |
543 #define IPC_SYNC_MESSAGE_ROUTED5_4(msg, a, b, c, d, e, f, g, h, i) \ | 543 #define IPC_SYNC_MESSAGE_ROUTED5_4(msg, a, b, c, d, e, f, g, h, i) \ |
544 IPC_SYNC_MESSAGE_ROUTED(msg, (a, b, c, d, e), (f, g, h, i)) | 544 IPC_SYNC_MESSAGE_ROUTED(msg, (a, b, c, d, e), (f, g, h, i)) |
545 | 545 |
546 #endif // IPC_IPC_MESSAGE_MACROS_H_ | 546 #endif // IPC_IPC_MESSAGE_MACROS_H_ |
547 | 547 |
548 // Clean up IPC_MESSAGE_START in this unguarded section so that the | 548 // Clean up IPC_MESSAGE_START in this unguarded section so that the |
549 // XXX_messages.h files need not do so themselves. This makes the | 549 // XXX_messages.h files need not do so themselves. This makes the |
550 // XXX_messages.h files easier to write. | 550 // XXX_messages.h files easier to write. |
551 #undef IPC_MESSAGE_START | 551 #undef IPC_MESSAGE_START |
OLD | NEW |