Chromium Code Reviews| 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 // (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 "base/profiler/scoped_profile.h" | 204 #include "base/profiler/scoped_profile.h" |
| 205 #include "base/tuple.h" | 205 #include "base/tuple.h" |
|
Tom Sepez
2016/03/07 19:05:02
ditto
do we still need base/tuple.h?
tzik
2016/03/08 03:32:59
Done.
| |
| 206 #include "ipc/export_template.h" | 206 #include "ipc/export_template.h" |
| 207 #include "ipc/ipc_message_templates.h" | 207 #include "ipc/ipc_message_templates.h" |
| 208 #include "ipc/ipc_message_utils.h" | 208 #include "ipc/ipc_message_utils.h" |
| 209 #include "ipc/param_traits_macros.h" | 209 #include "ipc/param_traits_macros.h" |
| 210 | 210 |
| 211 // Convenience macro for defining structs without inheritance. Should not need | 211 // Convenience macro for defining structs without inheritance. Should not need |
| 212 // to be subsequently redefined. | 212 // to be subsequently redefined. |
| 213 #define IPC_STRUCT_BEGIN(struct_name) \ | 213 #define IPC_STRUCT_BEGIN(struct_name) \ |
| 214 IPC_STRUCT_BEGIN_WITH_PARENT(struct_name, IPC::NoParams) | 214 IPC_STRUCT_BEGIN_WITH_PARENT(struct_name, IPC::NoParams) |
| 215 | 215 |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 241 // IPC_SYNC_MESSAGE_CONTROL(BarMsg, (int, int), (bool)) | 241 // IPC_SYNC_MESSAGE_CONTROL(BarMsg, (int, int), (bool)) |
| 242 // | 242 // |
| 243 // Implementation detail: The parentheses supplied by the caller for | 243 // Implementation detail: The parentheses supplied by the caller for |
| 244 // disambiguation are also used to trigger the IPC_TUPLE invocations below, | 244 // disambiguation are also used to trigger the IPC_TUPLE invocations below, |
| 245 // so "IPC_TUPLE in" and "IPC_TUPLE out" are intentional. | 245 // so "IPC_TUPLE in" and "IPC_TUPLE out" are intentional. |
| 246 #define IPC_SYNC_MESSAGE_CONTROL(msg_class, in, out) \ | 246 #define IPC_SYNC_MESSAGE_CONTROL(msg_class, in, out) \ |
| 247 IPC_MESSAGE_DECL(msg_class, CONTROL, IPC_TUPLE in, IPC_TUPLE out) | 247 IPC_MESSAGE_DECL(msg_class, CONTROL, IPC_TUPLE in, IPC_TUPLE out) |
| 248 #define IPC_SYNC_MESSAGE_ROUTED(msg_class, in, out) \ | 248 #define IPC_SYNC_MESSAGE_ROUTED(msg_class, in, out) \ |
| 249 IPC_MESSAGE_DECL(msg_class, ROUTED, IPC_TUPLE in, IPC_TUPLE out) | 249 IPC_MESSAGE_DECL(msg_class, ROUTED, IPC_TUPLE in, IPC_TUPLE out) |
| 250 | 250 |
| 251 #define IPC_TUPLE(...) base::Tuple<__VA_ARGS__> | 251 #define IPC_TUPLE(...) std::tuple<__VA_ARGS__> |
| 252 | 252 |
| 253 #define IPC_MESSAGE_DECL(msg_name, kind, in_tuple, out_tuple) \ | 253 #define IPC_MESSAGE_DECL(msg_name, kind, in_tuple, out_tuple) \ |
| 254 struct IPC_MESSAGE_EXPORT msg_name##_Meta { \ | 254 struct IPC_MESSAGE_EXPORT msg_name##_Meta { \ |
| 255 using InTuple = in_tuple; \ | 255 using InTuple = in_tuple; \ |
| 256 using OutTuple = out_tuple; \ | 256 using OutTuple = out_tuple; \ |
| 257 enum { ID = IPC_MESSAGE_ID() }; \ | 257 enum { ID = IPC_MESSAGE_ID() }; \ |
| 258 static const IPC::MessageKind kKind = IPC::MessageKind::kind; \ | 258 static const IPC::MessageKind kKind = IPC::MessageKind::kind; \ |
| 259 static const char kName[]; \ | 259 static const char kName[]; \ |
| 260 }; \ | 260 }; \ |
| 261 extern template class EXPORT_TEMPLATE_DECLARE(IPC_MESSAGE_EXPORT) \ | 261 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)) | 541 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) \ | 542 #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)) | 543 IPC_SYNC_MESSAGE_ROUTED(msg, (a, b, c, d, e), (f, g, h, i)) |
| 544 | 544 |
| 545 #endif // IPC_IPC_MESSAGE_MACROS_H_ | 545 #endif // IPC_IPC_MESSAGE_MACROS_H_ |
| 546 | 546 |
| 547 // Clean up IPC_MESSAGE_START in this unguarded section so that the | 547 // 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 | 548 // XXX_messages.h files need not do so themselves. This makes the |
| 549 // XXX_messages.h files easier to write. | 549 // XXX_messages.h files easier to write. |
| 550 #undef IPC_MESSAGE_START | 550 #undef IPC_MESSAGE_START |
| OLD | NEW |