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