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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 // | 123 // |
124 // New structs are defined with IPC_STRUCT_BEGIN(), IPC_STRUCT_MEMBER(), | 124 // New structs are defined with IPC_STRUCT_BEGIN(), IPC_STRUCT_MEMBER(), |
125 // IPC_STRUCT_END() family of macros. These cause the XXX_messages.h | 125 // IPC_STRUCT_END() family of macros. These cause the XXX_messages.h |
126 // to proclaim equivalent struct declarations for use by callers, as well | 126 // to proclaim equivalent struct declarations for use by callers, as well |
127 // as later registering the type with the message generation. Note that | 127 // as later registering the type with the message generation. Note that |
128 // IPC_STRUCT_MEMBER() is only permitted inside matching calls to | 128 // IPC_STRUCT_MEMBER() is only permitted inside matching calls to |
129 // IPC_STRUCT_BEGIN() / IPC_STRUCT_END(). | 129 // IPC_STRUCT_BEGIN() / IPC_STRUCT_END(). |
130 // | 130 // |
131 // Externally-defined structs are registered with IPC_STRUCT_TRAITS_BEGIN(), | 131 // Externally-defined structs are registered with IPC_STRUCT_TRAITS_BEGIN(), |
132 // IPC_STRUCT_TRAITS_MEMBER(), and IPC_STRUCT_TRAITS_END() macros. These | 132 // IPC_STRUCT_TRAITS_MEMBER(), and IPC_STRUCT_TRAITS_END() macros. These |
133 // cause registration of the types with message generation only. Note that | 133 // cause registration of the types with message generation only. |
134 // IPC_STRUCT_TRAITS_MEMBER() is only permitted inside matching calls | 134 // There's also IPC_STRUCT_TRAITS_PARENT, which is used to register a parent |
135 // to IPC_STRUCT_TRAITS_BEGIN() / IPC_STRUCT_TRAITS_END(). | 135 // class (whose own traits are already defined). Note that |
| 136 // IPC_STRUCT_TRAITS_MEMBER() and IPC_STRUCT_TRAITS_PARENT are only permitted |
| 137 // inside matching calls to IPC_STRUCT_TRAITS_BEGIN() / IPC_STRUCT_TRAITS_END(). |
136 // | 138 // |
137 // Enum types are registered with a single IPC_ENUM_TRAITS() macro. There | 139 // Enum types are registered with a single IPC_ENUM_TRAITS() macro. There |
138 // is no need to enumerate each value to the IPC mechanism. | 140 // is no need to enumerate each value to the IPC mechanism. |
139 // | 141 // |
140 // Once the types have been declared / registered, message definitions follow. | 142 // Once the types have been declared / registered, message definitions follow. |
141 // "Sync" messages are just synchronous calls, the Send() call doesn't return | 143 // "Sync" messages are just synchronous calls, the Send() call doesn't return |
142 // until a reply comes back. Input parameters are first (const TYPE&), and | 144 // until a reply comes back. Input parameters are first (const TYPE&), and |
143 // To declare a sync message, use the IPC_SYNC_ macros. The numbers at the | 145 // To declare a sync message, use the IPC_SYNC_ macros. The numbers at the |
144 // end show how many input/output parameters there are (i.e. 1_2 is 1 in, 2 | 146 // end show how many input/output parameters there are (i.e. 1_2 is 1 in, 2 |
145 // out). The caller does a Send([route id, ], in1, &out1, &out2). | 147 // out). The caller does a Send([route id, ], in1, &out1, &out2). |
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
754 #define IPC_MESSAGE_CLASS(message) \ | 756 #define IPC_MESSAGE_CLASS(message) \ |
755 message.type() >> 16 | 757 message.type() >> 16 |
756 | 758 |
757 #endif // IPC_IPC_MESSAGE_MACROS_H_ | 759 #endif // IPC_IPC_MESSAGE_MACROS_H_ |
758 | 760 |
759 // Clean up IPC_MESSAGE_START in this unguarded section so that the | 761 // Clean up IPC_MESSAGE_START in this unguarded section so that the |
760 // XXX_messages.h files need not do so themselves. This makes the | 762 // XXX_messages.h files need not do so themselves. This makes the |
761 // XXX_messages.h files easier to write. | 763 // XXX_messages.h files easier to write. |
762 #undef IPC_MESSAGE_START | 764 #undef IPC_MESSAGE_START |
763 | 765 |
OLD | NEW |