Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/ipc/ipdl/PVideoBridgeChild.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/layers/PVideoBridgeChild.h"
8
9
#include "mozilla/layers/PTextureChild.h"
10
11
#include "nsIFile.h"
12
#include "GeckoProfiler.h"
13
14
namespace mozilla {
15
namespace layers {
16
17
18
auto PVideoBridgeChild::ActorDestroy(ActorDestroyReason aWhy) -> void
19
0
{
20
0
}
21
22
auto PVideoBridgeChild::ProcessingError(
23
        Result aCode,
24
        const char* aReason) -> void
25
0
{
26
0
}
27
28
auto PVideoBridgeChild::ShouldContinueFromReplyTimeout() -> bool
29
0
{
30
0
    return true;
31
0
}
32
33
auto PVideoBridgeChild::EnteredCxxStack() -> void
34
0
{
35
0
}
36
37
auto PVideoBridgeChild::ExitedCxxStack() -> void
38
0
{
39
0
}
40
41
auto PVideoBridgeChild::EnteredCall() -> void
42
0
{
43
0
}
44
45
auto PVideoBridgeChild::ExitedCall() -> void
46
0
{
47
0
}
48
49
MOZ_IMPLICIT PVideoBridgeChild::PVideoBridgeChild() :
50
    mozilla::ipc::IToplevelProtocol("PVideoBridgeChild", PVideoBridgeMsgStart, mozilla::ipc::ChildSide),
51
    mLivenessState(mozilla::ipc::LivenessState::Start)
52
0
{
53
0
    MOZ_COUNT_CTOR(PVideoBridgeChild);
54
0
}
55
56
PVideoBridgeChild::~PVideoBridgeChild()
57
0
{
58
0
    MOZ_COUNT_DTOR(PVideoBridgeChild);
59
0
}
60
61
auto PVideoBridgeChild::ManagedPTextureChild(nsTArray<PTextureChild*>& aArr) const -> void
62
0
{
63
0
    (mManagedPTextureChild).ToArray(aArr);
64
0
}
65
66
auto PVideoBridgeChild::ManagedPTextureChild() const -> const ManagedContainer<PTextureChild>&
67
0
{
68
0
    return mManagedPTextureChild;
69
0
}
70
71
auto PVideoBridgeChild::SendPTextureConstructor(
72
        const SurfaceDescriptor& aSharedData,
73
        const ReadLockDescriptor& aReadLock,
74
        const LayersBackend& aBackend,
75
        const TextureFlags& aTextureFlags,
76
        const uint64_t& aSerial) -> PTextureChild*
77
0
{
78
0
    return SendPTextureConstructor(AllocPTextureChild(aSharedData, aReadLock, aBackend, aTextureFlags, aSerial), aSharedData, aReadLock, aBackend, aTextureFlags, aSerial);
79
0
}
80
81
auto PVideoBridgeChild::SendPTextureConstructor(
82
        PTextureChild* actor,
83
        const SurfaceDescriptor& aSharedData,
84
        const ReadLockDescriptor& aReadLock,
85
        const LayersBackend& aBackend,
86
        const TextureFlags& aTextureFlags,
87
        const uint64_t& aSerial) -> PTextureChild*
88
0
{
89
0
    if ((!(actor))) {
90
0
        NS_WARNING("Error constructing actor PTextureChild");
91
0
        return nullptr;
92
0
    }
93
0
    (actor)->SetManagerAndRegister(this);
94
0
    (mManagedPTextureChild).PutEntry(actor);
95
0
    (actor)->mLivenessState = mozilla::ipc::LivenessState::Start;
96
0
97
0
    IPC::Message* msg__ = PVideoBridge::Msg_PTextureConstructor(MSG_ROUTING_CONTROL);
98
0
99
0
    MOZ_RELEASE_ASSERT(actor, "NULL actor value passed to non-nullable param");
100
0
    WriteIPDLParam(msg__, this, actor);
101
0
    // Sentinel = 'actor'
102
0
    (msg__)->WriteSentinel(875202478);
103
0
    WriteIPDLParam(msg__, this, aSharedData);
104
0
    // Sentinel = 'aSharedData'
105
0
    (msg__)->WriteSentinel(3013593029);
106
0
    WriteIPDLParam(msg__, this, aReadLock);
107
0
    // Sentinel = 'aReadLock'
108
0
    (msg__)->WriteSentinel(1208527801);
109
0
    WriteIPDLParam(msg__, this, aBackend);
110
0
    // Sentinel = 'aBackend'
111
0
    (msg__)->WriteSentinel(2878499283);
112
0
    WriteIPDLParam(msg__, this, aTextureFlags);
113
0
    // Sentinel = 'aTextureFlags'
114
0
    (msg__)->WriteSentinel(3005687826);
115
0
    WriteIPDLParam(msg__, this, aSerial);
116
0
    // Sentinel = 'aSerial'
117
0
    (msg__)->WriteSentinel(1247987114);
118
0
119
0
120
0
121
0
    if (mozilla::ipc::LoggingEnabledFor("PVideoBridgeChild")) {
122
0
        mozilla::ipc::LogMessageForProtocol("PVideoBridgeChild", OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending);
123
0
    }
124
0
    AUTO_PROFILER_LABEL("PVideoBridge::Msg_PTextureConstructor", OTHER);
125
0
    if ((!(StateTransition(false, (&(mLivenessState)))))) {
126
0
        mozilla::ipc::LogicError("Transition error");
127
0
    }
128
0
129
0
    bool sendok__ = (GetIPCChannel())->Send(msg__);
130
0
    if ((!(sendok__))) {
131
0
        FatalError("constructor for actor failed");
132
0
        return nullptr;
133
0
    }
134
0
    return actor;
135
0
}
136
137
auto PVideoBridgeChild::RemoveManagee(
138
        int32_t aProtocolId,
139
        IProtocol* aListener) -> void
140
0
{
141
0
    switch (aProtocolId) {
142
0
    case PTextureMsgStart:
143
0
        {
144
0
            PTextureChild* actor = static_cast<PTextureChild*>(aListener);
145
0
            auto& container = mManagedPTextureChild;
146
0
            MOZ_RELEASE_ASSERT((container).Contains(actor), "actor not managed by this!");
147
0
148
0
            (container).RemoveEntry(actor);
149
0
            DeallocPTextureChild(actor);
150
0
            return;
151
0
        }
152
0
    default:
153
0
        {
154
0
            FatalError("unreached");
155
0
            return;
156
0
        }
157
0
    }
158
0
}
159
160
auto PVideoBridgeChild::OnMessageReceived(const Message& msg__) -> PVideoBridgeChild::Result
161
0
{
162
0
    int32_t route__ = (msg__).routing_id();
163
0
    if ((MSG_ROUTING_CONTROL) != (route__)) {
164
0
        IProtocol* routed__ = Lookup(route__);
165
0
        if ((!(routed__))) {
166
0
            return MsgRouteError;
167
0
        }
168
0
        return (routed__)->OnMessageReceived(msg__);
169
0
    }
170
0
171
0
    switch ((msg__).type()) {
172
0
    case PVideoBridge::Reply_PTextureConstructor__ID:
173
0
        {
174
0
            return MsgProcessed;
175
0
        }
176
0
    default:
177
0
        {
178
0
            return MsgNotKnown;
179
0
        }
180
0
    case SHMEM_CREATED_MESSAGE_TYPE:
181
0
        {
182
0
            if ((!(ShmemCreated(msg__)))) {
183
0
                return MsgPayloadError;
184
0
            }
185
0
            return MsgProcessed;
186
0
        }
187
0
    case SHMEM_DESTROYED_MESSAGE_TYPE:
188
0
        {
189
0
            if ((!(ShmemDestroyed(msg__)))) {
190
0
                return MsgPayloadError;
191
0
            }
192
0
            return MsgProcessed;
193
0
        }
194
0
    }
195
0
}
196
197
auto PVideoBridgeChild::OnMessageReceived(
198
        const Message& msg__,
199
        Message*& reply__) -> PVideoBridgeChild::Result
200
0
{
201
0
    int32_t route__ = (msg__).routing_id();
202
0
    if ((MSG_ROUTING_CONTROL) != (route__)) {
203
0
        IProtocol* routed__ = Lookup(route__);
204
0
        if ((!(routed__))) {
205
0
            return MsgRouteError;
206
0
        }
207
0
        return (routed__)->OnMessageReceived(msg__, reply__);
208
0
    }
209
0
210
0
    return MsgNotKnown;
211
0
}
212
213
auto PVideoBridgeChild::OnCallReceived(
214
        const Message& msg__,
215
        Message*& reply__) -> PVideoBridgeChild::Result
216
0
{
217
0
    MOZ_ASSERT_UNREACHABLE("message protocol not supported");
218
0
    return MsgNotKnown;
219
0
}
220
221
auto PVideoBridgeChild::GetProtocolTypeId() -> int32_t
222
0
{
223
0
    return PVideoBridgeMsgStart;
224
0
}
225
226
auto PVideoBridgeChild::OnChannelClose() -> void
227
0
{
228
0
    DestroySubtree(NormalShutdown);
229
0
    DeallocSubtree();
230
0
    DeallocShmems();
231
0
    DeallocPVideoBridgeChild();
232
0
}
233
234
auto PVideoBridgeChild::OnChannelError() -> void
235
0
{
236
0
    DestroySubtree(AbnormalShutdown);
237
0
    DeallocSubtree();
238
0
    DeallocShmems();
239
0
    DeallocPVideoBridgeChild();
240
0
}
241
242
auto PVideoBridgeChild::DestroySubtree(ActorDestroyReason why) -> void
243
0
{
244
0
    ActorDestroyReason subtreewhy = (((why) == (Deletion)) || ((why) == (FailedConstructor)) ? AncestorDeletion : why);
245
0
246
0
    {
247
0
        // Recursively shutting down PTexture kids
248
0
        nsTArray<PTextureChild*> kids;
249
0
        // Accumulate kids into a stable structure to iterate over
250
0
        ManagedPTextureChild(kids);
251
0
        for (auto& kid : kids) {
252
0
            // Guarding against a child removing a sibling from the list during the iteration.
253
0
            if ((mManagedPTextureChild).Contains(kid)) {
254
0
                (kid)->DestroySubtree(subtreewhy);
255
0
            }
256
0
        }
257
0
    }
258
0
259
0
    // Reject owning pending responses.
260
0
    (GetIPCChannel())->RejectPendingResponsesForActor(this);
261
0
262
0
    // Finally, destroy "us".
263
0
    ActorDestroy(why);
264
0
}
265
266
auto PVideoBridgeChild::DeallocSubtree() -> void
267
0
{
268
0
    {
269
0
        // Recursively deleting PTexture kids
270
0
        for (auto iter = (mManagedPTextureChild).Iter(); (!((iter).Done())); (iter).Next()) {
271
0
            (((iter).Get())->GetKey())->DeallocSubtree();
272
0
        }
273
0
274
0
        for (auto iter = (mManagedPTextureChild).Iter(); (!((iter).Done())); (iter).Next()) {
275
0
            DeallocPTextureChild(((iter).Get())->GetKey());
276
0
        }
277
0
        (mManagedPTextureChild).Clear();
278
0
    }
279
0
}
280
281
auto PVideoBridgeChild::DeallocPVideoBridgeChild() -> void
282
0
{
283
0
}
284
285
286
287
} // namespace layers
288
} // namespace mozilla
289
namespace mozilla {
290
namespace ipc {
291
auto IPDLParamTraits<mozilla::layers::PVideoBridgeChild>::Write(
292
        IPC::Message* aMsg,
293
        mozilla::ipc::IProtocol* aActor,
294
        const paramType& aVar) -> void
295
0
{
296
0
    int32_t id;
297
0
    if ((!(aVar))) {
298
0
        id = 0;
299
0
    }
300
0
    else {
301
0
        id = (aVar)->Id();
302
0
        if ((1) == (id)) {
303
0
            (aActor)->FatalError("actor has been |delete|d");
304
0
        }
305
0
    }
306
0
    WriteIPDLParam(aMsg, aActor, id);
307
0
}
308
309
auto IPDLParamTraits<mozilla::layers::PVideoBridgeChild>::Read(
310
        const IPC::Message* aMsg,
311
        PickleIterator* aIter,
312
        mozilla::ipc::IProtocol* aActor,
313
        paramType* aVar) -> bool
314
0
{
315
0
    mozilla::Maybe<mozilla::ipc::IProtocol*> actor = (aActor)->ReadActor(aMsg, aIter, true, "PVideoBridge", PVideoBridgeMsgStart);
316
0
    if ((actor).isNothing()) {
317
0
        return false;
318
0
    }
319
0
320
0
    (*(aVar)) = static_cast<mozilla::layers::PVideoBridgeChild*>((actor).value());
321
0
    return true;
322
0
}
323
324
} // namespace ipc
325
} // namespace mozilla