Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/ipc/ipdl/PParentToChildStreamParent.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/ipc/PParentToChildStreamParent.h"
8
9
#include "mozilla/ipc/PBackgroundParent.h"
10
#include "mozilla/dom/PContentParent.h"
11
#include "mozilla/dom/PContentBridgeParent.h"
12
13
#include "nsIFile.h"
14
#include "GeckoProfiler.h"
15
16
namespace mozilla {
17
namespace ipc {
18
19
20
auto PParentToChildStreamParent::Recv__delete__() -> mozilla::ipc::IPCResult
21
0
{
22
0
    return IPC_OK();
23
0
}
24
25
auto PParentToChildStreamParent::ActorDestroy(ActorDestroyReason aWhy) -> void
26
0
{
27
0
}
28
29
MOZ_IMPLICIT PParentToChildStreamParent::PParentToChildStreamParent() :
30
    mozilla::ipc::IProtocol(mozilla::ipc::ParentSide),
31
    mLivenessState(mozilla::ipc::LivenessState::Dead)
32
0
{
33
0
    MOZ_COUNT_CTOR(PParentToChildStreamParent);
34
0
}
35
36
PParentToChildStreamParent::~PParentToChildStreamParent()
37
0
{
38
0
    MOZ_COUNT_DTOR(PParentToChildStreamParent);
39
0
}
40
41
auto PParentToChildStreamParent::SendBuffer(const ByteBuffer& aBuffer) -> bool
42
0
{
43
0
    IPC::Message* msg__ = PParentToChildStream::Msg_Buffer(Id());
44
0
45
0
    WriteIPDLParam(msg__, this, aBuffer);
46
0
    // Sentinel = 'aBuffer'
47
0
    (msg__)->WriteSentinel(35469444);
48
0
49
0
50
0
51
0
52
0
    if (mozilla::ipc::LoggingEnabledFor("PParentToChildStreamParent")) {
53
0
        mozilla::ipc::LogMessageForProtocol("PParentToChildStreamParent", OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending);
54
0
    }
55
0
    AUTO_PROFILER_LABEL("PParentToChildStream::Msg_Buffer", OTHER);
56
0
    if ((!(StateTransition(false, (&(mLivenessState)))))) {
57
0
        mozilla::ipc::LogicError("Transition error");
58
0
    }
59
0
60
0
    bool sendok__ = (GetIPCChannel())->Send(msg__);
61
0
    return sendok__;
62
0
}
63
64
auto PParentToChildStreamParent::SendClose(const nsresult& aRv) -> bool
65
0
{
66
0
    IPC::Message* msg__ = PParentToChildStream::Msg_Close(Id());
67
0
68
0
    WriteIPDLParam(msg__, this, aRv);
69
0
    // Sentinel = 'aRv'
70
0
    (msg__)->WriteSentinel(2742041894);
71
0
72
0
73
0
74
0
75
0
    if (mozilla::ipc::LoggingEnabledFor("PParentToChildStreamParent")) {
76
0
        mozilla::ipc::LogMessageForProtocol("PParentToChildStreamParent", OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending);
77
0
    }
78
0
    AUTO_PROFILER_LABEL("PParentToChildStream::Msg_Close", OTHER);
79
0
    if ((!(StateTransition(false, (&(mLivenessState)))))) {
80
0
        mozilla::ipc::LogicError("Transition error");
81
0
    }
82
0
83
0
    bool sendok__ = (GetIPCChannel())->Send(msg__);
84
0
    return sendok__;
85
0
}
86
87
auto PParentToChildStreamParent::RemoveManagee(
88
        int32_t aProtocolId,
89
        IProtocol* aListener) -> void
90
0
{
91
0
    FatalError("unreached");
92
0
    return;
93
0
}
94
95
auto PParentToChildStreamParent::OnMessageReceived(const Message& msg__) -> PParentToChildStreamParent::Result
96
0
{
97
0
    switch ((msg__).type()) {
98
0
    case PParentToChildStream::Msg_StartReading__ID:
99
0
        {
100
0
            if (mozilla::ipc::LoggingEnabledFor("PParentToChildStreamParent")) {
101
0
                mozilla::ipc::LogMessageForProtocol("PParentToChildStreamParent", OtherPid(), "Received ", ((&(msg__)))->type(), mozilla::ipc::MessageDirection::eReceiving);
102
0
            }
103
0
            AUTO_PROFILER_LABEL("PParentToChildStream::Msg_StartReading", OTHER);
104
0
105
0
            if ((!(StateTransition(false, (&(mLivenessState)))))) {
106
0
                FatalError("Transition error");
107
0
                return MsgValueError;
108
0
            }
109
0
            if ((!(RecvStartReading()))) {
110
0
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
111
0
                // Error handled in mozilla::ipc::IPCResult
112
0
                return MsgProcessingError;
113
0
            }
114
0
115
0
            return MsgProcessed;
116
0
        }
117
0
    case PParentToChildStream::Msg_RequestClose__ID:
118
0
        {
119
0
            if (mozilla::ipc::LoggingEnabledFor("PParentToChildStreamParent")) {
120
0
                mozilla::ipc::LogMessageForProtocol("PParentToChildStreamParent", OtherPid(), "Received ", ((&(msg__)))->type(), mozilla::ipc::MessageDirection::eReceiving);
121
0
            }
122
0
            AUTO_PROFILER_LABEL("PParentToChildStream::Msg_RequestClose", OTHER);
123
0
124
0
            PickleIterator iter__(msg__);
125
0
            nsresult aRv;
126
0
127
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(aRv)))))) {
128
0
                FatalError("Error deserializing 'nsresult'");
129
0
                return MsgValueError;
130
0
            }
131
0
            // Sentinel = 'aRv'
132
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 2742041894)))) {
133
0
                mozilla::ipc::SentinelReadError("Error deserializing 'nsresult'");
134
0
                return MsgValueError;
135
0
            }
136
0
            (msg__).EndRead(iter__, (msg__).type());
137
0
            if ((!(StateTransition(false, (&(mLivenessState)))))) {
138
0
                FatalError("Transition error");
139
0
                return MsgValueError;
140
0
            }
141
0
            if ((!(RecvRequestClose(aRv)))) {
142
0
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
143
0
                // Error handled in mozilla::ipc::IPCResult
144
0
                return MsgProcessingError;
145
0
            }
146
0
147
0
            return MsgProcessed;
148
0
        }
149
0
    case PParentToChildStream::Msg___delete____ID:
150
0
        {
151
0
            if (mozilla::ipc::LoggingEnabledFor("PParentToChildStreamParent")) {
152
0
                mozilla::ipc::LogMessageForProtocol("PParentToChildStreamParent", OtherPid(), "Received ", ((&(msg__)))->type(), mozilla::ipc::MessageDirection::eReceiving);
153
0
            }
154
0
            AUTO_PROFILER_LABEL("PParentToChildStream::Msg___delete__", OTHER);
155
0
156
0
            PickleIterator iter__(msg__);
157
0
            PParentToChildStreamParent* actor;
158
0
159
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(actor)))))) {
160
0
                FatalError("Error deserializing 'PParentToChildStreamParent'");
161
0
                return MsgValueError;
162
0
            }
163
0
            if ((!((*((&(actor))))))) {
164
0
                FatalError("Error deserializing 'PParentToChildStreamParent'");
165
0
                return MsgValueError;
166
0
            }
167
0
            // Sentinel = 'actor'
168
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 875202478)))) {
169
0
                mozilla::ipc::SentinelReadError("Error deserializing 'PParentToChildStreamParent'");
170
0
                return MsgValueError;
171
0
            }
172
0
            (msg__).EndRead(iter__, (msg__).type());
173
0
            if ((!(StateTransition(true, (&(mLivenessState)))))) {
174
0
                FatalError("Transition error");
175
0
                return MsgValueError;
176
0
            }
177
0
            if ((!(Recv__delete__()))) {
178
0
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
179
0
                // Error handled in mozilla::ipc::IPCResult
180
0
                return MsgProcessingError;
181
0
            }
182
0
183
0
184
0
            IProtocol* mgr = (actor)->Manager();
185
0
            (actor)->DestroySubtree(Deletion);
186
0
            (actor)->DeallocSubtree();
187
0
            (mgr)->RemoveManagee(PParentToChildStreamMsgStart, actor);
188
0
189
0
            return MsgProcessed;
190
0
        }
191
0
    default:
192
0
        {
193
0
            return MsgNotKnown;
194
0
        }
195
0
    }
196
0
}
197
198
auto PParentToChildStreamParent::OnMessageReceived(
199
        const Message& msg__,
200
        Message*& reply__) -> PParentToChildStreamParent::Result
201
0
{
202
0
    return MsgNotKnown;
203
0
}
204
205
auto PParentToChildStreamParent::OnCallReceived(
206
        const Message& msg__,
207
        Message*& reply__) -> PParentToChildStreamParent::Result
208
0
{
209
0
    MOZ_ASSERT_UNREACHABLE("message protocol not supported");
210
0
    return MsgNotKnown;
211
0
}
212
213
auto PParentToChildStreamParent::GetProtocolTypeId() -> int32_t
214
0
{
215
0
    return PParentToChildStreamMsgStart;
216
0
}
217
218
auto PParentToChildStreamParent::DestroySubtree(ActorDestroyReason why) -> void
219
0
{
220
0
    // Unregister from our manager.
221
0
    Unregister(Id());
222
0
223
0
    // Reject owning pending responses.
224
0
    (GetIPCChannel())->RejectPendingResponsesForActor(this);
225
0
226
0
    // Finally, destroy "us".
227
0
    ActorDestroy(why);
228
0
}
229
230
auto PParentToChildStreamParent::DeallocSubtree() -> void
231
0
{
232
0
}
233
234
235
236
} // namespace ipc
237
} // namespace mozilla
238
namespace mozilla {
239
namespace ipc {
240
auto IPDLParamTraits<mozilla::ipc::PParentToChildStreamParent>::Write(
241
        IPC::Message* aMsg,
242
        mozilla::ipc::IProtocol* aActor,
243
        const paramType& aVar) -> void
244
0
{
245
0
    int32_t id;
246
0
    if ((!(aVar))) {
247
0
        id = 0;
248
0
    }
249
0
    else {
250
0
        id = (aVar)->Id();
251
0
        if ((1) == (id)) {
252
0
            (aActor)->FatalError("actor has been |delete|d");
253
0
        }
254
0
    }
255
0
    WriteIPDLParam(aMsg, aActor, id);
256
0
}
257
258
auto IPDLParamTraits<mozilla::ipc::PParentToChildStreamParent>::Read(
259
        const IPC::Message* aMsg,
260
        PickleIterator* aIter,
261
        mozilla::ipc::IProtocol* aActor,
262
        paramType* aVar) -> bool
263
0
{
264
0
    mozilla::Maybe<mozilla::ipc::IProtocol*> actor = (aActor)->ReadActor(aMsg, aIter, true, "PParentToChildStream", PParentToChildStreamMsgStart);
265
0
    if ((actor).isNothing()) {
266
0
        return false;
267
0
    }
268
0
269
0
    (*(aVar)) = static_cast<mozilla::ipc::PParentToChildStreamParent*>((actor).value());
270
0
    return true;
271
0
}
272
273
} // namespace ipc
274
} // namespace mozilla