Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/ipc/ipdl/PGMPStorageChild.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/gmp/PGMPStorageChild.h"
8
9
#include "mozilla/gmp/PGMPChild.h"
10
11
#include "nsIFile.h"
12
#include "GeckoProfiler.h"
13
14
namespace mozilla {
15
namespace gmp {
16
17
18
auto PGMPStorageChild::ActorDestroy(ActorDestroyReason aWhy) -> void
19
0
{
20
0
}
21
22
MOZ_IMPLICIT PGMPStorageChild::PGMPStorageChild() :
23
    mozilla::ipc::IProtocol(mozilla::ipc::ChildSide),
24
    mLivenessState(mozilla::ipc::LivenessState::Dead)
25
0
{
26
0
    MOZ_COUNT_CTOR(PGMPStorageChild);
27
0
}
28
29
PGMPStorageChild::~PGMPStorageChild()
30
0
{
31
0
    MOZ_COUNT_DTOR(PGMPStorageChild);
32
0
}
33
34
auto PGMPStorageChild::Manager() const -> PGMPChild*
35
0
{
36
0
    return static_cast<PGMPChild*>(IProtocol::Manager());
37
0
}
38
39
auto PGMPStorageChild::SendOpen(const nsCString& aRecordName) -> bool
40
0
{
41
0
    IPC::Message* msg__ = PGMPStorage::Msg_Open(Id());
42
0
43
0
    WriteIPDLParam(msg__, this, aRecordName);
44
0
    // Sentinel = 'aRecordName'
45
0
    (msg__)->WriteSentinel(4079879416);
46
0
47
0
48
0
49
0
50
0
    if (mozilla::ipc::LoggingEnabledFor("PGMPStorageChild")) {
51
0
        mozilla::ipc::LogMessageForProtocol("PGMPStorageChild", OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending);
52
0
    }
53
0
    AUTO_PROFILER_LABEL("PGMPStorage::Msg_Open", 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 PGMPStorageChild::SendRead(const nsCString& aRecordName) -> bool
63
0
{
64
0
    IPC::Message* msg__ = PGMPStorage::Msg_Read(Id());
65
0
66
0
    WriteIPDLParam(msg__, this, aRecordName);
67
0
    // Sentinel = 'aRecordName'
68
0
    (msg__)->WriteSentinel(4079879416);
69
0
70
0
71
0
72
0
73
0
    if (mozilla::ipc::LoggingEnabledFor("PGMPStorageChild")) {
74
0
        mozilla::ipc::LogMessageForProtocol("PGMPStorageChild", OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending);
75
0
    }
76
0
    AUTO_PROFILER_LABEL("PGMPStorage::Msg_Read", OTHER);
77
0
    if ((!(StateTransition(false, (&(mLivenessState)))))) {
78
0
        mozilla::ipc::LogicError("Transition error");
79
0
    }
80
0
81
0
    bool sendok__ = (GetIPCChannel())->Send(msg__);
82
0
    return sendok__;
83
0
}
84
85
auto PGMPStorageChild::SendWrite(
86
        const nsCString& aRecordName,
87
        const nsTArray<uint8_t>& aBytes) -> bool
88
0
{
89
0
    IPC::Message* msg__ = PGMPStorage::Msg_Write(Id());
90
0
91
0
    WriteIPDLParam(msg__, this, aRecordName);
92
0
    // Sentinel = 'aRecordName'
93
0
    (msg__)->WriteSentinel(4079879416);
94
0
    WriteIPDLParam(msg__, this, aBytes);
95
0
    // Sentinel = 'aBytes'
96
0
    (msg__)->WriteSentinel(4118068628);
97
0
98
0
99
0
100
0
101
0
    if (mozilla::ipc::LoggingEnabledFor("PGMPStorageChild")) {
102
0
        mozilla::ipc::LogMessageForProtocol("PGMPStorageChild", OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending);
103
0
    }
104
0
    AUTO_PROFILER_LABEL("PGMPStorage::Msg_Write", OTHER);
105
0
    if ((!(StateTransition(false, (&(mLivenessState)))))) {
106
0
        mozilla::ipc::LogicError("Transition error");
107
0
    }
108
0
109
0
    bool sendok__ = (GetIPCChannel())->Send(msg__);
110
0
    return sendok__;
111
0
}
112
113
auto PGMPStorageChild::SendClose(const nsCString& aRecordName) -> bool
114
0
{
115
0
    IPC::Message* msg__ = PGMPStorage::Msg_Close(Id());
116
0
117
0
    WriteIPDLParam(msg__, this, aRecordName);
118
0
    // Sentinel = 'aRecordName'
119
0
    (msg__)->WriteSentinel(4079879416);
120
0
121
0
122
0
123
0
124
0
    if (mozilla::ipc::LoggingEnabledFor("PGMPStorageChild")) {
125
0
        mozilla::ipc::LogMessageForProtocol("PGMPStorageChild", OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending);
126
0
    }
127
0
    AUTO_PROFILER_LABEL("PGMPStorage::Msg_Close", OTHER);
128
0
    if ((!(StateTransition(false, (&(mLivenessState)))))) {
129
0
        mozilla::ipc::LogicError("Transition error");
130
0
    }
131
0
132
0
    bool sendok__ = (GetIPCChannel())->Send(msg__);
133
0
    return sendok__;
134
0
}
135
136
auto PGMPStorageChild::Send__delete__(PGMPStorageChild* actor) -> bool
137
0
{
138
0
    if ((!(actor))) {
139
0
        return false;
140
0
    }
141
0
142
0
    IPC::Message* msg__ = PGMPStorage::Msg___delete__((actor)->Id());
143
0
144
0
    MOZ_RELEASE_ASSERT(actor, "NULL actor value passed to non-nullable param");
145
0
    WriteIPDLParam(msg__, actor, actor);
146
0
    // Sentinel = 'actor'
147
0
    (msg__)->WriteSentinel(875202478);
148
0
149
0
150
0
151
0
    if (mozilla::ipc::LoggingEnabledFor("PGMPStorageChild")) {
152
0
        mozilla::ipc::LogMessageForProtocol("PGMPStorageChild", (actor)->OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending);
153
0
    }
154
0
    AUTO_PROFILER_LABEL("PGMPStorage::Msg___delete__", OTHER);
155
0
    if ((!(StateTransition(true, (&((actor)->mLivenessState)))))) {
156
0
        mozilla::ipc::LogicError("Transition error");
157
0
    }
158
0
159
0
    bool sendok__ = ((actor)->GetIPCChannel())->Send(msg__);
160
0
161
0
    IProtocol* mgr = (actor)->Manager();
162
0
    (actor)->DestroySubtree(Deletion);
163
0
    (actor)->DeallocSubtree();
164
0
    (mgr)->RemoveManagee(PGMPStorageMsgStart, actor);
165
0
    return sendok__;
166
0
}
167
168
auto PGMPStorageChild::RemoveManagee(
169
        int32_t aProtocolId,
170
        IProtocol* aListener) -> void
171
0
{
172
0
    FatalError("unreached");
173
0
    return;
174
0
}
175
176
auto PGMPStorageChild::OnMessageReceived(const Message& msg__) -> PGMPStorageChild::Result
177
0
{
178
0
    switch ((msg__).type()) {
179
0
    case PGMPStorage::Msg_OpenComplete__ID:
180
0
        {
181
0
            if (mozilla::ipc::LoggingEnabledFor("PGMPStorageChild")) {
182
0
                mozilla::ipc::LogMessageForProtocol("PGMPStorageChild", OtherPid(), "Received ", ((&(msg__)))->type(), mozilla::ipc::MessageDirection::eReceiving);
183
0
            }
184
0
            AUTO_PROFILER_LABEL("PGMPStorage::Msg_OpenComplete", OTHER);
185
0
186
0
            PickleIterator iter__(msg__);
187
0
            nsCString aRecordName;
188
0
            GMPErr aStatus;
189
0
190
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(aRecordName)))))) {
191
0
                FatalError("Error deserializing 'nsCString'");
192
0
                return MsgValueError;
193
0
            }
194
0
            // Sentinel = 'aRecordName'
195
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 4079879416)))) {
196
0
                mozilla::ipc::SentinelReadError("Error deserializing 'nsCString'");
197
0
                return MsgValueError;
198
0
            }
199
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(aStatus)))))) {
200
0
                FatalError("Error deserializing 'GMPErr'");
201
0
                return MsgValueError;
202
0
            }
203
0
            // Sentinel = 'aStatus'
204
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 236002576)))) {
205
0
                mozilla::ipc::SentinelReadError("Error deserializing 'GMPErr'");
206
0
                return MsgValueError;
207
0
            }
208
0
            (msg__).EndRead(iter__, (msg__).type());
209
0
            if ((!(StateTransition(false, (&(mLivenessState)))))) {
210
0
                FatalError("Transition error");
211
0
                return MsgValueError;
212
0
            }
213
0
            if ((!(RecvOpenComplete(aRecordName, aStatus)))) {
214
0
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
215
0
                // Error handled in mozilla::ipc::IPCResult
216
0
                return MsgProcessingError;
217
0
            }
218
0
219
0
            return MsgProcessed;
220
0
        }
221
0
    case PGMPStorage::Msg_ReadComplete__ID:
222
0
        {
223
0
            if (mozilla::ipc::LoggingEnabledFor("PGMPStorageChild")) {
224
0
                mozilla::ipc::LogMessageForProtocol("PGMPStorageChild", OtherPid(), "Received ", ((&(msg__)))->type(), mozilla::ipc::MessageDirection::eReceiving);
225
0
            }
226
0
            AUTO_PROFILER_LABEL("PGMPStorage::Msg_ReadComplete", OTHER);
227
0
228
0
            PickleIterator iter__(msg__);
229
0
            nsCString aRecordName;
230
0
            GMPErr aStatus;
231
0
            nsTArray<uint8_t> aBytes;
232
0
233
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(aRecordName)))))) {
234
0
                FatalError("Error deserializing 'nsCString'");
235
0
                return MsgValueError;
236
0
            }
237
0
            // Sentinel = 'aRecordName'
238
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 4079879416)))) {
239
0
                mozilla::ipc::SentinelReadError("Error deserializing 'nsCString'");
240
0
                return MsgValueError;
241
0
            }
242
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(aStatus)))))) {
243
0
                FatalError("Error deserializing 'GMPErr'");
244
0
                return MsgValueError;
245
0
            }
246
0
            // Sentinel = 'aStatus'
247
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 236002576)))) {
248
0
                mozilla::ipc::SentinelReadError("Error deserializing 'GMPErr'");
249
0
                return MsgValueError;
250
0
            }
251
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(aBytes)))))) {
252
0
                FatalError("Error deserializing 'nsTArray'");
253
0
                return MsgValueError;
254
0
            }
255
0
            // Sentinel = 'aBytes'
256
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 4118068628)))) {
257
0
                mozilla::ipc::SentinelReadError("Error deserializing 'nsTArray'");
258
0
                return MsgValueError;
259
0
            }
260
0
            (msg__).EndRead(iter__, (msg__).type());
261
0
            if ((!(StateTransition(false, (&(mLivenessState)))))) {
262
0
                FatalError("Transition error");
263
0
                return MsgValueError;
264
0
            }
265
0
            if ((!(RecvReadComplete(aRecordName, aStatus, std::move(aBytes))))) {
266
0
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
267
0
                // Error handled in mozilla::ipc::IPCResult
268
0
                return MsgProcessingError;
269
0
            }
270
0
271
0
            return MsgProcessed;
272
0
        }
273
0
    case PGMPStorage::Msg_WriteComplete__ID:
274
0
        {
275
0
            if (mozilla::ipc::LoggingEnabledFor("PGMPStorageChild")) {
276
0
                mozilla::ipc::LogMessageForProtocol("PGMPStorageChild", OtherPid(), "Received ", ((&(msg__)))->type(), mozilla::ipc::MessageDirection::eReceiving);
277
0
            }
278
0
            AUTO_PROFILER_LABEL("PGMPStorage::Msg_WriteComplete", OTHER);
279
0
280
0
            PickleIterator iter__(msg__);
281
0
            nsCString aRecordName;
282
0
            GMPErr aStatus;
283
0
284
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(aRecordName)))))) {
285
0
                FatalError("Error deserializing 'nsCString'");
286
0
                return MsgValueError;
287
0
            }
288
0
            // Sentinel = 'aRecordName'
289
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 4079879416)))) {
290
0
                mozilla::ipc::SentinelReadError("Error deserializing 'nsCString'");
291
0
                return MsgValueError;
292
0
            }
293
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(aStatus)))))) {
294
0
                FatalError("Error deserializing 'GMPErr'");
295
0
                return MsgValueError;
296
0
            }
297
0
            // Sentinel = 'aStatus'
298
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 236002576)))) {
299
0
                mozilla::ipc::SentinelReadError("Error deserializing 'GMPErr'");
300
0
                return MsgValueError;
301
0
            }
302
0
            (msg__).EndRead(iter__, (msg__).type());
303
0
            if ((!(StateTransition(false, (&(mLivenessState)))))) {
304
0
                FatalError("Transition error");
305
0
                return MsgValueError;
306
0
            }
307
0
            if ((!(RecvWriteComplete(aRecordName, aStatus)))) {
308
0
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
309
0
                // Error handled in mozilla::ipc::IPCResult
310
0
                return MsgProcessingError;
311
0
            }
312
0
313
0
            return MsgProcessed;
314
0
        }
315
0
    case PGMPStorage::Msg_Shutdown__ID:
316
0
        {
317
0
            if (mozilla::ipc::LoggingEnabledFor("PGMPStorageChild")) {
318
0
                mozilla::ipc::LogMessageForProtocol("PGMPStorageChild", OtherPid(), "Received ", ((&(msg__)))->type(), mozilla::ipc::MessageDirection::eReceiving);
319
0
            }
320
0
            AUTO_PROFILER_LABEL("PGMPStorage::Msg_Shutdown", OTHER);
321
0
322
0
            if ((!(StateTransition(false, (&(mLivenessState)))))) {
323
0
                FatalError("Transition error");
324
0
                return MsgValueError;
325
0
            }
326
0
            if ((!(RecvShutdown()))) {
327
0
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
328
0
                // Error handled in mozilla::ipc::IPCResult
329
0
                return MsgProcessingError;
330
0
            }
331
0
332
0
            return MsgProcessed;
333
0
        }
334
0
    case PGMPStorage::Reply___delete____ID:
335
0
        {
336
0
            return MsgProcessed;
337
0
        }
338
0
    default:
339
0
        {
340
0
            return MsgNotKnown;
341
0
        }
342
0
    }
343
0
}
344
345
auto PGMPStorageChild::OnMessageReceived(
346
        const Message& msg__,
347
        Message*& reply__) -> PGMPStorageChild::Result
348
0
{
349
0
    return MsgNotKnown;
350
0
}
351
352
auto PGMPStorageChild::OnCallReceived(
353
        const Message& msg__,
354
        Message*& reply__) -> PGMPStorageChild::Result
355
0
{
356
0
    return MsgNotKnown;
357
0
}
358
359
auto PGMPStorageChild::GetProtocolTypeId() -> int32_t
360
0
{
361
0
    return PGMPStorageMsgStart;
362
0
}
363
364
auto PGMPStorageChild::DestroySubtree(ActorDestroyReason why) -> void
365
0
{
366
0
    // Unregister from our manager.
367
0
    Unregister(Id());
368
0
369
0
    // Reject owning pending responses.
370
0
    (GetIPCChannel())->RejectPendingResponsesForActor(this);
371
0
372
0
    // Finally, destroy "us".
373
0
    ActorDestroy(why);
374
0
}
375
376
auto PGMPStorageChild::DeallocSubtree() -> void
377
0
{
378
0
}
379
380
381
382
} // namespace gmp
383
} // namespace mozilla
384
namespace mozilla {
385
namespace ipc {
386
auto IPDLParamTraits<mozilla::gmp::PGMPStorageChild>::Write(
387
        IPC::Message* aMsg,
388
        mozilla::ipc::IProtocol* aActor,
389
        const paramType& aVar) -> void
390
0
{
391
0
    int32_t id;
392
0
    if ((!(aVar))) {
393
0
        id = 0;
394
0
    }
395
0
    else {
396
0
        id = (aVar)->Id();
397
0
        if ((1) == (id)) {
398
0
            (aActor)->FatalError("actor has been |delete|d");
399
0
        }
400
0
    }
401
0
    WriteIPDLParam(aMsg, aActor, id);
402
0
}
403
404
auto IPDLParamTraits<mozilla::gmp::PGMPStorageChild>::Read(
405
        const IPC::Message* aMsg,
406
        PickleIterator* aIter,
407
        mozilla::ipc::IProtocol* aActor,
408
        paramType* aVar) -> bool
409
0
{
410
0
    mozilla::Maybe<mozilla::ipc::IProtocol*> actor = (aActor)->ReadActor(aMsg, aIter, true, "PGMPStorage", PGMPStorageMsgStart);
411
0
    if ((actor).isNothing()) {
412
0
        return false;
413
0
    }
414
0
415
0
    (*(aVar)) = static_cast<mozilla::gmp::PGMPStorageChild*>((actor).value());
416
0
    return true;
417
0
}
418
419
} // namespace ipc
420
} // namespace mozilla