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