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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 // after including this header, but before using any of the macros below. | 194 // after including this header, but before using any of the macros below. |
195 // (This needs to be before the include guard.) | 195 // (This needs to be before the include guard.) |
196 #undef IPC_MESSAGE_EXPORT | 196 #undef IPC_MESSAGE_EXPORT |
197 #define IPC_MESSAGE_EXPORT | 197 #define IPC_MESSAGE_EXPORT |
198 | 198 |
199 #ifndef IPC_IPC_MESSAGE_MACROS_H_ | 199 #ifndef IPC_IPC_MESSAGE_MACROS_H_ |
200 #define IPC_IPC_MESSAGE_MACROS_H_ | 200 #define IPC_IPC_MESSAGE_MACROS_H_ |
201 | 201 |
202 #include <stdint.h> | 202 #include <stdint.h> |
203 | 203 |
| 204 #include <tuple> |
| 205 |
204 #include "base/profiler/scoped_profile.h" | 206 #include "base/profiler/scoped_profile.h" |
205 #include "base/tuple.h" | |
206 #include "ipc/export_template.h" | 207 #include "ipc/export_template.h" |
207 #include "ipc/ipc_message_templates.h" | 208 #include "ipc/ipc_message_templates.h" |
208 #include "ipc/ipc_message_utils.h" | 209 #include "ipc/ipc_message_utils.h" |
209 #include "ipc/param_traits_macros.h" | 210 #include "ipc/param_traits_macros.h" |
210 | 211 |
211 // Convenience macro for defining structs without inheritance. Should not need | 212 // Convenience macro for defining structs without inheritance. Should not need |
212 // to be subsequently redefined. | 213 // to be subsequently redefined. |
213 #define IPC_STRUCT_BEGIN(struct_name) \ | 214 #define IPC_STRUCT_BEGIN(struct_name) \ |
214 IPC_STRUCT_BEGIN_WITH_PARENT(struct_name, IPC::NoParams) | 215 IPC_STRUCT_BEGIN_WITH_PARENT(struct_name, IPC::NoParams) |
215 | 216 |
(...skipping 25 matching lines...) Expand all Loading... |
241 // IPC_SYNC_MESSAGE_CONTROL(BarMsg, (int, int), (bool)) | 242 // IPC_SYNC_MESSAGE_CONTROL(BarMsg, (int, int), (bool)) |
242 // | 243 // |
243 // Implementation detail: The parentheses supplied by the caller for | 244 // Implementation detail: The parentheses supplied by the caller for |
244 // disambiguation are also used to trigger the IPC_TUPLE invocations below, | 245 // disambiguation are also used to trigger the IPC_TUPLE invocations below, |
245 // so "IPC_TUPLE in" and "IPC_TUPLE out" are intentional. | 246 // so "IPC_TUPLE in" and "IPC_TUPLE out" are intentional. |
246 #define IPC_SYNC_MESSAGE_CONTROL(msg_class, in, out) \ | 247 #define IPC_SYNC_MESSAGE_CONTROL(msg_class, in, out) \ |
247 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) |
248 #define IPC_SYNC_MESSAGE_ROUTED(msg_class, in, out) \ | 249 #define IPC_SYNC_MESSAGE_ROUTED(msg_class, in, out) \ |
249 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) |
250 | 251 |
251 #define IPC_TUPLE(...) base::Tuple<__VA_ARGS__> | 252 #define IPC_TUPLE(...) std::tuple<__VA_ARGS__> |
252 | 253 |
253 #define IPC_MESSAGE_DECL(msg_name, kind, in_tuple, out_tuple) \ | 254 #define IPC_MESSAGE_DECL(msg_name, kind, in_tuple, out_tuple) \ |
254 struct IPC_MESSAGE_EXPORT msg_name##_Meta { \ | 255 struct IPC_MESSAGE_EXPORT msg_name##_Meta { \ |
255 using InTuple = in_tuple; \ | 256 using InTuple = in_tuple; \ |
256 using OutTuple = out_tuple; \ | 257 using OutTuple = out_tuple; \ |
257 enum { ID = IPC_MESSAGE_ID() }; \ | 258 enum { ID = IPC_MESSAGE_ID() }; \ |
258 static const IPC::MessageKind kKind = IPC::MessageKind::kind; \ | 259 static const IPC::MessageKind kKind = IPC::MessageKind::kind; \ |
259 static const char kName[]; \ | 260 static const char kName[]; \ |
260 }; \ | 261 }; \ |
261 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... |
541 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)) |
542 #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) \ |
543 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)) |
544 | 545 |
545 #endif // IPC_IPC_MESSAGE_MACROS_H_ | 546 #endif // IPC_IPC_MESSAGE_MACROS_H_ |
546 | 547 |
547 // 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 |
548 // 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 |
549 // XXX_messages.h files easier to write. | 550 // XXX_messages.h files easier to write. |
550 #undef IPC_MESSAGE_START | 551 #undef IPC_MESSAGE_START |
OLD | NEW |