Coverage Report

Created: 2018-09-25 14:53

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