Coverage Report

Created: 2018-09-25 14:53

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