Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/ipc/ipdl/PGMPServiceChild.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/gmp/PGMPServiceChild.h"
8
9
#include "mozilla/gmp/PGMPContentChild.h"
10
11
#include "nsIFile.h"
12
#include "GeckoProfiler.h"
13
14
namespace mozilla {
15
namespace gmp {
16
17
18
auto PGMPServiceChild::ActorDestroy(ActorDestroyReason aWhy) -> void
19
0
{
20
0
}
21
22
auto PGMPServiceChild::ProcessingError(
23
        Result aCode,
24
        const char* aReason) -> void
25
0
{
26
0
}
27
28
auto PGMPServiceChild::ShouldContinueFromReplyTimeout() -> bool
29
0
{
30
0
    return true;
31
0
}
32
33
auto PGMPServiceChild::EnteredCxxStack() -> void
34
0
{
35
0
}
36
37
auto PGMPServiceChild::ExitedCxxStack() -> void
38
0
{
39
0
}
40
41
auto PGMPServiceChild::EnteredCall() -> void
42
0
{
43
0
}
44
45
auto PGMPServiceChild::ExitedCall() -> void
46
0
{
47
0
}
48
49
MOZ_IMPLICIT PGMPServiceChild::PGMPServiceChild() :
50
    mozilla::ipc::IToplevelProtocol("PGMPServiceChild", PGMPServiceMsgStart, mozilla::ipc::ChildSide),
51
    mLivenessState(mozilla::ipc::LivenessState::Start)
52
0
{
53
0
    MOZ_COUNT_CTOR(PGMPServiceChild);
54
0
}
55
56
PGMPServiceChild::~PGMPServiceChild()
57
0
{
58
0
    MOZ_COUNT_DTOR(PGMPServiceChild);
59
0
}
60
61
auto PGMPServiceChild::SendLaunchGMP(
62
        const nsCString& nodeId,
63
        const nsCString& api,
64
        const nsTArray<nsCString>& tags,
65
        const nsTArray<ProcessId>& alreadyBridgedTo,
66
        uint32_t* pluginId,
67
        ProcessId* id,
68
        nsCString* displayName,
69
        Endpoint<mozilla::gmp::PGMPContentParent>* endpoint,
70
        nsresult* aResult,
71
        nsCString* aErrorDescription) -> bool
72
0
{
73
0
    IPC::Message* msg__ = PGMPService::Msg_LaunchGMP(MSG_ROUTING_CONTROL);
74
0
75
0
    WriteIPDLParam(msg__, this, nodeId);
76
0
    // Sentinel = 'nodeId'
77
0
    (msg__)->WriteSentinel(592730925);
78
0
    WriteIPDLParam(msg__, this, api);
79
0
    // Sentinel = 'api'
80
0
    (msg__)->WriteSentinel(2712041747);
81
0
    WriteIPDLParam(msg__, this, tags);
82
0
    // Sentinel = 'tags'
83
0
    (msg__)->WriteSentinel(2697818311);
84
0
    WriteIPDLParam(msg__, this, alreadyBridgedTo);
85
0
    // Sentinel = 'alreadyBridgedTo'
86
0
    (msg__)->WriteSentinel(3102476118);
87
0
88
0
89
0
90
0
    Message reply__;
91
0
92
0
    if (mozilla::ipc::LoggingEnabledFor("PGMPServiceChild")) {
93
0
        mozilla::ipc::LogMessageForProtocol("PGMPServiceChild", OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending);
94
0
    }
95
0
    AUTO_PROFILER_LABEL("PGMPService::Msg_LaunchGMP", OTHER);
96
0
    if ((!(StateTransition(false, (&(mLivenessState)))))) {
97
0
        mozilla::ipc::LogicError("Transition error");
98
0
    }
99
0
100
0
    bool sendok__;
101
0
    {
102
0
        AUTO_PROFILER_TRACING("IPC", "PGMPService::Msg_LaunchGMP");
103
0
        sendok__ = (GetIPCChannel())->Send(msg__, (&(reply__)));
104
0
    }
105
0
    if ((!(sendok__))) {
106
0
        return false;
107
0
    }
108
0
109
0
    if (mozilla::ipc::LoggingEnabledFor("PGMPServiceChild")) {
110
0
        mozilla::ipc::LogMessageForProtocol("PGMPServiceChild", OtherPid(), "Received reply ", ((&(reply__)))->type(), mozilla::ipc::MessageDirection::eReceiving);
111
0
    }
112
0
113
0
    PickleIterator iter__(reply__);
114
0
115
0
    if ((!(ReadIPDLParam((&(reply__)), (&(iter__)), this, pluginId)))) {
116
0
        FatalError("Error deserializing 'uint32_t'");
117
0
        return false;
118
0
    }
119
0
    // Sentinel = 'pluginId'
120
0
    if ((!(((&(reply__)))->ReadSentinel((&(iter__)), 1563488274)))) {
121
0
        mozilla::ipc::SentinelReadError("Error deserializing 'uint32_t'");
122
0
        return false;
123
0
    }
124
0
    if ((!(ReadIPDLParam((&(reply__)), (&(iter__)), this, id)))) {
125
0
        FatalError("Error deserializing 'ProcessId'");
126
0
        return false;
127
0
    }
128
0
    // Sentinel = 'id'
129
0
    if ((!(((&(reply__)))->ReadSentinel((&(iter__)), 2794505629)))) {
130
0
        mozilla::ipc::SentinelReadError("Error deserializing 'ProcessId'");
131
0
        return false;
132
0
    }
133
0
    if ((!(ReadIPDLParam((&(reply__)), (&(iter__)), this, displayName)))) {
134
0
        FatalError("Error deserializing 'nsCString'");
135
0
        return false;
136
0
    }
137
0
    // Sentinel = 'displayName'
138
0
    if ((!(((&(reply__)))->ReadSentinel((&(iter__)), 3335312356)))) {
139
0
        mozilla::ipc::SentinelReadError("Error deserializing 'nsCString'");
140
0
        return false;
141
0
    }
142
0
    if ((!(ReadIPDLParam((&(reply__)), (&(iter__)), this, endpoint)))) {
143
0
        FatalError("Error deserializing 'Endpoint<mozilla::gmp::PGMPContentParent>'");
144
0
        return false;
145
0
    }
146
0
    // Sentinel = 'endpoint'
147
0
    if ((!(((&(reply__)))->ReadSentinel((&(iter__)), 3610972515)))) {
148
0
        mozilla::ipc::SentinelReadError("Error deserializing 'Endpoint<mozilla::gmp::PGMPContentParent>'");
149
0
        return false;
150
0
    }
151
0
    if ((!(ReadIPDLParam((&(reply__)), (&(iter__)), this, aResult)))) {
152
0
        FatalError("Error deserializing 'nsresult'");
153
0
        return false;
154
0
    }
155
0
    // Sentinel = 'aResult'
156
0
    if ((!(((&(reply__)))->ReadSentinel((&(iter__)), 3888726089)))) {
157
0
        mozilla::ipc::SentinelReadError("Error deserializing 'nsresult'");
158
0
        return false;
159
0
    }
160
0
    if ((!(ReadIPDLParam((&(reply__)), (&(iter__)), this, aErrorDescription)))) {
161
0
        FatalError("Error deserializing 'nsCString'");
162
0
        return false;
163
0
    }
164
0
    // Sentinel = 'aErrorDescription'
165
0
    if ((!(((&(reply__)))->ReadSentinel((&(iter__)), 947178020)))) {
166
0
        mozilla::ipc::SentinelReadError("Error deserializing 'nsCString'");
167
0
        return false;
168
0
    }
169
0
    (reply__).EndRead(iter__, (reply__).type());
170
0
171
0
    return true;
172
0
}
173
174
auto PGMPServiceChild::SendLaunchGMPForNodeId(
175
        const NodeIdData& nodeId,
176
        const nsCString& api,
177
        const nsTArray<nsCString>& tags,
178
        const nsTArray<ProcessId>& alreadyBridgedTo,
179
        uint32_t* pluginId,
180
        ProcessId* id,
181
        nsCString* displayName,
182
        Endpoint<mozilla::gmp::PGMPContentParent>* endpoint,
183
        nsresult* aResult,
184
        nsCString* aErrorDescription) -> bool
185
0
{
186
0
    IPC::Message* msg__ = PGMPService::Msg_LaunchGMPForNodeId(MSG_ROUTING_CONTROL);
187
0
188
0
    WriteIPDLParam(msg__, this, nodeId);
189
0
    // Sentinel = 'nodeId'
190
0
    (msg__)->WriteSentinel(592730925);
191
0
    WriteIPDLParam(msg__, this, api);
192
0
    // Sentinel = 'api'
193
0
    (msg__)->WriteSentinel(2712041747);
194
0
    WriteIPDLParam(msg__, this, tags);
195
0
    // Sentinel = 'tags'
196
0
    (msg__)->WriteSentinel(2697818311);
197
0
    WriteIPDLParam(msg__, this, alreadyBridgedTo);
198
0
    // Sentinel = 'alreadyBridgedTo'
199
0
    (msg__)->WriteSentinel(3102476118);
200
0
201
0
202
0
203
0
    Message reply__;
204
0
205
0
    if (mozilla::ipc::LoggingEnabledFor("PGMPServiceChild")) {
206
0
        mozilla::ipc::LogMessageForProtocol("PGMPServiceChild", OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending);
207
0
    }
208
0
    AUTO_PROFILER_LABEL("PGMPService::Msg_LaunchGMPForNodeId", OTHER);
209
0
    if ((!(StateTransition(false, (&(mLivenessState)))))) {
210
0
        mozilla::ipc::LogicError("Transition error");
211
0
    }
212
0
213
0
    bool sendok__;
214
0
    {
215
0
        AUTO_PROFILER_TRACING("IPC", "PGMPService::Msg_LaunchGMPForNodeId");
216
0
        sendok__ = (GetIPCChannel())->Send(msg__, (&(reply__)));
217
0
    }
218
0
    if ((!(sendok__))) {
219
0
        return false;
220
0
    }
221
0
222
0
    if (mozilla::ipc::LoggingEnabledFor("PGMPServiceChild")) {
223
0
        mozilla::ipc::LogMessageForProtocol("PGMPServiceChild", OtherPid(), "Received reply ", ((&(reply__)))->type(), mozilla::ipc::MessageDirection::eReceiving);
224
0
    }
225
0
226
0
    PickleIterator iter__(reply__);
227
0
228
0
    if ((!(ReadIPDLParam((&(reply__)), (&(iter__)), this, pluginId)))) {
229
0
        FatalError("Error deserializing 'uint32_t'");
230
0
        return false;
231
0
    }
232
0
    // Sentinel = 'pluginId'
233
0
    if ((!(((&(reply__)))->ReadSentinel((&(iter__)), 1563488274)))) {
234
0
        mozilla::ipc::SentinelReadError("Error deserializing 'uint32_t'");
235
0
        return false;
236
0
    }
237
0
    if ((!(ReadIPDLParam((&(reply__)), (&(iter__)), this, id)))) {
238
0
        FatalError("Error deserializing 'ProcessId'");
239
0
        return false;
240
0
    }
241
0
    // Sentinel = 'id'
242
0
    if ((!(((&(reply__)))->ReadSentinel((&(iter__)), 2794505629)))) {
243
0
        mozilla::ipc::SentinelReadError("Error deserializing 'ProcessId'");
244
0
        return false;
245
0
    }
246
0
    if ((!(ReadIPDLParam((&(reply__)), (&(iter__)), this, displayName)))) {
247
0
        FatalError("Error deserializing 'nsCString'");
248
0
        return false;
249
0
    }
250
0
    // Sentinel = 'displayName'
251
0
    if ((!(((&(reply__)))->ReadSentinel((&(iter__)), 3335312356)))) {
252
0
        mozilla::ipc::SentinelReadError("Error deserializing 'nsCString'");
253
0
        return false;
254
0
    }
255
0
    if ((!(ReadIPDLParam((&(reply__)), (&(iter__)), this, endpoint)))) {
256
0
        FatalError("Error deserializing 'Endpoint<mozilla::gmp::PGMPContentParent>'");
257
0
        return false;
258
0
    }
259
0
    // Sentinel = 'endpoint'
260
0
    if ((!(((&(reply__)))->ReadSentinel((&(iter__)), 3610972515)))) {
261
0
        mozilla::ipc::SentinelReadError("Error deserializing 'Endpoint<mozilla::gmp::PGMPContentParent>'");
262
0
        return false;
263
0
    }
264
0
    if ((!(ReadIPDLParam((&(reply__)), (&(iter__)), this, aResult)))) {
265
0
        FatalError("Error deserializing 'nsresult'");
266
0
        return false;
267
0
    }
268
0
    // Sentinel = 'aResult'
269
0
    if ((!(((&(reply__)))->ReadSentinel((&(iter__)), 3888726089)))) {
270
0
        mozilla::ipc::SentinelReadError("Error deserializing 'nsresult'");
271
0
        return false;
272
0
    }
273
0
    if ((!(ReadIPDLParam((&(reply__)), (&(iter__)), this, aErrorDescription)))) {
274
0
        FatalError("Error deserializing 'nsCString'");
275
0
        return false;
276
0
    }
277
0
    // Sentinel = 'aErrorDescription'
278
0
    if ((!(((&(reply__)))->ReadSentinel((&(iter__)), 947178020)))) {
279
0
        mozilla::ipc::SentinelReadError("Error deserializing 'nsCString'");
280
0
        return false;
281
0
    }
282
0
    (reply__).EndRead(iter__, (reply__).type());
283
0
284
0
    return true;
285
0
}
286
287
auto PGMPServiceChild::SendGetGMPNodeId(
288
        const nsString& origin,
289
        const nsString& topLevelOrigin,
290
        const nsString& gmpName,
291
        nsCString* id) -> bool
292
0
{
293
0
    IPC::Message* msg__ = PGMPService::Msg_GetGMPNodeId(MSG_ROUTING_CONTROL);
294
0
295
0
    WriteIPDLParam(msg__, this, origin);
296
0
    // Sentinel = 'origin'
297
0
    (msg__)->WriteSentinel(1429924608);
298
0
    WriteIPDLParam(msg__, this, topLevelOrigin);
299
0
    // Sentinel = 'topLevelOrigin'
300
0
    (msg__)->WriteSentinel(2455035801);
301
0
    WriteIPDLParam(msg__, this, gmpName);
302
0
    // Sentinel = 'gmpName'
303
0
    (msg__)->WriteSentinel(2256822302);
304
0
305
0
306
0
307
0
    Message reply__;
308
0
309
0
    if (mozilla::ipc::LoggingEnabledFor("PGMPServiceChild")) {
310
0
        mozilla::ipc::LogMessageForProtocol("PGMPServiceChild", OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending);
311
0
    }
312
0
    AUTO_PROFILER_LABEL("PGMPService::Msg_GetGMPNodeId", OTHER);
313
0
    if ((!(StateTransition(false, (&(mLivenessState)))))) {
314
0
        mozilla::ipc::LogicError("Transition error");
315
0
    }
316
0
317
0
    bool sendok__;
318
0
    {
319
0
        AUTO_PROFILER_TRACING("IPC", "PGMPService::Msg_GetGMPNodeId");
320
0
        sendok__ = (GetIPCChannel())->Send(msg__, (&(reply__)));
321
0
    }
322
0
    if ((!(sendok__))) {
323
0
        return false;
324
0
    }
325
0
326
0
    if (mozilla::ipc::LoggingEnabledFor("PGMPServiceChild")) {
327
0
        mozilla::ipc::LogMessageForProtocol("PGMPServiceChild", OtherPid(), "Received reply ", ((&(reply__)))->type(), mozilla::ipc::MessageDirection::eReceiving);
328
0
    }
329
0
330
0
    PickleIterator iter__(reply__);
331
0
332
0
    if ((!(ReadIPDLParam((&(reply__)), (&(iter__)), this, id)))) {
333
0
        FatalError("Error deserializing 'nsCString'");
334
0
        return false;
335
0
    }
336
0
    // Sentinel = 'id'
337
0
    if ((!(((&(reply__)))->ReadSentinel((&(iter__)), 2794505629)))) {
338
0
        mozilla::ipc::SentinelReadError("Error deserializing 'nsCString'");
339
0
        return false;
340
0
    }
341
0
    (reply__).EndRead(iter__, (reply__).type());
342
0
343
0
    return true;
344
0
}
345
346
auto PGMPServiceChild::RemoveManagee(
347
        int32_t aProtocolId,
348
        IProtocol* aListener) -> void
349
0
{
350
0
    FatalError("unreached");
351
0
    return;
352
0
}
353
354
auto PGMPServiceChild::OnMessageReceived(const Message& msg__) -> PGMPServiceChild::Result
355
0
{
356
0
    switch ((msg__).type()) {
357
0
    case PGMPService::Msg_BeginShutdown__ID:
358
0
        {
359
0
            if (mozilla::ipc::LoggingEnabledFor("PGMPServiceChild")) {
360
0
                mozilla::ipc::LogMessageForProtocol("PGMPServiceChild", OtherPid(), "Received ", ((&(msg__)))->type(), mozilla::ipc::MessageDirection::eReceiving);
361
0
            }
362
0
            AUTO_PROFILER_LABEL("PGMPService::Msg_BeginShutdown", OTHER);
363
0
364
0
            if ((!(StateTransition(false, (&(mLivenessState)))))) {
365
0
                FatalError("Transition error");
366
0
                return MsgValueError;
367
0
            }
368
0
            if ((!(RecvBeginShutdown()))) {
369
0
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
370
0
                // Error handled in mozilla::ipc::IPCResult
371
0
                return MsgProcessingError;
372
0
            }
373
0
374
0
            return MsgProcessed;
375
0
        }
376
0
    default:
377
0
        {
378
0
            return MsgNotKnown;
379
0
        }
380
0
    case SHMEM_CREATED_MESSAGE_TYPE:
381
0
        {
382
0
            FatalError("this protocol tree does not use shmem");
383
0
            return MsgNotKnown;
384
0
        }
385
0
    case SHMEM_DESTROYED_MESSAGE_TYPE:
386
0
        {
387
0
            FatalError("this protocol tree does not use shmem");
388
0
            return MsgNotKnown;
389
0
        }
390
0
    }
391
0
}
392
393
auto PGMPServiceChild::OnMessageReceived(
394
        const Message& msg__,
395
        Message*& reply__) -> PGMPServiceChild::Result
396
0
{
397
0
    return MsgNotKnown;
398
0
}
399
400
auto PGMPServiceChild::OnCallReceived(
401
        const Message& msg__,
402
        Message*& reply__) -> PGMPServiceChild::Result
403
0
{
404
0
    MOZ_ASSERT_UNREACHABLE("message protocol not supported");
405
0
    return MsgNotKnown;
406
0
}
407
408
auto PGMPServiceChild::GetProtocolTypeId() -> int32_t
409
0
{
410
0
    return PGMPServiceMsgStart;
411
0
}
412
413
auto PGMPServiceChild::OnChannelClose() -> void
414
0
{
415
0
    DestroySubtree(NormalShutdown);
416
0
    DeallocSubtree();
417
0
    DeallocShmems();
418
0
    DeallocPGMPServiceChild();
419
0
}
420
421
auto PGMPServiceChild::OnChannelError() -> void
422
0
{
423
0
    DestroySubtree(AbnormalShutdown);
424
0
    DeallocSubtree();
425
0
    DeallocShmems();
426
0
    DeallocPGMPServiceChild();
427
0
}
428
429
auto PGMPServiceChild::DestroySubtree(ActorDestroyReason why) -> void
430
0
{
431
0
    // Reject owning pending responses.
432
0
    (GetIPCChannel())->RejectPendingResponsesForActor(this);
433
0
434
0
    // Finally, destroy "us".
435
0
    ActorDestroy(why);
436
0
}
437
438
auto PGMPServiceChild::DeallocSubtree() -> void
439
0
{
440
0
}
441
442
auto PGMPServiceChild::DeallocPGMPServiceChild() -> void
443
0
{
444
0
}
445
446
447
448
} // namespace gmp
449
} // namespace mozilla
450
namespace mozilla {
451
namespace ipc {
452
auto IPDLParamTraits<mozilla::gmp::PGMPServiceChild>::Write(
453
        IPC::Message* aMsg,
454
        mozilla::ipc::IProtocol* aActor,
455
        const paramType& aVar) -> void
456
0
{
457
0
    int32_t id;
458
0
    if ((!(aVar))) {
459
0
        id = 0;
460
0
    }
461
0
    else {
462
0
        id = (aVar)->Id();
463
0
        if ((1) == (id)) {
464
0
            (aActor)->FatalError("actor has been |delete|d");
465
0
        }
466
0
    }
467
0
    WriteIPDLParam(aMsg, aActor, id);
468
0
}
469
470
auto IPDLParamTraits<mozilla::gmp::PGMPServiceChild>::Read(
471
        const IPC::Message* aMsg,
472
        PickleIterator* aIter,
473
        mozilla::ipc::IProtocol* aActor,
474
        paramType* aVar) -> bool
475
0
{
476
0
    mozilla::Maybe<mozilla::ipc::IProtocol*> actor = (aActor)->ReadActor(aMsg, aIter, true, "PGMPService", PGMPServiceMsgStart);
477
0
    if ((actor).isNothing()) {
478
0
        return false;
479
0
    }
480
0
481
0
    (*(aVar)) = static_cast<mozilla::gmp::PGMPServiceChild*>((actor).value());
482
0
    return true;
483
0
}
484
485
} // namespace ipc
486
} // namespace mozilla