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