Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/ipc/ipdl/PServiceWorkerRegistrationParent.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/PServiceWorkerRegistrationParent.h"
8
9
#include "mozilla/ipc/PBackgroundParent.h"
10
11
#include "nsIFile.h"
12
#include "GeckoProfiler.h"
13
14
namespace mozilla {
15
namespace dom {
16
17
18
auto PServiceWorkerRegistrationParent::ActorDestroy(ActorDestroyReason aWhy) -> void
19
0
{
20
0
}
21
22
MOZ_IMPLICIT PServiceWorkerRegistrationParent::PServiceWorkerRegistrationParent() :
23
    mozilla::ipc::IProtocol(mozilla::ipc::ParentSide),
24
    mLivenessState(mozilla::ipc::LivenessState::Dead)
25
0
{
26
0
    MOZ_COUNT_CTOR(PServiceWorkerRegistrationParent);
27
0
}
28
29
PServiceWorkerRegistrationParent::~PServiceWorkerRegistrationParent()
30
0
{
31
0
    MOZ_COUNT_DTOR(PServiceWorkerRegistrationParent);
32
0
}
33
34
auto PServiceWorkerRegistrationParent::Manager() const -> PBackgroundParent*
35
0
{
36
0
    return static_cast<PBackgroundParent*>(IProtocol::Manager());
37
0
}
38
39
auto PServiceWorkerRegistrationParent::Send__delete__(PServiceWorkerRegistrationParent* actor) -> bool
40
0
{
41
0
    if ((!(actor))) {
42
0
        return false;
43
0
    }
44
0
45
0
    IPC::Message* msg__ = PServiceWorkerRegistration::Msg___delete__((actor)->Id());
46
0
47
0
    MOZ_RELEASE_ASSERT(actor, "NULL actor value passed to non-nullable param");
48
0
    WriteIPDLParam(msg__, actor, actor);
49
0
    // Sentinel = 'actor'
50
0
    (msg__)->WriteSentinel(875202478);
51
0
52
0
53
0
54
0
    if (mozilla::ipc::LoggingEnabledFor("PServiceWorkerRegistrationParent")) {
55
0
        mozilla::ipc::LogMessageForProtocol("PServiceWorkerRegistrationParent", (actor)->OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending);
56
0
    }
57
0
    AUTO_PROFILER_LABEL("PServiceWorkerRegistration::Msg___delete__", OTHER);
58
0
    if ((!(StateTransition(true, (&((actor)->mLivenessState)))))) {
59
0
        mozilla::ipc::LogicError("Transition error");
60
0
    }
61
0
62
0
    bool sendok__ = ((actor)->GetIPCChannel())->Send(msg__);
63
0
64
0
    IProtocol* mgr = (actor)->Manager();
65
0
    (actor)->DestroySubtree(Deletion);
66
0
    (actor)->DeallocSubtree();
67
0
    (mgr)->RemoveManagee(PServiceWorkerRegistrationMsgStart, actor);
68
0
    return sendok__;
69
0
}
70
71
auto PServiceWorkerRegistrationParent::SendUpdateState(const IPCServiceWorkerRegistrationDescriptor& aDescriptor) -> bool
72
0
{
73
0
    IPC::Message* msg__ = PServiceWorkerRegistration::Msg_UpdateState(Id());
74
0
75
0
    WriteIPDLParam(msg__, this, aDescriptor);
76
0
    // Sentinel = 'aDescriptor'
77
0
    (msg__)->WriteSentinel(897756877);
78
0
79
0
80
0
81
0
82
0
    if (mozilla::ipc::LoggingEnabledFor("PServiceWorkerRegistrationParent")) {
83
0
        mozilla::ipc::LogMessageForProtocol("PServiceWorkerRegistrationParent", OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending);
84
0
    }
85
0
    AUTO_PROFILER_LABEL("PServiceWorkerRegistration::Msg_UpdateState", OTHER);
86
0
    if ((!(StateTransition(false, (&(mLivenessState)))))) {
87
0
        mozilla::ipc::LogicError("Transition error");
88
0
    }
89
0
90
0
    bool sendok__ = (GetIPCChannel())->Send(msg__);
91
0
    return sendok__;
92
0
}
93
94
auto PServiceWorkerRegistrationParent::RemoveManagee(
95
        int32_t aProtocolId,
96
        IProtocol* aListener) -> void
97
0
{
98
0
    FatalError("unreached");
99
0
    return;
100
0
}
101
102
auto PServiceWorkerRegistrationParent::OnMessageReceived(const Message& msg__) -> PServiceWorkerRegistrationParent::Result
103
0
{
104
0
    switch ((msg__).type()) {
105
0
    case PServiceWorkerRegistration::Msg_Teardown__ID:
106
0
        {
107
0
            if (mozilla::ipc::LoggingEnabledFor("PServiceWorkerRegistrationParent")) {
108
0
                mozilla::ipc::LogMessageForProtocol("PServiceWorkerRegistrationParent", OtherPid(), "Received ", ((&(msg__)))->type(), mozilla::ipc::MessageDirection::eReceiving);
109
0
            }
110
0
            AUTO_PROFILER_LABEL("PServiceWorkerRegistration::Msg_Teardown", OTHER);
111
0
112
0
            if ((!(StateTransition(false, (&(mLivenessState)))))) {
113
0
                FatalError("Transition error");
114
0
                return MsgValueError;
115
0
            }
116
0
            if ((!(RecvTeardown()))) {
117
0
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
118
0
                // Error handled in mozilla::ipc::IPCResult
119
0
                return MsgProcessingError;
120
0
            }
121
0
122
0
            return MsgProcessed;
123
0
        }
124
0
    case PServiceWorkerRegistration::Msg_Unregister__ID:
125
0
        {
126
0
            if (mozilla::ipc::LoggingEnabledFor("PServiceWorkerRegistrationParent")) {
127
0
                mozilla::ipc::LogMessageForProtocol("PServiceWorkerRegistrationParent", OtherPid(), "Received ", ((&(msg__)))->type(), mozilla::ipc::MessageDirection::eReceiving);
128
0
            }
129
0
            AUTO_PROFILER_LABEL("PServiceWorkerRegistration::Msg_Unregister", OTHER);
130
0
131
0
            if ((!(StateTransition(false, (&(mLivenessState)))))) {
132
0
                FatalError("Transition error");
133
0
                return MsgValueError;
134
0
            }
135
0
            int32_t id__ = Id();
136
0
137
0
            int32_t seqno__ = (msg__).seqno();
138
0
            WeakPtr<PServiceWorkerRegistrationParent> self__ = this;
139
0
            UnregisterResolver resolver = [this, self__, id__, seqno__](const Tuple<const bool&, const CopyableErrorResult&>& aParam) {
140
0
                if ((!(self__))) {
141
0
                    NS_WARNING("Not resolving response because actor is dead.");
142
0
                    return;
143
0
                }
144
0
                if ((mLivenessState) == (mozilla::ipc::LivenessState::Dead)) {
145
0
                    NS_WARNING("Not resolving response because actor is destroyed.");
146
0
                    return;
147
0
                }
148
0
                bool resolve__ = true;
149
0
                bool aSuccess;
150
0
                CopyableErrorResult aRv;
151
0
                Tie(aSuccess, aRv) = std::move(aParam);
152
0
                IPC::Message* reply__ = PServiceWorkerRegistration::Reply_Unregister(id__);
153
0
                WriteIPDLParam(reply__, self__, resolve__);
154
0
                // Sentinel = 'resolve__'
155
0
                (reply__)->WriteSentinel(3997392463);
156
0
                WriteIPDLParam(reply__, self__, aSuccess);
157
0
                // Sentinel = 'aSuccess'
158
0
                (reply__)->WriteSentinel(2132928722);
159
0
                WriteIPDLParam(reply__, self__, aRv);
160
0
                // Sentinel = 'aRv'
161
0
                (reply__)->WriteSentinel(2742041894);
162
0
                (reply__)->set_seqno(seqno__);
163
0
164
0
                if (mozilla::ipc::LoggingEnabledFor("PServiceWorkerRegistrationParent")) {
165
0
                    mozilla::ipc::LogMessageForProtocol("PServiceWorkerRegistrationParent", OtherPid(), "Sending reply ", (reply__)->type(), mozilla::ipc::MessageDirection::eSending);
166
0
                }
167
0
                bool sendok__ = (GetIPCChannel())->Send(reply__);
168
0
                if ((!(sendok__))) {
169
0
                    NS_WARNING("Error sending reply");
170
0
                }
171
0
            };
172
0
            if ((!(RecvUnregister(std::move(resolver))))) {
173
0
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
174
0
                // Error handled in mozilla::ipc::IPCResult
175
0
                return MsgProcessingError;
176
0
            }
177
0
178
0
            return MsgProcessed;
179
0
        }
180
0
    case PServiceWorkerRegistration::Msg_Update__ID:
181
0
        {
182
0
            if (mozilla::ipc::LoggingEnabledFor("PServiceWorkerRegistrationParent")) {
183
0
                mozilla::ipc::LogMessageForProtocol("PServiceWorkerRegistrationParent", OtherPid(), "Received ", ((&(msg__)))->type(), mozilla::ipc::MessageDirection::eReceiving);
184
0
            }
185
0
            AUTO_PROFILER_LABEL("PServiceWorkerRegistration::Msg_Update", OTHER);
186
0
187
0
            if ((!(StateTransition(false, (&(mLivenessState)))))) {
188
0
                FatalError("Transition error");
189
0
                return MsgValueError;
190
0
            }
191
0
            int32_t id__ = Id();
192
0
193
0
            int32_t seqno__ = (msg__).seqno();
194
0
            WeakPtr<PServiceWorkerRegistrationParent> self__ = this;
195
0
            UpdateResolver resolver = [this, self__, id__, seqno__](const IPCServiceWorkerRegistrationDescriptorOrCopyableErrorResult& aParam) {
196
0
                if ((!(self__))) {
197
0
                    NS_WARNING("Not resolving response because actor is dead.");
198
0
                    return;
199
0
                }
200
0
                if ((mLivenessState) == (mozilla::ipc::LivenessState::Dead)) {
201
0
                    NS_WARNING("Not resolving response because actor is destroyed.");
202
0
                    return;
203
0
                }
204
0
                bool resolve__ = true;
205
0
                IPCServiceWorkerRegistrationDescriptorOrCopyableErrorResult aResult;
206
0
                aResult = std::move(aParam);
207
0
                IPC::Message* reply__ = PServiceWorkerRegistration::Reply_Update(id__);
208
0
                WriteIPDLParam(reply__, self__, resolve__);
209
0
                // Sentinel = 'resolve__'
210
0
                (reply__)->WriteSentinel(3997392463);
211
0
                WriteIPDLParam(reply__, self__, aResult);
212
0
                // Sentinel = 'aResult'
213
0
                (reply__)->WriteSentinel(3888726089);
214
0
                (reply__)->set_seqno(seqno__);
215
0
216
0
                if (mozilla::ipc::LoggingEnabledFor("PServiceWorkerRegistrationParent")) {
217
0
                    mozilla::ipc::LogMessageForProtocol("PServiceWorkerRegistrationParent", OtherPid(), "Sending reply ", (reply__)->type(), mozilla::ipc::MessageDirection::eSending);
218
0
                }
219
0
                bool sendok__ = (GetIPCChannel())->Send(reply__);
220
0
                if ((!(sendok__))) {
221
0
                    NS_WARNING("Error sending reply");
222
0
                }
223
0
            };
224
0
            if ((!(RecvUpdate(std::move(resolver))))) {
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 PServiceWorkerRegistration::Reply___delete____ID:
233
0
        {
234
0
            return MsgProcessed;
235
0
        }
236
0
    default:
237
0
        {
238
0
            return MsgNotKnown;
239
0
        }
240
0
    }
241
0
}
242
243
auto PServiceWorkerRegistrationParent::OnMessageReceived(
244
        const Message& msg__,
245
        Message*& reply__) -> PServiceWorkerRegistrationParent::Result
246
0
{
247
0
    return MsgNotKnown;
248
0
}
249
250
auto PServiceWorkerRegistrationParent::OnCallReceived(
251
        const Message& msg__,
252
        Message*& reply__) -> PServiceWorkerRegistrationParent::Result
253
0
{
254
0
    MOZ_ASSERT_UNREACHABLE("message protocol not supported");
255
0
    return MsgNotKnown;
256
0
}
257
258
auto PServiceWorkerRegistrationParent::GetProtocolTypeId() -> int32_t
259
0
{
260
0
    return PServiceWorkerRegistrationMsgStart;
261
0
}
262
263
auto PServiceWorkerRegistrationParent::DestroySubtree(ActorDestroyReason why) -> void
264
0
{
265
0
    // Unregister from our manager.
266
0
    Unregister(Id());
267
0
268
0
    // Reject owning pending responses.
269
0
    (GetIPCChannel())->RejectPendingResponsesForActor(this);
270
0
271
0
    // Finally, destroy "us".
272
0
    ActorDestroy(why);
273
0
}
274
275
auto PServiceWorkerRegistrationParent::DeallocSubtree() -> void
276
0
{
277
0
}
278
279
280
281
} // namespace dom
282
} // namespace mozilla
283
namespace mozilla {
284
namespace ipc {
285
auto IPDLParamTraits<mozilla::dom::PServiceWorkerRegistrationParent>::Write(
286
        IPC::Message* aMsg,
287
        mozilla::ipc::IProtocol* aActor,
288
        const paramType& aVar) -> void
289
0
{
290
0
    int32_t id;
291
0
    if ((!(aVar))) {
292
0
        id = 0;
293
0
    }
294
0
    else {
295
0
        id = (aVar)->Id();
296
0
        if ((1) == (id)) {
297
0
            (aActor)->FatalError("actor has been |delete|d");
298
0
        }
299
0
    }
300
0
    WriteIPDLParam(aMsg, aActor, id);
301
0
}
302
303
auto IPDLParamTraits<mozilla::dom::PServiceWorkerRegistrationParent>::Read(
304
        const IPC::Message* aMsg,
305
        PickleIterator* aIter,
306
        mozilla::ipc::IProtocol* aActor,
307
        paramType* aVar) -> bool
308
0
{
309
0
    mozilla::Maybe<mozilla::ipc::IProtocol*> actor = (aActor)->ReadActor(aMsg, aIter, true, "PServiceWorkerRegistration", PServiceWorkerRegistrationMsgStart);
310
0
    if ((actor).isNothing()) {
311
0
        return false;
312
0
    }
313
0
314
0
    (*(aVar)) = static_cast<mozilla::dom::PServiceWorkerRegistrationParent*>((actor).value());
315
0
    return true;
316
0
}
317
318
} // namespace ipc
319
} // namespace mozilla