Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/ipc/ipdl/PTCPSocket.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/net/NeckoMessageUtils.h"
8
#include "mozilla/net/PNeckoParent.h"
9
#include "mozilla/net/PNeckoChild.h"
10
#include "mozilla/net/PTCPSocket.h"
11
12
namespace mozilla {
13
namespace net {
14
namespace PTCPSocket {
15
16
nsresult
17
CreateEndpoints(
18
        base::ProcessId aParentDestPid,
19
        base::ProcessId aChildDestPid,
20
        mozilla::ipc::Endpoint<mozilla::net::PTCPSocketParent>* aParent,
21
        mozilla::ipc::Endpoint<mozilla::net::PTCPSocketChild>* aChild)
22
0
{
23
0
    return mozilla::ipc::CreateEndpoints(mozilla::ipc::PrivateIPDLInterface(), aParentDestPid, aChildDestPid, aParent, aChild);
24
0
}
25
IPC::Message*
26
Msg_Open(int32_t routingId)
27
0
{
28
0
    return IPC::Message::IPDLMessage(routingId, Msg_Open__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));
29
0
}
30
IPC::Message*
31
Msg_OpenBind(int32_t routingId)
32
0
{
33
0
    return IPC::Message::IPDLMessage(routingId, Msg_OpenBind__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));
34
0
}
35
IPC::Message*
36
Msg_Data(int32_t routingId)
37
0
{
38
0
    return IPC::Message::IPDLMessage(routingId, Msg_Data__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));
39
0
}
40
IPC::Message*
41
Msg_StartTLS(int32_t routingId)
42
0
{
43
0
    return IPC::Message::IPDLMessage(routingId, Msg_StartTLS__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));
44
0
}
45
IPC::Message*
46
Msg_Suspend(int32_t routingId)
47
0
{
48
0
    return IPC::Message::IPDLMessage(routingId, Msg_Suspend__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));
49
0
}
50
IPC::Message*
51
Msg_Resume(int32_t routingId)
52
0
{
53
0
    return IPC::Message::IPDLMessage(routingId, Msg_Resume__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));
54
0
}
55
IPC::Message*
56
Msg_Close(int32_t routingId)
57
0
{
58
0
    return IPC::Message::IPDLMessage(routingId, Msg_Close__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));
59
0
}
60
IPC::Message*
61
Msg_Callback(int32_t routingId)
62
0
{
63
0
    return IPC::Message::IPDLMessage(routingId, Msg_Callback__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));
64
0
}
65
IPC::Message*
66
Msg_UpdateBufferedAmount(int32_t routingId)
67
0
{
68
0
    return IPC::Message::IPDLMessage(routingId, Msg_UpdateBufferedAmount__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));
69
0
}
70
IPC::Message*
71
Msg_RequestDelete(int32_t routingId)
72
0
{
73
0
    return IPC::Message::IPDLMessage(routingId, Msg_RequestDelete__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));
74
0
}
75
IPC::Message*
76
Msg___delete__(int32_t routingId)
77
0
{
78
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));
79
0
}
80
IPC::Message*
81
Reply___delete__(int32_t routingId)
82
0
{
83
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));
84
0
}
85
86
} // namespace PTCPSocket
87
} // namespace net
88
} // namespace mozilla
89
90
//-----------------------------------------------------------------------------
91
// Method definitions for the IPDL type |struct TCPError|
92
//
93
auto TCPError::operator==(const TCPError& _o) const -> bool
94
0
{
95
0
    if ((!((name()) == ((_o).name())))) {
96
0
        return false;
97
0
    }
98
0
    if ((!((message()) == ((_o).message())))) {
99
0
        return false;
100
0
    }
101
0
    return true;
102
0
}
103
104
auto TCPError::operator!=(const TCPError& _o) const -> bool
105
0
{
106
0
    return (!(operator==(_o)));
107
0
}
108
109
110
namespace mozilla {
111
namespace ipc {
112
auto IPDLParamTraits<TCPError>::Write(
113
        IPC::Message* aMsg,
114
        mozilla::ipc::IProtocol* aActor,
115
        const paramType& aVar) -> void
116
0
{
117
0
    WriteIPDLParam(aMsg, aActor, (aVar).name());
118
0
    // Sentinel = 'name'
119
0
    (aMsg)->WriteSentinel(15034981);
120
0
    WriteIPDLParam(aMsg, aActor, (aVar).message());
121
0
    // Sentinel = 'message'
122
0
    (aMsg)->WriteSentinel(1366108954);
123
0
}
124
125
auto IPDLParamTraits<TCPError>::Read(
126
        const IPC::Message* aMsg,
127
        PickleIterator* aIter,
128
        mozilla::ipc::IProtocol* aActor,
129
        paramType* aVar) -> bool
130
0
{
131
0
    if ((!(ReadIPDLParam(aMsg, aIter, aActor, (&((aVar)->name())))))) {
132
0
        (aActor)->FatalError("Error deserializing 'name' (nsString) member of 'TCPError'");
133
0
        return false;
134
0
    }
135
0
    // Sentinel = 'name'
136
0
    if ((!((aMsg)->ReadSentinel(aIter, 15034981)))) {
137
0
        mozilla::ipc::SentinelReadError("Error deserializing 'name' (nsString) member of 'TCPError'");
138
0
        return false;
139
0
    }
140
0
    if ((!(ReadIPDLParam(aMsg, aIter, aActor, (&((aVar)->message())))))) {
141
0
        (aActor)->FatalError("Error deserializing 'message' (nsString) member of 'TCPError'");
142
0
        return false;
143
0
    }
144
0
    // Sentinel = 'message'
145
0
    if ((!((aMsg)->ReadSentinel(aIter, 1366108954)))) {
146
0
        mozilla::ipc::SentinelReadError("Error deserializing 'message' (nsString) member of 'TCPError'");
147
0
        return false;
148
0
    }
149
0
    return true;
150
0
}
151
152
} // namespace ipc
153
} // namespace mozilla
154
155
//-----------------------------------------------------------------------------
156
// Method definitions for the IPDL type |union SendableData|
157
//
158
auto SendableData::MaybeDestroy(Type aNewType) -> bool
159
0
{
160
0
    if ((mType) == (T__None)) {
161
0
        return true;
162
0
    }
163
0
    if ((mType) == (aNewType)) {
164
0
        return false;
165
0
    }
166
0
    switch (mType) {
167
0
    case TArrayOfuint8_t:
168
0
        {
169
0
            (ptr_ArrayOfuint8_t())->~ArrayOfuint8_t__tdef();
170
0
            break;
171
0
        }
172
0
    case TnsCString:
173
0
        {
174
0
            (ptr_nsCString())->~nsCString__tdef();
175
0
            break;
176
0
        }
177
0
    default:
178
0
        {
179
0
            mozilla::ipc::LogicError("not reached");
180
0
            break;
181
0
        }
182
0
    }
183
0
    return true;
184
0
}
185
186
MOZ_IMPLICIT SendableData::SendableData(const nsTArray<uint8_t>& aOther)
187
0
{
188
0
    new (mozilla::KnownNotNull, ptr_ArrayOfuint8_t()) nsTArray<uint8_t>(aOther);
189
0
    mType = TArrayOfuint8_t;
190
0
}
191
192
MOZ_IMPLICIT SendableData::SendableData(nsTArray<uint8_t>&& aOther)
193
0
{
194
0
    new (mozilla::KnownNotNull, ptr_ArrayOfuint8_t()) nsTArray<uint8_t>(std::move(aOther));
195
0
    mType = TArrayOfuint8_t;
196
0
}
197
198
MOZ_IMPLICIT SendableData::SendableData(const nsCString& aOther)
199
0
{
200
0
    new (mozilla::KnownNotNull, ptr_nsCString()) nsCString(aOther);
201
0
    mType = TnsCString;
202
0
}
203
204
MOZ_IMPLICIT SendableData::SendableData(nsCString&& aOther)
205
0
{
206
0
    new (mozilla::KnownNotNull, ptr_nsCString()) nsCString(std::move(aOther));
207
0
    mType = TnsCString;
208
0
}
209
210
MOZ_IMPLICIT SendableData::SendableData(const SendableData& aOther)
211
0
{
212
0
    (aOther).AssertSanity();
213
0
    switch ((aOther).type()) {
214
0
    case TArrayOfuint8_t:
215
0
        {
216
0
            new (mozilla::KnownNotNull, ptr_ArrayOfuint8_t()) nsTArray<uint8_t>((aOther).get_ArrayOfuint8_t());
217
0
            break;
218
0
        }
219
0
    case TnsCString:
220
0
        {
221
0
            new (mozilla::KnownNotNull, ptr_nsCString()) nsCString((aOther).get_nsCString());
222
0
            break;
223
0
        }
224
0
    case T__None:
225
0
        {
226
0
            break;
227
0
        }
228
0
    default:
229
0
        {
230
0
            mozilla::ipc::LogicError("unreached");
231
0
            return;
232
0
        }
233
0
    }
234
0
    mType = (aOther).type();
235
0
}
236
237
MOZ_IMPLICIT SendableData::SendableData(SendableData&& aOther)
238
0
{
239
0
    (aOther).AssertSanity();
240
0
    Type t = (aOther).type();
241
0
    switch (t) {
242
0
    case TArrayOfuint8_t:
243
0
        {
244
0
            new (mozilla::KnownNotNull, ptr_ArrayOfuint8_t()) nsTArray<uint8_t>(std::move((aOther).get_ArrayOfuint8_t()));
245
0
            static_cast<void>((aOther).MaybeDestroy(T__None));
246
0
            break;
247
0
        }
248
0
    case TnsCString:
249
0
        {
250
0
            new (mozilla::KnownNotNull, ptr_nsCString()) nsCString(std::move((aOther).get_nsCString()));
251
0
            static_cast<void>((aOther).MaybeDestroy(T__None));
252
0
            break;
253
0
        }
254
0
    case T__None:
255
0
        {
256
0
            break;
257
0
        }
258
0
    default:
259
0
        {
260
0
            mozilla::ipc::LogicError("unreached");
261
0
            return;
262
0
        }
263
0
    }
264
0
    (aOther).mType = T__None;
265
0
    mType = t;
266
0
}
267
268
SendableData::~SendableData()
269
0
{
270
0
    static_cast<void>(MaybeDestroy(T__None));
271
0
}
272
273
auto SendableData::operator=(const nsTArray<uint8_t>& aRhs) -> SendableData&
274
0
{
275
0
    if (MaybeDestroy(TArrayOfuint8_t)) {
276
0
        new (mozilla::KnownNotNull, ptr_ArrayOfuint8_t()) nsTArray<uint8_t>;
277
0
    }
278
0
    (*(ptr_ArrayOfuint8_t())) = aRhs;
279
0
    mType = TArrayOfuint8_t;
280
0
    return (*(this));
281
0
}
282
283
auto SendableData::operator=(nsTArray<uint8_t>&& aRhs) -> SendableData&
284
0
{
285
0
    if (MaybeDestroy(TArrayOfuint8_t)) {
286
0
        new (mozilla::KnownNotNull, ptr_ArrayOfuint8_t()) nsTArray<uint8_t>;
287
0
    }
288
0
    (*(ptr_ArrayOfuint8_t())) = std::move(aRhs);
289
0
    mType = TArrayOfuint8_t;
290
0
    return (*(this));
291
0
}
292
293
auto SendableData::operator=(const nsCString& aRhs) -> SendableData&
294
0
{
295
0
    if (MaybeDestroy(TnsCString)) {
296
0
        new (mozilla::KnownNotNull, ptr_nsCString()) nsCString;
297
0
    }
298
0
    (*(ptr_nsCString())) = aRhs;
299
0
    mType = TnsCString;
300
0
    return (*(this));
301
0
}
302
303
auto SendableData::operator=(nsCString&& aRhs) -> SendableData&
304
0
{
305
0
    if (MaybeDestroy(TnsCString)) {
306
0
        new (mozilla::KnownNotNull, ptr_nsCString()) nsCString;
307
0
    }
308
0
    (*(ptr_nsCString())) = std::move(aRhs);
309
0
    mType = TnsCString;
310
0
    return (*(this));
311
0
}
312
313
auto SendableData::operator=(const SendableData& aRhs) -> SendableData&
314
0
{
315
0
    (aRhs).AssertSanity();
316
0
    Type t = (aRhs).type();
317
0
    switch (t) {
318
0
    case TArrayOfuint8_t:
319
0
        {
320
0
            if (MaybeDestroy(t)) {
321
0
                new (mozilla::KnownNotNull, ptr_ArrayOfuint8_t()) nsTArray<uint8_t>;
322
0
            }
323
0
            (*(ptr_ArrayOfuint8_t())) = (aRhs).get_ArrayOfuint8_t();
324
0
            break;
325
0
        }
326
0
    case TnsCString:
327
0
        {
328
0
            if (MaybeDestroy(t)) {
329
0
                new (mozilla::KnownNotNull, ptr_nsCString()) nsCString;
330
0
            }
331
0
            (*(ptr_nsCString())) = (aRhs).get_nsCString();
332
0
            break;
333
0
        }
334
0
    case T__None:
335
0
        {
336
0
            static_cast<void>(MaybeDestroy(t));
337
0
            break;
338
0
        }
339
0
    default:
340
0
        {
341
0
            mozilla::ipc::LogicError("unreached");
342
0
            break;
343
0
        }
344
0
    }
345
0
    mType = t;
346
0
    return (*(this));
347
0
}
348
349
auto SendableData::operator=(SendableData&& aRhs) -> SendableData&
350
0
{
351
0
    (aRhs).AssertSanity();
352
0
    Type t = (aRhs).type();
353
0
    switch (t) {
354
0
    case TArrayOfuint8_t:
355
0
        {
356
0
            if (MaybeDestroy(t)) {
357
0
                new (mozilla::KnownNotNull, ptr_ArrayOfuint8_t()) nsTArray<uint8_t>;
358
0
            }
359
0
            (*(ptr_ArrayOfuint8_t())) = std::move((aRhs).get_ArrayOfuint8_t());
360
0
            static_cast<void>((aRhs).MaybeDestroy(T__None));
361
0
            break;
362
0
        }
363
0
    case TnsCString:
364
0
        {
365
0
            if (MaybeDestroy(t)) {
366
0
                new (mozilla::KnownNotNull, ptr_nsCString()) nsCString;
367
0
            }
368
0
            (*(ptr_nsCString())) = std::move((aRhs).get_nsCString());
369
0
            static_cast<void>((aRhs).MaybeDestroy(T__None));
370
0
            break;
371
0
        }
372
0
    case T__None:
373
0
        {
374
0
            static_cast<void>(MaybeDestroy(t));
375
0
            break;
376
0
        }
377
0
    default:
378
0
        {
379
0
            mozilla::ipc::LogicError("unreached");
380
0
            break;
381
0
        }
382
0
    }
383
0
    (aRhs).mType = T__None;
384
0
    mType = t;
385
0
    return (*(this));
386
0
}
387
388
auto SendableData::operator==(const nsTArray<uint8_t>& aRhs) const -> bool
389
0
{
390
0
    return (get_ArrayOfuint8_t()) == (aRhs);
391
0
}
392
393
auto SendableData::operator==(const nsCString& aRhs) const -> bool
394
0
{
395
0
    return (get_nsCString()) == (aRhs);
396
0
}
397
398
auto SendableData::operator==(const SendableData& aRhs) const -> bool
399
0
{
400
0
    if ((type()) != ((aRhs).type())) {
401
0
        return false;
402
0
    }
403
0
404
0
    switch (type()) {
405
0
    case TArrayOfuint8_t:
406
0
        {
407
0
            return (get_ArrayOfuint8_t()) == ((aRhs).get_ArrayOfuint8_t());
408
0
        }
409
0
    case TnsCString:
410
0
        {
411
0
            return (get_nsCString()) == ((aRhs).get_nsCString());
412
0
        }
413
0
    default:
414
0
        {
415
0
            mozilla::ipc::LogicError("unreached");
416
0
            return false;
417
0
        }
418
0
    }
419
0
}
420
421
auto SendableData::get(nsTArray<uint8_t>* aOutValue) const -> void
422
0
{
423
0
    (*(aOutValue)) = get_ArrayOfuint8_t();
424
0
}
425
426
auto SendableData::get(nsCString* aOutValue) const -> void
427
0
{
428
0
    (*(aOutValue)) = get_nsCString();
429
0
}
430
431
432
namespace mozilla {
433
namespace ipc {
434
auto IPDLParamTraits<SendableData>::Write(
435
        IPC::Message* aMsg,
436
        mozilla::ipc::IProtocol* aActor,
437
        const paramType& aVar) -> void
438
{
439
    typedef SendableData union__;
440
    int type;
441
    type = (aVar).type();
442
    WriteIPDLParam(aMsg, aActor, type);
443
    // Sentinel = 'SendableData'
444
    (aMsg)->WriteSentinel(1792235082);
445
446
    switch (type) {
447
    case union__::TArrayOfuint8_t:
448
        {
449
            WriteIPDLParam(aMsg, aActor, (aVar).get_ArrayOfuint8_t());
450
            // Sentinel = 'TArrayOfuint8_t'
451
            (aMsg)->WriteSentinel(430000978);
452
            return;
453
        }
454
    case union__::TnsCString:
455
        {
456
            WriteIPDLParam(aMsg, aActor, (aVar).get_nsCString());
457
            // Sentinel = 'TnsCString'
458
            (aMsg)->WriteSentinel(2427411293);
459
            return;
460
        }
461
    default:
462
        {
463
            (aActor)->FatalError("unknown union type");
464
            return;
465
        }
466
    }
467
}
468
469
auto IPDLParamTraits<SendableData>::Read(
470
        const IPC::Message* aMsg,
471
        PickleIterator* aIter,
472
        mozilla::ipc::IProtocol* aActor,
473
        paramType* aVar) -> bool
474
0
{
475
0
    typedef SendableData union__;
476
0
    int type;
477
0
    if ((!(ReadIPDLParam(aMsg, aIter, aActor, (&(type)))))) {
478
0
        (aActor)->FatalError("Error deserializing type of union SendableData");
479
0
        return false;
480
0
    }
481
0
    // Sentinel = 'SendableData'
482
0
    if ((!((aMsg)->ReadSentinel(aIter, 1792235082)))) {
483
0
        mozilla::ipc::SentinelReadError("Error deserializing type of union SendableData");
484
0
        return false;
485
0
    }
486
0
487
0
    switch (type) {
488
0
    case union__::TArrayOfuint8_t:
489
0
        {
490
0
            nsTArray<uint8_t> tmp;
491
0
            (*(aVar)) = tmp;
492
0
            if ((!(ReadIPDLParam(aMsg, aIter, aActor, (&((aVar)->get_ArrayOfuint8_t())))))) {
493
0
                (aActor)->FatalError("Error deserializing variant TArrayOfuint8_t of union SendableData");
494
0
                return false;
495
0
            }
496
0
            // Sentinel = 'TArrayOfuint8_t'
497
0
            if ((!((aMsg)->ReadSentinel(aIter, 430000978)))) {
498
0
                mozilla::ipc::SentinelReadError("Error deserializing variant TArrayOfuint8_t of union SendableData");
499
0
                return false;
500
0
            }
501
0
            return true;
502
0
        }
503
0
    case union__::TnsCString:
504
0
        {
505
0
            nsCString tmp = nsCString();
506
0
            (*(aVar)) = tmp;
507
0
            if ((!(ReadIPDLParam(aMsg, aIter, aActor, (&((aVar)->get_nsCString())))))) {
508
0
                (aActor)->FatalError("Error deserializing variant TnsCString of union SendableData");
509
0
                return false;
510
0
            }
511
0
            // Sentinel = 'TnsCString'
512
0
            if ((!((aMsg)->ReadSentinel(aIter, 2427411293)))) {
513
0
                mozilla::ipc::SentinelReadError("Error deserializing variant TnsCString of union SendableData");
514
0
                return false;
515
0
            }
516
0
            return true;
517
0
        }
518
0
    default:
519
0
        {
520
0
            (aActor)->FatalError("unknown union type");
521
0
            return false;
522
0
        }
523
0
    }
524
0
}
525
526
} // namespace ipc
527
} // namespace mozilla
528
529
//-----------------------------------------------------------------------------
530
// Method definitions for the IPDL type |union CallbackData|
531
//
532
auto CallbackData::MaybeDestroy(Type aNewType) -> bool
533
0
{
534
0
    if ((mType) == (T__None)) {
535
0
        return true;
536
0
    }
537
0
    if ((mType) == (aNewType)) {
538
0
        return false;
539
0
    }
540
0
    switch (mType) {
541
0
    case Tvoid_t:
542
0
        {
543
0
            (ptr_void_t())->~void_t__tdef();
544
0
            break;
545
0
        }
546
0
    case TSendableData:
547
0
        {
548
0
            (ptr_SendableData())->~SendableData__tdef();
549
0
            break;
550
0
        }
551
0
    case TTCPError:
552
0
        {
553
0
            (ptr_TCPError())->~TCPError__tdef();
554
0
            break;
555
0
        }
556
0
    default:
557
0
        {
558
0
            mozilla::ipc::LogicError("not reached");
559
0
            break;
560
0
        }
561
0
    }
562
0
    return true;
563
0
}
564
565
MOZ_IMPLICIT CallbackData::CallbackData(const void_t& aOther)
566
0
{
567
0
    new (mozilla::KnownNotNull, ptr_void_t()) void_t(aOther);
568
0
    mType = Tvoid_t;
569
0
}
570
571
MOZ_IMPLICIT CallbackData::CallbackData(void_t&& aOther)
572
0
{
573
0
    new (mozilla::KnownNotNull, ptr_void_t()) void_t(std::move(aOther));
574
0
    mType = Tvoid_t;
575
0
}
576
577
MOZ_IMPLICIT CallbackData::CallbackData(const SendableData& aOther)
578
0
{
579
0
    new (mozilla::KnownNotNull, ptr_SendableData()) SendableData(aOther);
580
0
    mType = TSendableData;
581
0
}
582
583
MOZ_IMPLICIT CallbackData::CallbackData(SendableData&& aOther)
584
0
{
585
0
    new (mozilla::KnownNotNull, ptr_SendableData()) SendableData(std::move(aOther));
586
0
    mType = TSendableData;
587
0
}
588
589
MOZ_IMPLICIT CallbackData::CallbackData(const TCPError& aOther)
590
0
{
591
0
    new (mozilla::KnownNotNull, ptr_TCPError()) TCPError(aOther);
592
0
    mType = TTCPError;
593
0
}
594
595
MOZ_IMPLICIT CallbackData::CallbackData(TCPError&& aOther)
596
0
{
597
0
    new (mozilla::KnownNotNull, ptr_TCPError()) TCPError(std::move(aOther));
598
0
    mType = TTCPError;
599
0
}
600
601
MOZ_IMPLICIT CallbackData::CallbackData(const CallbackData& aOther)
602
0
{
603
0
    (aOther).AssertSanity();
604
0
    switch ((aOther).type()) {
605
0
    case Tvoid_t:
606
0
        {
607
0
            new (mozilla::KnownNotNull, ptr_void_t()) void_t((aOther).get_void_t());
608
0
            break;
609
0
        }
610
0
    case TSendableData:
611
0
        {
612
0
            new (mozilla::KnownNotNull, ptr_SendableData()) SendableData((aOther).get_SendableData());
613
0
            break;
614
0
        }
615
0
    case TTCPError:
616
0
        {
617
0
            new (mozilla::KnownNotNull, ptr_TCPError()) TCPError((aOther).get_TCPError());
618
0
            break;
619
0
        }
620
0
    case T__None:
621
0
        {
622
0
            break;
623
0
        }
624
0
    default:
625
0
        {
626
0
            mozilla::ipc::LogicError("unreached");
627
0
            return;
628
0
        }
629
0
    }
630
0
    mType = (aOther).type();
631
0
}
632
633
MOZ_IMPLICIT CallbackData::CallbackData(CallbackData&& aOther)
634
0
{
635
0
    (aOther).AssertSanity();
636
0
    Type t = (aOther).type();
637
0
    switch (t) {
638
0
    case Tvoid_t:
639
0
        {
640
0
            new (mozilla::KnownNotNull, ptr_void_t()) void_t(std::move((aOther).get_void_t()));
641
0
            static_cast<void>((aOther).MaybeDestroy(T__None));
642
0
            break;
643
0
        }
644
0
    case TSendableData:
645
0
        {
646
0
            new (mozilla::KnownNotNull, ptr_SendableData()) SendableData(std::move((aOther).get_SendableData()));
647
0
            static_cast<void>((aOther).MaybeDestroy(T__None));
648
0
            break;
649
0
        }
650
0
    case TTCPError:
651
0
        {
652
0
            new (mozilla::KnownNotNull, ptr_TCPError()) TCPError(std::move((aOther).get_TCPError()));
653
0
            static_cast<void>((aOther).MaybeDestroy(T__None));
654
0
            break;
655
0
        }
656
0
    case T__None:
657
0
        {
658
0
            break;
659
0
        }
660
0
    default:
661
0
        {
662
0
            mozilla::ipc::LogicError("unreached");
663
0
            return;
664
0
        }
665
0
    }
666
0
    (aOther).mType = T__None;
667
0
    mType = t;
668
0
}
669
670
CallbackData::~CallbackData()
671
0
{
672
0
    static_cast<void>(MaybeDestroy(T__None));
673
0
}
674
675
auto CallbackData::operator=(const void_t& aRhs) -> CallbackData&
676
0
{
677
0
    if (MaybeDestroy(Tvoid_t)) {
678
0
        new (mozilla::KnownNotNull, ptr_void_t()) void_t;
679
0
    }
680
0
    (*(ptr_void_t())) = aRhs;
681
0
    mType = Tvoid_t;
682
0
    return (*(this));
683
0
}
684
685
auto CallbackData::operator=(void_t&& aRhs) -> CallbackData&
686
0
{
687
0
    if (MaybeDestroy(Tvoid_t)) {
688
0
        new (mozilla::KnownNotNull, ptr_void_t()) void_t;
689
0
    }
690
0
    (*(ptr_void_t())) = std::move(aRhs);
691
0
    mType = Tvoid_t;
692
0
    return (*(this));
693
0
}
694
695
auto CallbackData::operator=(const SendableData& aRhs) -> CallbackData&
696
0
{
697
0
    if (MaybeDestroy(TSendableData)) {
698
0
        new (mozilla::KnownNotNull, ptr_SendableData()) SendableData;
699
0
    }
700
0
    (*(ptr_SendableData())) = aRhs;
701
0
    mType = TSendableData;
702
0
    return (*(this));
703
0
}
704
705
auto CallbackData::operator=(SendableData&& aRhs) -> CallbackData&
706
0
{
707
0
    if (MaybeDestroy(TSendableData)) {
708
0
        new (mozilla::KnownNotNull, ptr_SendableData()) SendableData;
709
0
    }
710
0
    (*(ptr_SendableData())) = std::move(aRhs);
711
0
    mType = TSendableData;
712
0
    return (*(this));
713
0
}
714
715
auto CallbackData::operator=(const TCPError& aRhs) -> CallbackData&
716
0
{
717
0
    if (MaybeDestroy(TTCPError)) {
718
0
        new (mozilla::KnownNotNull, ptr_TCPError()) TCPError;
719
0
    }
720
0
    (*(ptr_TCPError())) = aRhs;
721
0
    mType = TTCPError;
722
0
    return (*(this));
723
0
}
724
725
auto CallbackData::operator=(TCPError&& aRhs) -> CallbackData&
726
0
{
727
0
    if (MaybeDestroy(TTCPError)) {
728
0
        new (mozilla::KnownNotNull, ptr_TCPError()) TCPError;
729
0
    }
730
0
    (*(ptr_TCPError())) = std::move(aRhs);
731
0
    mType = TTCPError;
732
0
    return (*(this));
733
0
}
734
735
auto CallbackData::operator=(const CallbackData& aRhs) -> CallbackData&
736
0
{
737
0
    (aRhs).AssertSanity();
738
0
    Type t = (aRhs).type();
739
0
    switch (t) {
740
0
    case Tvoid_t:
741
0
        {
742
0
            if (MaybeDestroy(t)) {
743
0
                new (mozilla::KnownNotNull, ptr_void_t()) void_t;
744
0
            }
745
0
            (*(ptr_void_t())) = (aRhs).get_void_t();
746
0
            break;
747
0
        }
748
0
    case TSendableData:
749
0
        {
750
0
            if (MaybeDestroy(t)) {
751
0
                new (mozilla::KnownNotNull, ptr_SendableData()) SendableData;
752
0
            }
753
0
            (*(ptr_SendableData())) = (aRhs).get_SendableData();
754
0
            break;
755
0
        }
756
0
    case TTCPError:
757
0
        {
758
0
            if (MaybeDestroy(t)) {
759
0
                new (mozilla::KnownNotNull, ptr_TCPError()) TCPError;
760
0
            }
761
0
            (*(ptr_TCPError())) = (aRhs).get_TCPError();
762
0
            break;
763
0
        }
764
0
    case T__None:
765
0
        {
766
0
            static_cast<void>(MaybeDestroy(t));
767
0
            break;
768
0
        }
769
0
    default:
770
0
        {
771
0
            mozilla::ipc::LogicError("unreached");
772
0
            break;
773
0
        }
774
0
    }
775
0
    mType = t;
776
0
    return (*(this));
777
0
}
778
779
auto CallbackData::operator=(CallbackData&& aRhs) -> CallbackData&
780
0
{
781
0
    (aRhs).AssertSanity();
782
0
    Type t = (aRhs).type();
783
0
    switch (t) {
784
0
    case Tvoid_t:
785
0
        {
786
0
            if (MaybeDestroy(t)) {
787
0
                new (mozilla::KnownNotNull, ptr_void_t()) void_t;
788
0
            }
789
0
            (*(ptr_void_t())) = std::move((aRhs).get_void_t());
790
0
            static_cast<void>((aRhs).MaybeDestroy(T__None));
791
0
            break;
792
0
        }
793
0
    case TSendableData:
794
0
        {
795
0
            if (MaybeDestroy(t)) {
796
0
                new (mozilla::KnownNotNull, ptr_SendableData()) SendableData;
797
0
            }
798
0
            (*(ptr_SendableData())) = std::move((aRhs).get_SendableData());
799
0
            static_cast<void>((aRhs).MaybeDestroy(T__None));
800
0
            break;
801
0
        }
802
0
    case TTCPError:
803
0
        {
804
0
            if (MaybeDestroy(t)) {
805
0
                new (mozilla::KnownNotNull, ptr_TCPError()) TCPError;
806
0
            }
807
0
            (*(ptr_TCPError())) = std::move((aRhs).get_TCPError());
808
0
            static_cast<void>((aRhs).MaybeDestroy(T__None));
809
0
            break;
810
0
        }
811
0
    case T__None:
812
0
        {
813
0
            static_cast<void>(MaybeDestroy(t));
814
0
            break;
815
0
        }
816
0
    default:
817
0
        {
818
0
            mozilla::ipc::LogicError("unreached");
819
0
            break;
820
0
        }
821
0
    }
822
0
    (aRhs).mType = T__None;
823
0
    mType = t;
824
0
    return (*(this));
825
0
}
826
827
auto CallbackData::operator==(const void_t& aRhs) const -> bool
828
0
{
829
0
    return (get_void_t()) == (aRhs);
830
0
}
831
832
auto CallbackData::operator==(const SendableData& aRhs) const -> bool
833
0
{
834
0
    return (get_SendableData()) == (aRhs);
835
0
}
836
837
auto CallbackData::operator==(const TCPError& aRhs) const -> bool
838
0
{
839
0
    return (get_TCPError()) == (aRhs);
840
0
}
841
842
auto CallbackData::operator==(const CallbackData& aRhs) const -> bool
843
0
{
844
0
    if ((type()) != ((aRhs).type())) {
845
0
        return false;
846
0
    }
847
0
848
0
    switch (type()) {
849
0
    case Tvoid_t:
850
0
        {
851
0
            return (get_void_t()) == ((aRhs).get_void_t());
852
0
        }
853
0
    case TSendableData:
854
0
        {
855
0
            return (get_SendableData()) == ((aRhs).get_SendableData());
856
0
        }
857
0
    case TTCPError:
858
0
        {
859
0
            return (get_TCPError()) == ((aRhs).get_TCPError());
860
0
        }
861
0
    default:
862
0
        {
863
0
            mozilla::ipc::LogicError("unreached");
864
0
            return false;
865
0
        }
866
0
    }
867
0
}
868
869
auto CallbackData::get(void_t* aOutValue) const -> void
870
0
{
871
0
    (*(aOutValue)) = get_void_t();
872
0
}
873
874
auto CallbackData::get(SendableData* aOutValue) const -> void
875
0
{
876
0
    (*(aOutValue)) = get_SendableData();
877
0
}
878
879
auto CallbackData::get(TCPError* aOutValue) const -> void
880
0
{
881
0
    (*(aOutValue)) = get_TCPError();
882
0
}
883
884
885
namespace mozilla {
886
namespace ipc {
887
auto IPDLParamTraits<CallbackData>::Write(
888
        IPC::Message* aMsg,
889
        mozilla::ipc::IProtocol* aActor,
890
        const paramType& aVar) -> void
891
{
892
    typedef CallbackData union__;
893
    int type;
894
    type = (aVar).type();
895
    WriteIPDLParam(aMsg, aActor, type);
896
    // Sentinel = 'CallbackData'
897
    (aMsg)->WriteSentinel(3715623197);
898
899
    switch (type) {
900
    case union__::Tvoid_t:
901
        {
902
            WriteIPDLParam(aMsg, aActor, (aVar).get_void_t());
903
            // Sentinel = 'Tvoid_t'
904
            (aMsg)->WriteSentinel(3041273328);
905
            return;
906
        }
907
    case union__::TSendableData:
908
        {
909
            WriteIPDLParam(aMsg, aActor, (aVar).get_SendableData());
910
            // Sentinel = 'TSendableData'
911
            (aMsg)->WriteSentinel(1253583583);
912
            return;
913
        }
914
    case union__::TTCPError:
915
        {
916
            WriteIPDLParam(aMsg, aActor, (aVar).get_TCPError());
917
            // Sentinel = 'TTCPError'
918
            (aMsg)->WriteSentinel(2275116752);
919
            return;
920
        }
921
    default:
922
        {
923
            (aActor)->FatalError("unknown union type");
924
            return;
925
        }
926
    }
927
}
928
929
auto IPDLParamTraits<CallbackData>::Read(
930
        const IPC::Message* aMsg,
931
        PickleIterator* aIter,
932
        mozilla::ipc::IProtocol* aActor,
933
        paramType* aVar) -> bool
934
0
{
935
0
    typedef CallbackData union__;
936
0
    int type;
937
0
    if ((!(ReadIPDLParam(aMsg, aIter, aActor, (&(type)))))) {
938
0
        (aActor)->FatalError("Error deserializing type of union CallbackData");
939
0
        return false;
940
0
    }
941
0
    // Sentinel = 'CallbackData'
942
0
    if ((!((aMsg)->ReadSentinel(aIter, 3715623197)))) {
943
0
        mozilla::ipc::SentinelReadError("Error deserializing type of union CallbackData");
944
0
        return false;
945
0
    }
946
0
947
0
    switch (type) {
948
0
    case union__::Tvoid_t:
949
0
        {
950
0
            mozilla::void_t tmp = mozilla::void_t();
951
0
            (*(aVar)) = tmp;
952
0
            if ((!(ReadIPDLParam(aMsg, aIter, aActor, (&((aVar)->get_void_t())))))) {
953
0
                (aActor)->FatalError("Error deserializing variant Tvoid_t of union CallbackData");
954
0
                return false;
955
0
            }
956
0
            // Sentinel = 'Tvoid_t'
957
0
            if ((!((aMsg)->ReadSentinel(aIter, 3041273328)))) {
958
0
                mozilla::ipc::SentinelReadError("Error deserializing variant Tvoid_t of union CallbackData");
959
0
                return false;
960
0
            }
961
0
            return true;
962
0
        }
963
0
    case union__::TSendableData:
964
0
        {
965
0
            SendableData tmp = SendableData();
966
0
            (*(aVar)) = tmp;
967
0
            if ((!(ReadIPDLParam(aMsg, aIter, aActor, (&((aVar)->get_SendableData())))))) {
968
0
                (aActor)->FatalError("Error deserializing variant TSendableData of union CallbackData");
969
0
                return false;
970
0
            }
971
0
            // Sentinel = 'TSendableData'
972
0
            if ((!((aMsg)->ReadSentinel(aIter, 1253583583)))) {
973
0
                mozilla::ipc::SentinelReadError("Error deserializing variant TSendableData of union CallbackData");
974
0
                return false;
975
0
            }
976
0
            return true;
977
0
        }
978
0
    case union__::TTCPError:
979
0
        {
980
0
            TCPError tmp = TCPError();
981
0
            (*(aVar)) = tmp;
982
0
            if ((!(ReadIPDLParam(aMsg, aIter, aActor, (&((aVar)->get_TCPError())))))) {
983
0
                (aActor)->FatalError("Error deserializing variant TTCPError of union CallbackData");
984
0
                return false;
985
0
            }
986
0
            // Sentinel = 'TTCPError'
987
0
            if ((!((aMsg)->ReadSentinel(aIter, 2275116752)))) {
988
0
                mozilla::ipc::SentinelReadError("Error deserializing variant TTCPError of union CallbackData");
989
0
                return false;
990
0
            }
991
0
            return true;
992
0
        }
993
0
    default:
994
0
        {
995
0
            (aActor)->FatalError("unknown union type");
996
0
            return false;
997
0
        }
998
0
    }
999
0
}
1000
1001
} // namespace ipc
1002
} // namespace mozilla