Coverage Report

Created: 2018-09-25 14:53

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