Coverage Report

Created: 2018-09-25 14:53

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