1 : //
2 : // Automatically generated by ipdlc.
3 : // Edit at your own risk
4 : //
5 :
6 :
7 : #include "mozilla/dom/PAudioParent.h"
8 :
9 : #include "mozilla/dom/PContentParent.h"
10 :
11 : typedef IPC::Message Message;
12 : typedef mozilla::ipc::RPCChannel Channel;
13 : typedef mozilla::ipc::RPCChannel::RPCListener ChannelListener;
14 : typedef base::ProcessHandle ProcessHandle;
15 : typedef mozilla::ipc::AsyncChannel AsyncChannel;
16 : typedef mozilla::ipc::SharedMemory SharedMemory;
17 : typedef mozilla::ipc::Trigger Trigger;
18 : typedef mozilla::ipc::ActorHandle ActorHandle;
19 : typedef mozilla::ipc::Shmem Shmem;
20 : using mozilla::dom::PContentParent;
21 :
22 : namespace mozilla {
23 : namespace dom {
24 :
25 :
26 : void
27 0 : PAudioParent::ActorDestroy(ActorDestroyReason why)
28 : {
29 0 : }
30 :
31 0 : PAudioParent::PAudioParent() :
32 : mId(0),
33 0 : mState(PAudio::__Dead)
34 : {
35 0 : MOZ_COUNT_CTOR(PAudioParent);
36 0 : }
37 :
38 0 : PAudioParent::~PAudioParent()
39 : {
40 0 : MOZ_COUNT_DTOR(PAudioParent);
41 0 : }
42 :
43 : PContentParent*
44 0 : PAudioParent::Manager()
45 : {
46 0 : return static_cast<PContentParent*>(mManager);
47 : }
48 :
49 : PAudio::State
50 0 : PAudioParent::state()
51 : {
52 0 : return mState;
53 : }
54 :
55 : bool
56 0 : PAudioParent::Send__delete__(PAudioParent* actor)
57 : {
58 0 : if ((!(actor))) {
59 0 : return false;
60 : }
61 :
62 0 : if ((!(actor))) {
63 0 : return false;
64 : }
65 :
66 0 : PAudio::Msg___delete__* __msg = new PAudio::Msg___delete__();
67 :
68 0 : (actor)->Write(actor, __msg, false);
69 :
70 0 : (__msg)->set_routing_id((actor)->mId);
71 :
72 :
73 0 : if (mozilla::ipc::LoggingEnabled()) {
74 0 : (__msg)->Log("[PAudioParent] Sending ", stderr);
75 : }
76 0 : if ((!(PAudio::Transition((actor)->mState, Trigger(Trigger::Send, PAudio::Msg___delete____ID), (&((actor)->mState)))))) {
77 0 : NS_WARNING("bad state transition!");
78 : }
79 :
80 0 : bool __sendok = ((actor)->mChannel)->Send(__msg);
81 :
82 0 : (actor)->DestroySubtree(Deletion);
83 0 : (actor)->DeallocSubtree();
84 0 : ((actor)->mManager)->RemoveManagee(PAudioMsgStart, actor);
85 0 : return __sendok;
86 : }
87 :
88 : bool
89 0 : PAudioParent::SendPositionInFramesUpdate(
90 : const PRInt64& position,
91 : const PRInt64& time)
92 : {
93 0 : PAudio::Msg_PositionInFramesUpdate* __msg = new PAudio::Msg_PositionInFramesUpdate();
94 :
95 0 : Write(position, __msg);
96 0 : Write(time, __msg);
97 :
98 0 : (__msg)->set_routing_id(mId);
99 :
100 :
101 :
102 0 : if (mozilla::ipc::LoggingEnabled()) {
103 0 : (__msg)->Log("[PAudioParent] Sending ", stderr);
104 : }
105 0 : if ((!(PAudio::Transition(mState, Trigger(Trigger::Send, PAudio::Msg_PositionInFramesUpdate__ID), (&(mState)))))) {
106 0 : NS_WARNING("bad state transition!");
107 : }
108 :
109 0 : bool __sendok = (mChannel)->Send(__msg);
110 0 : return __sendok;
111 : }
112 :
113 : bool
114 0 : PAudioParent::SendMinWriteSizeDone(const PRInt32& frameCount)
115 : {
116 0 : PAudio::Msg_MinWriteSizeDone* __msg = new PAudio::Msg_MinWriteSizeDone();
117 :
118 0 : Write(frameCount, __msg);
119 :
120 0 : (__msg)->set_routing_id(mId);
121 :
122 :
123 :
124 0 : if (mozilla::ipc::LoggingEnabled()) {
125 0 : (__msg)->Log("[PAudioParent] Sending ", stderr);
126 : }
127 0 : if ((!(PAudio::Transition(mState, Trigger(Trigger::Send, PAudio::Msg_MinWriteSizeDone__ID), (&(mState)))))) {
128 0 : NS_WARNING("bad state transition!");
129 : }
130 :
131 0 : bool __sendok = (mChannel)->Send(__msg);
132 0 : return __sendok;
133 : }
134 :
135 : bool
136 0 : PAudioParent::SendDrainDone()
137 : {
138 0 : PAudio::Msg_DrainDone* __msg = new PAudio::Msg_DrainDone();
139 :
140 :
141 0 : (__msg)->set_routing_id(mId);
142 :
143 :
144 :
145 0 : if (mozilla::ipc::LoggingEnabled()) {
146 0 : (__msg)->Log("[PAudioParent] Sending ", stderr);
147 : }
148 0 : if ((!(PAudio::Transition(mState, Trigger(Trigger::Send, PAudio::Msg_DrainDone__ID), (&(mState)))))) {
149 0 : NS_WARNING("bad state transition!");
150 : }
151 :
152 0 : bool __sendok = (mChannel)->Send(__msg);
153 0 : return __sendok;
154 : }
155 :
156 : int32
157 0 : PAudioParent::Register(ChannelListener* aRouted)
158 : {
159 0 : return (mManager)->Register(aRouted);
160 : }
161 :
162 : int32
163 0 : PAudioParent::RegisterID(
164 : ChannelListener* aRouted,
165 : int32 aId)
166 : {
167 0 : return (mManager)->RegisterID(aRouted, aId);
168 : }
169 :
170 : ChannelListener*
171 0 : PAudioParent::Lookup(int32 aId)
172 : {
173 0 : return (mManager)->Lookup(aId);
174 : }
175 :
176 : void
177 0 : PAudioParent::Unregister(int32 aId)
178 : {
179 0 : return (mManager)->Unregister(aId);
180 : }
181 :
182 : void
183 0 : PAudioParent::RemoveManagee(
184 : int32 aProtocolId,
185 : ChannelListener* aListener)
186 : {
187 0 : NS_RUNTIMEABORT("unreached");
188 : return;
189 : }
190 :
191 : Shmem::SharedMemory*
192 0 : PAudioParent::CreateSharedMemory(
193 : size_t aSize,
194 : Shmem::SharedMemory::SharedMemoryType type,
195 : bool unsafe,
196 : Shmem::id_t* aId)
197 : {
198 0 : return (mManager)->CreateSharedMemory(aSize, type, unsafe, aId);
199 : }
200 :
201 : bool
202 0 : PAudioParent::AdoptSharedMemory(
203 : Shmem::SharedMemory* segment,
204 : Shmem::id_t* aId)
205 : {
206 0 : return (mManager)->AdoptSharedMemory(segment, aId);
207 : }
208 :
209 : Shmem::SharedMemory*
210 0 : PAudioParent::LookupSharedMemory(Shmem::id_t aId)
211 : {
212 0 : return (mManager)->LookupSharedMemory(aId);
213 : }
214 :
215 : bool
216 0 : PAudioParent::IsTrackingSharedMemory(Shmem::SharedMemory* segment)
217 : {
218 0 : return (mManager)->IsTrackingSharedMemory(segment);
219 : }
220 :
221 : bool
222 0 : PAudioParent::DestroySharedMemory(Shmem& aShmem)
223 : {
224 0 : return (mManager)->DestroySharedMemory(aShmem);
225 : }
226 :
227 : ProcessHandle
228 0 : PAudioParent::OtherProcess() const
229 : {
230 0 : return (mManager)->OtherProcess();
231 : }
232 :
233 : AsyncChannel*
234 0 : PAudioParent::GetIPCChannel()
235 : {
236 0 : return mChannel;
237 : }
238 :
239 : PAudioParent::Result
240 0 : PAudioParent::OnMessageReceived(const Message& __msg)
241 : {
242 0 : switch ((__msg).type()) {
243 : case PAudio::Msg_Write__ID:
244 : {
245 0 : (const_cast<Message&>(__msg)).set_name("PAudio::Msg_Write");
246 0 : if (mozilla::ipc::LoggingEnabled()) {
247 0 : (static_cast<const PAudio::Msg_Write*>((&(__msg))))->Log("[PAudioParent] Received ", stderr);
248 : }
249 :
250 0 : void* __iter = 0;
251 0 : nsCString data;
252 : PRUint32 frames;
253 :
254 0 : if ((!(Read((&(data)), (&(__msg)), (&(__iter)))))) {
255 0 : FatalError("error deserializing (better message TODO)");
256 0 : return MsgValueError;
257 : }
258 0 : if ((!(Read((&(frames)), (&(__msg)), (&(__iter)))))) {
259 0 : FatalError("error deserializing (better message TODO)");
260 0 : return MsgValueError;
261 : }
262 0 : (__msg).EndRead(__iter);
263 0 : if ((!(PAudio::Transition(mState, Trigger(Trigger::Recv, PAudio::Msg_Write__ID), (&(mState)))))) {
264 0 : NS_WARNING("bad state transition!");
265 : }
266 0 : if ((!(RecvWrite(data, frames)))) {
267 0 : return MsgProcessingError;
268 : }
269 :
270 0 : return MsgProcessed;
271 : }
272 : case PAudio::Msg_SetVolume__ID:
273 : {
274 0 : (const_cast<Message&>(__msg)).set_name("PAudio::Msg_SetVolume");
275 0 : if (mozilla::ipc::LoggingEnabled()) {
276 0 : (static_cast<const PAudio::Msg_SetVolume*>((&(__msg))))->Log("[PAudioParent] Received ", stderr);
277 : }
278 :
279 0 : void* __iter = 0;
280 : float aVolume;
281 :
282 0 : if ((!(Read((&(aVolume)), (&(__msg)), (&(__iter)))))) {
283 0 : FatalError("error deserializing (better message TODO)");
284 0 : return MsgValueError;
285 : }
286 0 : (__msg).EndRead(__iter);
287 0 : if ((!(PAudio::Transition(mState, Trigger(Trigger::Recv, PAudio::Msg_SetVolume__ID), (&(mState)))))) {
288 0 : NS_WARNING("bad state transition!");
289 : }
290 0 : if ((!(RecvSetVolume(aVolume)))) {
291 0 : return MsgProcessingError;
292 : }
293 :
294 0 : return MsgProcessed;
295 : }
296 : case PAudio::Msg_MinWriteSize__ID:
297 : {
298 0 : (const_cast<Message&>(__msg)).set_name("PAudio::Msg_MinWriteSize");
299 0 : if (mozilla::ipc::LoggingEnabled()) {
300 0 : (static_cast<const PAudio::Msg_MinWriteSize*>((&(__msg))))->Log("[PAudioParent] Received ", stderr);
301 : }
302 :
303 0 : if ((!(PAudio::Transition(mState, Trigger(Trigger::Recv, PAudio::Msg_MinWriteSize__ID), (&(mState)))))) {
304 0 : NS_WARNING("bad state transition!");
305 : }
306 0 : if ((!(RecvMinWriteSize()))) {
307 0 : return MsgProcessingError;
308 : }
309 :
310 0 : return MsgProcessed;
311 : }
312 : case PAudio::Msg_Drain__ID:
313 : {
314 0 : (const_cast<Message&>(__msg)).set_name("PAudio::Msg_Drain");
315 0 : if (mozilla::ipc::LoggingEnabled()) {
316 0 : (static_cast<const PAudio::Msg_Drain*>((&(__msg))))->Log("[PAudioParent] Received ", stderr);
317 : }
318 :
319 0 : if ((!(PAudio::Transition(mState, Trigger(Trigger::Recv, PAudio::Msg_Drain__ID), (&(mState)))))) {
320 0 : NS_WARNING("bad state transition!");
321 : }
322 0 : if ((!(RecvDrain()))) {
323 0 : return MsgProcessingError;
324 : }
325 :
326 0 : return MsgProcessed;
327 : }
328 : case PAudio::Msg_Pause__ID:
329 : {
330 0 : (const_cast<Message&>(__msg)).set_name("PAudio::Msg_Pause");
331 0 : if (mozilla::ipc::LoggingEnabled()) {
332 0 : (static_cast<const PAudio::Msg_Pause*>((&(__msg))))->Log("[PAudioParent] Received ", stderr);
333 : }
334 :
335 0 : if ((!(PAudio::Transition(mState, Trigger(Trigger::Recv, PAudio::Msg_Pause__ID), (&(mState)))))) {
336 0 : NS_WARNING("bad state transition!");
337 : }
338 0 : if ((!(RecvPause()))) {
339 0 : return MsgProcessingError;
340 : }
341 :
342 0 : return MsgProcessed;
343 : }
344 : case PAudio::Msg_Resume__ID:
345 : {
346 0 : (const_cast<Message&>(__msg)).set_name("PAudio::Msg_Resume");
347 0 : if (mozilla::ipc::LoggingEnabled()) {
348 0 : (static_cast<const PAudio::Msg_Resume*>((&(__msg))))->Log("[PAudioParent] Received ", stderr);
349 : }
350 :
351 0 : if ((!(PAudio::Transition(mState, Trigger(Trigger::Recv, PAudio::Msg_Resume__ID), (&(mState)))))) {
352 0 : NS_WARNING("bad state transition!");
353 : }
354 0 : if ((!(RecvResume()))) {
355 0 : return MsgProcessingError;
356 : }
357 :
358 0 : return MsgProcessed;
359 : }
360 : case PAudio::Msg_Shutdown__ID:
361 : {
362 0 : (const_cast<Message&>(__msg)).set_name("PAudio::Msg_Shutdown");
363 0 : if (mozilla::ipc::LoggingEnabled()) {
364 0 : (static_cast<const PAudio::Msg_Shutdown*>((&(__msg))))->Log("[PAudioParent] Received ", stderr);
365 : }
366 :
367 0 : if ((!(PAudio::Transition(mState, Trigger(Trigger::Recv, PAudio::Msg_Shutdown__ID), (&(mState)))))) {
368 0 : NS_WARNING("bad state transition!");
369 : }
370 0 : if ((!(RecvShutdown()))) {
371 0 : return MsgProcessingError;
372 : }
373 :
374 0 : return MsgProcessed;
375 : }
376 : case PAudio::Reply___delete____ID:
377 : {
378 0 : return MsgProcessed;
379 : }
380 : default:
381 : {
382 0 : return MsgNotKnown;
383 : }
384 : }
385 : }
386 :
387 : PAudioParent::Result
388 0 : PAudioParent::OnMessageReceived(
389 : const Message& __msg,
390 : Message*& __reply)
391 : {
392 0 : return MsgNotKnown;
393 : }
394 :
395 : PAudioParent::Result
396 0 : PAudioParent::OnCallReceived(
397 : const Message& __msg,
398 : Message*& __reply)
399 : {
400 0 : return MsgNotKnown;
401 : }
402 :
403 : void
404 0 : PAudioParent::OnProcessingError(Result code)
405 : {
406 0 : NS_RUNTIMEABORT("`OnProcessingError' called on non-toplevel actor");
407 0 : }
408 :
409 : bool
410 0 : PAudioParent::OnReplyTimeout()
411 : {
412 0 : NS_RUNTIMEABORT("`OnReplyTimeout' called on non-toplevel actor");
413 0 : return false;
414 : }
415 :
416 : void
417 0 : PAudioParent::OnChannelClose()
418 : {
419 0 : NS_RUNTIMEABORT("`OnClose' called on non-toplevel actor");
420 0 : }
421 :
422 : void
423 0 : PAudioParent::OnChannelError()
424 : {
425 0 : NS_RUNTIMEABORT("`OnError' called on non-toplevel actor");
426 0 : }
427 :
428 : void
429 0 : PAudioParent::OnChannelConnected(int32 pid)
430 : {
431 0 : NS_RUNTIMEABORT("'OnConnected' called on non-toplevel actor");
432 0 : }
433 :
434 : bool
435 0 : PAudioParent::AllocShmem(
436 : size_t aSize,
437 : Shmem::SharedMemory::SharedMemoryType aType,
438 : Shmem* aMem)
439 : {
440 : Shmem::id_t aId;
441 0 : nsAutoPtr<Shmem::SharedMemory> rawmem(CreateSharedMemory(aSize, aType, false, (&(aId))));
442 0 : if ((!(rawmem))) {
443 0 : return false;
444 : }
445 :
446 0 : (*(aMem)) = Shmem(Shmem::IHadBetterBeIPDLCodeCallingThis_OtherwiseIAmADoodyhead(), (rawmem).forget(), aId);
447 0 : return true;
448 : }
449 :
450 : bool
451 0 : PAudioParent::AllocUnsafeShmem(
452 : size_t aSize,
453 : Shmem::SharedMemory::SharedMemoryType aType,
454 : Shmem* aMem)
455 : {
456 : Shmem::id_t aId;
457 0 : nsAutoPtr<Shmem::SharedMemory> rawmem(CreateSharedMemory(aSize, aType, true, (&(aId))));
458 0 : if ((!(rawmem))) {
459 0 : return false;
460 : }
461 :
462 0 : (*(aMem)) = Shmem(Shmem::IHadBetterBeIPDLCodeCallingThis_OtherwiseIAmADoodyhead(), (rawmem).forget(), aId);
463 0 : return true;
464 : }
465 :
466 : bool
467 0 : PAudioParent::AdoptShmem(
468 : Shmem& aMem,
469 : Shmem* aOutMem)
470 : {
471 0 : Shmem::SharedMemory* rawmem = (aMem).Segment(Shmem::IHadBetterBeIPDLCodeCallingThis_OtherwiseIAmADoodyhead());
472 0 : if (((!(rawmem))) || (IsTrackingSharedMemory(rawmem))) {
473 0 : NS_RUNTIMEABORT("bad Shmem");
474 : }
475 :
476 : Shmem::id_t aId;
477 0 : if ((!(AdoptSharedMemory(rawmem, (&(aId)))))) {
478 0 : return false;
479 : }
480 :
481 0 : (*(aOutMem)) = Shmem(Shmem::IHadBetterBeIPDLCodeCallingThis_OtherwiseIAmADoodyhead(), rawmem, aId);
482 0 : return true;
483 : }
484 :
485 : bool
486 0 : PAudioParent::DeallocShmem(Shmem& aMem)
487 : {
488 0 : bool ok = DestroySharedMemory(aMem);
489 0 : (aMem).forget(Shmem::IHadBetterBeIPDLCodeCallingThis_OtherwiseIAmADoodyhead());
490 0 : return ok;
491 : }
492 :
493 : void
494 0 : PAudioParent::FatalError(const char* const msg) const
495 : {
496 : // Virtual method to prevent inlining.
497 : // This give us better error reporting.
498 : // See bug 589371
499 :
500 0 : NS_ERROR("IPDL error:");
501 0 : NS_ERROR(msg);
502 :
503 0 : NS_ERROR("[PAudioParent] killing child side as a result");
504 :
505 0 : if ((!(base::KillProcess(OtherProcess(), base::PROCESS_END_KILLED_BY_USER, false)))) {
506 0 : NS_ERROR(" may have failed to kill child!");
507 : }
508 0 : }
509 :
510 : void
511 0 : PAudioParent::DestroySubtree(ActorDestroyReason why)
512 : {
513 : // Unregister from our manager.
514 0 : Unregister(mId);
515 0 : mId = 1;
516 :
517 : // Finally, destroy "us".
518 0 : ActorDestroy(why);
519 0 : }
520 :
521 : void
522 0 : PAudioParent::DeallocSubtree()
523 : {
524 0 : }
525 :
526 : void
527 0 : PAudioParent::Write(
528 : PAudioParent* __v,
529 : Message* __msg,
530 : bool __nullable)
531 : {
532 : int32 id;
533 0 : if ((!(__v))) {
534 0 : if ((!(__nullable))) {
535 0 : NS_RUNTIMEABORT("NULL actor value passed to non-nullable param");
536 : }
537 0 : id = 0;
538 : }
539 : else {
540 0 : id = (__v)->mId;
541 0 : if ((1) == (id)) {
542 0 : NS_RUNTIMEABORT("actor has been |delete|d");
543 : }
544 : }
545 :
546 0 : Write(id, __msg);
547 0 : }
548 :
549 : bool
550 0 : PAudioParent::Read(
551 : PAudioParent** __v,
552 : const Message* __msg,
553 : void** __iter,
554 : bool __nullable)
555 : {
556 : int32 id;
557 0 : if ((!(Read((&(id)), __msg, __iter)))) {
558 0 : return false;
559 : }
560 0 : if (((1) == (id)) || (((0) == (id)) && ((!(__nullable))))) {
561 0 : return false;
562 : }
563 :
564 0 : if ((0) == (id)) {
565 0 : (*(__v)) = 0;
566 : }
567 : else {
568 0 : (*(__v)) = static_cast<PAudioParent*>(Lookup(id));
569 0 : if ((!((*(__v))))) {
570 0 : return false;
571 : }
572 : }
573 0 : return true;
574 : }
575 :
576 :
577 :
578 : } // namespace dom
579 : } // namespace mozilla
|