OLD | NEW |
| (Empty) |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 // The file ipc_messsage_macros.h defines the classes for individual | |
6 // messages. This file works similarly, except that it defines the | |
7 // implementations of the constructors and the logging methods. (These only | |
8 // have to be generated once). It is meant to be included in a XXX_messages.cc | |
9 // file. | |
10 // | |
11 // Unlike ipc_message_macros.h, this file is only included once; it uses one | |
12 // pass. But we *still* can't use normal include guards because we still need | |
13 // to use the MESSAGES_INTERNAL_FILE dispatch system. Because that #define is | |
14 // unset, we use the different name MESSAGES_INTERNAL_IMPL_FILE to tell this | |
15 // file what to do. | |
16 #ifndef IPC_IPC_MESSAGE_IMPL_MACROS_H_ | |
17 #define IPC_IPC_MESSAGE_IMPL_MACROS_H_ | |
18 | |
19 #include "ipc/ipc_message_utils.h" | |
20 #include "ipc/ipc_message_utils_impl.h" | |
21 | |
22 #ifndef MESSAGES_INTERNAL_IMPL_FILE | |
23 #error This file should only be included by X_messages.cc, which needs to define
MESSAGES_INTERNAL_IMPL_FILE first. | |
24 #endif | |
25 | |
26 // Trick scons and xcode into seeing the possible real dependencies since they | |
27 // don't understand #include MESSAGES_INTERNAL_FILE. See http://crbug.com/7828 | |
28 #if 0 | |
29 #include "ipc/ipc_sync_message_unittest.h" | |
30 #include "chrome/common/plugin_messages_internal.h" | |
31 #include "chrome/common/render_messages_internal.h" | |
32 #include "chrome/common/devtools_messages_internal.h" | |
33 #include "chrome/test/automation/automation_messages_internal.h" | |
34 #include "chrome/common/worker_messages_internal.h" | |
35 #endif | |
36 | |
37 // These are probalby still defined because of ipc_message_macros.h should be | |
38 // included before us for the class/method declarations. | |
39 #undef IPC_BEGIN_MESSAGES | |
40 #undef IPC_END_MESSAGES | |
41 #undef IPC_MESSAGE_CONTROL0 | |
42 #undef IPC_MESSAGE_CONTROL1 | |
43 #undef IPC_MESSAGE_CONTROL2 | |
44 #undef IPC_MESSAGE_CONTROL3 | |
45 #undef IPC_MESSAGE_CONTROL4 | |
46 #undef IPC_MESSAGE_CONTROL5 | |
47 #undef IPC_MESSAGE_ROUTED0 | |
48 #undef IPC_MESSAGE_ROUTED1 | |
49 #undef IPC_MESSAGE_ROUTED2 | |
50 #undef IPC_MESSAGE_ROUTED3 | |
51 #undef IPC_MESSAGE_ROUTED4 | |
52 #undef IPC_MESSAGE_ROUTED5 | |
53 #undef IPC_SYNC_MESSAGE_CONTROL0_0 | |
54 #undef IPC_SYNC_MESSAGE_CONTROL0_1 | |
55 #undef IPC_SYNC_MESSAGE_CONTROL0_2 | |
56 #undef IPC_SYNC_MESSAGE_CONTROL0_3 | |
57 #undef IPC_SYNC_MESSAGE_CONTROL1_0 | |
58 #undef IPC_SYNC_MESSAGE_CONTROL1_1 | |
59 #undef IPC_SYNC_MESSAGE_CONTROL1_2 | |
60 #undef IPC_SYNC_MESSAGE_CONTROL1_3 | |
61 #undef IPC_SYNC_MESSAGE_CONTROL2_0 | |
62 #undef IPC_SYNC_MESSAGE_CONTROL2_1 | |
63 #undef IPC_SYNC_MESSAGE_CONTROL2_2 | |
64 #undef IPC_SYNC_MESSAGE_CONTROL2_3 | |
65 #undef IPC_SYNC_MESSAGE_CONTROL3_1 | |
66 #undef IPC_SYNC_MESSAGE_CONTROL3_2 | |
67 #undef IPC_SYNC_MESSAGE_CONTROL3_3 | |
68 #undef IPC_SYNC_MESSAGE_CONTROL4_1 | |
69 #undef IPC_SYNC_MESSAGE_CONTROL4_2 | |
70 #undef IPC_SYNC_MESSAGE_ROUTED0_0 | |
71 #undef IPC_SYNC_MESSAGE_ROUTED0_1 | |
72 #undef IPC_SYNC_MESSAGE_ROUTED0_2 | |
73 #undef IPC_SYNC_MESSAGE_ROUTED0_3 | |
74 #undef IPC_SYNC_MESSAGE_ROUTED1_0 | |
75 #undef IPC_SYNC_MESSAGE_ROUTED1_1 | |
76 #undef IPC_SYNC_MESSAGE_ROUTED1_2 | |
77 #undef IPC_SYNC_MESSAGE_ROUTED1_3 | |
78 #undef IPC_SYNC_MESSAGE_ROUTED1_4 | |
79 #undef IPC_SYNC_MESSAGE_ROUTED2_0 | |
80 #undef IPC_SYNC_MESSAGE_ROUTED2_1 | |
81 #undef IPC_SYNC_MESSAGE_ROUTED2_2 | |
82 #undef IPC_SYNC_MESSAGE_ROUTED2_3 | |
83 #undef IPC_SYNC_MESSAGE_ROUTED3_0 | |
84 #undef IPC_SYNC_MESSAGE_ROUTED3_1 | |
85 #undef IPC_SYNC_MESSAGE_ROUTED3_2 | |
86 #undef IPC_SYNC_MESSAGE_ROUTED3_3 | |
87 #undef IPC_SYNC_MESSAGE_ROUTED4_0 | |
88 #undef IPC_SYNC_MESSAGE_ROUTED4_1 | |
89 #undef IPC_SYNC_MESSAGE_ROUTED4_2 | |
90 #undef IPC_SYNC_MESSAGE_ROUTED4_3 | |
91 #undef IPC_SYNC_MESSAGE_ROUTED5_0 | |
92 #undef IPC_SYNC_MESSAGE_ROUTED5_1 | |
93 #undef IPC_SYNC_MESSAGE_ROUTED5_2 | |
94 #undef IPC_SYNC_MESSAGE_ROUTED5_3 | |
95 | |
96 // These don't do anything during this pass. | |
97 #define IPC_BEGIN_MESSAGES(label) | |
98 #define IPC_END_MESSAGES(label) | |
99 | |
100 // This derives from IPC::Message and thus doesn't need us to keep the | |
101 // implementations in this impl file. | |
102 #define IPC_MESSAGE_CONTROL0(msg_class) | |
103 | |
104 #define IPC_MESSAGE_CONTROL1(msg_class, type1) \ | |
105 msg_class::msg_class(const type1& arg1) \ | |
106 : IPC::MessageWithTuple< Tuple1<type1> >( \ | |
107 MSG_ROUTING_CONTROL, ID, MakeRefTuple(arg1)) {} \ | |
108 \ | |
109 msg_class::~msg_class() {} \ | |
110 \ | |
111 void msg_class::Log(const Message* msg, std::wstring* l) { \ | |
112 Param p; \ | |
113 if (Read(msg, &p)) \ | |
114 IPC::LogParam(p, l); \ | |
115 } | |
116 | |
117 #define IPC_MESSAGE_CONTROL2(msg_class, type1, type2) \ | |
118 msg_class::msg_class(const type1& arg1, const type2& arg2) \ | |
119 : IPC::MessageWithTuple< Tuple2<type1, type2> >( \ | |
120 MSG_ROUTING_CONTROL, ID, MakeRefTuple(arg1, arg2)) {} \ | |
121 \ | |
122 msg_class::~msg_class() {} \ | |
123 \ | |
124 void msg_class::Log(const Message* msg, std::wstring* l) { \ | |
125 Param p; \ | |
126 if (Read(msg, &p)) \ | |
127 IPC::LogParam(p, l); \ | |
128 } | |
129 | |
130 #define IPC_MESSAGE_CONTROL3(msg_class, type1, type2, type3) \ | |
131 msg_class::msg_class(const type1& arg1, const type2& arg2, \ | |
132 const type3& arg3) \ | |
133 : IPC::MessageWithTuple< Tuple3<type1, type2, type3> >( \ | |
134 MSG_ROUTING_CONTROL, ID, MakeRefTuple(arg1, arg2, arg3)) {} \ | |
135 \ | |
136 msg_class::~msg_class() {} \ | |
137 \ | |
138 void msg_class::Log(const Message* msg, std::wstring* l) { \ | |
139 Param p; \ | |
140 if (Read(msg, &p)) \ | |
141 IPC::LogParam(p, l); \ | |
142 } | |
143 | |
144 #define IPC_MESSAGE_CONTROL4(msg_class, type1, type2, type3, type4) \ | |
145 msg_class::msg_class(const type1& arg1, const type2& arg2, \ | |
146 const type3& arg3, const type4& arg4) \ | |
147 : IPC::MessageWithTuple< Tuple4<type1, type2, type3, type4> >( \ | |
148 MSG_ROUTING_CONTROL, ID, MakeRefTuple(arg1, arg2, arg3, arg4)) {} \ | |
149 \ | |
150 msg_class::~msg_class() {} \ | |
151 \ | |
152 void msg_class::Log(const Message* msg, std::wstring* l) { \ | |
153 Param p; \ | |
154 if (Read(msg, &p)) \ | |
155 IPC::LogParam(p, l); \ | |
156 } | |
157 | |
158 #define IPC_MESSAGE_CONTROL5(msg_class, type1, type2, type3, type4, type5) \ | |
159 msg_class::msg_class(const type1& arg1, const type2& arg2, \ | |
160 const type3& arg3, const type4& arg4, \ | |
161 const type5& arg5) \ | |
162 : IPC::MessageWithTuple< Tuple5<type1, type2, type3, type4, type5> >( \ | |
163 MSG_ROUTING_CONTROL, ID, \ | |
164 MakeRefTuple(arg1, arg2, arg3, arg4, arg5)) {} \ | |
165 \ | |
166 msg_class::~msg_class() {} \ | |
167 \ | |
168 void msg_class::Log(const Message* msg, std::wstring* l) { \ | |
169 Param p; \ | |
170 if (Read(msg, &p)) \ | |
171 IPC::LogParam(p, l); \ | |
172 } | |
173 | |
174 // This derives from IPC::Message and thus doesn't need us to keep the | |
175 // implementations in this impl file. | |
176 #define IPC_MESSAGE_ROUTED0(msg_class) | |
177 | |
178 #define IPC_MESSAGE_ROUTED1(msg_class, type1) \ | |
179 msg_class::msg_class(int32 routing_id, const type1& arg1) \ | |
180 : IPC::MessageWithTuple< Tuple1<type1> >( \ | |
181 routing_id, ID, MakeRefTuple(arg1)) {} \ | |
182 \ | |
183 msg_class::~msg_class() {} \ | |
184 \ | |
185 void msg_class::Log(const Message* msg, std::wstring* l) { \ | |
186 Param p; \ | |
187 if (Read(msg, &p)) \ | |
188 IPC::LogParam(p, l); \ | |
189 } | |
190 | |
191 #define IPC_MESSAGE_ROUTED2(msg_class, type1, type2) \ | |
192 msg_class::msg_class(int32 routing_id, const type1& arg1, const type2& arg2) \ | |
193 : IPC::MessageWithTuple< Tuple2<type1, type2> >( \ | |
194 routing_id, ID, MakeRefTuple(arg1, arg2)) {} \ | |
195 \ | |
196 msg_class::~msg_class() {} \ | |
197 \ | |
198 void msg_class::Log(const Message* msg, std::wstring* l) { \ | |
199 Param p; \ | |
200 if (Read(msg, &p)) \ | |
201 IPC::LogParam(p, l); \ | |
202 } | |
203 | |
204 | |
205 #define IPC_MESSAGE_ROUTED3(msg_class, type1, type2, type3) \ | |
206 msg_class::msg_class(int32 routing_id, const type1& arg1, \ | |
207 const type2& arg2, const type3& arg3) \ | |
208 : IPC::MessageWithTuple< Tuple3<type1, type2, type3> >( \ | |
209 routing_id, ID, MakeRefTuple(arg1, arg2, arg3)) {} \ | |
210 \ | |
211 msg_class::~msg_class() {} \ | |
212 \ | |
213 void msg_class::Log(const Message* msg, std::wstring* l) { \ | |
214 Param p; \ | |
215 if (Read(msg, &p)) \ | |
216 IPC::LogParam(p, l); \ | |
217 } | |
218 | |
219 #define IPC_MESSAGE_ROUTED4(msg_class, type1, type2, type3, type4) \ | |
220 msg_class::msg_class(int32 routing_id, const type1& arg1, const type2& arg2, \ | |
221 const type3& arg3, const type4& arg4) \ | |
222 : IPC::MessageWithTuple< Tuple4<type1, type2, type3, type4> >( \ | |
223 routing_id, ID, MakeRefTuple(arg1, arg2, arg3, arg4)) {} \ | |
224 \ | |
225 msg_class::~msg_class() {} \ | |
226 \ | |
227 void msg_class::Log(const Message* msg, std::wstring* l) { \ | |
228 Param p; \ | |
229 if (Read(msg, &p)) \ | |
230 IPC::LogParam(p, l); \ | |
231 } | |
232 | |
233 #define IPC_MESSAGE_ROUTED5(msg_class, type1, type2, type3, type4, type5) \ | |
234 msg_class::msg_class(int32 routing_id, const type1& arg1, \ | |
235 const type2& arg2, const type3& arg3, \ | |
236 const type4& arg4, const type5& arg5) \ | |
237 : IPC::MessageWithTuple< Tuple5<type1, type2, type3, type4, type5> >( \ | |
238 routing_id, ID, MakeRefTuple(arg1, arg2, arg3, arg4, arg5)) {} \ | |
239 \ | |
240 msg_class::~msg_class() { } \ | |
241 \ | |
242 void msg_class::Log(const Message* msg, std::wstring* l) { \ | |
243 Param p; \ | |
244 if (Read(msg, &p)) \ | |
245 IPC::LogParam(p, l); \ | |
246 } | |
247 | |
248 // TODO(erg): Fill these in as I go along. | |
249 #define IPC_SYNC_MESSAGE_CONTROL0_0(msg_class) | |
250 #define IPC_SYNC_MESSAGE_CONTROL0_1(msg_class, type1_out) | |
251 #define IPC_SYNC_MESSAGE_CONTROL0_2(msg_class, type1_out, type2_out) | |
252 #define IPC_SYNC_MESSAGE_CONTROL0_3(msg_class, type1_out, type2_out, type3_out) | |
253 #define IPC_SYNC_MESSAGE_CONTROL1_0(msg_class, type1_in) | |
254 #define IPC_SYNC_MESSAGE_CONTROL1_1(msg_class, type1_in, type1_out) | |
255 #define IPC_SYNC_MESSAGE_CONTROL1_2(msg_class, type1_in, type1_out, type2_out) | |
256 #define IPC_SYNC_MESSAGE_CONTROL1_3(msg_class, type1_in, type1_out, type2_out, t
ype3_out) | |
257 #define IPC_SYNC_MESSAGE_CONTROL2_0(msg_class, type1_in, type2_in) | |
258 #define IPC_SYNC_MESSAGE_CONTROL2_1(msg_class, type1_in, type2_in, type1_out) | |
259 #define IPC_SYNC_MESSAGE_CONTROL2_2(msg_class, type1_in, type2_in, type1_out, ty
pe2_out) | |
260 #define IPC_SYNC_MESSAGE_CONTROL2_3(msg_class, type1_in, type2_in, type1_out, ty
pe2_out, type3_out) | |
261 #define IPC_SYNC_MESSAGE_CONTROL3_1(msg_class, type1_in, type2_in, type3_in, typ
e1_out) | |
262 #define IPC_SYNC_MESSAGE_CONTROL3_2(msg_class, type1_in, type2_in, type3_in, typ
e1_out, type2_out) | |
263 #define IPC_SYNC_MESSAGE_CONTROL3_3(msg_class, type1_in, type2_in, type3_in, typ
e1_out, type2_out, type3_out) | |
264 #define IPC_SYNC_MESSAGE_CONTROL4_1(msg_class, type1_in, type2_in, type3_in, typ
e4_in, type1_out) | |
265 #define IPC_SYNC_MESSAGE_CONTROL4_2(msg_class, type1_in, type2_in, type3_in, typ
e4_in, type1_out, type2_out) | |
266 #define IPC_SYNC_MESSAGE_ROUTED0_0(msg_class) | |
267 #define IPC_SYNC_MESSAGE_ROUTED0_1(msg_class, type1_out) | |
268 #define IPC_SYNC_MESSAGE_ROUTED0_2(msg_class, type1_out, type2_out) | |
269 #define IPC_SYNC_MESSAGE_ROUTED0_3(msg_class, type1_out, type2_out, type3_out) | |
270 #define IPC_SYNC_MESSAGE_ROUTED1_0(msg_class, type1_in) | |
271 #define IPC_SYNC_MESSAGE_ROUTED1_1(msg_class, type1_in, type1_out) | |
272 #define IPC_SYNC_MESSAGE_ROUTED1_2(msg_class, type1_in, type1_out, type2_out) | |
273 #define IPC_SYNC_MESSAGE_ROUTED1_3(msg_class, type1_in, type1_out, type2_out, ty
pe3_out) | |
274 #define IPC_SYNC_MESSAGE_ROUTED1_4(msg_class, type1_in, type1_out, type2_out, ty
pe3_out, type4_out) | |
275 #define IPC_SYNC_MESSAGE_ROUTED2_0(msg_class, type1_in, type2_in) | |
276 #define IPC_SYNC_MESSAGE_ROUTED2_1(msg_class, type1_in, type2_in, type1_out) | |
277 #define IPC_SYNC_MESSAGE_ROUTED2_2(msg_class, type1_in, type2_in, type1_out, typ
e2_out) | |
278 #define IPC_SYNC_MESSAGE_ROUTED2_3(msg_class, type1_in, type2_in, type1_out, typ
e2_out, type3_out) | |
279 #define IPC_SYNC_MESSAGE_ROUTED3_0(msg_class, type1_in, type2_in, type3_in) | |
280 #define IPC_SYNC_MESSAGE_ROUTED3_1(msg_class, type1_in, type2_in, type3_in, type
1_out) | |
281 #define IPC_SYNC_MESSAGE_ROUTED3_2(msg_class, type1_in, type2_in, type3_in, type
1_out, type2_out) | |
282 #define IPC_SYNC_MESSAGE_ROUTED3_3(msg_class, type1_in, type2_in, type3_in, type
1_out, type2_out, type3_out) | |
283 #define IPC_SYNC_MESSAGE_ROUTED4_0(msg_class, type1_in, type2_in, type3_in, type
4_in) | |
284 #define IPC_SYNC_MESSAGE_ROUTED4_1(msg_class, type1_in, type2_in, type3_in, type
4_in, type1_out) | |
285 #define IPC_SYNC_MESSAGE_ROUTED4_2(msg_class, type1_in, type2_in, type3_in, type
4_in, type1_out, type2_out) | |
286 #define IPC_SYNC_MESSAGE_ROUTED4_3(msg_class, type1_in, type2_in, type3_in, type
4_in, type1_out, type2_out, type3_out) | |
287 #define IPC_SYNC_MESSAGE_ROUTED5_0(msg_class, type1_in, type2_in, type3_in, type
4_in, type5_in) | |
288 #define IPC_SYNC_MESSAGE_ROUTED5_1(msg_class, type1_in, type2_in, type3_in, type
4_in, type5_in, type1_out) | |
289 #define IPC_SYNC_MESSAGE_ROUTED5_2(msg_class, type1_in, type2_in, type3_in, type
4_in, type5_in, type1_out, type2_out) | |
290 #define IPC_SYNC_MESSAGE_ROUTED5_3(msg_class, type1_in, type2_in, type3_in, type
4_in, type5_in, type1_out, type2_out, type3_out) | |
291 | |
292 // Trigger the header guard define in ipc_message_macros.h so we don't get | |
293 // duplicate including when we include MESSAGES_INTERNAL_FILE again at the end | |
294 // of this file. | |
295 #define IPC_MESSAGE_MACROS_INCLUDE_BLOCK | |
296 | |
297 // Redefine MESSAGES_INTERNAL_FILE just for the header check in | |
298 // ipc_messages_macros.h that happens before it breaks on the header guard. | |
299 #define MESSAGES_INTERNAL_FILE MESSAGES_INTERNAL_IMPL_FILE | |
300 | |
301 // Include our INTERNAL file first to get the normal expansion. | |
302 #include MESSAGES_INTERNAL_IMPL_FILE | |
303 | |
304 #endif // IPC_IPC_MESSAGE_IMPL_MACROS_H_ | |
OLD | NEW |