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