Coverage Report

Created: 2018-09-25 14:53

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