Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/ipc/ipdl/PMIDIPortChild.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/PMIDIPortChild.h"
8
9
#include "mozilla/ipc/PBackgroundChild.h"
10
11
#include "nsIFile.h"
12
#include "GeckoProfiler.h"
13
14
namespace mozilla {
15
namespace dom {
16
17
18
auto PMIDIPortChild::Recv__delete__() -> mozilla::ipc::IPCResult
19
0
{
20
0
    return IPC_OK();
21
0
}
22
23
auto PMIDIPortChild::ActorDestroy(ActorDestroyReason aWhy) -> void
24
0
{
25
0
}
26
27
MOZ_IMPLICIT PMIDIPortChild::PMIDIPortChild() :
28
    mozilla::ipc::IProtocol(mozilla::ipc::ChildSide),
29
    mLivenessState(mozilla::ipc::LivenessState::Dead)
30
0
{
31
0
    MOZ_COUNT_CTOR(PMIDIPortChild);
32
0
}
33
34
PMIDIPortChild::~PMIDIPortChild()
35
0
{
36
0
    MOZ_COUNT_DTOR(PMIDIPortChild);
37
0
}
38
39
auto PMIDIPortChild::Manager() const -> PBackgroundChild*
40
0
{
41
0
    return static_cast<PBackgroundChild*>(IProtocol::Manager());
42
0
}
43
44
auto PMIDIPortChild::SendShutdown() -> bool
45
0
{
46
0
    IPC::Message* msg__ = PMIDIPort::Msg_Shutdown(Id());
47
0
48
0
49
0
50
0
51
0
52
0
    if (mozilla::ipc::LoggingEnabledFor("PMIDIPortChild")) {
53
0
        mozilla::ipc::LogMessageForProtocol("PMIDIPortChild", OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending);
54
0
    }
55
0
    AUTO_PROFILER_LABEL("PMIDIPort::Msg_Shutdown", OTHER);
56
0
    if ((!(StateTransition(false, (&(mLivenessState)))))) {
57
0
        mozilla::ipc::LogicError("Transition error");
58
0
    }
59
0
60
0
    bool sendok__ = (GetIPCChannel())->Send(msg__);
61
0
    return sendok__;
62
0
}
63
64
auto PMIDIPortChild::SendSend(const nsTArray<MIDIMessage>& msg) -> bool
65
0
{
66
0
    IPC::Message* msg__ = PMIDIPort::Msg_Send(Id());
67
0
68
0
    WriteIPDLParam(msg__, this, msg);
69
0
    // Sentinel = 'msg'
70
0
    (msg__)->WriteSentinel(2050943288);
71
0
72
0
73
0
74
0
75
0
    if (mozilla::ipc::LoggingEnabledFor("PMIDIPortChild")) {
76
0
        mozilla::ipc::LogMessageForProtocol("PMIDIPortChild", OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending);
77
0
    }
78
0
    AUTO_PROFILER_LABEL("PMIDIPort::Msg_Send", OTHER);
79
0
    if ((!(StateTransition(false, (&(mLivenessState)))))) {
80
0
        mozilla::ipc::LogicError("Transition error");
81
0
    }
82
0
83
0
    bool sendok__ = (GetIPCChannel())->Send(msg__);
84
0
    return sendok__;
85
0
}
86
87
auto PMIDIPortChild::SendOpen() -> bool
88
0
{
89
0
    IPC::Message* msg__ = PMIDIPort::Msg_Open(Id());
90
0
91
0
92
0
93
0
94
0
95
0
    if (mozilla::ipc::LoggingEnabledFor("PMIDIPortChild")) {
96
0
        mozilla::ipc::LogMessageForProtocol("PMIDIPortChild", OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending);
97
0
    }
98
0
    AUTO_PROFILER_LABEL("PMIDIPort::Msg_Open", OTHER);
99
0
    if ((!(StateTransition(false, (&(mLivenessState)))))) {
100
0
        mozilla::ipc::LogicError("Transition error");
101
0
    }
102
0
103
0
    bool sendok__ = (GetIPCChannel())->Send(msg__);
104
0
    return sendok__;
105
0
}
106
107
auto PMIDIPortChild::SendClose() -> bool
108
0
{
109
0
    IPC::Message* msg__ = PMIDIPort::Msg_Close(Id());
110
0
111
0
112
0
113
0
114
0
115
0
    if (mozilla::ipc::LoggingEnabledFor("PMIDIPortChild")) {
116
0
        mozilla::ipc::LogMessageForProtocol("PMIDIPortChild", OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending);
117
0
    }
118
0
    AUTO_PROFILER_LABEL("PMIDIPort::Msg_Close", OTHER);
119
0
    if ((!(StateTransition(false, (&(mLivenessState)))))) {
120
0
        mozilla::ipc::LogicError("Transition error");
121
0
    }
122
0
123
0
    bool sendok__ = (GetIPCChannel())->Send(msg__);
124
0
    return sendok__;
125
0
}
126
127
auto PMIDIPortChild::SendClear() -> bool
128
0
{
129
0
    IPC::Message* msg__ = PMIDIPort::Msg_Clear(Id());
130
0
131
0
132
0
133
0
134
0
135
0
    if (mozilla::ipc::LoggingEnabledFor("PMIDIPortChild")) {
136
0
        mozilla::ipc::LogMessageForProtocol("PMIDIPortChild", OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending);
137
0
    }
138
0
    AUTO_PROFILER_LABEL("PMIDIPort::Msg_Clear", OTHER);
139
0
    if ((!(StateTransition(false, (&(mLivenessState)))))) {
140
0
        mozilla::ipc::LogicError("Transition error");
141
0
    }
142
0
143
0
    bool sendok__ = (GetIPCChannel())->Send(msg__);
144
0
    return sendok__;
145
0
}
146
147
auto PMIDIPortChild::RemoveManagee(
148
        int32_t aProtocolId,
149
        IProtocol* aListener) -> void
150
0
{
151
0
    FatalError("unreached");
152
0
    return;
153
0
}
154
155
auto PMIDIPortChild::OnMessageReceived(const Message& msg__) -> PMIDIPortChild::Result
156
0
{
157
0
    switch ((msg__).type()) {
158
0
    case PMIDIPort::Msg_Receive__ID:
159
0
        {
160
0
            if (mozilla::ipc::LoggingEnabledFor("PMIDIPortChild")) {
161
0
                mozilla::ipc::LogMessageForProtocol("PMIDIPortChild", OtherPid(), "Received ", ((&(msg__)))->type(), mozilla::ipc::MessageDirection::eReceiving);
162
0
            }
163
0
            AUTO_PROFILER_LABEL("PMIDIPort::Msg_Receive", OTHER);
164
0
165
0
            PickleIterator iter__(msg__);
166
0
            nsTArray<MIDIMessage> msg;
167
0
168
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(msg)))))) {
169
0
                FatalError("Error deserializing 'nsTArray'");
170
0
                return MsgValueError;
171
0
            }
172
0
            // Sentinel = 'msg'
173
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 2050943288)))) {
174
0
                mozilla::ipc::SentinelReadError("Error deserializing 'nsTArray'");
175
0
                return MsgValueError;
176
0
            }
177
0
            (msg__).EndRead(iter__, (msg__).type());
178
0
            if ((!(StateTransition(false, (&(mLivenessState)))))) {
179
0
                FatalError("Transition error");
180
0
                return MsgValueError;
181
0
            }
182
0
            if ((!(RecvReceive(std::move(msg))))) {
183
0
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
184
0
                // Error handled in mozilla::ipc::IPCResult
185
0
                return MsgProcessingError;
186
0
            }
187
0
188
0
            return MsgProcessed;
189
0
        }
190
0
    case PMIDIPort::Msg_UpdateStatus__ID:
191
0
        {
192
0
            if (mozilla::ipc::LoggingEnabledFor("PMIDIPortChild")) {
193
0
                mozilla::ipc::LogMessageForProtocol("PMIDIPortChild", OtherPid(), "Received ", ((&(msg__)))->type(), mozilla::ipc::MessageDirection::eReceiving);
194
0
            }
195
0
            AUTO_PROFILER_LABEL("PMIDIPort::Msg_UpdateStatus", OTHER);
196
0
197
0
            PickleIterator iter__(msg__);
198
0
            uint32_t deviceState;
199
0
            uint32_t connectionState;
200
0
201
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(deviceState)))))) {
202
0
                FatalError("Error deserializing 'uint32_t'");
203
0
                return MsgValueError;
204
0
            }
205
0
            // Sentinel = 'deviceState'
206
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 238582270)))) {
207
0
                mozilla::ipc::SentinelReadError("Error deserializing 'uint32_t'");
208
0
                return MsgValueError;
209
0
            }
210
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(connectionState)))))) {
211
0
                FatalError("Error deserializing 'uint32_t'");
212
0
                return MsgValueError;
213
0
            }
214
0
            // Sentinel = 'connectionState'
215
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 1532711696)))) {
216
0
                mozilla::ipc::SentinelReadError("Error deserializing 'uint32_t'");
217
0
                return MsgValueError;
218
0
            }
219
0
            (msg__).EndRead(iter__, (msg__).type());
220
0
            if ((!(StateTransition(false, (&(mLivenessState)))))) {
221
0
                FatalError("Transition error");
222
0
                return MsgValueError;
223
0
            }
224
0
            if ((!(RecvUpdateStatus(deviceState, connectionState)))) {
225
0
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
226
0
                // Error handled in mozilla::ipc::IPCResult
227
0
                return MsgProcessingError;
228
0
            }
229
0
230
0
            return MsgProcessed;
231
0
        }
232
0
    case PMIDIPort::Msg___delete____ID:
233
0
        {
234
0
            if (mozilla::ipc::LoggingEnabledFor("PMIDIPortChild")) {
235
0
                mozilla::ipc::LogMessageForProtocol("PMIDIPortChild", OtherPid(), "Received ", ((&(msg__)))->type(), mozilla::ipc::MessageDirection::eReceiving);
236
0
            }
237
0
            AUTO_PROFILER_LABEL("PMIDIPort::Msg___delete__", OTHER);
238
0
239
0
            PickleIterator iter__(msg__);
240
0
            PMIDIPortChild* actor;
241
0
242
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(actor)))))) {
243
0
                FatalError("Error deserializing 'PMIDIPortChild'");
244
0
                return MsgValueError;
245
0
            }
246
0
            if ((!((*((&(actor))))))) {
247
0
                FatalError("Error deserializing 'PMIDIPortChild'");
248
0
                return MsgValueError;
249
0
            }
250
0
            // Sentinel = 'actor'
251
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 875202478)))) {
252
0
                mozilla::ipc::SentinelReadError("Error deserializing 'PMIDIPortChild'");
253
0
                return MsgValueError;
254
0
            }
255
0
            (msg__).EndRead(iter__, (msg__).type());
256
0
            if ((!(StateTransition(true, (&(mLivenessState)))))) {
257
0
                FatalError("Transition error");
258
0
                return MsgValueError;
259
0
            }
260
0
            if ((!(Recv__delete__()))) {
261
0
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
262
0
                // Error handled in mozilla::ipc::IPCResult
263
0
                return MsgProcessingError;
264
0
            }
265
0
266
0
267
0
            IProtocol* mgr = (actor)->Manager();
268
0
            (actor)->DestroySubtree(Deletion);
269
0
            (actor)->DeallocSubtree();
270
0
            (mgr)->RemoveManagee(PMIDIPortMsgStart, actor);
271
0
272
0
            return MsgProcessed;
273
0
        }
274
0
    default:
275
0
        {
276
0
            return MsgNotKnown;
277
0
        }
278
0
    }
279
0
}
280
281
auto PMIDIPortChild::OnMessageReceived(
282
        const Message& msg__,
283
        Message*& reply__) -> PMIDIPortChild::Result
284
0
{
285
0
    return MsgNotKnown;
286
0
}
287
288
auto PMIDIPortChild::OnCallReceived(
289
        const Message& msg__,
290
        Message*& reply__) -> PMIDIPortChild::Result
291
0
{
292
0
    MOZ_ASSERT_UNREACHABLE("message protocol not supported");
293
0
    return MsgNotKnown;
294
0
}
295
296
auto PMIDIPortChild::GetProtocolTypeId() -> int32_t
297
0
{
298
0
    return PMIDIPortMsgStart;
299
0
}
300
301
auto PMIDIPortChild::DestroySubtree(ActorDestroyReason why) -> void
302
0
{
303
0
    // Unregister from our manager.
304
0
    Unregister(Id());
305
0
306
0
    // Reject owning pending responses.
307
0
    (GetIPCChannel())->RejectPendingResponsesForActor(this);
308
0
309
0
    // Finally, destroy "us".
310
0
    ActorDestroy(why);
311
0
}
312
313
auto PMIDIPortChild::DeallocSubtree() -> void
314
0
{
315
0
}
316
317
318
319
} // namespace dom
320
} // namespace mozilla
321
namespace mozilla {
322
namespace ipc {
323
auto IPDLParamTraits<mozilla::dom::PMIDIPortChild>::Write(
324
        IPC::Message* aMsg,
325
        mozilla::ipc::IProtocol* aActor,
326
        const paramType& aVar) -> void
327
0
{
328
0
    int32_t id;
329
0
    if ((!(aVar))) {
330
0
        id = 0;
331
0
    }
332
0
    else {
333
0
        id = (aVar)->Id();
334
0
        if ((1) == (id)) {
335
0
            (aActor)->FatalError("actor has been |delete|d");
336
0
        }
337
0
    }
338
0
    WriteIPDLParam(aMsg, aActor, id);
339
0
}
340
341
auto IPDLParamTraits<mozilla::dom::PMIDIPortChild>::Read(
342
        const IPC::Message* aMsg,
343
        PickleIterator* aIter,
344
        mozilla::ipc::IProtocol* aActor,
345
        paramType* aVar) -> bool
346
0
{
347
0
    mozilla::Maybe<mozilla::ipc::IProtocol*> actor = (aActor)->ReadActor(aMsg, aIter, true, "PMIDIPort", PMIDIPortMsgStart);
348
0
    if ((actor).isNothing()) {
349
0
        return false;
350
0
    }
351
0
352
0
    (*(aVar)) = static_cast<mozilla::dom::PMIDIPortChild*>((actor).value());
353
0
    return true;
354
0
}
355
356
} // namespace ipc
357
} // namespace mozilla