Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(426)

Side by Side Diff: ipc/ipc_message_impl_macros.h

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

Powered by Google App Engine
This is Rietveld 408576698