Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/ipc/ipdl/PGamepadEventChannelChild.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/PGamepadEventChannelChild.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 PGamepadEventChannelChild::Recv__delete__() -> mozilla::ipc::IPCResult
19
0
{
20
0
    return IPC_OK();
21
0
}
22
23
auto PGamepadEventChannelChild::ActorDestroy(ActorDestroyReason aWhy) -> void
24
0
{
25
0
}
26
27
MOZ_IMPLICIT PGamepadEventChannelChild::PGamepadEventChannelChild() :
28
    mozilla::ipc::IProtocol(mozilla::ipc::ChildSide),
29
    mLivenessState(mozilla::ipc::LivenessState::Dead)
30
0
{
31
0
    MOZ_COUNT_CTOR(PGamepadEventChannelChild);
32
0
}
33
34
PGamepadEventChannelChild::~PGamepadEventChannelChild()
35
0
{
36
0
    MOZ_COUNT_DTOR(PGamepadEventChannelChild);
37
0
}
38
39
auto PGamepadEventChannelChild::Manager() const -> PBackgroundChild*
40
0
{
41
0
    return static_cast<PBackgroundChild*>(IProtocol::Manager());
42
0
}
43
44
auto PGamepadEventChannelChild::SendGamepadListenerAdded() -> bool
45
0
{
46
0
    IPC::Message* msg__ = PGamepadEventChannel::Msg_GamepadListenerAdded(Id());
47
0
48
0
49
0
50
0
51
0
52
0
    if (mozilla::ipc::LoggingEnabledFor("PGamepadEventChannelChild")) {
53
0
        mozilla::ipc::LogMessageForProtocol("PGamepadEventChannelChild", OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending);
54
0
    }
55
0
    AUTO_PROFILER_LABEL("PGamepadEventChannel::Msg_GamepadListenerAdded", 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 PGamepadEventChannelChild::SendGamepadListenerRemoved() -> bool
65
0
{
66
0
    IPC::Message* msg__ = PGamepadEventChannel::Msg_GamepadListenerRemoved(Id());
67
0
68
0
69
0
70
0
71
0
72
0
    if (mozilla::ipc::LoggingEnabledFor("PGamepadEventChannelChild")) {
73
0
        mozilla::ipc::LogMessageForProtocol("PGamepadEventChannelChild", OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending);
74
0
    }
75
0
    AUTO_PROFILER_LABEL("PGamepadEventChannel::Msg_GamepadListenerRemoved", OTHER);
76
0
    if ((!(StateTransition(false, (&(mLivenessState)))))) {
77
0
        mozilla::ipc::LogicError("Transition error");
78
0
    }
79
0
80
0
    bool sendok__ = (GetIPCChannel())->Send(msg__);
81
0
    return sendok__;
82
0
}
83
84
auto PGamepadEventChannelChild::SendVibrateHaptic(
85
        const uint32_t& aControllerIdx,
86
        const uint32_t& aHapticIndex,
87
        const double& aIntensity,
88
        const double& aDuration,
89
        const uint32_t& aPromiseID) -> bool
90
0
{
91
0
    IPC::Message* msg__ = PGamepadEventChannel::Msg_VibrateHaptic(Id());
92
0
93
0
    WriteIPDLParam(msg__, this, aControllerIdx);
94
0
    // Sentinel = 'aControllerIdx'
95
0
    (msg__)->WriteSentinel(1525026068);
96
0
    WriteIPDLParam(msg__, this, aHapticIndex);
97
0
    // Sentinel = 'aHapticIndex'
98
0
    (msg__)->WriteSentinel(3997306204);
99
0
    WriteIPDLParam(msg__, this, aIntensity);
100
0
    // Sentinel = 'aIntensity'
101
0
    (msg__)->WriteSentinel(701797642);
102
0
    WriteIPDLParam(msg__, this, aDuration);
103
0
    // Sentinel = 'aDuration'
104
0
    (msg__)->WriteSentinel(3213285508);
105
0
    WriteIPDLParam(msg__, this, aPromiseID);
106
0
    // Sentinel = 'aPromiseID'
107
0
    (msg__)->WriteSentinel(1396174117);
108
0
109
0
110
0
111
0
112
0
    if (mozilla::ipc::LoggingEnabledFor("PGamepadEventChannelChild")) {
113
0
        mozilla::ipc::LogMessageForProtocol("PGamepadEventChannelChild", OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending);
114
0
    }
115
0
    AUTO_PROFILER_LABEL("PGamepadEventChannel::Msg_VibrateHaptic", OTHER);
116
0
    if ((!(StateTransition(false, (&(mLivenessState)))))) {
117
0
        mozilla::ipc::LogicError("Transition error");
118
0
    }
119
0
120
0
    bool sendok__ = (GetIPCChannel())->Send(msg__);
121
0
    return sendok__;
122
0
}
123
124
auto PGamepadEventChannelChild::SendStopVibrateHaptic(const uint32_t& aGamepadIndex) -> bool
125
0
{
126
0
    IPC::Message* msg__ = PGamepadEventChannel::Msg_StopVibrateHaptic(Id());
127
0
128
0
    WriteIPDLParam(msg__, this, aGamepadIndex);
129
0
    // Sentinel = 'aGamepadIndex'
130
0
    (msg__)->WriteSentinel(952744851);
131
0
132
0
133
0
134
0
135
0
    if (mozilla::ipc::LoggingEnabledFor("PGamepadEventChannelChild")) {
136
0
        mozilla::ipc::LogMessageForProtocol("PGamepadEventChannelChild", OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending);
137
0
    }
138
0
    AUTO_PROFILER_LABEL("PGamepadEventChannel::Msg_StopVibrateHaptic", 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 PGamepadEventChannelChild::RemoveManagee(
148
        int32_t aProtocolId,
149
        IProtocol* aListener) -> void
150
0
{
151
0
    FatalError("unreached");
152
0
    return;
153
0
}
154
155
auto PGamepadEventChannelChild::OnMessageReceived(const Message& msg__) -> PGamepadEventChannelChild::Result
156
0
{
157
0
    switch ((msg__).type()) {
158
0
    case PGamepadEventChannel::Msg___delete____ID:
159
0
        {
160
0
            if (mozilla::ipc::LoggingEnabledFor("PGamepadEventChannelChild")) {
161
0
                mozilla::ipc::LogMessageForProtocol("PGamepadEventChannelChild", OtherPid(), "Received ", ((&(msg__)))->type(), mozilla::ipc::MessageDirection::eReceiving);
162
0
            }
163
0
            AUTO_PROFILER_LABEL("PGamepadEventChannel::Msg___delete__", OTHER);
164
0
165
0
            PickleIterator iter__(msg__);
166
0
            PGamepadEventChannelChild* actor;
167
0
168
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(actor)))))) {
169
0
                FatalError("Error deserializing 'PGamepadEventChannelChild'");
170
0
                return MsgValueError;
171
0
            }
172
0
            if ((!((*((&(actor))))))) {
173
0
                FatalError("Error deserializing 'PGamepadEventChannelChild'");
174
0
                return MsgValueError;
175
0
            }
176
0
            // Sentinel = 'actor'
177
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 875202478)))) {
178
0
                mozilla::ipc::SentinelReadError("Error deserializing 'PGamepadEventChannelChild'");
179
0
                return MsgValueError;
180
0
            }
181
0
            (msg__).EndRead(iter__, (msg__).type());
182
0
            if ((!(StateTransition(true, (&(mLivenessState)))))) {
183
0
                FatalError("Transition error");
184
0
                return MsgValueError;
185
0
            }
186
0
            if ((!(Recv__delete__()))) {
187
0
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
188
0
                // Error handled in mozilla::ipc::IPCResult
189
0
                return MsgProcessingError;
190
0
            }
191
0
192
0
193
0
            IProtocol* mgr = (actor)->Manager();
194
0
            (actor)->DestroySubtree(Deletion);
195
0
            (actor)->DeallocSubtree();
196
0
            (mgr)->RemoveManagee(PGamepadEventChannelMsgStart, actor);
197
0
198
0
            return MsgProcessed;
199
0
        }
200
0
    case PGamepadEventChannel::Msg_GamepadUpdate__ID:
201
0
        {
202
0
            if (mozilla::ipc::LoggingEnabledFor("PGamepadEventChannelChild")) {
203
0
                mozilla::ipc::LogMessageForProtocol("PGamepadEventChannelChild", OtherPid(), "Received ", ((&(msg__)))->type(), mozilla::ipc::MessageDirection::eReceiving);
204
0
            }
205
0
            AUTO_PROFILER_LABEL("PGamepadEventChannel::Msg_GamepadUpdate", OTHER);
206
0
207
0
            PickleIterator iter__(msg__);
208
0
            GamepadChangeEvent aGamepadEvent;
209
0
210
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(aGamepadEvent)))))) {
211
0
                FatalError("Error deserializing 'GamepadChangeEvent'");
212
0
                return MsgValueError;
213
0
            }
214
0
            // Sentinel = 'aGamepadEvent'
215
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 1167032459)))) {
216
0
                mozilla::ipc::SentinelReadError("Error deserializing 'GamepadChangeEvent'");
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 ((!(RecvGamepadUpdate(aGamepadEvent)))) {
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 PGamepadEventChannel::Msg_ReplyGamepadVibrateHaptic__ID:
233
0
        {
234
0
            if (mozilla::ipc::LoggingEnabledFor("PGamepadEventChannelChild")) {
235
0
                mozilla::ipc::LogMessageForProtocol("PGamepadEventChannelChild", OtherPid(), "Received ", ((&(msg__)))->type(), mozilla::ipc::MessageDirection::eReceiving);
236
0
            }
237
0
            AUTO_PROFILER_LABEL("PGamepadEventChannel::Msg_ReplyGamepadVibrateHaptic", OTHER);
238
0
239
0
            PickleIterator iter__(msg__);
240
0
            uint32_t aPromiseID;
241
0
242
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(aPromiseID)))))) {
243
0
                FatalError("Error deserializing 'uint32_t'");
244
0
                return MsgValueError;
245
0
            }
246
0
            // Sentinel = 'aPromiseID'
247
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 1396174117)))) {
248
0
                mozilla::ipc::SentinelReadError("Error deserializing 'uint32_t'");
249
0
                return MsgValueError;
250
0
            }
251
0
            (msg__).EndRead(iter__, (msg__).type());
252
0
            if ((!(StateTransition(false, (&(mLivenessState)))))) {
253
0
                FatalError("Transition error");
254
0
                return MsgValueError;
255
0
            }
256
0
            if ((!(RecvReplyGamepadVibrateHaptic(aPromiseID)))) {
257
0
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
258
0
                // Error handled in mozilla::ipc::IPCResult
259
0
                return MsgProcessingError;
260
0
            }
261
0
262
0
            return MsgProcessed;
263
0
        }
264
0
    default:
265
0
        {
266
0
            return MsgNotKnown;
267
0
        }
268
0
    }
269
0
}
270
271
auto PGamepadEventChannelChild::OnMessageReceived(
272
        const Message& msg__,
273
        Message*& reply__) -> PGamepadEventChannelChild::Result
274
0
{
275
0
    return MsgNotKnown;
276
0
}
277
278
auto PGamepadEventChannelChild::OnCallReceived(
279
        const Message& msg__,
280
        Message*& reply__) -> PGamepadEventChannelChild::Result
281
0
{
282
0
    MOZ_ASSERT_UNREACHABLE("message protocol not supported");
283
0
    return MsgNotKnown;
284
0
}
285
286
auto PGamepadEventChannelChild::GetProtocolTypeId() -> int32_t
287
0
{
288
0
    return PGamepadEventChannelMsgStart;
289
0
}
290
291
auto PGamepadEventChannelChild::DestroySubtree(ActorDestroyReason why) -> void
292
0
{
293
0
    // Unregister from our manager.
294
0
    Unregister(Id());
295
0
296
0
    // Reject owning pending responses.
297
0
    (GetIPCChannel())->RejectPendingResponsesForActor(this);
298
0
299
0
    // Finally, destroy "us".
300
0
    ActorDestroy(why);
301
0
}
302
303
auto PGamepadEventChannelChild::DeallocSubtree() -> void
304
0
{
305
0
}
306
307
308
309
} // namespace dom
310
} // namespace mozilla
311
namespace mozilla {
312
namespace ipc {
313
auto IPDLParamTraits<mozilla::dom::PGamepadEventChannelChild>::Write(
314
        IPC::Message* aMsg,
315
        mozilla::ipc::IProtocol* aActor,
316
        const paramType& aVar) -> void
317
0
{
318
0
    int32_t id;
319
0
    if ((!(aVar))) {
320
0
        id = 0;
321
0
    }
322
0
    else {
323
0
        id = (aVar)->Id();
324
0
        if ((1) == (id)) {
325
0
            (aActor)->FatalError("actor has been |delete|d");
326
0
        }
327
0
    }
328
0
    WriteIPDLParam(aMsg, aActor, id);
329
0
}
330
331
auto IPDLParamTraits<mozilla::dom::PGamepadEventChannelChild>::Read(
332
        const IPC::Message* aMsg,
333
        PickleIterator* aIter,
334
        mozilla::ipc::IProtocol* aActor,
335
        paramType* aVar) -> bool
336
0
{
337
0
    mozilla::Maybe<mozilla::ipc::IProtocol*> actor = (aActor)->ReadActor(aMsg, aIter, true, "PGamepadEventChannel", PGamepadEventChannelMsgStart);
338
0
    if ((actor).isNothing()) {
339
0
        return false;
340
0
    }
341
0
342
0
    (*(aVar)) = static_cast<mozilla::dom::PGamepadEventChannelChild*>((actor).value());
343
0
    return true;
344
0
}
345
346
} // namespace ipc
347
} // namespace mozilla