/work/obj-fuzz/ipc/ipdl/PImageBridgeChild.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/PImageBridgeChild.h" |
8 | | #include "mozilla/layers/CompositorTypes.h" |
9 | | |
10 | | #include "mozilla/layers/PTextureChild.h" |
11 | | #include "mozilla/media/PMediaSystemResourceManagerChild.h" |
12 | | |
13 | | #include "nsIFile.h" |
14 | | #include "GeckoProfiler.h" |
15 | | |
16 | | namespace mozilla { |
17 | | namespace layers { |
18 | | |
19 | | |
20 | | auto PImageBridgeChild::ActorDestroy(ActorDestroyReason aWhy) -> void |
21 | 0 | { |
22 | 0 | } |
23 | | |
24 | | auto PImageBridgeChild::ProcessingError( |
25 | | Result aCode, |
26 | | const char* aReason) -> void |
27 | 0 | { |
28 | 0 | } |
29 | | |
30 | | auto PImageBridgeChild::ShouldContinueFromReplyTimeout() -> bool |
31 | 0 | { |
32 | 0 | return true; |
33 | 0 | } |
34 | | |
35 | | auto PImageBridgeChild::EnteredCxxStack() -> void |
36 | 0 | { |
37 | 0 | } |
38 | | |
39 | | auto PImageBridgeChild::ExitedCxxStack() -> void |
40 | 0 | { |
41 | 0 | } |
42 | | |
43 | | auto PImageBridgeChild::EnteredCall() -> void |
44 | 0 | { |
45 | 0 | } |
46 | | |
47 | | auto PImageBridgeChild::ExitedCall() -> void |
48 | 0 | { |
49 | 0 | } |
50 | | |
51 | | MOZ_IMPLICIT PImageBridgeChild::PImageBridgeChild() : |
52 | | mozilla::ipc::IToplevelProtocol("PImageBridgeChild", PImageBridgeMsgStart, mozilla::ipc::ChildSide), |
53 | | mLivenessState(mozilla::ipc::LivenessState::Start) |
54 | 0 | { |
55 | 0 | MOZ_COUNT_CTOR(PImageBridgeChild); |
56 | 0 | } |
57 | | |
58 | | PImageBridgeChild::~PImageBridgeChild() |
59 | 0 | { |
60 | 0 | MOZ_COUNT_DTOR(PImageBridgeChild); |
61 | 0 | } |
62 | | |
63 | | auto PImageBridgeChild::ManagedPTextureChild(nsTArray<PTextureChild*>& aArr) const -> void |
64 | 0 | { |
65 | 0 | (mManagedPTextureChild).ToArray(aArr); |
66 | 0 | } |
67 | | |
68 | | auto PImageBridgeChild::ManagedPTextureChild() const -> const ManagedContainer<PTextureChild>& |
69 | 0 | { |
70 | 0 | return mManagedPTextureChild; |
71 | 0 | } |
72 | | |
73 | | auto PImageBridgeChild::ManagedPMediaSystemResourceManagerChild(nsTArray<PMediaSystemResourceManagerChild*>& aArr) const -> void |
74 | 0 | { |
75 | 0 | (mManagedPMediaSystemResourceManagerChild).ToArray(aArr); |
76 | 0 | } |
77 | | |
78 | | auto PImageBridgeChild::ManagedPMediaSystemResourceManagerChild() const -> const ManagedContainer<PMediaSystemResourceManagerChild>& |
79 | 0 | { |
80 | 0 | return mManagedPMediaSystemResourceManagerChild; |
81 | 0 | } |
82 | | |
83 | | auto PImageBridgeChild::SendUpdate( |
84 | | const nsTArray<CompositableOperation>& ops, |
85 | | const nsTArray<OpDestroy>& toDestroy, |
86 | | const uint64_t& fwdTransactionId) -> bool |
87 | 0 | { |
88 | 0 | IPC::Message* msg__ = PImageBridge::Msg_Update(MSG_ROUTING_CONTROL); |
89 | 0 |
|
90 | 0 | WriteIPDLParam(msg__, this, ops); |
91 | 0 | // Sentinel = 'ops' |
92 | 0 | (msg__)->WriteSentinel(4059743815); |
93 | 0 | WriteIPDLParam(msg__, this, toDestroy); |
94 | 0 | // Sentinel = 'toDestroy' |
95 | 0 | (msg__)->WriteSentinel(4183172130); |
96 | 0 | WriteIPDLParam(msg__, this, fwdTransactionId); |
97 | 0 | // Sentinel = 'fwdTransactionId' |
98 | 0 | (msg__)->WriteSentinel(2023976742); |
99 | 0 |
|
100 | 0 |
|
101 | 0 |
|
102 | 0 |
|
103 | 0 | if (mozilla::ipc::LoggingEnabledFor("PImageBridgeChild")) { |
104 | 0 | mozilla::ipc::LogMessageForProtocol("PImageBridgeChild", OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending); |
105 | 0 | } |
106 | 0 | AUTO_PROFILER_LABEL("PImageBridge::Msg_Update", OTHER); |
107 | 0 | if ((!(StateTransition(false, (&(mLivenessState)))))) { |
108 | 0 | mozilla::ipc::LogicError("Transition error"); |
109 | 0 | } |
110 | 0 |
|
111 | 0 | bool sendok__ = (GetIPCChannel())->Send(msg__); |
112 | 0 | return sendok__; |
113 | 0 | } |
114 | | |
115 | | auto PImageBridgeChild::SendWillClose() -> bool |
116 | 0 | { |
117 | 0 | IPC::Message* msg__ = PImageBridge::Msg_WillClose(MSG_ROUTING_CONTROL); |
118 | 0 |
|
119 | 0 |
|
120 | 0 |
|
121 | 0 |
|
122 | 0 | Message reply__; |
123 | 0 |
|
124 | 0 | if (mozilla::ipc::LoggingEnabledFor("PImageBridgeChild")) { |
125 | 0 | mozilla::ipc::LogMessageForProtocol("PImageBridgeChild", OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending); |
126 | 0 | } |
127 | 0 | AUTO_PROFILER_LABEL("PImageBridge::Msg_WillClose", OTHER); |
128 | 0 | if ((!(StateTransition(false, (&(mLivenessState)))))) { |
129 | 0 | mozilla::ipc::LogicError("Transition error"); |
130 | 0 | } |
131 | 0 |
|
132 | 0 | bool sendok__; |
133 | 0 | { |
134 | 0 | AUTO_PROFILER_TRACING("IPC", "PImageBridge::Msg_WillClose"); |
135 | 0 | sendok__ = (GetIPCChannel())->Send(msg__, (&(reply__))); |
136 | 0 | } |
137 | 0 | if ((!(sendok__))) { |
138 | 0 | return false; |
139 | 0 | } |
140 | 0 | |
141 | 0 | if (mozilla::ipc::LoggingEnabledFor("PImageBridgeChild")) { |
142 | 0 | mozilla::ipc::LogMessageForProtocol("PImageBridgeChild", OtherPid(), "Received reply ", ((&(reply__)))->type(), mozilla::ipc::MessageDirection::eReceiving); |
143 | 0 | } |
144 | 0 |
|
145 | 0 | return true; |
146 | 0 | } |
147 | | |
148 | | auto PImageBridgeChild::SendPTextureConstructor( |
149 | | const SurfaceDescriptor& aSharedData, |
150 | | const ReadLockDescriptor& aReadLock, |
151 | | const LayersBackend& aBackend, |
152 | | const TextureFlags& aTextureFlags, |
153 | | const uint64_t& aSerial, |
154 | | const MaybeExternalImageId& aExternalImageId) -> PTextureChild* |
155 | 0 | { |
156 | 0 | return SendPTextureConstructor(AllocPTextureChild(aSharedData, aReadLock, aBackend, aTextureFlags, aSerial, aExternalImageId), aSharedData, aReadLock, aBackend, aTextureFlags, aSerial, aExternalImageId); |
157 | 0 | } |
158 | | |
159 | | auto PImageBridgeChild::SendPTextureConstructor( |
160 | | PTextureChild* actor, |
161 | | const SurfaceDescriptor& aSharedData, |
162 | | const ReadLockDescriptor& aReadLock, |
163 | | const LayersBackend& aBackend, |
164 | | const TextureFlags& aTextureFlags, |
165 | | const uint64_t& aSerial, |
166 | | const MaybeExternalImageId& aExternalImageId) -> PTextureChild* |
167 | 0 | { |
168 | 0 | if ((!(actor))) { |
169 | 0 | NS_WARNING("Error constructing actor PTextureChild"); |
170 | 0 | return nullptr; |
171 | 0 | } |
172 | 0 | (actor)->SetManagerAndRegister(this); |
173 | 0 | (mManagedPTextureChild).PutEntry(actor); |
174 | 0 | (actor)->mLivenessState = mozilla::ipc::LivenessState::Start; |
175 | 0 |
|
176 | 0 | IPC::Message* msg__ = PImageBridge::Msg_PTextureConstructor(MSG_ROUTING_CONTROL); |
177 | 0 |
|
178 | 0 | MOZ_RELEASE_ASSERT(actor, "NULL actor value passed to non-nullable param"); |
179 | 0 | WriteIPDLParam(msg__, this, actor); |
180 | 0 | // Sentinel = 'actor' |
181 | 0 | (msg__)->WriteSentinel(875202478); |
182 | 0 | WriteIPDLParam(msg__, this, aSharedData); |
183 | 0 | // Sentinel = 'aSharedData' |
184 | 0 | (msg__)->WriteSentinel(3013593029); |
185 | 0 | WriteIPDLParam(msg__, this, aReadLock); |
186 | 0 | // Sentinel = 'aReadLock' |
187 | 0 | (msg__)->WriteSentinel(1208527801); |
188 | 0 | WriteIPDLParam(msg__, this, aBackend); |
189 | 0 | // Sentinel = 'aBackend' |
190 | 0 | (msg__)->WriteSentinel(2878499283); |
191 | 0 | WriteIPDLParam(msg__, this, aTextureFlags); |
192 | 0 | // Sentinel = 'aTextureFlags' |
193 | 0 | (msg__)->WriteSentinel(3005687826); |
194 | 0 | WriteIPDLParam(msg__, this, aSerial); |
195 | 0 | // Sentinel = 'aSerial' |
196 | 0 | (msg__)->WriteSentinel(1247987114); |
197 | 0 | WriteIPDLParam(msg__, this, aExternalImageId); |
198 | 0 | // Sentinel = 'aExternalImageId' |
199 | 0 | (msg__)->WriteSentinel(2889998824); |
200 | 0 |
|
201 | 0 |
|
202 | 0 |
|
203 | 0 | if (mozilla::ipc::LoggingEnabledFor("PImageBridgeChild")) { |
204 | 0 | mozilla::ipc::LogMessageForProtocol("PImageBridgeChild", OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending); |
205 | 0 | } |
206 | 0 | AUTO_PROFILER_LABEL("PImageBridge::Msg_PTextureConstructor", OTHER); |
207 | 0 | if ((!(StateTransition(false, (&(mLivenessState)))))) { |
208 | 0 | mozilla::ipc::LogicError("Transition error"); |
209 | 0 | } |
210 | 0 |
|
211 | 0 | bool sendok__ = (GetIPCChannel())->Send(msg__); |
212 | 0 | if ((!(sendok__))) { |
213 | 0 | FatalError("constructor for actor failed"); |
214 | 0 | return nullptr; |
215 | 0 | } |
216 | 0 | return actor; |
217 | 0 | } |
218 | | |
219 | | auto PImageBridgeChild::SendPMediaSystemResourceManagerConstructor() -> PMediaSystemResourceManagerChild* |
220 | 0 | { |
221 | 0 | return SendPMediaSystemResourceManagerConstructor(AllocPMediaSystemResourceManagerChild()); |
222 | 0 | } |
223 | | |
224 | | auto PImageBridgeChild::SendPMediaSystemResourceManagerConstructor(PMediaSystemResourceManagerChild* actor) -> PMediaSystemResourceManagerChild* |
225 | 0 | { |
226 | 0 | if ((!(actor))) { |
227 | 0 | NS_WARNING("Error constructing actor PMediaSystemResourceManagerChild"); |
228 | 0 | return nullptr; |
229 | 0 | } |
230 | 0 | (actor)->SetManagerAndRegister(this); |
231 | 0 | (mManagedPMediaSystemResourceManagerChild).PutEntry(actor); |
232 | 0 | (actor)->mLivenessState = mozilla::ipc::LivenessState::Start; |
233 | 0 |
|
234 | 0 | IPC::Message* msg__ = PImageBridge::Msg_PMediaSystemResourceManagerConstructor(MSG_ROUTING_CONTROL); |
235 | 0 |
|
236 | 0 | MOZ_RELEASE_ASSERT(actor, "NULL actor value passed to non-nullable param"); |
237 | 0 | WriteIPDLParam(msg__, this, actor); |
238 | 0 | // Sentinel = 'actor' |
239 | 0 | (msg__)->WriteSentinel(875202478); |
240 | 0 |
|
241 | 0 |
|
242 | 0 |
|
243 | 0 | if (mozilla::ipc::LoggingEnabledFor("PImageBridgeChild")) { |
244 | 0 | mozilla::ipc::LogMessageForProtocol("PImageBridgeChild", OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending); |
245 | 0 | } |
246 | 0 | AUTO_PROFILER_LABEL("PImageBridge::Msg_PMediaSystemResourceManagerConstructor", OTHER); |
247 | 0 | if ((!(StateTransition(false, (&(mLivenessState)))))) { |
248 | 0 | mozilla::ipc::LogicError("Transition error"); |
249 | 0 | } |
250 | 0 |
|
251 | 0 | bool sendok__ = (GetIPCChannel())->Send(msg__); |
252 | 0 | if ((!(sendok__))) { |
253 | 0 | FatalError("constructor for actor failed"); |
254 | 0 | return nullptr; |
255 | 0 | } |
256 | 0 | return actor; |
257 | 0 | } |
258 | | |
259 | | auto PImageBridgeChild::SendNewCompositable( |
260 | | const CompositableHandle& aHandle, |
261 | | const TextureInfo& aInfo, |
262 | | const LayersBackend& aBackend) -> bool |
263 | 0 | { |
264 | 0 | IPC::Message* msg__ = PImageBridge::Msg_NewCompositable(MSG_ROUTING_CONTROL); |
265 | 0 |
|
266 | 0 | WriteIPDLParam(msg__, this, aHandle); |
267 | 0 | // Sentinel = 'aHandle' |
268 | 0 | (msg__)->WriteSentinel(2892339440); |
269 | 0 | WriteIPDLParam(msg__, this, aInfo); |
270 | 0 | // Sentinel = 'aInfo' |
271 | 0 | (msg__)->WriteSentinel(3826123752); |
272 | 0 | WriteIPDLParam(msg__, this, aBackend); |
273 | 0 | // Sentinel = 'aBackend' |
274 | 0 | (msg__)->WriteSentinel(2878499283); |
275 | 0 |
|
276 | 0 |
|
277 | 0 |
|
278 | 0 | Message reply__; |
279 | 0 |
|
280 | 0 | if (mozilla::ipc::LoggingEnabledFor("PImageBridgeChild")) { |
281 | 0 | mozilla::ipc::LogMessageForProtocol("PImageBridgeChild", OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending); |
282 | 0 | } |
283 | 0 | AUTO_PROFILER_LABEL("PImageBridge::Msg_NewCompositable", OTHER); |
284 | 0 | if ((!(StateTransition(false, (&(mLivenessState)))))) { |
285 | 0 | mozilla::ipc::LogicError("Transition error"); |
286 | 0 | } |
287 | 0 |
|
288 | 0 | bool sendok__; |
289 | 0 | { |
290 | 0 | AUTO_PROFILER_TRACING("IPC", "PImageBridge::Msg_NewCompositable"); |
291 | 0 | sendok__ = (GetIPCChannel())->Send(msg__, (&(reply__))); |
292 | 0 | } |
293 | 0 | if ((!(sendok__))) { |
294 | 0 | return false; |
295 | 0 | } |
296 | 0 | |
297 | 0 | if (mozilla::ipc::LoggingEnabledFor("PImageBridgeChild")) { |
298 | 0 | mozilla::ipc::LogMessageForProtocol("PImageBridgeChild", OtherPid(), "Received reply ", ((&(reply__)))->type(), mozilla::ipc::MessageDirection::eReceiving); |
299 | 0 | } |
300 | 0 |
|
301 | 0 | return true; |
302 | 0 | } |
303 | | |
304 | | auto PImageBridgeChild::SendReleaseCompositable(const CompositableHandle& aHandle) -> bool |
305 | 0 | { |
306 | 0 | IPC::Message* msg__ = PImageBridge::Msg_ReleaseCompositable(MSG_ROUTING_CONTROL); |
307 | 0 |
|
308 | 0 | WriteIPDLParam(msg__, this, aHandle); |
309 | 0 | // Sentinel = 'aHandle' |
310 | 0 | (msg__)->WriteSentinel(2892339440); |
311 | 0 |
|
312 | 0 |
|
313 | 0 |
|
314 | 0 |
|
315 | 0 | if (mozilla::ipc::LoggingEnabledFor("PImageBridgeChild")) { |
316 | 0 | mozilla::ipc::LogMessageForProtocol("PImageBridgeChild", OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending); |
317 | 0 | } |
318 | 0 | AUTO_PROFILER_LABEL("PImageBridge::Msg_ReleaseCompositable", OTHER); |
319 | 0 | if ((!(StateTransition(false, (&(mLivenessState)))))) { |
320 | 0 | mozilla::ipc::LogicError("Transition error"); |
321 | 0 | } |
322 | 0 |
|
323 | 0 | bool sendok__ = (GetIPCChannel())->Send(msg__); |
324 | 0 | return sendok__; |
325 | 0 | } |
326 | | |
327 | | auto PImageBridgeChild::RemoveManagee( |
328 | | int32_t aProtocolId, |
329 | | IProtocol* aListener) -> void |
330 | 0 | { |
331 | 0 | switch (aProtocolId) { |
332 | 0 | case PTextureMsgStart: |
333 | 0 | { |
334 | 0 | PTextureChild* actor = static_cast<PTextureChild*>(aListener); |
335 | 0 | auto& container = mManagedPTextureChild; |
336 | 0 | MOZ_RELEASE_ASSERT((container).Contains(actor), "actor not managed by this!"); |
337 | 0 |
|
338 | 0 | (container).RemoveEntry(actor); |
339 | 0 | DeallocPTextureChild(actor); |
340 | 0 | return; |
341 | 0 | } |
342 | 0 | case PMediaSystemResourceManagerMsgStart: |
343 | 0 | { |
344 | 0 | PMediaSystemResourceManagerChild* actor = static_cast<PMediaSystemResourceManagerChild*>(aListener); |
345 | 0 | auto& container = mManagedPMediaSystemResourceManagerChild; |
346 | 0 | MOZ_RELEASE_ASSERT((container).Contains(actor), "actor not managed by this!"); |
347 | 0 |
|
348 | 0 | (container).RemoveEntry(actor); |
349 | 0 | DeallocPMediaSystemResourceManagerChild(actor); |
350 | 0 | return; |
351 | 0 | } |
352 | 0 | default: |
353 | 0 | { |
354 | 0 | FatalError("unreached"); |
355 | 0 | return; |
356 | 0 | } |
357 | 0 | } |
358 | 0 | } |
359 | | |
360 | | auto PImageBridgeChild::OnMessageReceived(const Message& msg__) -> PImageBridgeChild::Result |
361 | 0 | { |
362 | 0 | int32_t route__ = (msg__).routing_id(); |
363 | 0 | if ((MSG_ROUTING_CONTROL) != (route__)) { |
364 | 0 | IProtocol* routed__ = Lookup(route__); |
365 | 0 | if ((!(routed__))) { |
366 | 0 | return MsgRouteError; |
367 | 0 | } |
368 | 0 | return (routed__)->OnMessageReceived(msg__); |
369 | 0 | } |
370 | 0 | |
371 | 0 | switch ((msg__).type()) { |
372 | 0 | case PImageBridge::Msg_ParentAsyncMessages__ID: |
373 | 0 | { |
374 | 0 | if (mozilla::ipc::LoggingEnabledFor("PImageBridgeChild")) { |
375 | 0 | mozilla::ipc::LogMessageForProtocol("PImageBridgeChild", OtherPid(), "Received ", ((&(msg__)))->type(), mozilla::ipc::MessageDirection::eReceiving); |
376 | 0 | } |
377 | 0 | AUTO_PROFILER_LABEL("PImageBridge::Msg_ParentAsyncMessages", OTHER); |
378 | 0 |
|
379 | 0 | PickleIterator iter__(msg__); |
380 | 0 | nsTArray<AsyncParentMessageData> aMessages; |
381 | 0 |
|
382 | 0 | if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(aMessages)))))) { |
383 | 0 | FatalError("Error deserializing 'nsTArray'"); |
384 | 0 | return MsgValueError; |
385 | 0 | } |
386 | 0 | // Sentinel = 'aMessages' |
387 | 0 | if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 1923086976)))) { |
388 | 0 | mozilla::ipc::SentinelReadError("Error deserializing 'nsTArray'"); |
389 | 0 | return MsgValueError; |
390 | 0 | } |
391 | 0 | (msg__).EndRead(iter__, (msg__).type()); |
392 | 0 | if ((!(StateTransition(false, (&(mLivenessState)))))) { |
393 | 0 | FatalError("Transition error"); |
394 | 0 | return MsgValueError; |
395 | 0 | } |
396 | 0 | if ((!(RecvParentAsyncMessages(std::move(aMessages))))) { |
397 | 0 | mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!"); |
398 | 0 | // Error handled in mozilla::ipc::IPCResult |
399 | 0 | return MsgProcessingError; |
400 | 0 | } |
401 | 0 | |
402 | 0 | return MsgProcessed; |
403 | 0 | } |
404 | 0 | case PImageBridge::Msg_DidComposite__ID: |
405 | 0 | { |
406 | 0 | if (mozilla::ipc::LoggingEnabledFor("PImageBridgeChild")) { |
407 | 0 | mozilla::ipc::LogMessageForProtocol("PImageBridgeChild", OtherPid(), "Received ", ((&(msg__)))->type(), mozilla::ipc::MessageDirection::eReceiving); |
408 | 0 | } |
409 | 0 | AUTO_PROFILER_LABEL("PImageBridge::Msg_DidComposite", OTHER); |
410 | 0 |
|
411 | 0 | PickleIterator iter__(msg__); |
412 | 0 | nsTArray<ImageCompositeNotification> aNotifications; |
413 | 0 |
|
414 | 0 | if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(aNotifications)))))) { |
415 | 0 | FatalError("Error deserializing 'nsTArray'"); |
416 | 0 | return MsgValueError; |
417 | 0 | } |
418 | 0 | // Sentinel = 'aNotifications' |
419 | 0 | if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 3779889553)))) { |
420 | 0 | mozilla::ipc::SentinelReadError("Error deserializing 'nsTArray'"); |
421 | 0 | return MsgValueError; |
422 | 0 | } |
423 | 0 | (msg__).EndRead(iter__, (msg__).type()); |
424 | 0 | if ((!(StateTransition(false, (&(mLivenessState)))))) { |
425 | 0 | FatalError("Transition error"); |
426 | 0 | return MsgValueError; |
427 | 0 | } |
428 | 0 | if ((!(RecvDidComposite(std::move(aNotifications))))) { |
429 | 0 | mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!"); |
430 | 0 | // Error handled in mozilla::ipc::IPCResult |
431 | 0 | return MsgProcessingError; |
432 | 0 | } |
433 | 0 | |
434 | 0 | return MsgProcessed; |
435 | 0 | } |
436 | 0 | case PImageBridge::Msg_ReportFramesDropped__ID: |
437 | 0 | { |
438 | 0 | if (mozilla::ipc::LoggingEnabledFor("PImageBridgeChild")) { |
439 | 0 | mozilla::ipc::LogMessageForProtocol("PImageBridgeChild", OtherPid(), "Received ", ((&(msg__)))->type(), mozilla::ipc::MessageDirection::eReceiving); |
440 | 0 | } |
441 | 0 | AUTO_PROFILER_LABEL("PImageBridge::Msg_ReportFramesDropped", OTHER); |
442 | 0 |
|
443 | 0 | PickleIterator iter__(msg__); |
444 | 0 | CompositableHandle aHandle; |
445 | 0 | uint32_t aFrames; |
446 | 0 |
|
447 | 0 | if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(aHandle)))))) { |
448 | 0 | FatalError("Error deserializing 'CompositableHandle'"); |
449 | 0 | return MsgValueError; |
450 | 0 | } |
451 | 0 | // Sentinel = 'aHandle' |
452 | 0 | if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 2892339440)))) { |
453 | 0 | mozilla::ipc::SentinelReadError("Error deserializing 'CompositableHandle'"); |
454 | 0 | return MsgValueError; |
455 | 0 | } |
456 | 0 | if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(aFrames)))))) { |
457 | 0 | FatalError("Error deserializing 'uint32_t'"); |
458 | 0 | return MsgValueError; |
459 | 0 | } |
460 | 0 | // Sentinel = 'aFrames' |
461 | 0 | if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 2222820396)))) { |
462 | 0 | mozilla::ipc::SentinelReadError("Error deserializing 'uint32_t'"); |
463 | 0 | return MsgValueError; |
464 | 0 | } |
465 | 0 | (msg__).EndRead(iter__, (msg__).type()); |
466 | 0 | if ((!(StateTransition(false, (&(mLivenessState)))))) { |
467 | 0 | FatalError("Transition error"); |
468 | 0 | return MsgValueError; |
469 | 0 | } |
470 | 0 | if ((!(RecvReportFramesDropped(aHandle, aFrames)))) { |
471 | 0 | mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!"); |
472 | 0 | // Error handled in mozilla::ipc::IPCResult |
473 | 0 | return MsgProcessingError; |
474 | 0 | } |
475 | 0 | |
476 | 0 | return MsgProcessed; |
477 | 0 | } |
478 | 0 | case PImageBridge::Reply_PTextureConstructor__ID: |
479 | 0 | { |
480 | 0 | return MsgProcessed; |
481 | 0 | } |
482 | 0 | case PImageBridge::Reply_PMediaSystemResourceManagerConstructor__ID: |
483 | 0 | { |
484 | 0 | return MsgProcessed; |
485 | 0 | } |
486 | 0 | default: |
487 | 0 | { |
488 | 0 | return MsgNotKnown; |
489 | 0 | } |
490 | 0 | case SHMEM_CREATED_MESSAGE_TYPE: |
491 | 0 | { |
492 | 0 | if ((!(ShmemCreated(msg__)))) { |
493 | 0 | return MsgPayloadError; |
494 | 0 | } |
495 | 0 | return MsgProcessed; |
496 | 0 | } |
497 | 0 | case SHMEM_DESTROYED_MESSAGE_TYPE: |
498 | 0 | { |
499 | 0 | if ((!(ShmemDestroyed(msg__)))) { |
500 | 0 | return MsgPayloadError; |
501 | 0 | } |
502 | 0 | return MsgProcessed; |
503 | 0 | } |
504 | 0 | } |
505 | 0 | } |
506 | | |
507 | | auto PImageBridgeChild::OnMessageReceived( |
508 | | const Message& msg__, |
509 | | Message*& reply__) -> PImageBridgeChild::Result |
510 | 0 | { |
511 | 0 | int32_t route__ = (msg__).routing_id(); |
512 | 0 | if ((MSG_ROUTING_CONTROL) != (route__)) { |
513 | 0 | IProtocol* routed__ = Lookup(route__); |
514 | 0 | if ((!(routed__))) { |
515 | 0 | return MsgRouteError; |
516 | 0 | } |
517 | 0 | return (routed__)->OnMessageReceived(msg__, reply__); |
518 | 0 | } |
519 | 0 | |
520 | 0 | return MsgNotKnown; |
521 | 0 | } |
522 | | |
523 | | auto PImageBridgeChild::OnCallReceived( |
524 | | const Message& msg__, |
525 | | Message*& reply__) -> PImageBridgeChild::Result |
526 | 0 | { |
527 | 0 | MOZ_ASSERT_UNREACHABLE("message protocol not supported"); |
528 | 0 | return MsgNotKnown; |
529 | 0 | } |
530 | | |
531 | | auto PImageBridgeChild::GetProtocolTypeId() -> int32_t |
532 | 0 | { |
533 | 0 | return PImageBridgeMsgStart; |
534 | 0 | } |
535 | | |
536 | | auto PImageBridgeChild::OnChannelClose() -> void |
537 | 0 | { |
538 | 0 | DestroySubtree(NormalShutdown); |
539 | 0 | DeallocSubtree(); |
540 | 0 | DeallocShmems(); |
541 | 0 | DeallocPImageBridgeChild(); |
542 | 0 | } |
543 | | |
544 | | auto PImageBridgeChild::OnChannelError() -> void |
545 | 0 | { |
546 | 0 | DestroySubtree(AbnormalShutdown); |
547 | 0 | DeallocSubtree(); |
548 | 0 | DeallocShmems(); |
549 | 0 | DeallocPImageBridgeChild(); |
550 | 0 | } |
551 | | |
552 | | auto PImageBridgeChild::DestroySubtree(ActorDestroyReason why) -> void |
553 | 0 | { |
554 | 0 | ActorDestroyReason subtreewhy = (((why) == (Deletion)) || ((why) == (FailedConstructor)) ? AncestorDeletion : why); |
555 | 0 |
|
556 | 0 | { |
557 | 0 | // Recursively shutting down PTexture kids |
558 | 0 | nsTArray<PTextureChild*> kids; |
559 | 0 | // Accumulate kids into a stable structure to iterate over |
560 | 0 | ManagedPTextureChild(kids); |
561 | 0 | for (auto& kid : kids) { |
562 | 0 | // Guarding against a child removing a sibling from the list during the iteration. |
563 | 0 | if ((mManagedPTextureChild).Contains(kid)) { |
564 | 0 | (kid)->DestroySubtree(subtreewhy); |
565 | 0 | } |
566 | 0 | } |
567 | 0 | } |
568 | 0 | { |
569 | 0 | // Recursively shutting down PMediaSystemResourceManager kids |
570 | 0 | nsTArray<PMediaSystemResourceManagerChild*> kids; |
571 | 0 | // Accumulate kids into a stable structure to iterate over |
572 | 0 | ManagedPMediaSystemResourceManagerChild(kids); |
573 | 0 | for (auto& kid : kids) { |
574 | 0 | // Guarding against a child removing a sibling from the list during the iteration. |
575 | 0 | if ((mManagedPMediaSystemResourceManagerChild).Contains(kid)) { |
576 | 0 | (kid)->DestroySubtree(subtreewhy); |
577 | 0 | } |
578 | 0 | } |
579 | 0 | } |
580 | 0 |
|
581 | 0 | // Reject owning pending responses. |
582 | 0 | (GetIPCChannel())->RejectPendingResponsesForActor(this); |
583 | 0 |
|
584 | 0 | // Finally, destroy "us". |
585 | 0 | ActorDestroy(why); |
586 | 0 | } |
587 | | |
588 | | auto PImageBridgeChild::DeallocSubtree() -> void |
589 | 0 | { |
590 | 0 | { |
591 | 0 | // Recursively deleting PTexture kids |
592 | 0 | for (auto iter = (mManagedPTextureChild).Iter(); (!((iter).Done())); (iter).Next()) { |
593 | 0 | (((iter).Get())->GetKey())->DeallocSubtree(); |
594 | 0 | } |
595 | 0 |
|
596 | 0 | for (auto iter = (mManagedPTextureChild).Iter(); (!((iter).Done())); (iter).Next()) { |
597 | 0 | DeallocPTextureChild(((iter).Get())->GetKey()); |
598 | 0 | } |
599 | 0 | (mManagedPTextureChild).Clear(); |
600 | 0 | } |
601 | 0 | { |
602 | 0 | // Recursively deleting PMediaSystemResourceManager kids |
603 | 0 | for (auto iter = (mManagedPMediaSystemResourceManagerChild).Iter(); (!((iter).Done())); (iter).Next()) { |
604 | 0 | (((iter).Get())->GetKey())->DeallocSubtree(); |
605 | 0 | } |
606 | 0 |
|
607 | 0 | for (auto iter = (mManagedPMediaSystemResourceManagerChild).Iter(); (!((iter).Done())); (iter).Next()) { |
608 | 0 | DeallocPMediaSystemResourceManagerChild(((iter).Get())->GetKey()); |
609 | 0 | } |
610 | 0 | (mManagedPMediaSystemResourceManagerChild).Clear(); |
611 | 0 | } |
612 | 0 | } |
613 | | |
614 | | auto PImageBridgeChild::DeallocPImageBridgeChild() -> void |
615 | 0 | { |
616 | 0 | } |
617 | | |
618 | | |
619 | | |
620 | | } // namespace layers |
621 | | } // namespace mozilla |
622 | | namespace mozilla { |
623 | | namespace ipc { |
624 | | auto IPDLParamTraits<mozilla::layers::PImageBridgeChild>::Write( |
625 | | IPC::Message* aMsg, |
626 | | mozilla::ipc::IProtocol* aActor, |
627 | | const paramType& aVar) -> void |
628 | 0 | { |
629 | 0 | int32_t id; |
630 | 0 | if ((!(aVar))) { |
631 | 0 | id = 0; |
632 | 0 | } |
633 | 0 | else { |
634 | 0 | id = (aVar)->Id(); |
635 | 0 | if ((1) == (id)) { |
636 | 0 | (aActor)->FatalError("actor has been |delete|d"); |
637 | 0 | } |
638 | 0 | } |
639 | 0 | WriteIPDLParam(aMsg, aActor, id); |
640 | 0 | } |
641 | | |
642 | | auto IPDLParamTraits<mozilla::layers::PImageBridgeChild>::Read( |
643 | | const IPC::Message* aMsg, |
644 | | PickleIterator* aIter, |
645 | | mozilla::ipc::IProtocol* aActor, |
646 | | paramType* aVar) -> bool |
647 | 0 | { |
648 | 0 | mozilla::Maybe<mozilla::ipc::IProtocol*> actor = (aActor)->ReadActor(aMsg, aIter, true, "PImageBridge", PImageBridgeMsgStart); |
649 | 0 | if ((actor).isNothing()) { |
650 | 0 | return false; |
651 | 0 | } |
652 | 0 | |
653 | 0 | (*(aVar)) = static_cast<mozilla::layers::PImageBridgeChild*>((actor).value()); |
654 | 0 | return true; |
655 | 0 | } |
656 | | |
657 | | } // namespace ipc |
658 | | } // namespace mozilla |