Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/ipc/ipdl/PTCPServerSocketParent.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/net/PTCPServerSocketParent.h"
8
9
#include "mozilla/net/PNeckoParent.h"
10
#include "mozilla/net/PTCPSocketParent.h"
11
12
#include "nsIFile.h"
13
#include "GeckoProfiler.h"
14
15
namespace mozilla {
16
namespace net {
17
18
19
auto PTCPServerSocketParent::ActorDestroy(ActorDestroyReason aWhy) -> void
20
0
{
21
0
}
22
23
MOZ_IMPLICIT PTCPServerSocketParent::PTCPServerSocketParent() :
24
    mozilla::ipc::IProtocol(mozilla::ipc::ParentSide),
25
    mLivenessState(mozilla::ipc::LivenessState::Dead)
26
0
{
27
0
    MOZ_COUNT_CTOR(PTCPServerSocketParent);
28
0
}
29
30
PTCPServerSocketParent::~PTCPServerSocketParent()
31
0
{
32
0
    MOZ_COUNT_DTOR(PTCPServerSocketParent);
33
0
}
34
35
auto PTCPServerSocketParent::Manager() const -> PNeckoParent*
36
0
{
37
0
    return static_cast<PNeckoParent*>(IProtocol::Manager());
38
0
}
39
40
auto PTCPServerSocketParent::SendCallbackAccept(PTCPSocketParent* socket) -> bool
41
0
{
42
0
    IPC::Message* msg__ = PTCPServerSocket::Msg_CallbackAccept(Id());
43
0
44
0
    MOZ_RELEASE_ASSERT(socket, "NULL actor value passed to non-nullable param");
45
0
    WriteIPDLParam(msg__, this, socket);
46
0
    // Sentinel = 'socket'
47
0
    (msg__)->WriteSentinel(3619774181);
48
0
49
0
50
0
51
0
52
0
    if (mozilla::ipc::LoggingEnabledFor("PTCPServerSocketParent")) {
53
0
        mozilla::ipc::LogMessageForProtocol("PTCPServerSocketParent", OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending);
54
0
    }
55
0
    AUTO_PROFILER_LABEL("PTCPServerSocket::Msg_CallbackAccept", 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 PTCPServerSocketParent::Send__delete__(PTCPServerSocketParent* actor) -> bool
65
0
{
66
0
    if ((!(actor))) {
67
0
        return false;
68
0
    }
69
0
70
0
    IPC::Message* msg__ = PTCPServerSocket::Msg___delete__((actor)->Id());
71
0
72
0
    MOZ_RELEASE_ASSERT(actor, "NULL actor value passed to non-nullable param");
73
0
    WriteIPDLParam(msg__, actor, actor);
74
0
    // Sentinel = 'actor'
75
0
    (msg__)->WriteSentinel(875202478);
76
0
77
0
78
0
79
0
    if (mozilla::ipc::LoggingEnabledFor("PTCPServerSocketParent")) {
80
0
        mozilla::ipc::LogMessageForProtocol("PTCPServerSocketParent", (actor)->OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending);
81
0
    }
82
0
    AUTO_PROFILER_LABEL("PTCPServerSocket::Msg___delete__", OTHER);
83
0
    if ((!(StateTransition(true, (&((actor)->mLivenessState)))))) {
84
0
        mozilla::ipc::LogicError("Transition error");
85
0
    }
86
0
87
0
    bool sendok__ = ((actor)->GetIPCChannel())->Send(msg__);
88
0
89
0
    IProtocol* mgr = (actor)->Manager();
90
0
    (actor)->DestroySubtree(Deletion);
91
0
    (actor)->DeallocSubtree();
92
0
    (mgr)->RemoveManagee(PTCPServerSocketMsgStart, actor);
93
0
    return sendok__;
94
0
}
95
96
auto PTCPServerSocketParent::RemoveManagee(
97
        int32_t aProtocolId,
98
        IProtocol* aListener) -> void
99
0
{
100
0
    FatalError("unreached");
101
0
    return;
102
0
}
103
104
auto PTCPServerSocketParent::OnMessageReceived(const Message& msg__) -> PTCPServerSocketParent::Result
105
0
{
106
0
    switch ((msg__).type()) {
107
0
    case PTCPServerSocket::Msg_Close__ID:
108
0
        {
109
0
            if (mozilla::ipc::LoggingEnabledFor("PTCPServerSocketParent")) {
110
0
                mozilla::ipc::LogMessageForProtocol("PTCPServerSocketParent", OtherPid(), "Received ", ((&(msg__)))->type(), mozilla::ipc::MessageDirection::eReceiving);
111
0
            }
112
0
            AUTO_PROFILER_LABEL("PTCPServerSocket::Msg_Close", OTHER);
113
0
114
0
            if ((!(StateTransition(false, (&(mLivenessState)))))) {
115
0
                FatalError("Transition error");
116
0
                return MsgValueError;
117
0
            }
118
0
            if ((!(RecvClose()))) {
119
0
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
120
0
                // Error handled in mozilla::ipc::IPCResult
121
0
                return MsgProcessingError;
122
0
            }
123
0
124
0
            return MsgProcessed;
125
0
        }
126
0
    case PTCPServerSocket::Msg_RequestDelete__ID:
127
0
        {
128
0
            if (mozilla::ipc::LoggingEnabledFor("PTCPServerSocketParent")) {
129
0
                mozilla::ipc::LogMessageForProtocol("PTCPServerSocketParent", OtherPid(), "Received ", ((&(msg__)))->type(), mozilla::ipc::MessageDirection::eReceiving);
130
0
            }
131
0
            AUTO_PROFILER_LABEL("PTCPServerSocket::Msg_RequestDelete", OTHER);
132
0
133
0
            if ((!(StateTransition(false, (&(mLivenessState)))))) {
134
0
                FatalError("Transition error");
135
0
                return MsgValueError;
136
0
            }
137
0
            if ((!(RecvRequestDelete()))) {
138
0
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
139
0
                // Error handled in mozilla::ipc::IPCResult
140
0
                return MsgProcessingError;
141
0
            }
142
0
143
0
            return MsgProcessed;
144
0
        }
145
0
    case PTCPServerSocket::Reply___delete____ID:
146
0
        {
147
0
            return MsgProcessed;
148
0
        }
149
0
    default:
150
0
        {
151
0
            return MsgNotKnown;
152
0
        }
153
0
    }
154
0
}
155
156
auto PTCPServerSocketParent::OnMessageReceived(
157
        const Message& msg__,
158
        Message*& reply__) -> PTCPServerSocketParent::Result
159
0
{
160
0
    return MsgNotKnown;
161
0
}
162
163
auto PTCPServerSocketParent::OnCallReceived(
164
        const Message& msg__,
165
        Message*& reply__) -> PTCPServerSocketParent::Result
166
0
{
167
0
    MOZ_ASSERT_UNREACHABLE("message protocol not supported");
168
0
    return MsgNotKnown;
169
0
}
170
171
auto PTCPServerSocketParent::GetProtocolTypeId() -> int32_t
172
0
{
173
0
    return PTCPServerSocketMsgStart;
174
0
}
175
176
auto PTCPServerSocketParent::DestroySubtree(ActorDestroyReason why) -> void
177
0
{
178
0
    // Unregister from our manager.
179
0
    Unregister(Id());
180
0
181
0
    // Reject owning pending responses.
182
0
    (GetIPCChannel())->RejectPendingResponsesForActor(this);
183
0
184
0
    // Finally, destroy "us".
185
0
    ActorDestroy(why);
186
0
}
187
188
auto PTCPServerSocketParent::DeallocSubtree() -> void
189
0
{
190
0
}
191
192
193
194
} // namespace net
195
} // namespace mozilla
196
namespace mozilla {
197
namespace ipc {
198
auto IPDLParamTraits<mozilla::net::PTCPServerSocketParent>::Write(
199
        IPC::Message* aMsg,
200
        mozilla::ipc::IProtocol* aActor,
201
        const paramType& aVar) -> void
202
0
{
203
0
    int32_t id;
204
0
    if ((!(aVar))) {
205
0
        id = 0;
206
0
    }
207
0
    else {
208
0
        id = (aVar)->Id();
209
0
        if ((1) == (id)) {
210
0
            (aActor)->FatalError("actor has been |delete|d");
211
0
        }
212
0
    }
213
0
    WriteIPDLParam(aMsg, aActor, id);
214
0
}
215
216
auto IPDLParamTraits<mozilla::net::PTCPServerSocketParent>::Read(
217
        const IPC::Message* aMsg,
218
        PickleIterator* aIter,
219
        mozilla::ipc::IProtocol* aActor,
220
        paramType* aVar) -> bool
221
0
{
222
0
    mozilla::Maybe<mozilla::ipc::IProtocol*> actor = (aActor)->ReadActor(aMsg, aIter, true, "PTCPServerSocket", PTCPServerSocketMsgStart);
223
0
    if ((actor).isNothing()) {
224
0
        return false;
225
0
    }
226
0
227
0
    (*(aVar)) = static_cast<mozilla::net::PTCPServerSocketParent*>((actor).value());
228
0
    return true;
229
0
}
230
231
} // namespace ipc
232
} // namespace mozilla