| 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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 // as later registering the type with the message generation. Note that | 131 // as later registering the type with the message generation. Note that |
| 132 // IPC_STRUCT_MEMBER() is only permitted inside matching calls to | 132 // IPC_STRUCT_MEMBER() is only permitted inside matching calls to |
| 133 // IPC_STRUCT_BEGIN() / IPC_STRUCT_END(). | 133 // IPC_STRUCT_BEGIN() / IPC_STRUCT_END(). |
| 134 // | 134 // |
| 135 // Externally-defined structs are registered with IPC_STRUCT_TRAITS_BEGIN(), | 135 // Externally-defined structs are registered with IPC_STRUCT_TRAITS_BEGIN(), |
| 136 // IPC_STRUCT_TRAITS_MEMBER(), and IPC_STRUCT_TRAITS_END() macros. These | 136 // IPC_STRUCT_TRAITS_MEMBER(), and IPC_STRUCT_TRAITS_END() macros. These |
| 137 // cause registration of the types with message generation only. | 137 // cause registration of the types with message generation only. |
| 138 // There's also IPC_STRUCT_TRAITS_PARENT, which is used to register a parent | 138 // There's also IPC_STRUCT_TRAITS_PARENT, which is used to register a parent |
| 139 // class (whose own traits are already defined). Note that | 139 // class (whose own traits are already defined). Note that |
| 140 // IPC_STRUCT_TRAITS_MEMBER() and IPC_STRUCT_TRAITS_PARENT are only permitted | 140 // IPC_STRUCT_TRAITS_MEMBER() and IPC_STRUCT_TRAITS_PARENT are only permitted |
| 141 // inside matching calls to IPC_STRUCT_TRAITS_BEGIN() / IPC_STRUCT_TRAITS_END(). | 141 // inside matching calls to IPC_STRUCT_TRAITS_BEGIN() / |
| 142 // IPC_STRUCT_TRAITS_END(). |
| 142 // | 143 // |
| 143 // Enum types are registered with a single IPC_ENUM_TRAITS() macro. There | 144 // Enum types are registered with a single IPC_ENUM_TRAITS() macro. There |
| 144 // is no need to enumerate each value to the IPC mechanism. | 145 // is no need to enumerate each value to the IPC mechanism. |
| 145 // | 146 // |
| 147 // Do not place semicolons following these IPC_ macro invocations. There |
| 148 // is no reason to expect that their expansion corresponds one-to-one with |
| 149 // C++ statements. |
| 150 // |
| 146 // Once the types have been declared / registered, message definitions follow. | 151 // Once the types have been declared / registered, message definitions follow. |
| 147 // "Sync" messages are just synchronous calls, the Send() call doesn't return | 152 // "Sync" messages are just synchronous calls, the Send() call doesn't return |
| 148 // until a reply comes back. Input parameters are first (const TYPE&), and | 153 // until a reply comes back. Input parameters are first (const TYPE&), and |
| 149 // To declare a sync message, use the IPC_SYNC_ macros. The numbers at the | 154 // To declare a sync message, use the IPC_SYNC_ macros. The numbers at the |
| 150 // end show how many input/output parameters there are (i.e. 1_2 is 1 in, 2 | 155 // end show how many input/output parameters there are (i.e. 1_2 is 1 in, 2 |
| 151 // out). The caller does a Send([route id, ], in1, &out1, &out2). | 156 // out). The caller does a Send([route id, ], in1, &out1, &out2). |
| 152 // The receiver's handler function will be | 157 // The receiver's handler function will be |
| 153 // void OnSyncMessageName(const type1& in1, type2* out1, type3* out2) | 158 // void OnSyncMessageName(const type1& in1, type2* out1, type3* out2) |
| 154 // | 159 // |
| 155 // A caller can also send a synchronous message, while the receiver can respond | 160 // A caller can also send a synchronous message, while the receiver can respond |
| (...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 766 #define IPC_MESSAGE_CLASS(message) \ | 771 #define IPC_MESSAGE_CLASS(message) \ |
| 767 IPC_MESSAGE_ID_CLASS(message.type()) | 772 IPC_MESSAGE_ID_CLASS(message.type()) |
| 768 | 773 |
| 769 #endif // IPC_IPC_MESSAGE_MACROS_H_ | 774 #endif // IPC_IPC_MESSAGE_MACROS_H_ |
| 770 | 775 |
| 771 // Clean up IPC_MESSAGE_START in this unguarded section so that the | 776 // Clean up IPC_MESSAGE_START in this unguarded section so that the |
| 772 // XXX_messages.h files need not do so themselves. This makes the | 777 // XXX_messages.h files need not do so themselves. This makes the |
| 773 // XXX_messages.h files easier to write. | 778 // XXX_messages.h files easier to write. |
| 774 #undef IPC_MESSAGE_START | 779 #undef IPC_MESSAGE_START |
| 775 | 780 |
| OLD | NEW |