/work/obj-fuzz/ipc/ipdl/PTemporaryIPCBlob.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | // |
2 | | // Automatically generated by ipdlc. |
3 | | // Edit at your own risk |
4 | | // |
5 | | |
6 | | |
7 | | #include "mozilla/ipc/PBackgroundParent.h" |
8 | | #include "mozilla/ipc/PBackgroundChild.h" |
9 | | #include "mozilla/ipc/PChildToParentStreamParent.h" |
10 | | #include "mozilla/ipc/PChildToParentStreamChild.h" |
11 | | #include "mozilla/ipc/PFileDescriptorSetParent.h" |
12 | | #include "mozilla/ipc/PFileDescriptorSetChild.h" |
13 | | #include "mozilla/ipc/PIPCBlobInputStreamParent.h" |
14 | | #include "mozilla/ipc/PIPCBlobInputStreamChild.h" |
15 | | #include "mozilla/ipc/PParentToChildStreamParent.h" |
16 | | #include "mozilla/ipc/PParentToChildStreamChild.h" |
17 | | #include "mozilla/ipc/PTemporaryIPCBlob.h" |
18 | | |
19 | | namespace mozilla { |
20 | | namespace ipc { |
21 | | namespace PTemporaryIPCBlob { |
22 | | |
23 | | nsresult |
24 | | CreateEndpoints( |
25 | | base::ProcessId aParentDestPid, |
26 | | base::ProcessId aChildDestPid, |
27 | | mozilla::ipc::Endpoint<mozilla::ipc::PTemporaryIPCBlobParent>* aParent, |
28 | | mozilla::ipc::Endpoint<mozilla::ipc::PTemporaryIPCBlobChild>* aChild) |
29 | 0 | { |
30 | 0 | return mozilla::ipc::CreateEndpoints(mozilla::ipc::PrivateIPDLInterface(), aParentDestPid, aChildDestPid, aParent, aChild); |
31 | 0 | } |
32 | | IPC::Message* |
33 | | Msg_FileDesc(int32_t routingId) |
34 | 0 | { |
35 | 0 | return IPC::Message::IPDLMessage(routingId, Msg_FileDesc__ID, IPC::Message::HeaderFlags(IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, IPC::Message::NOT_CONSTRUCTOR, IPC::Message::ASYNC, IPC::Message::NOT_INTERRUPT, IPC::Message::NOT_REPLY)); |
36 | 0 | } |
37 | | IPC::Message* |
38 | | Msg___delete__(int32_t routingId) |
39 | 0 | { |
40 | 0 | return IPC::Message::IPDLMessage(routingId, Msg___delete____ID, IPC::Message::HeaderFlags(IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, IPC::Message::NOT_CONSTRUCTOR, IPC::Message::ASYNC, IPC::Message::NOT_INTERRUPT, IPC::Message::NOT_REPLY)); |
41 | 0 | } |
42 | | IPC::Message* |
43 | | Reply___delete__(int32_t routingId) |
44 | 0 | { |
45 | 0 | return IPC::Message::IPDLMessage(routingId, Reply___delete____ID, IPC::Message::HeaderFlags(IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, IPC::Message::NOT_CONSTRUCTOR, IPC::Message::ASYNC, IPC::Message::NOT_INTERRUPT, IPC::Message::REPLY)); |
46 | 0 | } |
47 | | IPC::Message* |
48 | | Msg_OperationFailed(int32_t routingId) |
49 | 0 | { |
50 | 0 | return IPC::Message::IPDLMessage(routingId, Msg_OperationFailed__ID, IPC::Message::HeaderFlags(IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, IPC::Message::NOT_CONSTRUCTOR, IPC::Message::ASYNC, IPC::Message::NOT_INTERRUPT, IPC::Message::NOT_REPLY)); |
51 | 0 | } |
52 | | IPC::Message* |
53 | | Msg_OperationDone(int32_t routingId) |
54 | 0 | { |
55 | 0 | return IPC::Message::IPDLMessage(routingId, Msg_OperationDone__ID, IPC::Message::HeaderFlags(IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, IPC::Message::NOT_CONSTRUCTOR, IPC::Message::ASYNC, IPC::Message::NOT_INTERRUPT, IPC::Message::NOT_REPLY)); |
56 | 0 | } |
57 | | |
58 | | } // namespace PTemporaryIPCBlob |
59 | | } // namespace ipc |
60 | | } // namespace mozilla |
61 | | |
62 | | //----------------------------------------------------------------------------- |
63 | | // Method definitions for the IPDL type |union IPCBlobOrError| |
64 | | // |
65 | | namespace mozilla { |
66 | | namespace ipc { |
67 | | auto IPCBlobOrError::MaybeDestroy(Type aNewType) -> bool |
68 | 0 | { |
69 | 0 | if ((mType) == (T__None)) { |
70 | 0 | return true; |
71 | 0 | } |
72 | 0 | if ((mType) == (aNewType)) { |
73 | 0 | return false; |
74 | 0 | } |
75 | 0 | switch (mType) { |
76 | 0 | case TIPCBlob: |
77 | 0 | { |
78 | 0 | (ptr_IPCBlob())->~IPCBlob__tdef(); |
79 | 0 | break; |
80 | 0 | } |
81 | 0 | case Tnsresult: |
82 | 0 | { |
83 | 0 | (ptr_nsresult())->~nsresult__tdef(); |
84 | 0 | break; |
85 | 0 | } |
86 | 0 | default: |
87 | 0 | { |
88 | 0 | mozilla::ipc::LogicError("not reached"); |
89 | 0 | break; |
90 | 0 | } |
91 | 0 | } |
92 | 0 | return true; |
93 | 0 | } |
94 | | |
95 | | MOZ_IMPLICIT IPCBlobOrError::IPCBlobOrError(const IPCBlob& aOther) |
96 | 0 | { |
97 | 0 | new (mozilla::KnownNotNull, ptr_IPCBlob()) IPCBlob(aOther); |
98 | 0 | mType = TIPCBlob; |
99 | 0 | } |
100 | | |
101 | | MOZ_IMPLICIT IPCBlobOrError::IPCBlobOrError(IPCBlob&& aOther) |
102 | 0 | { |
103 | 0 | new (mozilla::KnownNotNull, ptr_IPCBlob()) IPCBlob(std::move(aOther)); |
104 | 0 | mType = TIPCBlob; |
105 | 0 | } |
106 | | |
107 | | MOZ_IMPLICIT IPCBlobOrError::IPCBlobOrError(const nsresult& aOther) |
108 | 0 | { |
109 | 0 | new (mozilla::KnownNotNull, ptr_nsresult()) nsresult(aOther); |
110 | 0 | mType = Tnsresult; |
111 | 0 | } |
112 | | |
113 | | MOZ_IMPLICIT IPCBlobOrError::IPCBlobOrError(nsresult&& aOther) |
114 | 0 | { |
115 | 0 | new (mozilla::KnownNotNull, ptr_nsresult()) nsresult(std::move(aOther)); |
116 | 0 | mType = Tnsresult; |
117 | 0 | } |
118 | | |
119 | | MOZ_IMPLICIT IPCBlobOrError::IPCBlobOrError(const IPCBlobOrError& aOther) |
120 | 0 | { |
121 | 0 | (aOther).AssertSanity(); |
122 | 0 | switch ((aOther).type()) { |
123 | 0 | case TIPCBlob: |
124 | 0 | { |
125 | 0 | new (mozilla::KnownNotNull, ptr_IPCBlob()) IPCBlob((aOther).get_IPCBlob()); |
126 | 0 | break; |
127 | 0 | } |
128 | 0 | case Tnsresult: |
129 | 0 | { |
130 | 0 | new (mozilla::KnownNotNull, ptr_nsresult()) nsresult((aOther).get_nsresult()); |
131 | 0 | break; |
132 | 0 | } |
133 | 0 | case T__None: |
134 | 0 | { |
135 | 0 | break; |
136 | 0 | } |
137 | 0 | default: |
138 | 0 | { |
139 | 0 | mozilla::ipc::LogicError("unreached"); |
140 | 0 | return; |
141 | 0 | } |
142 | 0 | } |
143 | 0 | mType = (aOther).type(); |
144 | 0 | } |
145 | | |
146 | | MOZ_IMPLICIT IPCBlobOrError::IPCBlobOrError(IPCBlobOrError&& aOther) |
147 | 0 | { |
148 | 0 | (aOther).AssertSanity(); |
149 | 0 | Type t = (aOther).type(); |
150 | 0 | switch (t) { |
151 | 0 | case TIPCBlob: |
152 | 0 | { |
153 | 0 | new (mozilla::KnownNotNull, ptr_IPCBlob()) IPCBlob(std::move((aOther).get_IPCBlob())); |
154 | 0 | static_cast<void>((aOther).MaybeDestroy(T__None)); |
155 | 0 | break; |
156 | 0 | } |
157 | 0 | case Tnsresult: |
158 | 0 | { |
159 | 0 | new (mozilla::KnownNotNull, ptr_nsresult()) nsresult(std::move((aOther).get_nsresult())); |
160 | 0 | static_cast<void>((aOther).MaybeDestroy(T__None)); |
161 | 0 | break; |
162 | 0 | } |
163 | 0 | case T__None: |
164 | 0 | { |
165 | 0 | break; |
166 | 0 | } |
167 | 0 | default: |
168 | 0 | { |
169 | 0 | mozilla::ipc::LogicError("unreached"); |
170 | 0 | return; |
171 | 0 | } |
172 | 0 | } |
173 | 0 | (aOther).mType = T__None; |
174 | 0 | mType = t; |
175 | 0 | } |
176 | | |
177 | | IPCBlobOrError::~IPCBlobOrError() |
178 | 0 | { |
179 | 0 | static_cast<void>(MaybeDestroy(T__None)); |
180 | 0 | } |
181 | | |
182 | | auto IPCBlobOrError::operator=(const IPCBlob& aRhs) -> IPCBlobOrError& |
183 | 0 | { |
184 | 0 | if (MaybeDestroy(TIPCBlob)) { |
185 | 0 | new (mozilla::KnownNotNull, ptr_IPCBlob()) IPCBlob; |
186 | 0 | } |
187 | 0 | (*(ptr_IPCBlob())) = aRhs; |
188 | 0 | mType = TIPCBlob; |
189 | 0 | return (*(this)); |
190 | 0 | } |
191 | | |
192 | | auto IPCBlobOrError::operator=(IPCBlob&& aRhs) -> IPCBlobOrError& |
193 | 0 | { |
194 | 0 | if (MaybeDestroy(TIPCBlob)) { |
195 | 0 | new (mozilla::KnownNotNull, ptr_IPCBlob()) IPCBlob; |
196 | 0 | } |
197 | 0 | (*(ptr_IPCBlob())) = std::move(aRhs); |
198 | 0 | mType = TIPCBlob; |
199 | 0 | return (*(this)); |
200 | 0 | } |
201 | | |
202 | | auto IPCBlobOrError::operator=(const nsresult& aRhs) -> IPCBlobOrError& |
203 | 0 | { |
204 | 0 | if (MaybeDestroy(Tnsresult)) { |
205 | 0 | new (mozilla::KnownNotNull, ptr_nsresult()) nsresult; |
206 | 0 | } |
207 | 0 | (*(ptr_nsresult())) = aRhs; |
208 | 0 | mType = Tnsresult; |
209 | 0 | return (*(this)); |
210 | 0 | } |
211 | | |
212 | | auto IPCBlobOrError::operator=(nsresult&& aRhs) -> IPCBlobOrError& |
213 | 0 | { |
214 | 0 | if (MaybeDestroy(Tnsresult)) { |
215 | 0 | new (mozilla::KnownNotNull, ptr_nsresult()) nsresult; |
216 | 0 | } |
217 | 0 | (*(ptr_nsresult())) = std::move(aRhs); |
218 | 0 | mType = Tnsresult; |
219 | 0 | return (*(this)); |
220 | 0 | } |
221 | | |
222 | | auto IPCBlobOrError::operator=(const IPCBlobOrError& aRhs) -> IPCBlobOrError& |
223 | 0 | { |
224 | 0 | (aRhs).AssertSanity(); |
225 | 0 | Type t = (aRhs).type(); |
226 | 0 | switch (t) { |
227 | 0 | case TIPCBlob: |
228 | 0 | { |
229 | 0 | if (MaybeDestroy(t)) { |
230 | 0 | new (mozilla::KnownNotNull, ptr_IPCBlob()) IPCBlob; |
231 | 0 | } |
232 | 0 | (*(ptr_IPCBlob())) = (aRhs).get_IPCBlob(); |
233 | 0 | break; |
234 | 0 | } |
235 | 0 | case Tnsresult: |
236 | 0 | { |
237 | 0 | if (MaybeDestroy(t)) { |
238 | 0 | new (mozilla::KnownNotNull, ptr_nsresult()) nsresult; |
239 | 0 | } |
240 | 0 | (*(ptr_nsresult())) = (aRhs).get_nsresult(); |
241 | 0 | break; |
242 | 0 | } |
243 | 0 | case T__None: |
244 | 0 | { |
245 | 0 | static_cast<void>(MaybeDestroy(t)); |
246 | 0 | break; |
247 | 0 | } |
248 | 0 | default: |
249 | 0 | { |
250 | 0 | mozilla::ipc::LogicError("unreached"); |
251 | 0 | break; |
252 | 0 | } |
253 | 0 | } |
254 | 0 | mType = t; |
255 | 0 | return (*(this)); |
256 | 0 | } |
257 | | |
258 | | auto IPCBlobOrError::operator=(IPCBlobOrError&& aRhs) -> IPCBlobOrError& |
259 | 0 | { |
260 | 0 | (aRhs).AssertSanity(); |
261 | 0 | Type t = (aRhs).type(); |
262 | 0 | switch (t) { |
263 | 0 | case TIPCBlob: |
264 | 0 | { |
265 | 0 | if (MaybeDestroy(t)) { |
266 | 0 | new (mozilla::KnownNotNull, ptr_IPCBlob()) IPCBlob; |
267 | 0 | } |
268 | 0 | (*(ptr_IPCBlob())) = std::move((aRhs).get_IPCBlob()); |
269 | 0 | static_cast<void>((aRhs).MaybeDestroy(T__None)); |
270 | 0 | break; |
271 | 0 | } |
272 | 0 | case Tnsresult: |
273 | 0 | { |
274 | 0 | if (MaybeDestroy(t)) { |
275 | 0 | new (mozilla::KnownNotNull, ptr_nsresult()) nsresult; |
276 | 0 | } |
277 | 0 | (*(ptr_nsresult())) = std::move((aRhs).get_nsresult()); |
278 | 0 | static_cast<void>((aRhs).MaybeDestroy(T__None)); |
279 | 0 | break; |
280 | 0 | } |
281 | 0 | case T__None: |
282 | 0 | { |
283 | 0 | static_cast<void>(MaybeDestroy(t)); |
284 | 0 | break; |
285 | 0 | } |
286 | 0 | default: |
287 | 0 | { |
288 | 0 | mozilla::ipc::LogicError("unreached"); |
289 | 0 | break; |
290 | 0 | } |
291 | 0 | } |
292 | 0 | (aRhs).mType = T__None; |
293 | 0 | mType = t; |
294 | 0 | return (*(this)); |
295 | 0 | } |
296 | | |
297 | | auto IPCBlobOrError::operator==(const IPCBlob& aRhs) const -> bool |
298 | 0 | { |
299 | 0 | return (get_IPCBlob()) == (aRhs); |
300 | 0 | } |
301 | | |
302 | | auto IPCBlobOrError::operator==(const nsresult& aRhs) const -> bool |
303 | 0 | { |
304 | 0 | return (get_nsresult()) == (aRhs); |
305 | 0 | } |
306 | | |
307 | | auto IPCBlobOrError::operator==(const IPCBlobOrError& aRhs) const -> bool |
308 | 0 | { |
309 | 0 | if ((type()) != ((aRhs).type())) { |
310 | 0 | return false; |
311 | 0 | } |
312 | 0 | |
313 | 0 | switch (type()) { |
314 | 0 | case TIPCBlob: |
315 | 0 | { |
316 | 0 | return (get_IPCBlob()) == ((aRhs).get_IPCBlob()); |
317 | 0 | } |
318 | 0 | case Tnsresult: |
319 | 0 | { |
320 | 0 | return (get_nsresult()) == ((aRhs).get_nsresult()); |
321 | 0 | } |
322 | 0 | default: |
323 | 0 | { |
324 | 0 | mozilla::ipc::LogicError("unreached"); |
325 | 0 | return false; |
326 | 0 | } |
327 | 0 | } |
328 | 0 | } |
329 | | |
330 | | auto IPCBlobOrError::get(IPCBlob* aOutValue) const -> void |
331 | 0 | { |
332 | 0 | (*(aOutValue)) = get_IPCBlob(); |
333 | 0 | } |
334 | | |
335 | | auto IPCBlobOrError::get(nsresult* aOutValue) const -> void |
336 | 0 | { |
337 | 0 | (*(aOutValue)) = get_nsresult(); |
338 | 0 | } |
339 | | |
340 | | } // namespace ipc |
341 | | } // namespace mozilla |
342 | | |
343 | | namespace mozilla { |
344 | | namespace ipc { |
345 | | auto IPDLParamTraits<mozilla::ipc::IPCBlobOrError>::Write( |
346 | | IPC::Message* aMsg, |
347 | | mozilla::ipc::IProtocol* aActor, |
348 | | const paramType& aVar) -> void |
349 | | { |
350 | | typedef mozilla::ipc::IPCBlobOrError union__; |
351 | | int type; |
352 | | type = (aVar).type(); |
353 | | WriteIPDLParam(aMsg, aActor, type); |
354 | | // Sentinel = 'IPCBlobOrError' |
355 | | (aMsg)->WriteSentinel(942667920); |
356 | | |
357 | | switch (type) { |
358 | | case union__::TIPCBlob: |
359 | | { |
360 | | WriteIPDLParam(aMsg, aActor, (aVar).get_IPCBlob()); |
361 | | // Sentinel = 'TIPCBlob' |
362 | | (aMsg)->WriteSentinel(3270420211); |
363 | | return; |
364 | | } |
365 | | case union__::Tnsresult: |
366 | | { |
367 | | WriteIPDLParam(aMsg, aActor, (aVar).get_nsresult()); |
368 | | // Sentinel = 'Tnsresult' |
369 | | (aMsg)->WriteSentinel(2293764539); |
370 | | return; |
371 | | } |
372 | | default: |
373 | | { |
374 | | (aActor)->FatalError("unknown union type"); |
375 | | return; |
376 | | } |
377 | | } |
378 | | } |
379 | | |
380 | | auto IPDLParamTraits<mozilla::ipc::IPCBlobOrError>::Read( |
381 | | const IPC::Message* aMsg, |
382 | | PickleIterator* aIter, |
383 | | mozilla::ipc::IProtocol* aActor, |
384 | | paramType* aVar) -> bool |
385 | 0 | { |
386 | 0 | typedef mozilla::ipc::IPCBlobOrError union__; |
387 | 0 | int type; |
388 | 0 | if ((!(ReadIPDLParam(aMsg, aIter, aActor, (&(type)))))) { |
389 | 0 | (aActor)->FatalError("Error deserializing type of union IPCBlobOrError"); |
390 | 0 | return false; |
391 | 0 | } |
392 | 0 | // Sentinel = 'IPCBlobOrError' |
393 | 0 | if ((!((aMsg)->ReadSentinel(aIter, 942667920)))) { |
394 | 0 | mozilla::ipc::SentinelReadError("Error deserializing type of union IPCBlobOrError"); |
395 | 0 | return false; |
396 | 0 | } |
397 | 0 | |
398 | 0 | switch (type) { |
399 | 0 | case union__::TIPCBlob: |
400 | 0 | { |
401 | 0 | mozilla::dom::IPCBlob tmp = mozilla::dom::IPCBlob(); |
402 | 0 | (*(aVar)) = tmp; |
403 | 0 | if ((!(ReadIPDLParam(aMsg, aIter, aActor, (&((aVar)->get_IPCBlob())))))) { |
404 | 0 | (aActor)->FatalError("Error deserializing variant TIPCBlob of union IPCBlobOrError"); |
405 | 0 | return false; |
406 | 0 | } |
407 | 0 | // Sentinel = 'TIPCBlob' |
408 | 0 | if ((!((aMsg)->ReadSentinel(aIter, 3270420211)))) { |
409 | 0 | mozilla::ipc::SentinelReadError("Error deserializing variant TIPCBlob of union IPCBlobOrError"); |
410 | 0 | return false; |
411 | 0 | } |
412 | 0 | return true; |
413 | 0 | } |
414 | 0 | case union__::Tnsresult: |
415 | 0 | { |
416 | 0 | nsresult tmp = nsresult(); |
417 | 0 | (*(aVar)) = tmp; |
418 | 0 | if ((!(ReadIPDLParam(aMsg, aIter, aActor, (&((aVar)->get_nsresult())))))) { |
419 | 0 | (aActor)->FatalError("Error deserializing variant Tnsresult of union IPCBlobOrError"); |
420 | 0 | return false; |
421 | 0 | } |
422 | 0 | // Sentinel = 'Tnsresult' |
423 | 0 | if ((!((aMsg)->ReadSentinel(aIter, 2293764539)))) { |
424 | 0 | mozilla::ipc::SentinelReadError("Error deserializing variant Tnsresult of union IPCBlobOrError"); |
425 | 0 | return false; |
426 | 0 | } |
427 | 0 | return true; |
428 | 0 | } |
429 | 0 | default: |
430 | 0 | { |
431 | 0 | (aActor)->FatalError("unknown union type"); |
432 | 0 | return false; |
433 | 0 | } |
434 | 0 | } |
435 | 0 | } |
436 | | |
437 | | } // namespace ipc |
438 | | } // namespace mozilla |