Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/ipc/ipdl/PVideoDecoderManagerChild.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/PVideoDecoderManagerChild.h"
8
#include "mozilla/layers/CompositorTypes.h"
9
10
#include "mozilla/layers/PTextureChild.h"
11
#include "mozilla/dom/PVideoDecoderChild.h"
12
13
#include "nsIFile.h"
14
#include "GeckoProfiler.h"
15
16
namespace mozilla {
17
namespace dom {
18
19
20
auto PVideoDecoderManagerChild::ActorDestroy(ActorDestroyReason aWhy) -> void
21
0
{
22
0
}
23
24
auto PVideoDecoderManagerChild::ProcessingError(
25
        Result aCode,
26
        const char* aReason) -> void
27
0
{
28
0
}
29
30
auto PVideoDecoderManagerChild::ShouldContinueFromReplyTimeout() -> bool
31
0
{
32
0
    return true;
33
0
}
34
35
auto PVideoDecoderManagerChild::EnteredCxxStack() -> void
36
0
{
37
0
}
38
39
auto PVideoDecoderManagerChild::ExitedCxxStack() -> void
40
0
{
41
0
}
42
43
auto PVideoDecoderManagerChild::EnteredCall() -> void
44
0
{
45
0
}
46
47
auto PVideoDecoderManagerChild::ExitedCall() -> void
48
0
{
49
0
}
50
51
MOZ_IMPLICIT PVideoDecoderManagerChild::PVideoDecoderManagerChild() :
52
    mozilla::ipc::IToplevelProtocol("PVideoDecoderManagerChild", PVideoDecoderManagerMsgStart, mozilla::ipc::ChildSide),
53
    mLivenessState(mozilla::ipc::LivenessState::Start)
54
0
{
55
0
    MOZ_COUNT_CTOR(PVideoDecoderManagerChild);
56
0
}
57
58
PVideoDecoderManagerChild::~PVideoDecoderManagerChild()
59
0
{
60
0
    MOZ_COUNT_DTOR(PVideoDecoderManagerChild);
61
0
}
62
63
auto PVideoDecoderManagerChild::ManagedPVideoDecoderChild(nsTArray<PVideoDecoderChild*>& aArr) const -> void
64
0
{
65
0
    (mManagedPVideoDecoderChild).ToArray(aArr);
66
0
}
67
68
auto PVideoDecoderManagerChild::ManagedPVideoDecoderChild() const -> const ManagedContainer<PVideoDecoderChild>&
69
0
{
70
0
    return mManagedPVideoDecoderChild;
71
0
}
72
73
auto PVideoDecoderManagerChild::SendPVideoDecoderConstructor(
74
        const VideoInfo& info,
75
        const float& framerate,
76
        const TextureFactoryIdentifier& identifier,
77
        bool* success,
78
        nsCString* aBlacklistedD3D11Driver,
79
        nsCString* aBlacklistedD3D9Driver,
80
        nsCString* aErrorDescription) -> PVideoDecoderChild*
81
0
{
82
0
    return SendPVideoDecoderConstructor(AllocPVideoDecoderChild(info, framerate, identifier, success, aBlacklistedD3D11Driver, aBlacklistedD3D9Driver, aErrorDescription), info, framerate, identifier, success, aBlacklistedD3D11Driver, aBlacklistedD3D9Driver, aErrorDescription);
83
0
}
84
85
auto PVideoDecoderManagerChild::SendPVideoDecoderConstructor(
86
        PVideoDecoderChild* actor,
87
        const VideoInfo& info,
88
        const float& framerate,
89
        const TextureFactoryIdentifier& identifier,
90
        bool* success,
91
        nsCString* aBlacklistedD3D11Driver,
92
        nsCString* aBlacklistedD3D9Driver,
93
        nsCString* aErrorDescription) -> PVideoDecoderChild*
94
0
{
95
0
    if ((!(actor))) {
96
0
        NS_WARNING("Error constructing actor PVideoDecoderChild");
97
0
        return nullptr;
98
0
    }
99
0
    (actor)->SetManagerAndRegister(this);
100
0
    (mManagedPVideoDecoderChild).PutEntry(actor);
101
0
    (actor)->mLivenessState = mozilla::ipc::LivenessState::Start;
102
0
103
0
    IPC::Message* msg__ = PVideoDecoderManager::Msg_PVideoDecoderConstructor(MSG_ROUTING_CONTROL);
104
0
105
0
    MOZ_RELEASE_ASSERT(actor, "NULL actor value passed to non-nullable param");
106
0
    WriteIPDLParam(msg__, this, actor);
107
0
    // Sentinel = 'actor'
108
0
    (msg__)->WriteSentinel(875202478);
109
0
    WriteIPDLParam(msg__, this, info);
110
0
    // Sentinel = 'info'
111
0
    (msg__)->WriteSentinel(3750868832);
112
0
    WriteIPDLParam(msg__, this, framerate);
113
0
    // Sentinel = 'framerate'
114
0
    (msg__)->WriteSentinel(2455104364);
115
0
    WriteIPDLParam(msg__, this, identifier);
116
0
    // Sentinel = 'identifier'
117
0
    (msg__)->WriteSentinel(2916735611);
118
0
119
0
120
0
121
0
    Message reply__;
122
0
123
0
    if (mozilla::ipc::LoggingEnabledFor("PVideoDecoderManagerChild")) {
124
0
        mozilla::ipc::LogMessageForProtocol("PVideoDecoderManagerChild", OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending);
125
0
    }
126
0
    AUTO_PROFILER_LABEL("PVideoDecoderManager::Msg_PVideoDecoderConstructor", OTHER);
127
0
    if ((!(StateTransition(false, (&(mLivenessState)))))) {
128
0
        mozilla::ipc::LogicError("Transition error");
129
0
    }
130
0
131
0
    bool sendok__;
132
0
    {
133
0
        AUTO_PROFILER_TRACING("IPC", "PVideoDecoderManager::Msg_PVideoDecoderConstructor");
134
0
        sendok__ = (GetIPCChannel())->Send(msg__, (&(reply__)));
135
0
    }
136
0
    if ((!(sendok__))) {
137
0
        FatalError("constructor for actor failed");
138
0
        return nullptr;
139
0
    }
140
0
141
0
    if (mozilla::ipc::LoggingEnabledFor("PVideoDecoderManagerChild")) {
142
0
        mozilla::ipc::LogMessageForProtocol("PVideoDecoderManagerChild", OtherPid(), "Received reply ", ((&(reply__)))->type(), mozilla::ipc::MessageDirection::eReceiving);
143
0
    }
144
0
145
0
    PickleIterator iter__(reply__);
146
0
147
0
    if ((!(ReadIPDLParam((&(reply__)), (&(iter__)), this, success)))) {
148
0
        if (true) {
149
0
            FatalError("constructor for actor failed");
150
0
            return nullptr;
151
0
        }
152
0
    }
153
0
    // Sentinel = 'success'
154
0
    if ((!(((&(reply__)))->ReadSentinel((&(iter__)), 3877396070)))) {
155
0
        mozilla::ipc::SentinelReadError("Error deserializing 'bool'");
156
0
        return nullptr;
157
0
    }
158
0
    if ((!(ReadIPDLParam((&(reply__)), (&(iter__)), this, aBlacklistedD3D11Driver)))) {
159
0
        if (true) {
160
0
            FatalError("constructor for actor failed");
161
0
            return nullptr;
162
0
        }
163
0
    }
164
0
    // Sentinel = 'aBlacklistedD3D11Driver'
165
0
    if ((!(((&(reply__)))->ReadSentinel((&(iter__)), 1212092761)))) {
166
0
        mozilla::ipc::SentinelReadError("Error deserializing 'nsCString'");
167
0
        return nullptr;
168
0
    }
169
0
    if ((!(ReadIPDLParam((&(reply__)), (&(iter__)), this, aBlacklistedD3D9Driver)))) {
170
0
        if (true) {
171
0
            FatalError("constructor for actor failed");
172
0
            return nullptr;
173
0
        }
174
0
    }
175
0
    // Sentinel = 'aBlacklistedD3D9Driver'
176
0
    if ((!(((&(reply__)))->ReadSentinel((&(iter__)), 3754598291)))) {
177
0
        mozilla::ipc::SentinelReadError("Error deserializing 'nsCString'");
178
0
        return nullptr;
179
0
    }
180
0
    if ((!(ReadIPDLParam((&(reply__)), (&(iter__)), this, aErrorDescription)))) {
181
0
        if (true) {
182
0
            FatalError("constructor for actor failed");
183
0
            return nullptr;
184
0
        }
185
0
    }
186
0
    // Sentinel = 'aErrorDescription'
187
0
    if ((!(((&(reply__)))->ReadSentinel((&(iter__)), 947178020)))) {
188
0
        mozilla::ipc::SentinelReadError("Error deserializing 'nsCString'");
189
0
        return nullptr;
190
0
    }
191
0
    (reply__).EndRead(iter__, (reply__).type());
192
0
    return actor;
193
0
}
194
195
auto PVideoDecoderManagerChild::SendReadback(
196
        const SurfaceDescriptorGPUVideo& sd,
197
        SurfaceDescriptor* aResult) -> bool
198
0
{
199
0
    IPC::Message* msg__ = PVideoDecoderManager::Msg_Readback(MSG_ROUTING_CONTROL);
200
0
201
0
    WriteIPDLParam(msg__, this, sd);
202
0
    // Sentinel = 'sd'
203
0
    (msg__)->WriteSentinel(2856126975);
204
0
205
0
206
0
207
0
    Message reply__;
208
0
209
0
    if (mozilla::ipc::LoggingEnabledFor("PVideoDecoderManagerChild")) {
210
0
        mozilla::ipc::LogMessageForProtocol("PVideoDecoderManagerChild", OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending);
211
0
    }
212
0
    AUTO_PROFILER_LABEL("PVideoDecoderManager::Msg_Readback", OTHER);
213
0
    if ((!(StateTransition(false, (&(mLivenessState)))))) {
214
0
        mozilla::ipc::LogicError("Transition error");
215
0
    }
216
0
217
0
    bool sendok__;
218
0
    {
219
0
        AUTO_PROFILER_TRACING("IPC", "PVideoDecoderManager::Msg_Readback");
220
0
        sendok__ = (GetIPCChannel())->Send(msg__, (&(reply__)));
221
0
    }
222
0
    if ((!(sendok__))) {
223
0
        return false;
224
0
    }
225
0
226
0
    if (mozilla::ipc::LoggingEnabledFor("PVideoDecoderManagerChild")) {
227
0
        mozilla::ipc::LogMessageForProtocol("PVideoDecoderManagerChild", OtherPid(), "Received reply ", ((&(reply__)))->type(), mozilla::ipc::MessageDirection::eReceiving);
228
0
    }
229
0
230
0
    PickleIterator iter__(reply__);
231
0
232
0
    if ((!(ReadIPDLParam((&(reply__)), (&(iter__)), this, aResult)))) {
233
0
        FatalError("Error deserializing 'SurfaceDescriptor'");
234
0
        return false;
235
0
    }
236
0
    // Sentinel = 'aResult'
237
0
    if ((!(((&(reply__)))->ReadSentinel((&(iter__)), 3888726089)))) {
238
0
        mozilla::ipc::SentinelReadError("Error deserializing 'SurfaceDescriptor'");
239
0
        return false;
240
0
    }
241
0
    (reply__).EndRead(iter__, (reply__).type());
242
0
243
0
    return true;
244
0
}
245
246
auto PVideoDecoderManagerChild::SendDeallocateSurfaceDescriptorGPUVideo(const SurfaceDescriptorGPUVideo& sd) -> bool
247
0
{
248
0
    IPC::Message* msg__ = PVideoDecoderManager::Msg_DeallocateSurfaceDescriptorGPUVideo(MSG_ROUTING_CONTROL);
249
0
250
0
    WriteIPDLParam(msg__, this, sd);
251
0
    // Sentinel = 'sd'
252
0
    (msg__)->WriteSentinel(2856126975);
253
0
254
0
255
0
256
0
257
0
    if (mozilla::ipc::LoggingEnabledFor("PVideoDecoderManagerChild")) {
258
0
        mozilla::ipc::LogMessageForProtocol("PVideoDecoderManagerChild", OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending);
259
0
    }
260
0
    AUTO_PROFILER_LABEL("PVideoDecoderManager::Msg_DeallocateSurfaceDescriptorGPUVideo", OTHER);
261
0
    if ((!(StateTransition(false, (&(mLivenessState)))))) {
262
0
        mozilla::ipc::LogicError("Transition error");
263
0
    }
264
0
265
0
    bool sendok__ = (GetIPCChannel())->Send(msg__);
266
0
    return sendok__;
267
0
}
268
269
auto PVideoDecoderManagerChild::RemoveManagee(
270
        int32_t aProtocolId,
271
        IProtocol* aListener) -> void
272
0
{
273
0
    switch (aProtocolId) {
274
0
    case PVideoDecoderMsgStart:
275
0
        {
276
0
            PVideoDecoderChild* actor = static_cast<PVideoDecoderChild*>(aListener);
277
0
            auto& container = mManagedPVideoDecoderChild;
278
0
            MOZ_RELEASE_ASSERT((container).Contains(actor), "actor not managed by this!");
279
0
280
0
            (container).RemoveEntry(actor);
281
0
            DeallocPVideoDecoderChild(actor);
282
0
            return;
283
0
        }
284
0
    default:
285
0
        {
286
0
            FatalError("unreached");
287
0
            return;
288
0
        }
289
0
    }
290
0
}
291
292
auto PVideoDecoderManagerChild::OnMessageReceived(const Message& msg__) -> PVideoDecoderManagerChild::Result
293
0
{
294
0
    int32_t route__ = (msg__).routing_id();
295
0
    if ((MSG_ROUTING_CONTROL) != (route__)) {
296
0
        IProtocol* routed__ = Lookup(route__);
297
0
        if ((!(routed__))) {
298
0
            return MsgRouteError;
299
0
        }
300
0
        return (routed__)->OnMessageReceived(msg__);
301
0
    }
302
0
303
0
    switch ((msg__).type()) {
304
0
    default:
305
0
        {
306
0
            return MsgNotKnown;
307
0
        }
308
0
    case SHMEM_CREATED_MESSAGE_TYPE:
309
0
        {
310
0
            if ((!(ShmemCreated(msg__)))) {
311
0
                return MsgPayloadError;
312
0
            }
313
0
            return MsgProcessed;
314
0
        }
315
0
    case SHMEM_DESTROYED_MESSAGE_TYPE:
316
0
        {
317
0
            if ((!(ShmemDestroyed(msg__)))) {
318
0
                return MsgPayloadError;
319
0
            }
320
0
            return MsgProcessed;
321
0
        }
322
0
    }
323
0
}
324
325
auto PVideoDecoderManagerChild::OnMessageReceived(
326
        const Message& msg__,
327
        Message*& reply__) -> PVideoDecoderManagerChild::Result
328
0
{
329
0
    int32_t route__ = (msg__).routing_id();
330
0
    if ((MSG_ROUTING_CONTROL) != (route__)) {
331
0
        IProtocol* routed__ = Lookup(route__);
332
0
        if ((!(routed__))) {
333
0
            return MsgRouteError;
334
0
        }
335
0
        return (routed__)->OnMessageReceived(msg__, reply__);
336
0
    }
337
0
338
0
    return MsgNotKnown;
339
0
}
340
341
auto PVideoDecoderManagerChild::OnCallReceived(
342
        const Message& msg__,
343
        Message*& reply__) -> PVideoDecoderManagerChild::Result
344
0
{
345
0
    MOZ_ASSERT_UNREACHABLE("message protocol not supported");
346
0
    return MsgNotKnown;
347
0
}
348
349
auto PVideoDecoderManagerChild::GetProtocolTypeId() -> int32_t
350
0
{
351
0
    return PVideoDecoderManagerMsgStart;
352
0
}
353
354
auto PVideoDecoderManagerChild::OnChannelClose() -> void
355
0
{
356
0
    DestroySubtree(NormalShutdown);
357
0
    DeallocSubtree();
358
0
    DeallocShmems();
359
0
    DeallocPVideoDecoderManagerChild();
360
0
}
361
362
auto PVideoDecoderManagerChild::OnChannelError() -> void
363
0
{
364
0
    DestroySubtree(AbnormalShutdown);
365
0
    DeallocSubtree();
366
0
    DeallocShmems();
367
0
    DeallocPVideoDecoderManagerChild();
368
0
}
369
370
auto PVideoDecoderManagerChild::DestroySubtree(ActorDestroyReason why) -> void
371
0
{
372
0
    ActorDestroyReason subtreewhy = (((why) == (Deletion)) || ((why) == (FailedConstructor)) ? AncestorDeletion : why);
373
0
374
0
    {
375
0
        // Recursively shutting down PVideoDecoder kids
376
0
        nsTArray<PVideoDecoderChild*> kids;
377
0
        // Accumulate kids into a stable structure to iterate over
378
0
        ManagedPVideoDecoderChild(kids);
379
0
        for (auto& kid : kids) {
380
0
            // Guarding against a child removing a sibling from the list during the iteration.
381
0
            if ((mManagedPVideoDecoderChild).Contains(kid)) {
382
0
                (kid)->DestroySubtree(subtreewhy);
383
0
            }
384
0
        }
385
0
    }
386
0
387
0
    // Reject owning pending responses.
388
0
    (GetIPCChannel())->RejectPendingResponsesForActor(this);
389
0
390
0
    // Finally, destroy "us".
391
0
    ActorDestroy(why);
392
0
}
393
394
auto PVideoDecoderManagerChild::DeallocSubtree() -> void
395
0
{
396
0
    {
397
0
        // Recursively deleting PVideoDecoder kids
398
0
        for (auto iter = (mManagedPVideoDecoderChild).Iter(); (!((iter).Done())); (iter).Next()) {
399
0
            (((iter).Get())->GetKey())->DeallocSubtree();
400
0
        }
401
0
402
0
        for (auto iter = (mManagedPVideoDecoderChild).Iter(); (!((iter).Done())); (iter).Next()) {
403
0
            DeallocPVideoDecoderChild(((iter).Get())->GetKey());
404
0
        }
405
0
        (mManagedPVideoDecoderChild).Clear();
406
0
    }
407
0
}
408
409
auto PVideoDecoderManagerChild::DeallocPVideoDecoderManagerChild() -> void
410
0
{
411
0
}
412
413
414
415
} // namespace dom
416
} // namespace mozilla
417
namespace mozilla {
418
namespace ipc {
419
auto IPDLParamTraits<mozilla::dom::PVideoDecoderManagerChild>::Write(
420
        IPC::Message* aMsg,
421
        mozilla::ipc::IProtocol* aActor,
422
        const paramType& aVar) -> void
423
0
{
424
0
    int32_t id;
425
0
    if ((!(aVar))) {
426
0
        id = 0;
427
0
    }
428
0
    else {
429
0
        id = (aVar)->Id();
430
0
        if ((1) == (id)) {
431
0
            (aActor)->FatalError("actor has been |delete|d");
432
0
        }
433
0
    }
434
0
    WriteIPDLParam(aMsg, aActor, id);
435
0
}
436
437
auto IPDLParamTraits<mozilla::dom::PVideoDecoderManagerChild>::Read(
438
        const IPC::Message* aMsg,
439
        PickleIterator* aIter,
440
        mozilla::ipc::IProtocol* aActor,
441
        paramType* aVar) -> bool
442
0
{
443
0
    mozilla::Maybe<mozilla::ipc::IProtocol*> actor = (aActor)->ReadActor(aMsg, aIter, true, "PVideoDecoderManager", PVideoDecoderManagerMsgStart);
444
0
    if ((actor).isNothing()) {
445
0
        return false;
446
0
    }
447
0
448
0
    (*(aVar)) = static_cast<mozilla::dom::PVideoDecoderManagerChild*>((actor).value());
449
0
    return true;
450
0
}
451
452
} // namespace ipc
453
} // namespace mozilla