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