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