1 : //
2 : // Automatically generated by ipdlc.
3 : // Edit at your own risk
4 : //
5 :
6 :
7 : #include "mozilla/net/PNeckoChild.h"
8 :
9 : #include "mozilla/dom/PContentChild.h"
10 : #include "mozilla/net/PHttpChannelChild.h"
11 : #include "mozilla/net/PCookieServiceChild.h"
12 : #include "mozilla/dom/PBrowserChild.h"
13 : #include "mozilla/net/PWyciwygChannelChild.h"
14 : #include "mozilla/net/PFTPChannelChild.h"
15 : #include "mozilla/net/PWebSocketChild.h"
16 :
17 : typedef IPC::Message Message;
18 : typedef mozilla::ipc::RPCChannel Channel;
19 : typedef mozilla::ipc::RPCChannel::RPCListener ChannelListener;
20 : typedef base::ProcessHandle ProcessHandle;
21 : typedef mozilla::ipc::AsyncChannel AsyncChannel;
22 : typedef mozilla::ipc::SharedMemory SharedMemory;
23 : typedef mozilla::ipc::Trigger Trigger;
24 : typedef mozilla::ipc::ActorHandle ActorHandle;
25 : typedef mozilla::ipc::Shmem Shmem;
26 : using mozilla::dom::PContentChild;
27 : using mozilla::net::PHttpChannelChild;
28 : using mozilla::net::PCookieServiceChild;
29 : using mozilla::dom::PBrowserChild;
30 : using mozilla::net::PWyciwygChannelChild;
31 : using mozilla::net::PFTPChannelChild;
32 : using mozilla::net::PWebSocketChild;
33 :
34 : namespace mozilla {
35 : namespace net {
36 :
37 :
38 : bool
39 0 : PNeckoChild::RecvPHttpChannelConstructor(
40 : PHttpChannelChild* actor,
41 : PBrowserChild* browser)
42 : {
43 0 : return true;
44 : }
45 :
46 : void
47 0 : PNeckoChild::ActorDestroy(ActorDestroyReason why)
48 : {
49 0 : }
50 :
51 0 : PNeckoChild::PNeckoChild() :
52 : mId(0),
53 0 : mState(PNecko::__Dead)
54 : {
55 0 : MOZ_COUNT_CTOR(PNeckoChild);
56 0 : }
57 :
58 0 : PNeckoChild::~PNeckoChild()
59 : {
60 0 : MOZ_COUNT_DTOR(PNeckoChild);
61 0 : }
62 :
63 : PContentChild*
64 0 : PNeckoChild::Manager()
65 : {
66 0 : return static_cast<PContentChild*>(mManager);
67 : }
68 :
69 : void
70 0 : PNeckoChild::ManagedPHttpChannelChild(InfallibleTArray<PHttpChannelChild*>& aArr) const
71 : {
72 0 : aArr = mManagedPHttpChannelChild;
73 0 : }
74 :
75 : const InfallibleTArray<PHttpChannelChild*>&
76 0 : PNeckoChild::ManagedPHttpChannelChild() const
77 : {
78 0 : return mManagedPHttpChannelChild;
79 : }
80 :
81 : void
82 0 : PNeckoChild::ManagedPCookieServiceChild(InfallibleTArray<PCookieServiceChild*>& aArr) const
83 : {
84 0 : aArr = mManagedPCookieServiceChild;
85 0 : }
86 :
87 : const InfallibleTArray<PCookieServiceChild*>&
88 0 : PNeckoChild::ManagedPCookieServiceChild() const
89 : {
90 0 : return mManagedPCookieServiceChild;
91 : }
92 :
93 : void
94 0 : PNeckoChild::ManagedPWyciwygChannelChild(InfallibleTArray<PWyciwygChannelChild*>& aArr) const
95 : {
96 0 : aArr = mManagedPWyciwygChannelChild;
97 0 : }
98 :
99 : const InfallibleTArray<PWyciwygChannelChild*>&
100 0 : PNeckoChild::ManagedPWyciwygChannelChild() const
101 : {
102 0 : return mManagedPWyciwygChannelChild;
103 : }
104 :
105 : void
106 0 : PNeckoChild::ManagedPFTPChannelChild(InfallibleTArray<PFTPChannelChild*>& aArr) const
107 : {
108 0 : aArr = mManagedPFTPChannelChild;
109 0 : }
110 :
111 : const InfallibleTArray<PFTPChannelChild*>&
112 0 : PNeckoChild::ManagedPFTPChannelChild() const
113 : {
114 0 : return mManagedPFTPChannelChild;
115 : }
116 :
117 : void
118 0 : PNeckoChild::ManagedPWebSocketChild(InfallibleTArray<PWebSocketChild*>& aArr) const
119 : {
120 0 : aArr = mManagedPWebSocketChild;
121 0 : }
122 :
123 : const InfallibleTArray<PWebSocketChild*>&
124 0 : PNeckoChild::ManagedPWebSocketChild() const
125 : {
126 0 : return mManagedPWebSocketChild;
127 : }
128 :
129 : PNecko::State
130 0 : PNeckoChild::state()
131 : {
132 0 : return mState;
133 : }
134 :
135 : bool
136 0 : PNeckoChild::Send__delete__(PNeckoChild* actor)
137 : {
138 0 : if ((!(actor))) {
139 0 : return false;
140 : }
141 :
142 0 : if ((!(actor))) {
143 0 : return false;
144 : }
145 :
146 0 : PNecko::Msg___delete__* __msg = new PNecko::Msg___delete__();
147 :
148 0 : (actor)->Write(actor, __msg, false);
149 :
150 0 : (__msg)->set_routing_id((actor)->mId);
151 :
152 :
153 0 : if (mozilla::ipc::LoggingEnabled()) {
154 0 : (__msg)->Log("[PNeckoChild] Sending ", stderr);
155 : }
156 0 : if ((!(PNecko::Transition((actor)->mState, Trigger(Trigger::Recv, PNecko::Msg___delete____ID), (&((actor)->mState)))))) {
157 0 : NS_WARNING("bad state transition!");
158 : }
159 :
160 0 : bool __sendok = ((actor)->mChannel)->Send(__msg);
161 :
162 0 : (actor)->DestroySubtree(Deletion);
163 0 : (actor)->DeallocSubtree();
164 0 : ((actor)->mManager)->RemoveManagee(PNeckoMsgStart, actor);
165 0 : return __sendok;
166 : }
167 :
168 : PCookieServiceChild*
169 0 : PNeckoChild::SendPCookieServiceConstructor()
170 : {
171 0 : return SendPCookieServiceConstructor(AllocPCookieService());
172 : }
173 :
174 : PCookieServiceChild*
175 0 : PNeckoChild::SendPCookieServiceConstructor(PCookieServiceChild* actor)
176 : {
177 0 : if ((!(actor))) {
178 0 : return 0;
179 : }
180 0 : (actor)->mId = Register(actor);
181 0 : (actor)->mManager = this;
182 0 : (actor)->mChannel = mChannel;
183 0 : (mManagedPCookieServiceChild).InsertElementSorted(actor);
184 0 : (actor)->mState = mozilla::net::PCookieService::__Start;
185 :
186 0 : PNecko::Msg_PCookieServiceConstructor* __msg = new PNecko::Msg_PCookieServiceConstructor();
187 :
188 0 : Write(actor, __msg, false);
189 :
190 0 : (__msg)->set_routing_id(mId);
191 :
192 :
193 0 : if (mozilla::ipc::LoggingEnabled()) {
194 0 : (__msg)->Log("[PNeckoChild] Sending ", stderr);
195 : }
196 0 : if ((!(PNecko::Transition(mState, Trigger(Trigger::Recv, PNecko::Msg_PCookieServiceConstructor__ID), (&(mState)))))) {
197 0 : NS_WARNING("bad state transition!");
198 : }
199 :
200 0 : bool __sendok = (mChannel)->Send(__msg);
201 0 : if ((!(__sendok))) {
202 0 : (actor)->DestroySubtree(FailedConstructor);
203 0 : (actor)->DeallocSubtree();
204 0 : ((actor)->mManager)->RemoveManagee(PCookieServiceMsgStart, actor);
205 0 : return 0;
206 : }
207 0 : return actor;
208 : }
209 :
210 : PWyciwygChannelChild*
211 0 : PNeckoChild::SendPWyciwygChannelConstructor()
212 : {
213 0 : return SendPWyciwygChannelConstructor(AllocPWyciwygChannel());
214 : }
215 :
216 : PWyciwygChannelChild*
217 0 : PNeckoChild::SendPWyciwygChannelConstructor(PWyciwygChannelChild* actor)
218 : {
219 0 : if ((!(actor))) {
220 0 : return 0;
221 : }
222 0 : (actor)->mId = Register(actor);
223 0 : (actor)->mManager = this;
224 0 : (actor)->mChannel = mChannel;
225 0 : (mManagedPWyciwygChannelChild).InsertElementSorted(actor);
226 0 : (actor)->mState = mozilla::net::PWyciwygChannel::__Start;
227 :
228 0 : PNecko::Msg_PWyciwygChannelConstructor* __msg = new PNecko::Msg_PWyciwygChannelConstructor();
229 :
230 0 : Write(actor, __msg, false);
231 :
232 0 : (__msg)->set_routing_id(mId);
233 :
234 :
235 0 : if (mozilla::ipc::LoggingEnabled()) {
236 0 : (__msg)->Log("[PNeckoChild] Sending ", stderr);
237 : }
238 0 : if ((!(PNecko::Transition(mState, Trigger(Trigger::Recv, PNecko::Msg_PWyciwygChannelConstructor__ID), (&(mState)))))) {
239 0 : NS_WARNING("bad state transition!");
240 : }
241 :
242 0 : bool __sendok = (mChannel)->Send(__msg);
243 0 : if ((!(__sendok))) {
244 0 : (actor)->DestroySubtree(FailedConstructor);
245 0 : (actor)->DeallocSubtree();
246 0 : ((actor)->mManager)->RemoveManagee(PWyciwygChannelMsgStart, actor);
247 0 : return 0;
248 : }
249 0 : return actor;
250 : }
251 :
252 : PFTPChannelChild*
253 0 : PNeckoChild::SendPFTPChannelConstructor()
254 : {
255 0 : return SendPFTPChannelConstructor(AllocPFTPChannel());
256 : }
257 :
258 : PFTPChannelChild*
259 0 : PNeckoChild::SendPFTPChannelConstructor(PFTPChannelChild* actor)
260 : {
261 0 : if ((!(actor))) {
262 0 : return 0;
263 : }
264 0 : (actor)->mId = Register(actor);
265 0 : (actor)->mManager = this;
266 0 : (actor)->mChannel = mChannel;
267 0 : (mManagedPFTPChannelChild).InsertElementSorted(actor);
268 0 : (actor)->mState = mozilla::net::PFTPChannel::__Start;
269 :
270 0 : PNecko::Msg_PFTPChannelConstructor* __msg = new PNecko::Msg_PFTPChannelConstructor();
271 :
272 0 : Write(actor, __msg, false);
273 :
274 0 : (__msg)->set_routing_id(mId);
275 :
276 :
277 0 : if (mozilla::ipc::LoggingEnabled()) {
278 0 : (__msg)->Log("[PNeckoChild] Sending ", stderr);
279 : }
280 0 : if ((!(PNecko::Transition(mState, Trigger(Trigger::Recv, PNecko::Msg_PFTPChannelConstructor__ID), (&(mState)))))) {
281 0 : NS_WARNING("bad state transition!");
282 : }
283 :
284 0 : bool __sendok = (mChannel)->Send(__msg);
285 0 : if ((!(__sendok))) {
286 0 : (actor)->DestroySubtree(FailedConstructor);
287 0 : (actor)->DeallocSubtree();
288 0 : ((actor)->mManager)->RemoveManagee(PFTPChannelMsgStart, actor);
289 0 : return 0;
290 : }
291 0 : return actor;
292 : }
293 :
294 : PWebSocketChild*
295 0 : PNeckoChild::SendPWebSocketConstructor(PBrowserChild* browser)
296 : {
297 0 : return SendPWebSocketConstructor(AllocPWebSocket(browser), browser);
298 : }
299 :
300 : PWebSocketChild*
301 0 : PNeckoChild::SendPWebSocketConstructor(
302 : PWebSocketChild* actor,
303 : PBrowserChild* browser)
304 : {
305 0 : if ((!(actor))) {
306 0 : return 0;
307 : }
308 0 : (actor)->mId = Register(actor);
309 0 : (actor)->mManager = this;
310 0 : (actor)->mChannel = mChannel;
311 0 : (mManagedPWebSocketChild).InsertElementSorted(actor);
312 0 : (actor)->mState = mozilla::net::PWebSocket::__Start;
313 :
314 0 : PNecko::Msg_PWebSocketConstructor* __msg = new PNecko::Msg_PWebSocketConstructor();
315 :
316 0 : Write(actor, __msg, false);
317 0 : Write(browser, __msg, false);
318 :
319 0 : (__msg)->set_routing_id(mId);
320 :
321 :
322 0 : if (mozilla::ipc::LoggingEnabled()) {
323 0 : (__msg)->Log("[PNeckoChild] Sending ", stderr);
324 : }
325 0 : if ((!(PNecko::Transition(mState, Trigger(Trigger::Recv, PNecko::Msg_PWebSocketConstructor__ID), (&(mState)))))) {
326 0 : NS_WARNING("bad state transition!");
327 : }
328 :
329 0 : bool __sendok = (mChannel)->Send(__msg);
330 0 : if ((!(__sendok))) {
331 0 : (actor)->DestroySubtree(FailedConstructor);
332 0 : (actor)->DeallocSubtree();
333 0 : ((actor)->mManager)->RemoveManagee(PWebSocketMsgStart, actor);
334 0 : return 0;
335 : }
336 0 : return actor;
337 : }
338 :
339 : bool
340 0 : PNeckoChild::SendHTMLDNSPrefetch(
341 : const nsString& hostname,
342 : const PRUint16& flags)
343 : {
344 0 : PNecko::Msg_HTMLDNSPrefetch* __msg = new PNecko::Msg_HTMLDNSPrefetch();
345 :
346 0 : Write(hostname, __msg);
347 0 : Write(flags, __msg);
348 :
349 0 : (__msg)->set_routing_id(mId);
350 :
351 :
352 :
353 0 : if (mozilla::ipc::LoggingEnabled()) {
354 0 : (__msg)->Log("[PNeckoChild] Sending ", stderr);
355 : }
356 0 : if ((!(PNecko::Transition(mState, Trigger(Trigger::Recv, PNecko::Msg_HTMLDNSPrefetch__ID), (&(mState)))))) {
357 0 : NS_WARNING("bad state transition!");
358 : }
359 :
360 0 : bool __sendok = (mChannel)->Send(__msg);
361 0 : return __sendok;
362 : }
363 :
364 : bool
365 0 : PNeckoChild::SendCancelHTMLDNSPrefetch(
366 : const nsString& hostname,
367 : const PRUint16& flags,
368 : const nsresult& reason)
369 : {
370 0 : PNecko::Msg_CancelHTMLDNSPrefetch* __msg = new PNecko::Msg_CancelHTMLDNSPrefetch();
371 :
372 0 : Write(hostname, __msg);
373 0 : Write(flags, __msg);
374 0 : Write(reason, __msg);
375 :
376 0 : (__msg)->set_routing_id(mId);
377 :
378 :
379 :
380 0 : if (mozilla::ipc::LoggingEnabled()) {
381 0 : (__msg)->Log("[PNeckoChild] Sending ", stderr);
382 : }
383 0 : if ((!(PNecko::Transition(mState, Trigger(Trigger::Recv, PNecko::Msg_CancelHTMLDNSPrefetch__ID), (&(mState)))))) {
384 0 : NS_WARNING("bad state transition!");
385 : }
386 :
387 0 : bool __sendok = (mChannel)->Send(__msg);
388 0 : return __sendok;
389 : }
390 :
391 : PHttpChannelChild*
392 0 : PNeckoChild::SendPHttpChannelConstructor(PBrowserChild* browser)
393 : {
394 0 : return SendPHttpChannelConstructor(AllocPHttpChannel(browser), browser);
395 : }
396 :
397 : PHttpChannelChild*
398 0 : PNeckoChild::SendPHttpChannelConstructor(
399 : PHttpChannelChild* actor,
400 : PBrowserChild* browser)
401 : {
402 0 : if ((!(actor))) {
403 0 : return 0;
404 : }
405 0 : (actor)->mId = Register(actor);
406 0 : (actor)->mManager = this;
407 0 : (actor)->mChannel = mChannel;
408 0 : (mManagedPHttpChannelChild).InsertElementSorted(actor);
409 0 : (actor)->mState = mozilla::net::PHttpChannel::__Start;
410 :
411 0 : PNecko::Msg_PHttpChannelConstructor* __msg = new PNecko::Msg_PHttpChannelConstructor();
412 :
413 0 : Write(actor, __msg, false);
414 0 : Write(browser, __msg, true);
415 :
416 0 : (__msg)->set_routing_id(mId);
417 :
418 :
419 0 : if (mozilla::ipc::LoggingEnabled()) {
420 0 : (__msg)->Log("[PNeckoChild] Sending ", stderr);
421 : }
422 0 : if ((!(PNecko::Transition(mState, Trigger(Trigger::Recv, PNecko::Msg_PHttpChannelConstructor__ID), (&(mState)))))) {
423 0 : NS_WARNING("bad state transition!");
424 : }
425 :
426 0 : bool __sendok = (mChannel)->Send(__msg);
427 0 : if ((!(__sendok))) {
428 0 : (actor)->DestroySubtree(FailedConstructor);
429 0 : (actor)->DeallocSubtree();
430 0 : ((actor)->mManager)->RemoveManagee(PHttpChannelMsgStart, actor);
431 0 : return 0;
432 : }
433 0 : return actor;
434 : }
435 :
436 : int32
437 0 : PNeckoChild::Register(ChannelListener* aRouted)
438 : {
439 0 : return (mManager)->Register(aRouted);
440 : }
441 :
442 : int32
443 0 : PNeckoChild::RegisterID(
444 : ChannelListener* aRouted,
445 : int32 aId)
446 : {
447 0 : return (mManager)->RegisterID(aRouted, aId);
448 : }
449 :
450 : ChannelListener*
451 0 : PNeckoChild::Lookup(int32 aId)
452 : {
453 0 : return (mManager)->Lookup(aId);
454 : }
455 :
456 : void
457 0 : PNeckoChild::Unregister(int32 aId)
458 : {
459 0 : return (mManager)->Unregister(aId);
460 : }
461 :
462 : void
463 0 : PNeckoChild::RemoveManagee(
464 : int32 aProtocolId,
465 : ChannelListener* aListener)
466 : {
467 0 : switch (aProtocolId) {
468 : case PHttpChannelMsgStart:
469 : {
470 0 : PHttpChannelChild* actor = static_cast<PHttpChannelChild*>(aListener);
471 0 : NS_ABORT_IF_FALSE(((mManagedPHttpChannelChild).NoIndex) != ((mManagedPHttpChannelChild).BinaryIndexOf(actor)), "actor not managed by this!");
472 :
473 0 : (mManagedPHttpChannelChild).RemoveElementSorted(actor);
474 0 : DeallocPHttpChannel(actor);
475 0 : return;
476 : }
477 : case PCookieServiceMsgStart:
478 : {
479 0 : PCookieServiceChild* actor = static_cast<PCookieServiceChild*>(aListener);
480 0 : NS_ABORT_IF_FALSE(((mManagedPCookieServiceChild).NoIndex) != ((mManagedPCookieServiceChild).BinaryIndexOf(actor)), "actor not managed by this!");
481 :
482 0 : (mManagedPCookieServiceChild).RemoveElementSorted(actor);
483 0 : DeallocPCookieService(actor);
484 0 : return;
485 : }
486 : case PWyciwygChannelMsgStart:
487 : {
488 0 : PWyciwygChannelChild* actor = static_cast<PWyciwygChannelChild*>(aListener);
489 0 : NS_ABORT_IF_FALSE(((mManagedPWyciwygChannelChild).NoIndex) != ((mManagedPWyciwygChannelChild).BinaryIndexOf(actor)), "actor not managed by this!");
490 :
491 0 : (mManagedPWyciwygChannelChild).RemoveElementSorted(actor);
492 0 : DeallocPWyciwygChannel(actor);
493 0 : return;
494 : }
495 : case PFTPChannelMsgStart:
496 : {
497 0 : PFTPChannelChild* actor = static_cast<PFTPChannelChild*>(aListener);
498 0 : NS_ABORT_IF_FALSE(((mManagedPFTPChannelChild).NoIndex) != ((mManagedPFTPChannelChild).BinaryIndexOf(actor)), "actor not managed by this!");
499 :
500 0 : (mManagedPFTPChannelChild).RemoveElementSorted(actor);
501 0 : DeallocPFTPChannel(actor);
502 0 : return;
503 : }
504 : case PWebSocketMsgStart:
505 : {
506 0 : PWebSocketChild* actor = static_cast<PWebSocketChild*>(aListener);
507 0 : NS_ABORT_IF_FALSE(((mManagedPWebSocketChild).NoIndex) != ((mManagedPWebSocketChild).BinaryIndexOf(actor)), "actor not managed by this!");
508 :
509 0 : (mManagedPWebSocketChild).RemoveElementSorted(actor);
510 0 : DeallocPWebSocket(actor);
511 0 : return;
512 : }
513 : default:
514 : {
515 0 : NS_RUNTIMEABORT("unreached");
516 0 : return;
517 : }
518 : }
519 : }
520 :
521 : Shmem::SharedMemory*
522 0 : PNeckoChild::CreateSharedMemory(
523 : size_t aSize,
524 : Shmem::SharedMemory::SharedMemoryType type,
525 : bool unsafe,
526 : Shmem::id_t* aId)
527 : {
528 0 : return (mManager)->CreateSharedMemory(aSize, type, unsafe, aId);
529 : }
530 :
531 : bool
532 0 : PNeckoChild::AdoptSharedMemory(
533 : Shmem::SharedMemory* segment,
534 : Shmem::id_t* aId)
535 : {
536 0 : return (mManager)->AdoptSharedMemory(segment, aId);
537 : }
538 :
539 : Shmem::SharedMemory*
540 0 : PNeckoChild::LookupSharedMemory(Shmem::id_t aId)
541 : {
542 0 : return (mManager)->LookupSharedMemory(aId);
543 : }
544 :
545 : bool
546 0 : PNeckoChild::IsTrackingSharedMemory(Shmem::SharedMemory* segment)
547 : {
548 0 : return (mManager)->IsTrackingSharedMemory(segment);
549 : }
550 :
551 : bool
552 0 : PNeckoChild::DestroySharedMemory(Shmem& aShmem)
553 : {
554 0 : return (mManager)->DestroySharedMemory(aShmem);
555 : }
556 :
557 : ProcessHandle
558 0 : PNeckoChild::OtherProcess() const
559 : {
560 0 : return (mManager)->OtherProcess();
561 : }
562 :
563 : AsyncChannel*
564 0 : PNeckoChild::GetIPCChannel()
565 : {
566 0 : return mChannel;
567 : }
568 :
569 : PNeckoChild::Result
570 0 : PNeckoChild::OnMessageReceived(const Message& __msg)
571 : {
572 0 : switch ((__msg).type()) {
573 : case PNecko::Reply___delete____ID:
574 : {
575 0 : return MsgProcessed;
576 : }
577 : case PNecko::Reply_PCookieServiceConstructor__ID:
578 : {
579 0 : return MsgProcessed;
580 : }
581 : case PNecko::Reply_PWyciwygChannelConstructor__ID:
582 : {
583 0 : return MsgProcessed;
584 : }
585 : case PNecko::Reply_PFTPChannelConstructor__ID:
586 : {
587 0 : return MsgProcessed;
588 : }
589 : case PNecko::Reply_PWebSocketConstructor__ID:
590 : {
591 0 : return MsgProcessed;
592 : }
593 : case PNecko::Reply_PHttpChannelConstructor__ID:
594 : {
595 0 : return MsgProcessed;
596 : }
597 : case PNecko::Msg_PHttpChannelConstructor__ID:
598 : {
599 0 : (const_cast<Message&>(__msg)).set_name("PNecko::Msg_PHttpChannelConstructor");
600 0 : if (mozilla::ipc::LoggingEnabled()) {
601 0 : (static_cast<const PNecko::Msg_PHttpChannelConstructor*>((&(__msg))))->Log("[PNeckoChild] Received ", stderr);
602 : }
603 :
604 0 : void* __iter = 0;
605 : ActorHandle __handle;
606 : PHttpChannelChild* actor;
607 : PBrowserChild* browser;
608 :
609 0 : if ((!(Read((&(__handle)), (&(__msg)), (&(__iter)))))) {
610 0 : FatalError("error deserializing (better message TODO)");
611 0 : return MsgValueError;
612 : }
613 0 : if ((!(Read((&(browser)), (&(__msg)), (&(__iter)), true)))) {
614 0 : FatalError("error deserializing (better message TODO)");
615 0 : return MsgValueError;
616 : }
617 0 : (__msg).EndRead(__iter);
618 0 : if ((!(PNecko::Transition(mState, Trigger(Trigger::Send, PNecko::Msg_PHttpChannelConstructor__ID), (&(mState)))))) {
619 0 : NS_WARNING("bad state transition!");
620 : }
621 0 : actor = AllocPHttpChannel(browser);
622 0 : if ((!(actor))) {
623 0 : return MsgValueError;
624 : }
625 0 : (actor)->mId = RegisterID(actor, (__handle).mId);
626 0 : (actor)->mManager = this;
627 0 : (actor)->mChannel = mChannel;
628 0 : (mManagedPHttpChannelChild).InsertElementSorted(actor);
629 0 : (actor)->mState = mozilla::net::PHttpChannel::__Start;
630 :
631 0 : if ((!(RecvPHttpChannelConstructor(actor, browser)))) {
632 0 : return MsgProcessingError;
633 : }
634 :
635 0 : return MsgProcessed;
636 : }
637 : default:
638 : {
639 0 : return MsgNotKnown;
640 : }
641 : }
642 : }
643 :
644 : PNeckoChild::Result
645 0 : PNeckoChild::OnMessageReceived(
646 : const Message& __msg,
647 : Message*& __reply)
648 : {
649 0 : return MsgNotKnown;
650 : }
651 :
652 : PNeckoChild::Result
653 0 : PNeckoChild::OnCallReceived(
654 : const Message& __msg,
655 : Message*& __reply)
656 : {
657 0 : return MsgNotKnown;
658 : }
659 :
660 : void
661 0 : PNeckoChild::OnProcessingError(Result code)
662 : {
663 0 : NS_RUNTIMEABORT("`OnProcessingError' called on non-toplevel actor");
664 0 : }
665 :
666 : bool
667 0 : PNeckoChild::OnReplyTimeout()
668 : {
669 0 : NS_RUNTIMEABORT("`OnReplyTimeout' called on non-toplevel actor");
670 0 : return false;
671 : }
672 :
673 : void
674 0 : PNeckoChild::OnChannelClose()
675 : {
676 0 : NS_RUNTIMEABORT("`OnClose' called on non-toplevel actor");
677 0 : }
678 :
679 : void
680 0 : PNeckoChild::OnChannelError()
681 : {
682 0 : NS_RUNTIMEABORT("`OnError' called on non-toplevel actor");
683 0 : }
684 :
685 : void
686 0 : PNeckoChild::OnChannelConnected(int32 pid)
687 : {
688 0 : NS_RUNTIMEABORT("'OnConnected' called on non-toplevel actor");
689 0 : }
690 :
691 : bool
692 0 : PNeckoChild::AllocShmem(
693 : size_t aSize,
694 : Shmem::SharedMemory::SharedMemoryType aType,
695 : Shmem* aMem)
696 : {
697 : Shmem::id_t aId;
698 0 : nsAutoPtr<Shmem::SharedMemory> rawmem(CreateSharedMemory(aSize, aType, false, (&(aId))));
699 0 : if ((!(rawmem))) {
700 0 : return false;
701 : }
702 :
703 0 : (*(aMem)) = Shmem(Shmem::IHadBetterBeIPDLCodeCallingThis_OtherwiseIAmADoodyhead(), (rawmem).forget(), aId);
704 0 : return true;
705 : }
706 :
707 : bool
708 0 : PNeckoChild::AllocUnsafeShmem(
709 : size_t aSize,
710 : Shmem::SharedMemory::SharedMemoryType aType,
711 : Shmem* aMem)
712 : {
713 : Shmem::id_t aId;
714 0 : nsAutoPtr<Shmem::SharedMemory> rawmem(CreateSharedMemory(aSize, aType, true, (&(aId))));
715 0 : if ((!(rawmem))) {
716 0 : return false;
717 : }
718 :
719 0 : (*(aMem)) = Shmem(Shmem::IHadBetterBeIPDLCodeCallingThis_OtherwiseIAmADoodyhead(), (rawmem).forget(), aId);
720 0 : return true;
721 : }
722 :
723 : bool
724 0 : PNeckoChild::AdoptShmem(
725 : Shmem& aMem,
726 : Shmem* aOutMem)
727 : {
728 0 : Shmem::SharedMemory* rawmem = (aMem).Segment(Shmem::IHadBetterBeIPDLCodeCallingThis_OtherwiseIAmADoodyhead());
729 0 : if (((!(rawmem))) || (IsTrackingSharedMemory(rawmem))) {
730 0 : NS_RUNTIMEABORT("bad Shmem");
731 : }
732 :
733 : Shmem::id_t aId;
734 0 : if ((!(AdoptSharedMemory(rawmem, (&(aId)))))) {
735 0 : return false;
736 : }
737 :
738 0 : (*(aOutMem)) = Shmem(Shmem::IHadBetterBeIPDLCodeCallingThis_OtherwiseIAmADoodyhead(), rawmem, aId);
739 0 : return true;
740 : }
741 :
742 : bool
743 0 : PNeckoChild::DeallocShmem(Shmem& aMem)
744 : {
745 0 : bool ok = DestroySharedMemory(aMem);
746 0 : (aMem).forget(Shmem::IHadBetterBeIPDLCodeCallingThis_OtherwiseIAmADoodyhead());
747 0 : return ok;
748 : }
749 :
750 : void
751 0 : PNeckoChild::FatalError(const char* const msg) const
752 : {
753 : // Virtual method to prevent inlining.
754 : // This give us better error reporting.
755 : // See bug 589371
756 :
757 0 : NS_ERROR("IPDL error:");
758 0 : NS_ERROR(msg);
759 :
760 0 : NS_RUNTIMEABORT("[PNeckoChild] abort()ing as a result");
761 0 : }
762 :
763 : void
764 0 : PNeckoChild::DestroySubtree(ActorDestroyReason why)
765 : {
766 : // Unregister from our manager.
767 0 : Unregister(mId);
768 0 : mId = 1;
769 :
770 0 : ActorDestroyReason subtreewhy = (((why) == (Deletion)) || ((why) == (FailedConstructor)) ? AncestorDeletion : why);
771 :
772 : {
773 : // Recursively shutting down PHttpChannel kids
774 0 : InfallibleTArray<PHttpChannelChild*> kids = mManagedPHttpChannelChild;
775 0 : for (uint32 i = 0; (i) < ((kids).Length()); (++(i))) {
776 0 : (kids[i])->DestroySubtree(subtreewhy);
777 : }
778 : }
779 : {
780 : // Recursively shutting down PCookieService kids
781 0 : InfallibleTArray<PCookieServiceChild*> kids = mManagedPCookieServiceChild;
782 0 : for (uint32 i = 0; (i) < ((kids).Length()); (++(i))) {
783 0 : (kids[i])->DestroySubtree(subtreewhy);
784 : }
785 : }
786 : {
787 : // Recursively shutting down PWyciwygChannel kids
788 0 : InfallibleTArray<PWyciwygChannelChild*> kids = mManagedPWyciwygChannelChild;
789 0 : for (uint32 i = 0; (i) < ((kids).Length()); (++(i))) {
790 0 : (kids[i])->DestroySubtree(subtreewhy);
791 : }
792 : }
793 : {
794 : // Recursively shutting down PFTPChannel kids
795 0 : InfallibleTArray<PFTPChannelChild*> kids = mManagedPFTPChannelChild;
796 0 : for (uint32 i = 0; (i) < ((kids).Length()); (++(i))) {
797 0 : (kids[i])->DestroySubtree(subtreewhy);
798 : }
799 : }
800 : {
801 : // Recursively shutting down PWebSocket kids
802 0 : InfallibleTArray<PWebSocketChild*> kids = mManagedPWebSocketChild;
803 0 : for (uint32 i = 0; (i) < ((kids).Length()); (++(i))) {
804 0 : (kids[i])->DestroySubtree(subtreewhy);
805 : }
806 : }
807 :
808 : // Finally, destroy "us".
809 0 : ActorDestroy(why);
810 0 : }
811 :
812 : void
813 0 : PNeckoChild::DeallocSubtree()
814 : {
815 : {
816 : // Recursively deleting PHttpChannel kids
817 0 : InfallibleTArray<PHttpChannelChild*>& kids = mManagedPHttpChannelChild;
818 0 : for (uint32 i = 0; (i) < ((kids).Length()); (++(i))) {
819 0 : (kids[i])->DeallocSubtree();
820 : }
821 :
822 0 : for (uint32 i = 0; (i) < ((kids).Length()); (++(i))) {
823 0 : DeallocPHttpChannel(kids[i]);
824 : }
825 0 : (mManagedPHttpChannelChild).Clear();
826 : }
827 : {
828 : // Recursively deleting PCookieService kids
829 0 : InfallibleTArray<PCookieServiceChild*>& kids = mManagedPCookieServiceChild;
830 0 : for (uint32 i = 0; (i) < ((kids).Length()); (++(i))) {
831 0 : (kids[i])->DeallocSubtree();
832 : }
833 :
834 0 : for (uint32 i = 0; (i) < ((kids).Length()); (++(i))) {
835 0 : DeallocPCookieService(kids[i]);
836 : }
837 0 : (mManagedPCookieServiceChild).Clear();
838 : }
839 : {
840 : // Recursively deleting PWyciwygChannel kids
841 0 : InfallibleTArray<PWyciwygChannelChild*>& kids = mManagedPWyciwygChannelChild;
842 0 : for (uint32 i = 0; (i) < ((kids).Length()); (++(i))) {
843 0 : (kids[i])->DeallocSubtree();
844 : }
845 :
846 0 : for (uint32 i = 0; (i) < ((kids).Length()); (++(i))) {
847 0 : DeallocPWyciwygChannel(kids[i]);
848 : }
849 0 : (mManagedPWyciwygChannelChild).Clear();
850 : }
851 : {
852 : // Recursively deleting PFTPChannel kids
853 0 : InfallibleTArray<PFTPChannelChild*>& kids = mManagedPFTPChannelChild;
854 0 : for (uint32 i = 0; (i) < ((kids).Length()); (++(i))) {
855 0 : (kids[i])->DeallocSubtree();
856 : }
857 :
858 0 : for (uint32 i = 0; (i) < ((kids).Length()); (++(i))) {
859 0 : DeallocPFTPChannel(kids[i]);
860 : }
861 0 : (mManagedPFTPChannelChild).Clear();
862 : }
863 : {
864 : // Recursively deleting PWebSocket kids
865 0 : InfallibleTArray<PWebSocketChild*>& kids = mManagedPWebSocketChild;
866 0 : for (uint32 i = 0; (i) < ((kids).Length()); (++(i))) {
867 0 : (kids[i])->DeallocSubtree();
868 : }
869 :
870 0 : for (uint32 i = 0; (i) < ((kids).Length()); (++(i))) {
871 0 : DeallocPWebSocket(kids[i]);
872 : }
873 0 : (mManagedPWebSocketChild).Clear();
874 : }
875 0 : }
876 :
877 : void
878 0 : PNeckoChild::Write(
879 : PHttpChannelChild* __v,
880 : Message* __msg,
881 : bool __nullable)
882 : {
883 : int32 id;
884 0 : if ((!(__v))) {
885 0 : if ((!(__nullable))) {
886 0 : NS_RUNTIMEABORT("NULL actor value passed to non-nullable param");
887 : }
888 0 : id = 0;
889 : }
890 : else {
891 0 : id = (__v)->mId;
892 0 : if ((1) == (id)) {
893 0 : NS_RUNTIMEABORT("actor has been |delete|d");
894 : }
895 : }
896 :
897 0 : Write(id, __msg);
898 0 : }
899 :
900 : bool
901 0 : PNeckoChild::Read(
902 : PHttpChannelChild** __v,
903 : const Message* __msg,
904 : void** __iter,
905 : bool __nullable)
906 : {
907 : int32 id;
908 0 : if ((!(Read((&(id)), __msg, __iter)))) {
909 0 : return false;
910 : }
911 0 : if (((1) == (id)) || (((0) == (id)) && ((!(__nullable))))) {
912 0 : return false;
913 : }
914 :
915 0 : if ((0) == (id)) {
916 0 : (*(__v)) = 0;
917 : }
918 : else {
919 0 : (*(__v)) = static_cast<PHttpChannelChild*>(Lookup(id));
920 0 : if ((!((*(__v))))) {
921 0 : return false;
922 : }
923 : }
924 0 : return true;
925 : }
926 :
927 : void
928 0 : PNeckoChild::Write(
929 : PBrowserChild* __v,
930 : Message* __msg,
931 : bool __nullable)
932 : {
933 : int32 id;
934 0 : if ((!(__v))) {
935 0 : if ((!(__nullable))) {
936 0 : NS_RUNTIMEABORT("NULL actor value passed to non-nullable param");
937 : }
938 0 : id = 0;
939 : }
940 : else {
941 0 : id = (__v)->mId;
942 0 : if ((1) == (id)) {
943 0 : NS_RUNTIMEABORT("actor has been |delete|d");
944 : }
945 : }
946 :
947 0 : Write(id, __msg);
948 0 : }
949 :
950 : bool
951 0 : PNeckoChild::Read(
952 : PBrowserChild** __v,
953 : const Message* __msg,
954 : void** __iter,
955 : bool __nullable)
956 : {
957 : int32 id;
958 0 : if ((!(Read((&(id)), __msg, __iter)))) {
959 0 : return false;
960 : }
961 0 : if (((1) == (id)) || (((0) == (id)) && ((!(__nullable))))) {
962 0 : return false;
963 : }
964 :
965 0 : if ((0) == (id)) {
966 0 : (*(__v)) = 0;
967 : }
968 : else {
969 0 : (*(__v)) = static_cast<PBrowserChild*>(Lookup(id));
970 0 : if ((!((*(__v))))) {
971 0 : return false;
972 : }
973 : }
974 0 : return true;
975 : }
976 :
977 : void
978 0 : PNeckoChild::Write(
979 : PWyciwygChannelChild* __v,
980 : Message* __msg,
981 : bool __nullable)
982 : {
983 : int32 id;
984 0 : if ((!(__v))) {
985 0 : if ((!(__nullable))) {
986 0 : NS_RUNTIMEABORT("NULL actor value passed to non-nullable param");
987 : }
988 0 : id = 0;
989 : }
990 : else {
991 0 : id = (__v)->mId;
992 0 : if ((1) == (id)) {
993 0 : NS_RUNTIMEABORT("actor has been |delete|d");
994 : }
995 : }
996 :
997 0 : Write(id, __msg);
998 0 : }
999 :
1000 : bool
1001 0 : PNeckoChild::Read(
1002 : PWyciwygChannelChild** __v,
1003 : const Message* __msg,
1004 : void** __iter,
1005 : bool __nullable)
1006 : {
1007 : int32 id;
1008 0 : if ((!(Read((&(id)), __msg, __iter)))) {
1009 0 : return false;
1010 : }
1011 0 : if (((1) == (id)) || (((0) == (id)) && ((!(__nullable))))) {
1012 0 : return false;
1013 : }
1014 :
1015 0 : if ((0) == (id)) {
1016 0 : (*(__v)) = 0;
1017 : }
1018 : else {
1019 0 : (*(__v)) = static_cast<PWyciwygChannelChild*>(Lookup(id));
1020 0 : if ((!((*(__v))))) {
1021 0 : return false;
1022 : }
1023 : }
1024 0 : return true;
1025 : }
1026 :
1027 : void
1028 0 : PNeckoChild::Write(
1029 : PNeckoChild* __v,
1030 : Message* __msg,
1031 : bool __nullable)
1032 : {
1033 : int32 id;
1034 0 : if ((!(__v))) {
1035 0 : if ((!(__nullable))) {
1036 0 : NS_RUNTIMEABORT("NULL actor value passed to non-nullable param");
1037 : }
1038 0 : id = 0;
1039 : }
1040 : else {
1041 0 : id = (__v)->mId;
1042 0 : if ((1) == (id)) {
1043 0 : NS_RUNTIMEABORT("actor has been |delete|d");
1044 : }
1045 : }
1046 :
1047 0 : Write(id, __msg);
1048 0 : }
1049 :
1050 : bool
1051 0 : PNeckoChild::Read(
1052 : PNeckoChild** __v,
1053 : const Message* __msg,
1054 : void** __iter,
1055 : bool __nullable)
1056 : {
1057 : int32 id;
1058 0 : if ((!(Read((&(id)), __msg, __iter)))) {
1059 0 : return false;
1060 : }
1061 0 : if (((1) == (id)) || (((0) == (id)) && ((!(__nullable))))) {
1062 0 : return false;
1063 : }
1064 :
1065 0 : if ((0) == (id)) {
1066 0 : (*(__v)) = 0;
1067 : }
1068 : else {
1069 0 : (*(__v)) = static_cast<PNeckoChild*>(Lookup(id));
1070 0 : if ((!((*(__v))))) {
1071 0 : return false;
1072 : }
1073 : }
1074 0 : return true;
1075 : }
1076 :
1077 : void
1078 0 : PNeckoChild::Write(
1079 : PFTPChannelChild* __v,
1080 : Message* __msg,
1081 : bool __nullable)
1082 : {
1083 : int32 id;
1084 0 : if ((!(__v))) {
1085 0 : if ((!(__nullable))) {
1086 0 : NS_RUNTIMEABORT("NULL actor value passed to non-nullable param");
1087 : }
1088 0 : id = 0;
1089 : }
1090 : else {
1091 0 : id = (__v)->mId;
1092 0 : if ((1) == (id)) {
1093 0 : NS_RUNTIMEABORT("actor has been |delete|d");
1094 : }
1095 : }
1096 :
1097 0 : Write(id, __msg);
1098 0 : }
1099 :
1100 : bool
1101 0 : PNeckoChild::Read(
1102 : PFTPChannelChild** __v,
1103 : const Message* __msg,
1104 : void** __iter,
1105 : bool __nullable)
1106 : {
1107 : int32 id;
1108 0 : if ((!(Read((&(id)), __msg, __iter)))) {
1109 0 : return false;
1110 : }
1111 0 : if (((1) == (id)) || (((0) == (id)) && ((!(__nullable))))) {
1112 0 : return false;
1113 : }
1114 :
1115 0 : if ((0) == (id)) {
1116 0 : (*(__v)) = 0;
1117 : }
1118 : else {
1119 0 : (*(__v)) = static_cast<PFTPChannelChild*>(Lookup(id));
1120 0 : if ((!((*(__v))))) {
1121 0 : return false;
1122 : }
1123 : }
1124 0 : return true;
1125 : }
1126 :
1127 : void
1128 0 : PNeckoChild::Write(
1129 : PWebSocketChild* __v,
1130 : Message* __msg,
1131 : bool __nullable)
1132 : {
1133 : int32 id;
1134 0 : if ((!(__v))) {
1135 0 : if ((!(__nullable))) {
1136 0 : NS_RUNTIMEABORT("NULL actor value passed to non-nullable param");
1137 : }
1138 0 : id = 0;
1139 : }
1140 : else {
1141 0 : id = (__v)->mId;
1142 0 : if ((1) == (id)) {
1143 0 : NS_RUNTIMEABORT("actor has been |delete|d");
1144 : }
1145 : }
1146 :
1147 0 : Write(id, __msg);
1148 0 : }
1149 :
1150 : bool
1151 0 : PNeckoChild::Read(
1152 : PWebSocketChild** __v,
1153 : const Message* __msg,
1154 : void** __iter,
1155 : bool __nullable)
1156 : {
1157 : int32 id;
1158 0 : if ((!(Read((&(id)), __msg, __iter)))) {
1159 0 : return false;
1160 : }
1161 0 : if (((1) == (id)) || (((0) == (id)) && ((!(__nullable))))) {
1162 0 : return false;
1163 : }
1164 :
1165 0 : if ((0) == (id)) {
1166 0 : (*(__v)) = 0;
1167 : }
1168 : else {
1169 0 : (*(__v)) = static_cast<PWebSocketChild*>(Lookup(id));
1170 0 : if ((!((*(__v))))) {
1171 0 : return false;
1172 : }
1173 : }
1174 0 : return true;
1175 : }
1176 :
1177 : void
1178 0 : PNeckoChild::Write(
1179 : PCookieServiceChild* __v,
1180 : Message* __msg,
1181 : bool __nullable)
1182 : {
1183 : int32 id;
1184 0 : if ((!(__v))) {
1185 0 : if ((!(__nullable))) {
1186 0 : NS_RUNTIMEABORT("NULL actor value passed to non-nullable param");
1187 : }
1188 0 : id = 0;
1189 : }
1190 : else {
1191 0 : id = (__v)->mId;
1192 0 : if ((1) == (id)) {
1193 0 : NS_RUNTIMEABORT("actor has been |delete|d");
1194 : }
1195 : }
1196 :
1197 0 : Write(id, __msg);
1198 0 : }
1199 :
1200 : bool
1201 0 : PNeckoChild::Read(
1202 : PCookieServiceChild** __v,
1203 : const Message* __msg,
1204 : void** __iter,
1205 : bool __nullable)
1206 : {
1207 : int32 id;
1208 0 : if ((!(Read((&(id)), __msg, __iter)))) {
1209 0 : return false;
1210 : }
1211 0 : if (((1) == (id)) || (((0) == (id)) && ((!(__nullable))))) {
1212 0 : return false;
1213 : }
1214 :
1215 0 : if ((0) == (id)) {
1216 0 : (*(__v)) = 0;
1217 : }
1218 : else {
1219 0 : (*(__v)) = static_cast<PCookieServiceChild*>(Lookup(id));
1220 0 : if ((!((*(__v))))) {
1221 0 : return false;
1222 : }
1223 : }
1224 0 : return true;
1225 : }
1226 :
1227 :
1228 :
1229 : } // namespace net
1230 : } // namespace mozilla
|