Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/ipc/ipdl/PBackgroundSDBConnectionChild.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/PBackgroundSDBConnectionChild.h"
8
9
#include "mozilla/ipc/PBackgroundChild.h"
10
#include "mozilla/dom/PBackgroundSDBRequestChild.h"
11
12
#include "nsIFile.h"
13
#include "GeckoProfiler.h"
14
15
namespace mozilla {
16
namespace dom {
17
18
19
auto PBackgroundSDBConnectionChild::Recv__delete__() -> mozilla::ipc::IPCResult
20
0
{
21
0
    return IPC_OK();
22
0
}
23
24
auto PBackgroundSDBConnectionChild::ActorDestroy(ActorDestroyReason aWhy) -> void
25
0
{
26
0
}
27
28
MOZ_IMPLICIT PBackgroundSDBConnectionChild::PBackgroundSDBConnectionChild() :
29
    mozilla::ipc::IProtocol(mozilla::ipc::ChildSide),
30
    mLivenessState(mozilla::ipc::LivenessState::Dead)
31
0
{
32
0
    MOZ_COUNT_CTOR(PBackgroundSDBConnectionChild);
33
0
}
34
35
PBackgroundSDBConnectionChild::~PBackgroundSDBConnectionChild()
36
0
{
37
0
    MOZ_COUNT_DTOR(PBackgroundSDBConnectionChild);
38
0
}
39
40
auto PBackgroundSDBConnectionChild::Manager() const -> PBackgroundChild*
41
0
{
42
0
    return static_cast<PBackgroundChild*>(IProtocol::Manager());
43
0
}
44
45
auto PBackgroundSDBConnectionChild::ManagedPBackgroundSDBRequestChild(nsTArray<PBackgroundSDBRequestChild*>& aArr) const -> void
46
0
{
47
0
    (mManagedPBackgroundSDBRequestChild).ToArray(aArr);
48
0
}
49
50
auto PBackgroundSDBConnectionChild::ManagedPBackgroundSDBRequestChild() const -> const ManagedContainer<PBackgroundSDBRequestChild>&
51
0
{
52
0
    return mManagedPBackgroundSDBRequestChild;
53
0
}
54
55
auto PBackgroundSDBConnectionChild::SendDeleteMe() -> bool
56
0
{
57
0
    IPC::Message* msg__ = PBackgroundSDBConnection::Msg_DeleteMe(Id());
58
0
59
0
60
0
61
0
62
0
63
0
    if (mozilla::ipc::LoggingEnabledFor("PBackgroundSDBConnectionChild")) {
64
0
        mozilla::ipc::LogMessageForProtocol("PBackgroundSDBConnectionChild", OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending);
65
0
    }
66
0
    AUTO_PROFILER_LABEL("PBackgroundSDBConnection::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 PBackgroundSDBConnectionChild::SendPBackgroundSDBRequestConstructor(const SDBRequestParams& params) -> PBackgroundSDBRequestChild*
76
0
{
77
0
    return SendPBackgroundSDBRequestConstructor(AllocPBackgroundSDBRequestChild(params), params);
78
0
}
79
80
auto PBackgroundSDBConnectionChild::SendPBackgroundSDBRequestConstructor(
81
        PBackgroundSDBRequestChild* actor,
82
        const SDBRequestParams& params) -> PBackgroundSDBRequestChild*
83
0
{
84
0
    if ((!(actor))) {
85
0
        NS_WARNING("Error constructing actor PBackgroundSDBRequestChild");
86
0
        return nullptr;
87
0
    }
88
0
    (actor)->SetManagerAndRegister(this);
89
0
    (mManagedPBackgroundSDBRequestChild).PutEntry(actor);
90
0
    (actor)->mLivenessState = mozilla::ipc::LivenessState::Start;
91
0
92
0
    IPC::Message* msg__ = PBackgroundSDBConnection::Msg_PBackgroundSDBRequestConstructor(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, params);
99
0
    // Sentinel = 'params'
100
0
    (msg__)->WriteSentinel(1677790004);
101
0
102
0
103
0
104
0
    if (mozilla::ipc::LoggingEnabledFor("PBackgroundSDBConnectionChild")) {
105
0
        mozilla::ipc::LogMessageForProtocol("PBackgroundSDBConnectionChild", OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending);
106
0
    }
107
0
    AUTO_PROFILER_LABEL("PBackgroundSDBConnection::Msg_PBackgroundSDBRequestConstructor", 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 PBackgroundSDBConnectionChild::RemoveManagee(
121
        int32_t aProtocolId,
122
        IProtocol* aListener) -> void
123
0
{
124
0
    switch (aProtocolId) {
125
0
    case PBackgroundSDBRequestMsgStart:
126
0
        {
127
0
            PBackgroundSDBRequestChild* actor = static_cast<PBackgroundSDBRequestChild*>(aListener);
128
0
            auto& container = mManagedPBackgroundSDBRequestChild;
129
0
            MOZ_RELEASE_ASSERT((container).Contains(actor), "actor not managed by this!");
130
0
131
0
            (container).RemoveEntry(actor);
132
0
            DeallocPBackgroundSDBRequestChild(actor);
133
0
            return;
134
0
        }
135
0
    default:
136
0
        {
137
0
            FatalError("unreached");
138
0
            return;
139
0
        }
140
0
    }
141
0
}
142
143
auto PBackgroundSDBConnectionChild::OnMessageReceived(const Message& msg__) -> PBackgroundSDBConnectionChild::Result
144
0
{
145
0
    switch ((msg__).type()) {
146
0
    case PBackgroundSDBConnection::Reply_PBackgroundSDBRequestConstructor__ID:
147
0
        {
148
0
            return MsgProcessed;
149
0
        }
150
0
    case PBackgroundSDBConnection::Msg___delete____ID:
151
0
        {
152
0
            if (mozilla::ipc::LoggingEnabledFor("PBackgroundSDBConnectionChild")) {
153
0
                mozilla::ipc::LogMessageForProtocol("PBackgroundSDBConnectionChild", OtherPid(), "Received ", ((&(msg__)))->type(), mozilla::ipc::MessageDirection::eReceiving);
154
0
            }
155
0
            AUTO_PROFILER_LABEL("PBackgroundSDBConnection::Msg___delete__", OTHER);
156
0
157
0
            PickleIterator iter__(msg__);
158
0
            PBackgroundSDBConnectionChild* actor;
159
0
160
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(actor)))))) {
161
0
                FatalError("Error deserializing 'PBackgroundSDBConnectionChild'");
162
0
                return MsgValueError;
163
0
            }
164
0
            if ((!((*((&(actor))))))) {
165
0
                FatalError("Error deserializing 'PBackgroundSDBConnectionChild'");
166
0
                return MsgValueError;
167
0
            }
168
0
            // Sentinel = 'actor'
169
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 875202478)))) {
170
0
                mozilla::ipc::SentinelReadError("Error deserializing 'PBackgroundSDBConnectionChild'");
171
0
                return MsgValueError;
172
0
            }
173
0
            (msg__).EndRead(iter__, (msg__).type());
174
0
            if ((!(StateTransition(true, (&(mLivenessState)))))) {
175
0
                FatalError("Transition error");
176
0
                return MsgValueError;
177
0
            }
178
0
            if ((!(Recv__delete__()))) {
179
0
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
180
0
                // Error handled in mozilla::ipc::IPCResult
181
0
                return MsgProcessingError;
182
0
            }
183
0
184
0
185
0
            IProtocol* mgr = (actor)->Manager();
186
0
            (actor)->DestroySubtree(Deletion);
187
0
            (actor)->DeallocSubtree();
188
0
            (mgr)->RemoveManagee(PBackgroundSDBConnectionMsgStart, actor);
189
0
190
0
            return MsgProcessed;
191
0
        }
192
0
    case PBackgroundSDBConnection::Msg_AllowToClose__ID:
193
0
        {
194
0
            if (mozilla::ipc::LoggingEnabledFor("PBackgroundSDBConnectionChild")) {
195
0
                mozilla::ipc::LogMessageForProtocol("PBackgroundSDBConnectionChild", OtherPid(), "Received ", ((&(msg__)))->type(), mozilla::ipc::MessageDirection::eReceiving);
196
0
            }
197
0
            AUTO_PROFILER_LABEL("PBackgroundSDBConnection::Msg_AllowToClose", OTHER);
198
0
199
0
            if ((!(StateTransition(false, (&(mLivenessState)))))) {
200
0
                FatalError("Transition error");
201
0
                return MsgValueError;
202
0
            }
203
0
            if ((!(RecvAllowToClose()))) {
204
0
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
205
0
                // Error handled in mozilla::ipc::IPCResult
206
0
                return MsgProcessingError;
207
0
            }
208
0
209
0
            return MsgProcessed;
210
0
        }
211
0
    case PBackgroundSDBConnection::Msg_Closed__ID:
212
0
        {
213
0
            if (mozilla::ipc::LoggingEnabledFor("PBackgroundSDBConnectionChild")) {
214
0
                mozilla::ipc::LogMessageForProtocol("PBackgroundSDBConnectionChild", OtherPid(), "Received ", ((&(msg__)))->type(), mozilla::ipc::MessageDirection::eReceiving);
215
0
            }
216
0
            AUTO_PROFILER_LABEL("PBackgroundSDBConnection::Msg_Closed", OTHER);
217
0
218
0
            if ((!(StateTransition(false, (&(mLivenessState)))))) {
219
0
                FatalError("Transition error");
220
0
                return MsgValueError;
221
0
            }
222
0
            if ((!(RecvClosed()))) {
223
0
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
224
0
                // Error handled in mozilla::ipc::IPCResult
225
0
                return MsgProcessingError;
226
0
            }
227
0
228
0
            return MsgProcessed;
229
0
        }
230
0
    default:
231
0
        {
232
0
            return MsgNotKnown;
233
0
        }
234
0
    }
235
0
}
236
237
auto PBackgroundSDBConnectionChild::OnMessageReceived(
238
        const Message& msg__,
239
        Message*& reply__) -> PBackgroundSDBConnectionChild::Result
240
0
{
241
0
    return MsgNotKnown;
242
0
}
243
244
auto PBackgroundSDBConnectionChild::OnCallReceived(
245
        const Message& msg__,
246
        Message*& reply__) -> PBackgroundSDBConnectionChild::Result
247
0
{
248
0
    MOZ_ASSERT_UNREACHABLE("message protocol not supported");
249
0
    return MsgNotKnown;
250
0
}
251
252
auto PBackgroundSDBConnectionChild::GetProtocolTypeId() -> int32_t
253
0
{
254
0
    return PBackgroundSDBConnectionMsgStart;
255
0
}
256
257
auto PBackgroundSDBConnectionChild::DestroySubtree(ActorDestroyReason why) -> void
258
0
{
259
0
    // Unregister from our manager.
260
0
    Unregister(Id());
261
0
262
0
    ActorDestroyReason subtreewhy = (((why) == (Deletion)) || ((why) == (FailedConstructor)) ? AncestorDeletion : why);
263
0
264
0
    {
265
0
        // Recursively shutting down PBackgroundSDBRequest kids
266
0
        nsTArray<PBackgroundSDBRequestChild*> kids;
267
0
        // Accumulate kids into a stable structure to iterate over
268
0
        ManagedPBackgroundSDBRequestChild(kids);
269
0
        for (auto& kid : kids) {
270
0
            // Guarding against a child removing a sibling from the list during the iteration.
271
0
            if ((mManagedPBackgroundSDBRequestChild).Contains(kid)) {
272
0
                (kid)->DestroySubtree(subtreewhy);
273
0
            }
274
0
        }
275
0
    }
276
0
277
0
    // Reject owning pending responses.
278
0
    (GetIPCChannel())->RejectPendingResponsesForActor(this);
279
0
280
0
    // Finally, destroy "us".
281
0
    ActorDestroy(why);
282
0
}
283
284
auto PBackgroundSDBConnectionChild::DeallocSubtree() -> void
285
0
{
286
0
    {
287
0
        // Recursively deleting PBackgroundSDBRequest kids
288
0
        for (auto iter = (mManagedPBackgroundSDBRequestChild).Iter(); (!((iter).Done())); (iter).Next()) {
289
0
            (((iter).Get())->GetKey())->DeallocSubtree();
290
0
        }
291
0
292
0
        for (auto iter = (mManagedPBackgroundSDBRequestChild).Iter(); (!((iter).Done())); (iter).Next()) {
293
0
            DeallocPBackgroundSDBRequestChild(((iter).Get())->GetKey());
294
0
        }
295
0
        (mManagedPBackgroundSDBRequestChild).Clear();
296
0
    }
297
0
}
298
299
300
301
} // namespace dom
302
} // namespace mozilla
303
namespace mozilla {
304
namespace ipc {
305
auto IPDLParamTraits<mozilla::dom::PBackgroundSDBConnectionChild>::Write(
306
        IPC::Message* aMsg,
307
        mozilla::ipc::IProtocol* aActor,
308
        const paramType& aVar) -> void
309
0
{
310
0
    int32_t id;
311
0
    if ((!(aVar))) {
312
0
        id = 0;
313
0
    }
314
0
    else {
315
0
        id = (aVar)->Id();
316
0
        if ((1) == (id)) {
317
0
            (aActor)->FatalError("actor has been |delete|d");
318
0
        }
319
0
    }
320
0
    WriteIPDLParam(aMsg, aActor, id);
321
0
}
322
323
auto IPDLParamTraits<mozilla::dom::PBackgroundSDBConnectionChild>::Read(
324
        const IPC::Message* aMsg,
325
        PickleIterator* aIter,
326
        mozilla::ipc::IProtocol* aActor,
327
        paramType* aVar) -> bool
328
0
{
329
0
    mozilla::Maybe<mozilla::ipc::IProtocol*> actor = (aActor)->ReadActor(aMsg, aIter, true, "PBackgroundSDBConnection", PBackgroundSDBConnectionMsgStart);
330
0
    if ((actor).isNothing()) {
331
0
        return false;
332
0
    }
333
0
334
0
    (*(aVar)) = static_cast<mozilla::dom::PBackgroundSDBConnectionChild*>((actor).value());
335
0
    return true;
336
0
}
337
338
} // namespace ipc
339
} // namespace mozilla