Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/ipc/ipdl/PClientSourceParent.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/dom/PClientSourceParent.h"
8
9
#include "mozilla/dom/PClientManagerParent.h"
10
#include "mozilla/dom/PClientSourceOpParent.h"
11
#include "mozilla/ipc/PIPCBlobInputStreamParent.h"
12
#include "mozilla/ipc/PChildToParentStreamParent.h"
13
#include "mozilla/ipc/PParentToChildStreamParent.h"
14
#include "mozilla/ipc/PFileDescriptorSetParent.h"
15
16
#include "nsIFile.h"
17
#include "GeckoProfiler.h"
18
19
namespace mozilla {
20
namespace dom {
21
22
23
auto PClientSourceParent::ActorDestroy(ActorDestroyReason aWhy) -> void
24
0
{
25
0
}
26
27
MOZ_IMPLICIT PClientSourceParent::PClientSourceParent() :
28
    mozilla::ipc::IProtocol(mozilla::ipc::ParentSide),
29
    mLivenessState(mozilla::ipc::LivenessState::Dead)
30
0
{
31
0
    MOZ_COUNT_CTOR(PClientSourceParent);
32
0
}
33
34
PClientSourceParent::~PClientSourceParent()
35
0
{
36
0
    MOZ_COUNT_DTOR(PClientSourceParent);
37
0
}
38
39
auto PClientSourceParent::Manager() const -> PClientManagerParent*
40
0
{
41
0
    return static_cast<PClientManagerParent*>(IProtocol::Manager());
42
0
}
43
44
auto PClientSourceParent::ManagedPClientSourceOpParent(nsTArray<PClientSourceOpParent*>& aArr) const -> void
45
0
{
46
0
    (mManagedPClientSourceOpParent).ToArray(aArr);
47
0
}
48
49
auto PClientSourceParent::ManagedPClientSourceOpParent() const -> const ManagedContainer<PClientSourceOpParent>&
50
0
{
51
0
    return mManagedPClientSourceOpParent;
52
0
}
53
54
auto PClientSourceParent::SendPClientSourceOpConstructor(const ClientOpConstructorArgs& aArgs) -> PClientSourceOpParent*
55
0
{
56
0
    return SendPClientSourceOpConstructor(AllocPClientSourceOpParent(aArgs), aArgs);
57
0
}
58
59
auto PClientSourceParent::SendPClientSourceOpConstructor(
60
        PClientSourceOpParent* actor,
61
        const ClientOpConstructorArgs& aArgs) -> PClientSourceOpParent*
62
0
{
63
0
    if ((!(actor))) {
64
0
        NS_WARNING("Error constructing actor PClientSourceOpParent");
65
0
        return nullptr;
66
0
    }
67
0
    (actor)->SetManagerAndRegister(this);
68
0
    (mManagedPClientSourceOpParent).PutEntry(actor);
69
0
    (actor)->mLivenessState = mozilla::ipc::LivenessState::Start;
70
0
71
0
    IPC::Message* msg__ = PClientSource::Msg_PClientSourceOpConstructor(Id());
72
0
73
0
    MOZ_RELEASE_ASSERT(actor, "NULL actor value passed to non-nullable param");
74
0
    WriteIPDLParam(msg__, this, actor);
75
0
    // Sentinel = 'actor'
76
0
    (msg__)->WriteSentinel(875202478);
77
0
    WriteIPDLParam(msg__, this, aArgs);
78
0
    // Sentinel = 'aArgs'
79
0
    (msg__)->WriteSentinel(424150951);
80
0
81
0
82
0
83
0
    if (mozilla::ipc::LoggingEnabledFor("PClientSourceParent")) {
84
0
        mozilla::ipc::LogMessageForProtocol("PClientSourceParent", OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending);
85
0
    }
86
0
    AUTO_PROFILER_LABEL("PClientSource::Msg_PClientSourceOpConstructor", OTHER);
87
0
    if ((!(StateTransition(false, (&(mLivenessState)))))) {
88
0
        mozilla::ipc::LogicError("Transition error");
89
0
    }
90
0
91
0
    bool sendok__ = (GetIPCChannel())->Send(msg__);
92
0
    if ((!(sendok__))) {
93
0
        IProtocol* mgr = (actor)->Manager();
94
0
        (actor)->DestroySubtree(FailedConstructor);
95
0
        (actor)->DeallocSubtree();
96
0
        (mgr)->RemoveManagee(PClientSourceOpMsgStart, actor);
97
0
        return nullptr;
98
0
    }
99
0
    return actor;
100
0
}
101
102
auto PClientSourceParent::Send__delete__(PClientSourceParent* actor) -> bool
103
0
{
104
0
    if ((!(actor))) {
105
0
        return false;
106
0
    }
107
0
108
0
    IPC::Message* msg__ = PClientSource::Msg___delete__((actor)->Id());
109
0
110
0
    MOZ_RELEASE_ASSERT(actor, "NULL actor value passed to non-nullable param");
111
0
    WriteIPDLParam(msg__, actor, actor);
112
0
    // Sentinel = 'actor'
113
0
    (msg__)->WriteSentinel(875202478);
114
0
115
0
116
0
117
0
    if (mozilla::ipc::LoggingEnabledFor("PClientSourceParent")) {
118
0
        mozilla::ipc::LogMessageForProtocol("PClientSourceParent", (actor)->OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending);
119
0
    }
120
0
    AUTO_PROFILER_LABEL("PClientSource::Msg___delete__", OTHER);
121
0
    if ((!(StateTransition(true, (&((actor)->mLivenessState)))))) {
122
0
        mozilla::ipc::LogicError("Transition error");
123
0
    }
124
0
125
0
    bool sendok__ = ((actor)->GetIPCChannel())->Send(msg__);
126
0
127
0
    IProtocol* mgr = (actor)->Manager();
128
0
    (actor)->DestroySubtree(Deletion);
129
0
    (actor)->DeallocSubtree();
130
0
    (mgr)->RemoveManagee(PClientSourceMsgStart, actor);
131
0
    return sendok__;
132
0
}
133
134
auto PClientSourceParent::RemoveManagee(
135
        int32_t aProtocolId,
136
        IProtocol* aListener) -> void
137
0
{
138
0
    switch (aProtocolId) {
139
0
    case PClientSourceOpMsgStart:
140
0
        {
141
0
            PClientSourceOpParent* actor = static_cast<PClientSourceOpParent*>(aListener);
142
0
            auto& container = mManagedPClientSourceOpParent;
143
0
            MOZ_RELEASE_ASSERT((container).Contains(actor), "actor not managed by this!");
144
0
145
0
            (container).RemoveEntry(actor);
146
0
            DeallocPClientSourceOpParent(actor);
147
0
            return;
148
0
        }
149
0
    default:
150
0
        {
151
0
            FatalError("unreached");
152
0
            return;
153
0
        }
154
0
    }
155
0
}
156
157
auto PClientSourceParent::OnMessageReceived(const Message& msg__) -> PClientSourceParent::Result
158
0
{
159
0
    switch ((msg__).type()) {
160
0
    case PClientSource::Msg_Teardown__ID:
161
0
        {
162
0
            if (mozilla::ipc::LoggingEnabledFor("PClientSourceParent")) {
163
0
                mozilla::ipc::LogMessageForProtocol("PClientSourceParent", OtherPid(), "Received ", ((&(msg__)))->type(), mozilla::ipc::MessageDirection::eReceiving);
164
0
            }
165
0
            AUTO_PROFILER_LABEL("PClientSource::Msg_Teardown", OTHER);
166
0
167
0
            if ((!(StateTransition(false, (&(mLivenessState)))))) {
168
0
                FatalError("Transition error");
169
0
                return MsgValueError;
170
0
            }
171
0
            if ((!(RecvTeardown()))) {
172
0
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
173
0
                // Error handled in mozilla::ipc::IPCResult
174
0
                return MsgProcessingError;
175
0
            }
176
0
177
0
            return MsgProcessed;
178
0
        }
179
0
    case PClientSource::Msg_ExecutionReady__ID:
180
0
        {
181
0
            if (mozilla::ipc::LoggingEnabledFor("PClientSourceParent")) {
182
0
                mozilla::ipc::LogMessageForProtocol("PClientSourceParent", OtherPid(), "Received ", ((&(msg__)))->type(), mozilla::ipc::MessageDirection::eReceiving);
183
0
            }
184
0
            AUTO_PROFILER_LABEL("PClientSource::Msg_ExecutionReady", OTHER);
185
0
186
0
            PickleIterator iter__(msg__);
187
0
            ClientSourceExecutionReadyArgs aArgs;
188
0
189
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(aArgs)))))) {
190
0
                FatalError("Error deserializing 'ClientSourceExecutionReadyArgs'");
191
0
                return MsgValueError;
192
0
            }
193
0
            // Sentinel = 'aArgs'
194
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 424150951)))) {
195
0
                mozilla::ipc::SentinelReadError("Error deserializing 'ClientSourceExecutionReadyArgs'");
196
0
                return MsgValueError;
197
0
            }
198
0
            (msg__).EndRead(iter__, (msg__).type());
199
0
            if ((!(StateTransition(false, (&(mLivenessState)))))) {
200
0
                FatalError("Transition error");
201
0
                return MsgValueError;
202
0
            }
203
0
            if ((!(RecvExecutionReady(aArgs)))) {
204
0
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
205
0
                // Error handled in mozilla::ipc::IPCResult
206
0
                return MsgProcessingError;
207
0
            }
208
0
209
0
            return MsgProcessed;
210
0
        }
211
0
    case PClientSource::Msg_Freeze__ID:
212
0
        {
213
0
            if (mozilla::ipc::LoggingEnabledFor("PClientSourceParent")) {
214
0
                mozilla::ipc::LogMessageForProtocol("PClientSourceParent", OtherPid(), "Received ", ((&(msg__)))->type(), mozilla::ipc::MessageDirection::eReceiving);
215
0
            }
216
0
            AUTO_PROFILER_LABEL("PClientSource::Msg_Freeze", OTHER);
217
0
218
0
            if ((!(StateTransition(false, (&(mLivenessState)))))) {
219
0
                FatalError("Transition error");
220
0
                return MsgValueError;
221
0
            }
222
0
            if ((!(RecvFreeze()))) {
223
0
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
224
0
                // Error handled in mozilla::ipc::IPCResult
225
0
                return MsgProcessingError;
226
0
            }
227
0
228
0
            return MsgProcessed;
229
0
        }
230
0
    case PClientSource::Msg_Thaw__ID:
231
0
        {
232
0
            if (mozilla::ipc::LoggingEnabledFor("PClientSourceParent")) {
233
0
                mozilla::ipc::LogMessageForProtocol("PClientSourceParent", OtherPid(), "Received ", ((&(msg__)))->type(), mozilla::ipc::MessageDirection::eReceiving);
234
0
            }
235
0
            AUTO_PROFILER_LABEL("PClientSource::Msg_Thaw", OTHER);
236
0
237
0
            if ((!(StateTransition(false, (&(mLivenessState)))))) {
238
0
                FatalError("Transition error");
239
0
                return MsgValueError;
240
0
            }
241
0
            if ((!(RecvThaw()))) {
242
0
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
243
0
                // Error handled in mozilla::ipc::IPCResult
244
0
                return MsgProcessingError;
245
0
            }
246
0
247
0
            return MsgProcessed;
248
0
        }
249
0
    case PClientSource::Msg_InheritController__ID:
250
0
        {
251
0
            if (mozilla::ipc::LoggingEnabledFor("PClientSourceParent")) {
252
0
                mozilla::ipc::LogMessageForProtocol("PClientSourceParent", OtherPid(), "Received ", ((&(msg__)))->type(), mozilla::ipc::MessageDirection::eReceiving);
253
0
            }
254
0
            AUTO_PROFILER_LABEL("PClientSource::Msg_InheritController", OTHER);
255
0
256
0
            PickleIterator iter__(msg__);
257
0
            ClientControlledArgs aArgs;
258
0
259
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(aArgs)))))) {
260
0
                FatalError("Error deserializing 'ClientControlledArgs'");
261
0
                return MsgValueError;
262
0
            }
263
0
            // Sentinel = 'aArgs'
264
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 424150951)))) {
265
0
                mozilla::ipc::SentinelReadError("Error deserializing 'ClientControlledArgs'");
266
0
                return MsgValueError;
267
0
            }
268
0
            (msg__).EndRead(iter__, (msg__).type());
269
0
            if ((!(StateTransition(false, (&(mLivenessState)))))) {
270
0
                FatalError("Transition error");
271
0
                return MsgValueError;
272
0
            }
273
0
            if ((!(RecvInheritController(aArgs)))) {
274
0
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
275
0
                // Error handled in mozilla::ipc::IPCResult
276
0
                return MsgProcessingError;
277
0
            }
278
0
279
0
            return MsgProcessed;
280
0
        }
281
0
    case PClientSource::Msg_NoteDOMContentLoaded__ID:
282
0
        {
283
0
            if (mozilla::ipc::LoggingEnabledFor("PClientSourceParent")) {
284
0
                mozilla::ipc::LogMessageForProtocol("PClientSourceParent", OtherPid(), "Received ", ((&(msg__)))->type(), mozilla::ipc::MessageDirection::eReceiving);
285
0
            }
286
0
            AUTO_PROFILER_LABEL("PClientSource::Msg_NoteDOMContentLoaded", OTHER);
287
0
288
0
            if ((!(StateTransition(false, (&(mLivenessState)))))) {
289
0
                FatalError("Transition error");
290
0
                return MsgValueError;
291
0
            }
292
0
            if ((!(RecvNoteDOMContentLoaded()))) {
293
0
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
294
0
                // Error handled in mozilla::ipc::IPCResult
295
0
                return MsgProcessingError;
296
0
            }
297
0
298
0
            return MsgProcessed;
299
0
        }
300
0
    case PClientSource::Reply_PClientSourceOpConstructor__ID:
301
0
        {
302
0
            return MsgProcessed;
303
0
        }
304
0
    case PClientSource::Reply___delete____ID:
305
0
        {
306
0
            return MsgProcessed;
307
0
        }
308
0
    default:
309
0
        {
310
0
            return MsgNotKnown;
311
0
        }
312
0
    }
313
0
}
314
315
auto PClientSourceParent::OnMessageReceived(
316
        const Message& msg__,
317
        Message*& reply__) -> PClientSourceParent::Result
318
0
{
319
0
    switch ((msg__).type()) {
320
0
    case PClientSource::Msg_WorkerSyncPing__ID:
321
0
        {
322
0
            if (mozilla::ipc::LoggingEnabledFor("PClientSourceParent")) {
323
0
                mozilla::ipc::LogMessageForProtocol("PClientSourceParent", OtherPid(), "Received ", ((&(msg__)))->type(), mozilla::ipc::MessageDirection::eReceiving);
324
0
            }
325
0
            AUTO_PROFILER_LABEL("PClientSource::Msg_WorkerSyncPing", OTHER);
326
0
327
0
            if ((!(StateTransition(false, (&(mLivenessState)))))) {
328
0
                FatalError("Transition error");
329
0
                return MsgValueError;
330
0
            }
331
0
            int32_t id__ = Id();
332
0
            if ((!(RecvWorkerSyncPing()))) {
333
0
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
334
0
                // Error handled in mozilla::ipc::IPCResult
335
0
                return MsgProcessingError;
336
0
            }
337
0
338
0
            reply__ = PClientSource::Reply_WorkerSyncPing(id__);
339
0
340
0
341
0
            if (mozilla::ipc::LoggingEnabledFor("PClientSourceParent")) {
342
0
                mozilla::ipc::LogMessageForProtocol("PClientSourceParent", OtherPid(), "Sending reply ", (reply__)->type(), mozilla::ipc::MessageDirection::eSending);
343
0
            }
344
0
            return MsgProcessed;
345
0
        }
346
0
    default:
347
0
        {
348
0
            return MsgNotKnown;
349
0
        }
350
0
    }
351
0
}
352
353
auto PClientSourceParent::OnCallReceived(
354
        const Message& msg__,
355
        Message*& reply__) -> PClientSourceParent::Result
356
0
{
357
0
    MOZ_ASSERT_UNREACHABLE("message protocol not supported");
358
0
    return MsgNotKnown;
359
0
}
360
361
auto PClientSourceParent::GetProtocolTypeId() -> int32_t
362
0
{
363
0
    return PClientSourceMsgStart;
364
0
}
365
366
auto PClientSourceParent::DestroySubtree(ActorDestroyReason why) -> void
367
0
{
368
0
    // Unregister from our manager.
369
0
    Unregister(Id());
370
0
371
0
    ActorDestroyReason subtreewhy = (((why) == (Deletion)) || ((why) == (FailedConstructor)) ? AncestorDeletion : why);
372
0
373
0
    {
374
0
        // Recursively shutting down PClientSourceOp kids
375
0
        nsTArray<PClientSourceOpParent*> kids;
376
0
        // Accumulate kids into a stable structure to iterate over
377
0
        ManagedPClientSourceOpParent(kids);
378
0
        for (auto& kid : kids) {
379
0
            // Guarding against a child removing a sibling from the list during the iteration.
380
0
            if ((mManagedPClientSourceOpParent).Contains(kid)) {
381
0
                (kid)->DestroySubtree(subtreewhy);
382
0
            }
383
0
        }
384
0
    }
385
0
386
0
    // Reject owning pending responses.
387
0
    (GetIPCChannel())->RejectPendingResponsesForActor(this);
388
0
389
0
    // Finally, destroy "us".
390
0
    ActorDestroy(why);
391
0
}
392
393
auto PClientSourceParent::DeallocSubtree() -> void
394
0
{
395
0
    {
396
0
        // Recursively deleting PClientSourceOp kids
397
0
        for (auto iter = (mManagedPClientSourceOpParent).Iter(); (!((iter).Done())); (iter).Next()) {
398
0
            (((iter).Get())->GetKey())->DeallocSubtree();
399
0
        }
400
0
401
0
        for (auto iter = (mManagedPClientSourceOpParent).Iter(); (!((iter).Done())); (iter).Next()) {
402
0
            DeallocPClientSourceOpParent(((iter).Get())->GetKey());
403
0
        }
404
0
        (mManagedPClientSourceOpParent).Clear();
405
0
    }
406
0
}
407
408
409
410
} // namespace dom
411
} // namespace mozilla
412
namespace mozilla {
413
namespace ipc {
414
auto IPDLParamTraits<mozilla::dom::PClientSourceParent>::Write(
415
        IPC::Message* aMsg,
416
        mozilla::ipc::IProtocol* aActor,
417
        const paramType& aVar) -> void
418
0
{
419
0
    int32_t id;
420
0
    if ((!(aVar))) {
421
0
        id = 0;
422
0
    }
423
0
    else {
424
0
        id = (aVar)->Id();
425
0
        if ((1) == (id)) {
426
0
            (aActor)->FatalError("actor has been |delete|d");
427
0
        }
428
0
    }
429
0
    WriteIPDLParam(aMsg, aActor, id);
430
0
}
431
432
auto IPDLParamTraits<mozilla::dom::PClientSourceParent>::Read(
433
        const IPC::Message* aMsg,
434
        PickleIterator* aIter,
435
        mozilla::ipc::IProtocol* aActor,
436
        paramType* aVar) -> bool
437
0
{
438
0
    mozilla::Maybe<mozilla::ipc::IProtocol*> actor = (aActor)->ReadActor(aMsg, aIter, true, "PClientSource", PClientSourceMsgStart);
439
0
    if ((actor).isNothing()) {
440
0
        return false;
441
0
    }
442
0
443
0
    (*(aVar)) = static_cast<mozilla::dom::PClientSourceParent*>((actor).value());
444
0
    return true;
445
0
}
446
447
} // namespace ipc
448
} // namespace mozilla