Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/ipc/ipdl/PGamepadEventChannelParent.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/PGamepadEventChannelParent.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 PGamepadEventChannelParent::ActorDestroy(ActorDestroyReason aWhy) -> void
19
0
{
20
0
}
21
22
MOZ_IMPLICIT PGamepadEventChannelParent::PGamepadEventChannelParent() :
23
    mozilla::ipc::IProtocol(mozilla::ipc::ParentSide),
24
    mLivenessState(mozilla::ipc::LivenessState::Dead)
25
0
{
26
0
    MOZ_COUNT_CTOR(PGamepadEventChannelParent);
27
0
}
28
29
PGamepadEventChannelParent::~PGamepadEventChannelParent()
30
0
{
31
0
    MOZ_COUNT_DTOR(PGamepadEventChannelParent);
32
0
}
33
34
auto PGamepadEventChannelParent::Manager() const -> PBackgroundParent*
35
0
{
36
0
    return static_cast<PBackgroundParent*>(IProtocol::Manager());
37
0
}
38
39
auto PGamepadEventChannelParent::Send__delete__(PGamepadEventChannelParent* actor) -> bool
40
0
{
41
0
    if ((!(actor))) {
42
0
        return false;
43
0
    }
44
0
45
0
    IPC::Message* msg__ = PGamepadEventChannel::Msg___delete__((actor)->Id());
46
0
47
0
    MOZ_RELEASE_ASSERT(actor, "NULL actor value passed to non-nullable param");
48
0
    WriteIPDLParam(msg__, actor, actor);
49
0
    // Sentinel = 'actor'
50
0
    (msg__)->WriteSentinel(875202478);
51
0
52
0
53
0
54
0
    if (mozilla::ipc::LoggingEnabledFor("PGamepadEventChannelParent")) {
55
0
        mozilla::ipc::LogMessageForProtocol("PGamepadEventChannelParent", (actor)->OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending);
56
0
    }
57
0
    AUTO_PROFILER_LABEL("PGamepadEventChannel::Msg___delete__", OTHER);
58
0
    if ((!(StateTransition(true, (&((actor)->mLivenessState)))))) {
59
0
        mozilla::ipc::LogicError("Transition error");
60
0
    }
61
0
62
0
    bool sendok__ = ((actor)->GetIPCChannel())->Send(msg__);
63
0
64
0
    IProtocol* mgr = (actor)->Manager();
65
0
    (actor)->DestroySubtree(Deletion);
66
0
    (actor)->DeallocSubtree();
67
0
    (mgr)->RemoveManagee(PGamepadEventChannelMsgStart, actor);
68
0
    return sendok__;
69
0
}
70
71
auto PGamepadEventChannelParent::SendGamepadUpdate(const GamepadChangeEvent& aGamepadEvent) -> bool
72
0
{
73
0
    IPC::Message* msg__ = PGamepadEventChannel::Msg_GamepadUpdate(Id());
74
0
75
0
    WriteIPDLParam(msg__, this, aGamepadEvent);
76
0
    // Sentinel = 'aGamepadEvent'
77
0
    (msg__)->WriteSentinel(1167032459);
78
0
79
0
80
0
81
0
82
0
    if (mozilla::ipc::LoggingEnabledFor("PGamepadEventChannelParent")) {
83
0
        mozilla::ipc::LogMessageForProtocol("PGamepadEventChannelParent", OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending);
84
0
    }
85
0
    AUTO_PROFILER_LABEL("PGamepadEventChannel::Msg_GamepadUpdate", OTHER);
86
0
    if ((!(StateTransition(false, (&(mLivenessState)))))) {
87
0
        mozilla::ipc::LogicError("Transition error");
88
0
    }
89
0
90
0
    bool sendok__ = (GetIPCChannel())->Send(msg__);
91
0
    return sendok__;
92
0
}
93
94
auto PGamepadEventChannelParent::SendReplyGamepadVibrateHaptic(const uint32_t& aPromiseID) -> bool
95
0
{
96
0
    IPC::Message* msg__ = PGamepadEventChannel::Msg_ReplyGamepadVibrateHaptic(Id());
97
0
98
0
    WriteIPDLParam(msg__, this, aPromiseID);
99
0
    // Sentinel = 'aPromiseID'
100
0
    (msg__)->WriteSentinel(1396174117);
101
0
102
0
103
0
104
0
105
0
    if (mozilla::ipc::LoggingEnabledFor("PGamepadEventChannelParent")) {
106
0
        mozilla::ipc::LogMessageForProtocol("PGamepadEventChannelParent", OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending);
107
0
    }
108
0
    AUTO_PROFILER_LABEL("PGamepadEventChannel::Msg_ReplyGamepadVibrateHaptic", OTHER);
109
0
    if ((!(StateTransition(false, (&(mLivenessState)))))) {
110
0
        mozilla::ipc::LogicError("Transition error");
111
0
    }
112
0
113
0
    bool sendok__ = (GetIPCChannel())->Send(msg__);
114
0
    return sendok__;
115
0
}
116
117
auto PGamepadEventChannelParent::RemoveManagee(
118
        int32_t aProtocolId,
119
        IProtocol* aListener) -> void
120
0
{
121
0
    FatalError("unreached");
122
0
    return;
123
0
}
124
125
auto PGamepadEventChannelParent::OnMessageReceived(const Message& msg__) -> PGamepadEventChannelParent::Result
126
0
{
127
0
    switch ((msg__).type()) {
128
0
    case PGamepadEventChannel::Msg_GamepadListenerAdded__ID:
129
0
        {
130
0
            if (mozilla::ipc::LoggingEnabledFor("PGamepadEventChannelParent")) {
131
0
                mozilla::ipc::LogMessageForProtocol("PGamepadEventChannelParent", OtherPid(), "Received ", ((&(msg__)))->type(), mozilla::ipc::MessageDirection::eReceiving);
132
0
            }
133
0
            AUTO_PROFILER_LABEL("PGamepadEventChannel::Msg_GamepadListenerAdded", OTHER);
134
0
135
0
            if ((!(StateTransition(false, (&(mLivenessState)))))) {
136
0
                FatalError("Transition error");
137
0
                return MsgValueError;
138
0
            }
139
0
            if ((!(RecvGamepadListenerAdded()))) {
140
0
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
141
0
                // Error handled in mozilla::ipc::IPCResult
142
0
                return MsgProcessingError;
143
0
            }
144
0
145
0
            return MsgProcessed;
146
0
        }
147
0
    case PGamepadEventChannel::Msg_GamepadListenerRemoved__ID:
148
0
        {
149
0
            if (mozilla::ipc::LoggingEnabledFor("PGamepadEventChannelParent")) {
150
0
                mozilla::ipc::LogMessageForProtocol("PGamepadEventChannelParent", OtherPid(), "Received ", ((&(msg__)))->type(), mozilla::ipc::MessageDirection::eReceiving);
151
0
            }
152
0
            AUTO_PROFILER_LABEL("PGamepadEventChannel::Msg_GamepadListenerRemoved", OTHER);
153
0
154
0
            if ((!(StateTransition(false, (&(mLivenessState)))))) {
155
0
                FatalError("Transition error");
156
0
                return MsgValueError;
157
0
            }
158
0
            if ((!(RecvGamepadListenerRemoved()))) {
159
0
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
160
0
                // Error handled in mozilla::ipc::IPCResult
161
0
                return MsgProcessingError;
162
0
            }
163
0
164
0
            return MsgProcessed;
165
0
        }
166
0
    case PGamepadEventChannel::Msg_VibrateHaptic__ID:
167
0
        {
168
0
            if (mozilla::ipc::LoggingEnabledFor("PGamepadEventChannelParent")) {
169
0
                mozilla::ipc::LogMessageForProtocol("PGamepadEventChannelParent", OtherPid(), "Received ", ((&(msg__)))->type(), mozilla::ipc::MessageDirection::eReceiving);
170
0
            }
171
0
            AUTO_PROFILER_LABEL("PGamepadEventChannel::Msg_VibrateHaptic", OTHER);
172
0
173
0
            PickleIterator iter__(msg__);
174
0
            uint32_t aControllerIdx;
175
0
            uint32_t aHapticIndex;
176
0
            double aIntensity;
177
0
            double aDuration;
178
0
            uint32_t aPromiseID;
179
0
180
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(aControllerIdx)))))) {
181
0
                FatalError("Error deserializing 'uint32_t'");
182
0
                return MsgValueError;
183
0
            }
184
0
            // Sentinel = 'aControllerIdx'
185
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 1525026068)))) {
186
0
                mozilla::ipc::SentinelReadError("Error deserializing 'uint32_t'");
187
0
                return MsgValueError;
188
0
            }
189
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(aHapticIndex)))))) {
190
0
                FatalError("Error deserializing 'uint32_t'");
191
0
                return MsgValueError;
192
0
            }
193
0
            // Sentinel = 'aHapticIndex'
194
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 3997306204)))) {
195
0
                mozilla::ipc::SentinelReadError("Error deserializing 'uint32_t'");
196
0
                return MsgValueError;
197
0
            }
198
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(aIntensity)))))) {
199
0
                FatalError("Error deserializing 'double'");
200
0
                return MsgValueError;
201
0
            }
202
0
            // Sentinel = 'aIntensity'
203
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 701797642)))) {
204
0
                mozilla::ipc::SentinelReadError("Error deserializing 'double'");
205
0
                return MsgValueError;
206
0
            }
207
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(aDuration)))))) {
208
0
                FatalError("Error deserializing 'double'");
209
0
                return MsgValueError;
210
0
            }
211
0
            // Sentinel = 'aDuration'
212
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 3213285508)))) {
213
0
                mozilla::ipc::SentinelReadError("Error deserializing 'double'");
214
0
                return MsgValueError;
215
0
            }
216
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(aPromiseID)))))) {
217
0
                FatalError("Error deserializing 'uint32_t'");
218
0
                return MsgValueError;
219
0
            }
220
0
            // Sentinel = 'aPromiseID'
221
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 1396174117)))) {
222
0
                mozilla::ipc::SentinelReadError("Error deserializing 'uint32_t'");
223
0
                return MsgValueError;
224
0
            }
225
0
            (msg__).EndRead(iter__, (msg__).type());
226
0
            if ((!(StateTransition(false, (&(mLivenessState)))))) {
227
0
                FatalError("Transition error");
228
0
                return MsgValueError;
229
0
            }
230
0
            if ((!(RecvVibrateHaptic(aControllerIdx, aHapticIndex, aIntensity, aDuration, aPromiseID)))) {
231
0
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
232
0
                // Error handled in mozilla::ipc::IPCResult
233
0
                return MsgProcessingError;
234
0
            }
235
0
236
0
            return MsgProcessed;
237
0
        }
238
0
    case PGamepadEventChannel::Msg_StopVibrateHaptic__ID:
239
0
        {
240
0
            if (mozilla::ipc::LoggingEnabledFor("PGamepadEventChannelParent")) {
241
0
                mozilla::ipc::LogMessageForProtocol("PGamepadEventChannelParent", OtherPid(), "Received ", ((&(msg__)))->type(), mozilla::ipc::MessageDirection::eReceiving);
242
0
            }
243
0
            AUTO_PROFILER_LABEL("PGamepadEventChannel::Msg_StopVibrateHaptic", OTHER);
244
0
245
0
            PickleIterator iter__(msg__);
246
0
            uint32_t aGamepadIndex;
247
0
248
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(aGamepadIndex)))))) {
249
0
                FatalError("Error deserializing 'uint32_t'");
250
0
                return MsgValueError;
251
0
            }
252
0
            // Sentinel = 'aGamepadIndex'
253
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 952744851)))) {
254
0
                mozilla::ipc::SentinelReadError("Error deserializing 'uint32_t'");
255
0
                return MsgValueError;
256
0
            }
257
0
            (msg__).EndRead(iter__, (msg__).type());
258
0
            if ((!(StateTransition(false, (&(mLivenessState)))))) {
259
0
                FatalError("Transition error");
260
0
                return MsgValueError;
261
0
            }
262
0
            if ((!(RecvStopVibrateHaptic(aGamepadIndex)))) {
263
0
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
264
0
                // Error handled in mozilla::ipc::IPCResult
265
0
                return MsgProcessingError;
266
0
            }
267
0
268
0
            return MsgProcessed;
269
0
        }
270
0
    case PGamepadEventChannel::Reply___delete____ID:
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 PGamepadEventChannelParent::OnMessageReceived(
282
        const Message& msg__,
283
        Message*& reply__) -> PGamepadEventChannelParent::Result
284
0
{
285
0
    return MsgNotKnown;
286
0
}
287
288
auto PGamepadEventChannelParent::OnCallReceived(
289
        const Message& msg__,
290
        Message*& reply__) -> PGamepadEventChannelParent::Result
291
0
{
292
0
    MOZ_ASSERT_UNREACHABLE("message protocol not supported");
293
0
    return MsgNotKnown;
294
0
}
295
296
auto PGamepadEventChannelParent::GetProtocolTypeId() -> int32_t
297
0
{
298
0
    return PGamepadEventChannelMsgStart;
299
0
}
300
301
auto PGamepadEventChannelParent::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 PGamepadEventChannelParent::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::PGamepadEventChannelParent>::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::PGamepadEventChannelParent>::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, "PGamepadEventChannel", PGamepadEventChannelMsgStart);
348
0
    if ((actor).isNothing()) {
349
0
        return false;
350
0
    }
351
0
352
0
    (*(aVar)) = static_cast<mozilla::dom::PGamepadEventChannelParent*>((actor).value());
353
0
    return true;
354
0
}
355
356
} // namespace ipc
357
} // namespace mozilla