1 : //
2 : // Automatically generated by ipdlc.
3 : // Edit at your own risk
4 : //
5 :
6 :
7 : #include "mozilla/net/PCookieServiceParent.h"
8 :
9 : #include "mozilla/net/PNeckoParent.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 : typedef IPC::URI URI;
21 : using mozilla::net::PNeckoParent;
22 :
23 : namespace mozilla {
24 : namespace net {
25 :
26 :
27 : bool
28 0 : PCookieServiceParent::Recv__delete__()
29 : {
30 0 : return true;
31 : }
32 :
33 : void
34 0 : PCookieServiceParent::ActorDestroy(ActorDestroyReason why)
35 : {
36 0 : }
37 :
38 0 : PCookieServiceParent::PCookieServiceParent() :
39 : mId(0),
40 0 : mState(PCookieService::__Dead)
41 : {
42 0 : MOZ_COUNT_CTOR(PCookieServiceParent);
43 0 : }
44 :
45 0 : PCookieServiceParent::~PCookieServiceParent()
46 : {
47 0 : MOZ_COUNT_DTOR(PCookieServiceParent);
48 0 : }
49 :
50 : PNeckoParent*
51 0 : PCookieServiceParent::Manager()
52 : {
53 0 : return static_cast<PNeckoParent*>(mManager);
54 : }
55 :
56 : PCookieService::State
57 0 : PCookieServiceParent::state()
58 : {
59 0 : return mState;
60 : }
61 :
62 : int32
63 0 : PCookieServiceParent::Register(ChannelListener* aRouted)
64 : {
65 0 : return (mManager)->Register(aRouted);
66 : }
67 :
68 : int32
69 0 : PCookieServiceParent::RegisterID(
70 : ChannelListener* aRouted,
71 : int32 aId)
72 : {
73 0 : return (mManager)->RegisterID(aRouted, aId);
74 : }
75 :
76 : ChannelListener*
77 0 : PCookieServiceParent::Lookup(int32 aId)
78 : {
79 0 : return (mManager)->Lookup(aId);
80 : }
81 :
82 : void
83 0 : PCookieServiceParent::Unregister(int32 aId)
84 : {
85 0 : return (mManager)->Unregister(aId);
86 : }
87 :
88 : void
89 0 : PCookieServiceParent::RemoveManagee(
90 : int32 aProtocolId,
91 : ChannelListener* aListener)
92 : {
93 0 : NS_RUNTIMEABORT("unreached");
94 : return;
95 : }
96 :
97 : Shmem::SharedMemory*
98 0 : PCookieServiceParent::CreateSharedMemory(
99 : size_t aSize,
100 : Shmem::SharedMemory::SharedMemoryType type,
101 : bool unsafe,
102 : Shmem::id_t* aId)
103 : {
104 0 : return (mManager)->CreateSharedMemory(aSize, type, unsafe, aId);
105 : }
106 :
107 : bool
108 0 : PCookieServiceParent::AdoptSharedMemory(
109 : Shmem::SharedMemory* segment,
110 : Shmem::id_t* aId)
111 : {
112 0 : return (mManager)->AdoptSharedMemory(segment, aId);
113 : }
114 :
115 : Shmem::SharedMemory*
116 0 : PCookieServiceParent::LookupSharedMemory(Shmem::id_t aId)
117 : {
118 0 : return (mManager)->LookupSharedMemory(aId);
119 : }
120 :
121 : bool
122 0 : PCookieServiceParent::IsTrackingSharedMemory(Shmem::SharedMemory* segment)
123 : {
124 0 : return (mManager)->IsTrackingSharedMemory(segment);
125 : }
126 :
127 : bool
128 0 : PCookieServiceParent::DestroySharedMemory(Shmem& aShmem)
129 : {
130 0 : return (mManager)->DestroySharedMemory(aShmem);
131 : }
132 :
133 : ProcessHandle
134 0 : PCookieServiceParent::OtherProcess() const
135 : {
136 0 : return (mManager)->OtherProcess();
137 : }
138 :
139 : AsyncChannel*
140 0 : PCookieServiceParent::GetIPCChannel()
141 : {
142 0 : return mChannel;
143 : }
144 :
145 : PCookieServiceParent::Result
146 0 : PCookieServiceParent::OnMessageReceived(const Message& __msg)
147 : {
148 0 : switch ((__msg).type()) {
149 : case PCookieService::Msg_SetCookieString__ID:
150 : {
151 0 : (const_cast<Message&>(__msg)).set_name("PCookieService::Msg_SetCookieString");
152 0 : if (mozilla::ipc::LoggingEnabled()) {
153 0 : (static_cast<const PCookieService::Msg_SetCookieString*>((&(__msg))))->Log("[PCookieServiceParent] Received ", stderr);
154 : }
155 :
156 0 : void* __iter = 0;
157 0 : URI host;
158 : bool isForeign;
159 0 : nsCString cookieString;
160 0 : nsCString serverTime;
161 : bool fromHttp;
162 :
163 0 : if ((!(Read((&(host)), (&(__msg)), (&(__iter)))))) {
164 0 : FatalError("error deserializing (better message TODO)");
165 0 : return MsgValueError;
166 : }
167 0 : if ((!(Read((&(isForeign)), (&(__msg)), (&(__iter)))))) {
168 0 : FatalError("error deserializing (better message TODO)");
169 0 : return MsgValueError;
170 : }
171 0 : if ((!(Read((&(cookieString)), (&(__msg)), (&(__iter)))))) {
172 0 : FatalError("error deserializing (better message TODO)");
173 0 : return MsgValueError;
174 : }
175 0 : if ((!(Read((&(serverTime)), (&(__msg)), (&(__iter)))))) {
176 0 : FatalError("error deserializing (better message TODO)");
177 0 : return MsgValueError;
178 : }
179 0 : if ((!(Read((&(fromHttp)), (&(__msg)), (&(__iter)))))) {
180 0 : FatalError("error deserializing (better message TODO)");
181 0 : return MsgValueError;
182 : }
183 0 : (__msg).EndRead(__iter);
184 0 : if ((!(PCookieService::Transition(mState, Trigger(Trigger::Recv, PCookieService::Msg_SetCookieString__ID), (&(mState)))))) {
185 0 : NS_WARNING("bad state transition!");
186 : }
187 0 : if ((!(RecvSetCookieString(host, isForeign, cookieString, serverTime, fromHttp)))) {
188 0 : return MsgProcessingError;
189 : }
190 :
191 0 : return MsgProcessed;
192 : }
193 : case PCookieService::Msg___delete____ID:
194 : {
195 0 : (const_cast<Message&>(__msg)).set_name("PCookieService::Msg___delete__");
196 0 : if (mozilla::ipc::LoggingEnabled()) {
197 0 : (static_cast<const PCookieService::Msg___delete__*>((&(__msg))))->Log("[PCookieServiceParent] Received ", stderr);
198 : }
199 :
200 0 : void* __iter = 0;
201 : PCookieServiceParent* actor;
202 :
203 0 : if ((!(Read((&(actor)), (&(__msg)), (&(__iter)), false)))) {
204 0 : FatalError("error deserializing (better message TODO)");
205 0 : return MsgValueError;
206 : }
207 0 : (__msg).EndRead(__iter);
208 0 : if ((!(PCookieService::Transition(mState, Trigger(Trigger::Recv, PCookieService::Msg___delete____ID), (&(mState)))))) {
209 0 : NS_WARNING("bad state transition!");
210 : }
211 0 : if ((!(Recv__delete__()))) {
212 0 : return MsgProcessingError;
213 : }
214 :
215 0 : (actor)->DestroySubtree(Deletion);
216 0 : (actor)->DeallocSubtree();
217 0 : ((actor)->mManager)->RemoveManagee(PCookieServiceMsgStart, actor);
218 :
219 :
220 0 : return MsgProcessed;
221 : }
222 : default:
223 : {
224 0 : return MsgNotKnown;
225 : }
226 : }
227 : }
228 :
229 : PCookieServiceParent::Result
230 0 : PCookieServiceParent::OnMessageReceived(
231 : const Message& __msg,
232 : Message*& __reply)
233 : {
234 0 : switch ((__msg).type()) {
235 : case PCookieService::Msg_GetCookieString__ID:
236 : {
237 0 : (const_cast<Message&>(__msg)).set_name("PCookieService::Msg_GetCookieString");
238 0 : if (mozilla::ipc::LoggingEnabled()) {
239 0 : (static_cast<const PCookieService::Msg_GetCookieString*>((&(__msg))))->Log("[PCookieServiceParent] Received ", stderr);
240 : }
241 :
242 0 : void* __iter = 0;
243 0 : URI host;
244 : bool isForeign;
245 : bool fromHttp;
246 :
247 0 : if ((!(Read((&(host)), (&(__msg)), (&(__iter)))))) {
248 0 : FatalError("error deserializing (better message TODO)");
249 0 : return MsgValueError;
250 : }
251 0 : if ((!(Read((&(isForeign)), (&(__msg)), (&(__iter)))))) {
252 0 : FatalError("error deserializing (better message TODO)");
253 0 : return MsgValueError;
254 : }
255 0 : if ((!(Read((&(fromHttp)), (&(__msg)), (&(__iter)))))) {
256 0 : FatalError("error deserializing (better message TODO)");
257 0 : return MsgValueError;
258 : }
259 0 : (__msg).EndRead(__iter);
260 0 : if ((!(PCookieService::Transition(mState, Trigger(Trigger::Recv, PCookieService::Msg_GetCookieString__ID), (&(mState)))))) {
261 0 : NS_WARNING("bad state transition!");
262 : }
263 0 : nsCString result;
264 0 : int32 __id = mId;
265 0 : if ((!(RecvGetCookieString(host, isForeign, fromHttp, (&(result)))))) {
266 0 : return MsgProcessingError;
267 : }
268 :
269 0 : __reply = new PCookieService::Reply_GetCookieString();
270 :
271 0 : Write(result, __reply);
272 0 : (__reply)->set_routing_id(__id);
273 0 : (__reply)->set_sync();
274 0 : (__reply)->set_reply();
275 :
276 0 : if (mozilla::ipc::LoggingEnabled()) {
277 0 : (static_cast<const PCookieService::Reply_GetCookieString*>(__reply))->Log("[PCookieServiceParent] Sending reply ", stderr);
278 : }
279 0 : return MsgProcessed;
280 : }
281 : default:
282 : {
283 0 : return MsgNotKnown;
284 : }
285 : }
286 : }
287 :
288 : PCookieServiceParent::Result
289 0 : PCookieServiceParent::OnCallReceived(
290 : const Message& __msg,
291 : Message*& __reply)
292 : {
293 0 : return MsgNotKnown;
294 : }
295 :
296 : void
297 0 : PCookieServiceParent::OnProcessingError(Result code)
298 : {
299 0 : NS_RUNTIMEABORT("`OnProcessingError' called on non-toplevel actor");
300 0 : }
301 :
302 : bool
303 0 : PCookieServiceParent::OnReplyTimeout()
304 : {
305 0 : NS_RUNTIMEABORT("`OnReplyTimeout' called on non-toplevel actor");
306 0 : return false;
307 : }
308 :
309 : void
310 0 : PCookieServiceParent::OnChannelClose()
311 : {
312 0 : NS_RUNTIMEABORT("`OnClose' called on non-toplevel actor");
313 0 : }
314 :
315 : void
316 0 : PCookieServiceParent::OnChannelError()
317 : {
318 0 : NS_RUNTIMEABORT("`OnError' called on non-toplevel actor");
319 0 : }
320 :
321 : void
322 0 : PCookieServiceParent::OnChannelConnected(int32 pid)
323 : {
324 0 : NS_RUNTIMEABORT("'OnConnected' called on non-toplevel actor");
325 0 : }
326 :
327 : bool
328 0 : PCookieServiceParent::AllocShmem(
329 : size_t aSize,
330 : Shmem::SharedMemory::SharedMemoryType aType,
331 : Shmem* aMem)
332 : {
333 : Shmem::id_t aId;
334 0 : nsAutoPtr<Shmem::SharedMemory> rawmem(CreateSharedMemory(aSize, aType, false, (&(aId))));
335 0 : if ((!(rawmem))) {
336 0 : return false;
337 : }
338 :
339 0 : (*(aMem)) = Shmem(Shmem::IHadBetterBeIPDLCodeCallingThis_OtherwiseIAmADoodyhead(), (rawmem).forget(), aId);
340 0 : return true;
341 : }
342 :
343 : bool
344 0 : PCookieServiceParent::AllocUnsafeShmem(
345 : size_t aSize,
346 : Shmem::SharedMemory::SharedMemoryType aType,
347 : Shmem* aMem)
348 : {
349 : Shmem::id_t aId;
350 0 : nsAutoPtr<Shmem::SharedMemory> rawmem(CreateSharedMemory(aSize, aType, true, (&(aId))));
351 0 : if ((!(rawmem))) {
352 0 : return false;
353 : }
354 :
355 0 : (*(aMem)) = Shmem(Shmem::IHadBetterBeIPDLCodeCallingThis_OtherwiseIAmADoodyhead(), (rawmem).forget(), aId);
356 0 : return true;
357 : }
358 :
359 : bool
360 0 : PCookieServiceParent::AdoptShmem(
361 : Shmem& aMem,
362 : Shmem* aOutMem)
363 : {
364 0 : Shmem::SharedMemory* rawmem = (aMem).Segment(Shmem::IHadBetterBeIPDLCodeCallingThis_OtherwiseIAmADoodyhead());
365 0 : if (((!(rawmem))) || (IsTrackingSharedMemory(rawmem))) {
366 0 : NS_RUNTIMEABORT("bad Shmem");
367 : }
368 :
369 : Shmem::id_t aId;
370 0 : if ((!(AdoptSharedMemory(rawmem, (&(aId)))))) {
371 0 : return false;
372 : }
373 :
374 0 : (*(aOutMem)) = Shmem(Shmem::IHadBetterBeIPDLCodeCallingThis_OtherwiseIAmADoodyhead(), rawmem, aId);
375 0 : return true;
376 : }
377 :
378 : bool
379 0 : PCookieServiceParent::DeallocShmem(Shmem& aMem)
380 : {
381 0 : bool ok = DestroySharedMemory(aMem);
382 0 : (aMem).forget(Shmem::IHadBetterBeIPDLCodeCallingThis_OtherwiseIAmADoodyhead());
383 0 : return ok;
384 : }
385 :
386 : void
387 0 : PCookieServiceParent::FatalError(const char* const msg) const
388 : {
389 : // Virtual method to prevent inlining.
390 : // This give us better error reporting.
391 : // See bug 589371
392 :
393 0 : NS_ERROR("IPDL error:");
394 0 : NS_ERROR(msg);
395 :
396 0 : NS_ERROR("[PCookieServiceParent] killing child side as a result");
397 :
398 0 : if ((!(base::KillProcess(OtherProcess(), base::PROCESS_END_KILLED_BY_USER, false)))) {
399 0 : NS_ERROR(" may have failed to kill child!");
400 : }
401 0 : }
402 :
403 : void
404 0 : PCookieServiceParent::DestroySubtree(ActorDestroyReason why)
405 : {
406 : // Unregister from our manager.
407 0 : Unregister(mId);
408 0 : mId = 1;
409 :
410 : // Finally, destroy "us".
411 0 : ActorDestroy(why);
412 0 : }
413 :
414 : void
415 0 : PCookieServiceParent::DeallocSubtree()
416 : {
417 0 : }
418 :
419 : void
420 0 : PCookieServiceParent::Write(
421 : PCookieServiceParent* __v,
422 : Message* __msg,
423 : bool __nullable)
424 : {
425 : int32 id;
426 0 : if ((!(__v))) {
427 0 : if ((!(__nullable))) {
428 0 : NS_RUNTIMEABORT("NULL actor value passed to non-nullable param");
429 : }
430 0 : id = 0;
431 : }
432 : else {
433 0 : id = (__v)->mId;
434 0 : if ((1) == (id)) {
435 0 : NS_RUNTIMEABORT("actor has been |delete|d");
436 : }
437 : }
438 :
439 0 : Write(id, __msg);
440 0 : }
441 :
442 : bool
443 0 : PCookieServiceParent::Read(
444 : PCookieServiceParent** __v,
445 : const Message* __msg,
446 : void** __iter,
447 : bool __nullable)
448 : {
449 : int32 id;
450 0 : if ((!(Read((&(id)), __msg, __iter)))) {
451 0 : return false;
452 : }
453 0 : if (((1) == (id)) || (((0) == (id)) && ((!(__nullable))))) {
454 0 : return false;
455 : }
456 :
457 0 : if ((0) == (id)) {
458 0 : (*(__v)) = 0;
459 : }
460 : else {
461 0 : (*(__v)) = static_cast<PCookieServiceParent*>(Lookup(id));
462 0 : if ((!((*(__v))))) {
463 0 : return false;
464 : }
465 : }
466 0 : return true;
467 : }
468 :
469 :
470 :
471 : } // namespace net
472 : } // namespace mozilla
|