Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/ipc/ipdl/PBackgroundMutableFileChild.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/PBackgroundMutableFileChild.h"
8
9
#include "mozilla/dom/PBackgroundFileHandleChild.h"
10
#include "mozilla/dom/indexedDB/PBackgroundIDBDatabaseChild.h"
11
12
#include "nsIFile.h"
13
#include "GeckoProfiler.h"
14
15
namespace mozilla {
16
namespace dom {
17
18
19
auto PBackgroundMutableFileChild::Recv__delete__() -> mozilla::ipc::IPCResult
20
0
{
21
0
    return IPC_OK();
22
0
}
23
24
auto PBackgroundMutableFileChild::ActorDestroy(ActorDestroyReason aWhy) -> void
25
0
{
26
0
}
27
28
MOZ_IMPLICIT PBackgroundMutableFileChild::PBackgroundMutableFileChild() :
29
    mozilla::ipc::IProtocol(mozilla::ipc::ChildSide),
30
    mLivenessState(mozilla::ipc::LivenessState::Dead)
31
0
{
32
0
    MOZ_COUNT_CTOR(PBackgroundMutableFileChild);
33
0
}
34
35
PBackgroundMutableFileChild::~PBackgroundMutableFileChild()
36
0
{
37
0
    MOZ_COUNT_DTOR(PBackgroundMutableFileChild);
38
0
}
39
40
auto PBackgroundMutableFileChild::Manager() const -> PBackgroundIDBDatabaseChild*
41
0
{
42
0
    return static_cast<PBackgroundIDBDatabaseChild*>(IProtocol::Manager());
43
0
}
44
45
auto PBackgroundMutableFileChild::ManagedPBackgroundFileHandleChild(nsTArray<PBackgroundFileHandleChild*>& aArr) const -> void
46
0
{
47
0
    (mManagedPBackgroundFileHandleChild).ToArray(aArr);
48
0
}
49
50
auto PBackgroundMutableFileChild::ManagedPBackgroundFileHandleChild() const -> const ManagedContainer<PBackgroundFileHandleChild>&
51
0
{
52
0
    return mManagedPBackgroundFileHandleChild;
53
0
}
54
55
auto PBackgroundMutableFileChild::SendDeleteMe() -> bool
56
0
{
57
0
    IPC::Message* msg__ = PBackgroundMutableFile::Msg_DeleteMe(Id());
58
0
59
0
60
0
61
0
62
0
63
0
    if (mozilla::ipc::LoggingEnabledFor("PBackgroundMutableFileChild")) {
64
0
        mozilla::ipc::LogMessageForProtocol("PBackgroundMutableFileChild", OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending);
65
0
    }
66
0
    AUTO_PROFILER_LABEL("PBackgroundMutableFile::Msg_DeleteMe", OTHER);
67
0
    if ((!(StateTransition(false, (&(mLivenessState)))))) {
68
0
        mozilla::ipc::LogicError("Transition error");
69
0
    }
70
0
71
0
    bool sendok__ = (GetIPCChannel())->Send(msg__);
72
0
    return sendok__;
73
0
}
74
75
auto PBackgroundMutableFileChild::SendPBackgroundFileHandleConstructor(const FileMode& mode) -> PBackgroundFileHandleChild*
76
0
{
77
0
    return SendPBackgroundFileHandleConstructor(AllocPBackgroundFileHandleChild(mode), mode);
78
0
}
79
80
auto PBackgroundMutableFileChild::SendPBackgroundFileHandleConstructor(
81
        PBackgroundFileHandleChild* actor,
82
        const FileMode& mode) -> PBackgroundFileHandleChild*
83
0
{
84
0
    if ((!(actor))) {
85
0
        NS_WARNING("Error constructing actor PBackgroundFileHandleChild");
86
0
        return nullptr;
87
0
    }
88
0
    (actor)->SetManagerAndRegister(this);
89
0
    (mManagedPBackgroundFileHandleChild).PutEntry(actor);
90
0
    (actor)->mLivenessState = mozilla::ipc::LivenessState::Start;
91
0
92
0
    IPC::Message* msg__ = PBackgroundMutableFile::Msg_PBackgroundFileHandleConstructor(Id());
93
0
94
0
    MOZ_RELEASE_ASSERT(actor, "NULL actor value passed to non-nullable param");
95
0
    WriteIPDLParam(msg__, this, actor);
96
0
    // Sentinel = 'actor'
97
0
    (msg__)->WriteSentinel(875202478);
98
0
    WriteIPDLParam(msg__, this, mode);
99
0
    // Sentinel = 'mode'
100
0
    (msg__)->WriteSentinel(3911367285);
101
0
102
0
103
0
104
0
    if (mozilla::ipc::LoggingEnabledFor("PBackgroundMutableFileChild")) {
105
0
        mozilla::ipc::LogMessageForProtocol("PBackgroundMutableFileChild", OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending);
106
0
    }
107
0
    AUTO_PROFILER_LABEL("PBackgroundMutableFile::Msg_PBackgroundFileHandleConstructor", OTHER);
108
0
    if ((!(StateTransition(false, (&(mLivenessState)))))) {
109
0
        mozilla::ipc::LogicError("Transition error");
110
0
    }
111
0
112
0
    bool sendok__ = (GetIPCChannel())->Send(msg__);
113
0
    if ((!(sendok__))) {
114
0
        FatalError("constructor for actor failed");
115
0
        return nullptr;
116
0
    }
117
0
    return actor;
118
0
}
119
120
auto PBackgroundMutableFileChild::SendGetFileId(int64_t* fileId) -> bool
121
0
{
122
0
    IPC::Message* msg__ = PBackgroundMutableFile::Msg_GetFileId(Id());
123
0
124
0
125
0
126
0
127
0
    Message reply__;
128
0
129
0
    if (mozilla::ipc::LoggingEnabledFor("PBackgroundMutableFileChild")) {
130
0
        mozilla::ipc::LogMessageForProtocol("PBackgroundMutableFileChild", OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending);
131
0
    }
132
0
    AUTO_PROFILER_LABEL("PBackgroundMutableFile::Msg_GetFileId", OTHER);
133
0
    if ((!(StateTransition(false, (&(mLivenessState)))))) {
134
0
        mozilla::ipc::LogicError("Transition error");
135
0
    }
136
0
137
0
    bool sendok__;
138
0
    {
139
0
        AUTO_PROFILER_TRACING("IPC", "PBackgroundMutableFile::Msg_GetFileId");
140
0
        sendok__ = (GetIPCChannel())->Send(msg__, (&(reply__)));
141
0
    }
142
0
    if ((!(sendok__))) {
143
0
        return false;
144
0
    }
145
0
146
0
    if (mozilla::ipc::LoggingEnabledFor("PBackgroundMutableFileChild")) {
147
0
        mozilla::ipc::LogMessageForProtocol("PBackgroundMutableFileChild", OtherPid(), "Received reply ", ((&(reply__)))->type(), mozilla::ipc::MessageDirection::eReceiving);
148
0
    }
149
0
150
0
    PickleIterator iter__(reply__);
151
0
152
0
    if ((!(ReadIPDLParam((&(reply__)), (&(iter__)), this, fileId)))) {
153
0
        FatalError("Error deserializing 'int64_t'");
154
0
        return false;
155
0
    }
156
0
    // Sentinel = 'fileId'
157
0
    if ((!(((&(reply__)))->ReadSentinel((&(iter__)), 108004447)))) {
158
0
        mozilla::ipc::SentinelReadError("Error deserializing 'int64_t'");
159
0
        return false;
160
0
    }
161
0
    (reply__).EndRead(iter__, (reply__).type());
162
0
163
0
    return true;
164
0
}
165
166
auto PBackgroundMutableFileChild::RemoveManagee(
167
        int32_t aProtocolId,
168
        IProtocol* aListener) -> void
169
0
{
170
0
    switch (aProtocolId) {
171
0
    case PBackgroundFileHandleMsgStart:
172
0
        {
173
0
            PBackgroundFileHandleChild* actor = static_cast<PBackgroundFileHandleChild*>(aListener);
174
0
            auto& container = mManagedPBackgroundFileHandleChild;
175
0
            MOZ_RELEASE_ASSERT((container).Contains(actor), "actor not managed by this!");
176
0
177
0
            (container).RemoveEntry(actor);
178
0
            DeallocPBackgroundFileHandleChild(actor);
179
0
            return;
180
0
        }
181
0
    default:
182
0
        {
183
0
            FatalError("unreached");
184
0
            return;
185
0
        }
186
0
    }
187
0
}
188
189
auto PBackgroundMutableFileChild::OnMessageReceived(const Message& msg__) -> PBackgroundMutableFileChild::Result
190
0
{
191
0
    switch ((msg__).type()) {
192
0
    case PBackgroundMutableFile::Reply_PBackgroundFileHandleConstructor__ID:
193
0
        {
194
0
            return MsgProcessed;
195
0
        }
196
0
    case PBackgroundMutableFile::Msg___delete____ID:
197
0
        {
198
0
            if (mozilla::ipc::LoggingEnabledFor("PBackgroundMutableFileChild")) {
199
0
                mozilla::ipc::LogMessageForProtocol("PBackgroundMutableFileChild", OtherPid(), "Received ", ((&(msg__)))->type(), mozilla::ipc::MessageDirection::eReceiving);
200
0
            }
201
0
            AUTO_PROFILER_LABEL("PBackgroundMutableFile::Msg___delete__", OTHER);
202
0
203
0
            PickleIterator iter__(msg__);
204
0
            PBackgroundMutableFileChild* actor;
205
0
206
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(actor)))))) {
207
0
                FatalError("Error deserializing 'PBackgroundMutableFileChild'");
208
0
                return MsgValueError;
209
0
            }
210
0
            if ((!((*((&(actor))))))) {
211
0
                FatalError("Error deserializing 'PBackgroundMutableFileChild'");
212
0
                return MsgValueError;
213
0
            }
214
0
            // Sentinel = 'actor'
215
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 875202478)))) {
216
0
                mozilla::ipc::SentinelReadError("Error deserializing 'PBackgroundMutableFileChild'");
217
0
                return MsgValueError;
218
0
            }
219
0
            (msg__).EndRead(iter__, (msg__).type());
220
0
            if ((!(StateTransition(true, (&(mLivenessState)))))) {
221
0
                FatalError("Transition error");
222
0
                return MsgValueError;
223
0
            }
224
0
            if ((!(Recv__delete__()))) {
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
231
0
            IProtocol* mgr = (actor)->Manager();
232
0
            (actor)->DestroySubtree(Deletion);
233
0
            (actor)->DeallocSubtree();
234
0
            (mgr)->RemoveManagee(PBackgroundMutableFileMsgStart, actor);
235
0
236
0
            return MsgProcessed;
237
0
        }
238
0
    default:
239
0
        {
240
0
            return MsgNotKnown;
241
0
        }
242
0
    }
243
0
}
244
245
auto PBackgroundMutableFileChild::OnMessageReceived(
246
        const Message& msg__,
247
        Message*& reply__) -> PBackgroundMutableFileChild::Result
248
0
{
249
0
    return MsgNotKnown;
250
0
}
251
252
auto PBackgroundMutableFileChild::OnCallReceived(
253
        const Message& msg__,
254
        Message*& reply__) -> PBackgroundMutableFileChild::Result
255
0
{
256
0
    MOZ_ASSERT_UNREACHABLE("message protocol not supported");
257
0
    return MsgNotKnown;
258
0
}
259
260
auto PBackgroundMutableFileChild::GetProtocolTypeId() -> int32_t
261
0
{
262
0
    return PBackgroundMutableFileMsgStart;
263
0
}
264
265
auto PBackgroundMutableFileChild::DestroySubtree(ActorDestroyReason why) -> void
266
0
{
267
0
    // Unregister from our manager.
268
0
    Unregister(Id());
269
0
270
0
    ActorDestroyReason subtreewhy = (((why) == (Deletion)) || ((why) == (FailedConstructor)) ? AncestorDeletion : why);
271
0
272
0
    {
273
0
        // Recursively shutting down PBackgroundFileHandle kids
274
0
        nsTArray<PBackgroundFileHandleChild*> kids;
275
0
        // Accumulate kids into a stable structure to iterate over
276
0
        ManagedPBackgroundFileHandleChild(kids);
277
0
        for (auto& kid : kids) {
278
0
            // Guarding against a child removing a sibling from the list during the iteration.
279
0
            if ((mManagedPBackgroundFileHandleChild).Contains(kid)) {
280
0
                (kid)->DestroySubtree(subtreewhy);
281
0
            }
282
0
        }
283
0
    }
284
0
285
0
    // Reject owning pending responses.
286
0
    (GetIPCChannel())->RejectPendingResponsesForActor(this);
287
0
288
0
    // Finally, destroy "us".
289
0
    ActorDestroy(why);
290
0
}
291
292
auto PBackgroundMutableFileChild::DeallocSubtree() -> void
293
0
{
294
0
    {
295
0
        // Recursively deleting PBackgroundFileHandle kids
296
0
        for (auto iter = (mManagedPBackgroundFileHandleChild).Iter(); (!((iter).Done())); (iter).Next()) {
297
0
            (((iter).Get())->GetKey())->DeallocSubtree();
298
0
        }
299
0
300
0
        for (auto iter = (mManagedPBackgroundFileHandleChild).Iter(); (!((iter).Done())); (iter).Next()) {
301
0
            DeallocPBackgroundFileHandleChild(((iter).Get())->GetKey());
302
0
        }
303
0
        (mManagedPBackgroundFileHandleChild).Clear();
304
0
    }
305
0
}
306
307
308
309
} // namespace dom
310
} // namespace mozilla
311
namespace mozilla {
312
namespace ipc {
313
auto IPDLParamTraits<mozilla::dom::PBackgroundMutableFileChild>::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::PBackgroundMutableFileChild>::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, "PBackgroundMutableFile", PBackgroundMutableFileMsgStart);
338
0
    if ((actor).isNothing()) {
339
0
        return false;
340
0
    }
341
0
342
0
    (*(aVar)) = static_cast<mozilla::dom::PBackgroundMutableFileChild*>((actor).value());
343
0
    return true;
344
0
}
345
346
} // namespace ipc
347
} // namespace mozilla