Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/ipc/ipdl/PServiceWorkerParent.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/PServiceWorkerParent.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 PServiceWorkerParent::ActorDestroy(ActorDestroyReason aWhy) -> void
19
0
{
20
0
}
21
22
MOZ_IMPLICIT PServiceWorkerParent::PServiceWorkerParent() :
23
    mozilla::ipc::IProtocol(mozilla::ipc::ParentSide),
24
    mLivenessState(mozilla::ipc::LivenessState::Dead)
25
0
{
26
0
    MOZ_COUNT_CTOR(PServiceWorkerParent);
27
0
}
28
29
PServiceWorkerParent::~PServiceWorkerParent()
30
0
{
31
0
    MOZ_COUNT_DTOR(PServiceWorkerParent);
32
0
}
33
34
auto PServiceWorkerParent::Manager() const -> PBackgroundParent*
35
0
{
36
0
    return static_cast<PBackgroundParent*>(IProtocol::Manager());
37
0
}
38
39
auto PServiceWorkerParent::Send__delete__(PServiceWorkerParent* actor) -> bool
40
0
{
41
0
    if ((!(actor))) {
42
0
        return false;
43
0
    }
44
0
45
0
    IPC::Message* msg__ = PServiceWorker::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("PServiceWorkerParent")) {
55
0
        mozilla::ipc::LogMessageForProtocol("PServiceWorkerParent", (actor)->OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending);
56
0
    }
57
0
    AUTO_PROFILER_LABEL("PServiceWorker::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(PServiceWorkerMsgStart, actor);
68
0
    return sendok__;
69
0
}
70
71
auto PServiceWorkerParent::RemoveManagee(
72
        int32_t aProtocolId,
73
        IProtocol* aListener) -> void
74
0
{
75
0
    FatalError("unreached");
76
0
    return;
77
0
}
78
79
auto PServiceWorkerParent::OnMessageReceived(const Message& msg__) -> PServiceWorkerParent::Result
80
0
{
81
0
    switch ((msg__).type()) {
82
0
    case PServiceWorker::Msg_Teardown__ID:
83
0
        {
84
0
            if (mozilla::ipc::LoggingEnabledFor("PServiceWorkerParent")) {
85
0
                mozilla::ipc::LogMessageForProtocol("PServiceWorkerParent", OtherPid(), "Received ", ((&(msg__)))->type(), mozilla::ipc::MessageDirection::eReceiving);
86
0
            }
87
0
            AUTO_PROFILER_LABEL("PServiceWorker::Msg_Teardown", OTHER);
88
0
89
0
            if ((!(StateTransition(false, (&(mLivenessState)))))) {
90
0
                FatalError("Transition error");
91
0
                return MsgValueError;
92
0
            }
93
0
            if ((!(RecvTeardown()))) {
94
0
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
95
0
                // Error handled in mozilla::ipc::IPCResult
96
0
                return MsgProcessingError;
97
0
            }
98
0
99
0
            return MsgProcessed;
100
0
        }
101
0
    case PServiceWorker::Msg_PostMessage__ID:
102
0
        {
103
0
            if (mozilla::ipc::LoggingEnabledFor("PServiceWorkerParent")) {
104
0
                mozilla::ipc::LogMessageForProtocol("PServiceWorkerParent", OtherPid(), "Received ", ((&(msg__)))->type(), mozilla::ipc::MessageDirection::eReceiving);
105
0
            }
106
0
            AUTO_PROFILER_LABEL("PServiceWorker::Msg_PostMessage", OTHER);
107
0
108
0
            PickleIterator iter__(msg__);
109
0
            ClonedMessageData aClonedData;
110
0
            ClientInfoAndState aSource;
111
0
112
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(aClonedData)))))) {
113
0
                FatalError("Error deserializing 'ClonedMessageData'");
114
0
                return MsgValueError;
115
0
            }
116
0
            // Sentinel = 'aClonedData'
117
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 4150610527)))) {
118
0
                mozilla::ipc::SentinelReadError("Error deserializing 'ClonedMessageData'");
119
0
                return MsgValueError;
120
0
            }
121
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(aSource)))))) {
122
0
                FatalError("Error deserializing 'ClientInfoAndState'");
123
0
                return MsgValueError;
124
0
            }
125
0
            // Sentinel = 'aSource'
126
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 3199820789)))) {
127
0
                mozilla::ipc::SentinelReadError("Error deserializing 'ClientInfoAndState'");
128
0
                return MsgValueError;
129
0
            }
130
0
            (msg__).EndRead(iter__, (msg__).type());
131
0
            if ((!(StateTransition(false, (&(mLivenessState)))))) {
132
0
                FatalError("Transition error");
133
0
                return MsgValueError;
134
0
            }
135
0
            if ((!(RecvPostMessage(aClonedData, aSource)))) {
136
0
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
137
0
                // Error handled in mozilla::ipc::IPCResult
138
0
                return MsgProcessingError;
139
0
            }
140
0
141
0
            return MsgProcessed;
142
0
        }
143
0
    case PServiceWorker::Reply___delete____ID:
144
0
        {
145
0
            return MsgProcessed;
146
0
        }
147
0
    default:
148
0
        {
149
0
            return MsgNotKnown;
150
0
        }
151
0
    }
152
0
}
153
154
auto PServiceWorkerParent::OnMessageReceived(
155
        const Message& msg__,
156
        Message*& reply__) -> PServiceWorkerParent::Result
157
0
{
158
0
    return MsgNotKnown;
159
0
}
160
161
auto PServiceWorkerParent::OnCallReceived(
162
        const Message& msg__,
163
        Message*& reply__) -> PServiceWorkerParent::Result
164
0
{
165
0
    MOZ_ASSERT_UNREACHABLE("message protocol not supported");
166
0
    return MsgNotKnown;
167
0
}
168
169
auto PServiceWorkerParent::GetProtocolTypeId() -> int32_t
170
0
{
171
0
    return PServiceWorkerMsgStart;
172
0
}
173
174
auto PServiceWorkerParent::DestroySubtree(ActorDestroyReason why) -> void
175
0
{
176
0
    // Unregister from our manager.
177
0
    Unregister(Id());
178
0
179
0
    // Reject owning pending responses.
180
0
    (GetIPCChannel())->RejectPendingResponsesForActor(this);
181
0
182
0
    // Finally, destroy "us".
183
0
    ActorDestroy(why);
184
0
}
185
186
auto PServiceWorkerParent::DeallocSubtree() -> void
187
0
{
188
0
}
189
190
191
192
} // namespace dom
193
} // namespace mozilla
194
namespace mozilla {
195
namespace ipc {
196
auto IPDLParamTraits<mozilla::dom::PServiceWorkerParent>::Write(
197
        IPC::Message* aMsg,
198
        mozilla::ipc::IProtocol* aActor,
199
        const paramType& aVar) -> void
200
0
{
201
0
    int32_t id;
202
0
    if ((!(aVar))) {
203
0
        id = 0;
204
0
    }
205
0
    else {
206
0
        id = (aVar)->Id();
207
0
        if ((1) == (id)) {
208
0
            (aActor)->FatalError("actor has been |delete|d");
209
0
        }
210
0
    }
211
0
    WriteIPDLParam(aMsg, aActor, id);
212
0
}
213
214
auto IPDLParamTraits<mozilla::dom::PServiceWorkerParent>::Read(
215
        const IPC::Message* aMsg,
216
        PickleIterator* aIter,
217
        mozilla::ipc::IProtocol* aActor,
218
        paramType* aVar) -> bool
219
0
{
220
0
    mozilla::Maybe<mozilla::ipc::IProtocol*> actor = (aActor)->ReadActor(aMsg, aIter, true, "PServiceWorker", PServiceWorkerMsgStart);
221
0
    if ((actor).isNothing()) {
222
0
        return false;
223
0
    }
224
0
225
0
    (*(aVar)) = static_cast<mozilla::dom::PServiceWorkerParent*>((actor).value());
226
0
    return true;
227
0
}
228
229
} // namespace ipc
230
} // namespace mozilla