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