Coverage Report

Created: 2018-09-25 14:53

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