Coverage Report

Created: 2018-09-25 14:53

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