Coverage Report

Created: 2018-09-25 14:53

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