1 : //
2 : // Automatically generated by ipdlc.
3 : // Edit at your own risk
4 : //
5 :
6 :
7 : #include "mozilla/ipc/PTestShellCommandChild.h"
8 :
9 : #include "mozilla/ipc/PTestShellChild.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::PTestShellChild;
21 :
22 : namespace mozilla {
23 : namespace ipc {
24 :
25 :
26 : void
27 0 : PTestShellCommandChild::ActorDestroy(ActorDestroyReason why)
28 : {
29 0 : }
30 :
31 0 : PTestShellCommandChild::PTestShellCommandChild() :
32 : mId(0),
33 0 : mState(PTestShellCommand::__Dead)
34 : {
35 0 : MOZ_COUNT_CTOR(PTestShellCommandChild);
36 0 : }
37 :
38 0 : PTestShellCommandChild::~PTestShellCommandChild()
39 : {
40 0 : MOZ_COUNT_DTOR(PTestShellCommandChild);
41 0 : }
42 :
43 : PTestShellChild*
44 0 : PTestShellCommandChild::Manager()
45 : {
46 0 : return static_cast<PTestShellChild*>(mManager);
47 : }
48 :
49 : PTestShellCommand::State
50 0 : PTestShellCommandChild::state()
51 : {
52 0 : return mState;
53 : }
54 :
55 : bool
56 0 : PTestShellCommandChild::Send__delete__(
57 : PTestShellCommandChild* actor,
58 : const nsString& aResponse)
59 : {
60 0 : if ((!(actor))) {
61 0 : return false;
62 : }
63 :
64 0 : if ((!(actor))) {
65 0 : return false;
66 : }
67 :
68 0 : PTestShellCommand::Msg___delete__* __msg = new PTestShellCommand::Msg___delete__();
69 :
70 0 : (actor)->Write(actor, __msg, false);
71 0 : (actor)->Write(aResponse, __msg);
72 :
73 0 : (__msg)->set_routing_id((actor)->mId);
74 :
75 :
76 0 : if (mozilla::ipc::LoggingEnabled()) {
77 0 : (__msg)->Log("[PTestShellCommandChild] Sending ", stderr);
78 : }
79 0 : if ((!(PTestShellCommand::Transition((actor)->mState, Trigger(Trigger::Recv, PTestShellCommand::Msg___delete____ID), (&((actor)->mState)))))) {
80 0 : NS_WARNING("bad state transition!");
81 : }
82 :
83 0 : bool __sendok = ((actor)->mChannel)->Send(__msg);
84 :
85 0 : (actor)->DestroySubtree(Deletion);
86 0 : (actor)->DeallocSubtree();
87 0 : ((actor)->mManager)->RemoveManagee(PTestShellCommandMsgStart, actor);
88 0 : return __sendok;
89 : }
90 :
91 : int32
92 0 : PTestShellCommandChild::Register(ChannelListener* aRouted)
93 : {
94 0 : return (mManager)->Register(aRouted);
95 : }
96 :
97 : int32
98 0 : PTestShellCommandChild::RegisterID(
99 : ChannelListener* aRouted,
100 : int32 aId)
101 : {
102 0 : return (mManager)->RegisterID(aRouted, aId);
103 : }
104 :
105 : ChannelListener*
106 0 : PTestShellCommandChild::Lookup(int32 aId)
107 : {
108 0 : return (mManager)->Lookup(aId);
109 : }
110 :
111 : void
112 0 : PTestShellCommandChild::Unregister(int32 aId)
113 : {
114 0 : return (mManager)->Unregister(aId);
115 : }
116 :
117 : void
118 0 : PTestShellCommandChild::RemoveManagee(
119 : int32 aProtocolId,
120 : ChannelListener* aListener)
121 : {
122 0 : NS_RUNTIMEABORT("unreached");
123 : return;
124 : }
125 :
126 : Shmem::SharedMemory*
127 0 : PTestShellCommandChild::CreateSharedMemory(
128 : size_t aSize,
129 : Shmem::SharedMemory::SharedMemoryType type,
130 : bool unsafe,
131 : Shmem::id_t* aId)
132 : {
133 0 : return (mManager)->CreateSharedMemory(aSize, type, unsafe, aId);
134 : }
135 :
136 : bool
137 0 : PTestShellCommandChild::AdoptSharedMemory(
138 : Shmem::SharedMemory* segment,
139 : Shmem::id_t* aId)
140 : {
141 0 : return (mManager)->AdoptSharedMemory(segment, aId);
142 : }
143 :
144 : Shmem::SharedMemory*
145 0 : PTestShellCommandChild::LookupSharedMemory(Shmem::id_t aId)
146 : {
147 0 : return (mManager)->LookupSharedMemory(aId);
148 : }
149 :
150 : bool
151 0 : PTestShellCommandChild::IsTrackingSharedMemory(Shmem::SharedMemory* segment)
152 : {
153 0 : return (mManager)->IsTrackingSharedMemory(segment);
154 : }
155 :
156 : bool
157 0 : PTestShellCommandChild::DestroySharedMemory(Shmem& aShmem)
158 : {
159 0 : return (mManager)->DestroySharedMemory(aShmem);
160 : }
161 :
162 : ProcessHandle
163 0 : PTestShellCommandChild::OtherProcess() const
164 : {
165 0 : return (mManager)->OtherProcess();
166 : }
167 :
168 : AsyncChannel*
169 0 : PTestShellCommandChild::GetIPCChannel()
170 : {
171 0 : return mChannel;
172 : }
173 :
174 : PTestShellCommandChild::Result
175 0 : PTestShellCommandChild::OnMessageReceived(const Message& __msg)
176 : {
177 0 : switch ((__msg).type()) {
178 : case PTestShellCommand::Reply___delete____ID:
179 : {
180 0 : return MsgProcessed;
181 : }
182 : default:
183 : {
184 0 : return MsgNotKnown;
185 : }
186 : }
187 : }
188 :
189 : PTestShellCommandChild::Result
190 0 : PTestShellCommandChild::OnMessageReceived(
191 : const Message& __msg,
192 : Message*& __reply)
193 : {
194 0 : return MsgNotKnown;
195 : }
196 :
197 : PTestShellCommandChild::Result
198 0 : PTestShellCommandChild::OnCallReceived(
199 : const Message& __msg,
200 : Message*& __reply)
201 : {
202 0 : return MsgNotKnown;
203 : }
204 :
205 : void
206 0 : PTestShellCommandChild::OnProcessingError(Result code)
207 : {
208 0 : NS_RUNTIMEABORT("`OnProcessingError' called on non-toplevel actor");
209 0 : }
210 :
211 : bool
212 0 : PTestShellCommandChild::OnReplyTimeout()
213 : {
214 0 : NS_RUNTIMEABORT("`OnReplyTimeout' called on non-toplevel actor");
215 0 : return false;
216 : }
217 :
218 : void
219 0 : PTestShellCommandChild::OnChannelClose()
220 : {
221 0 : NS_RUNTIMEABORT("`OnClose' called on non-toplevel actor");
222 0 : }
223 :
224 : void
225 0 : PTestShellCommandChild::OnChannelError()
226 : {
227 0 : NS_RUNTIMEABORT("`OnError' called on non-toplevel actor");
228 0 : }
229 :
230 : void
231 0 : PTestShellCommandChild::OnChannelConnected(int32 pid)
232 : {
233 0 : NS_RUNTIMEABORT("'OnConnected' called on non-toplevel actor");
234 0 : }
235 :
236 : bool
237 0 : PTestShellCommandChild::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 : PTestShellCommandChild::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 : PTestShellCommandChild::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 : PTestShellCommandChild::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 : PTestShellCommandChild::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_RUNTIMEABORT("[PTestShellCommandChild] abort()ing as a result");
306 0 : }
307 :
308 : void
309 0 : PTestShellCommandChild::DestroySubtree(ActorDestroyReason why)
310 : {
311 : // Unregister from our manager.
312 0 : Unregister(mId);
313 0 : mId = 1;
314 :
315 : // Finally, destroy "us".
316 0 : ActorDestroy(why);
317 0 : }
318 :
319 : void
320 0 : PTestShellCommandChild::DeallocSubtree()
321 : {
322 0 : }
323 :
324 : void
325 0 : PTestShellCommandChild::Write(
326 : PTestShellCommandChild* __v,
327 : Message* __msg,
328 : bool __nullable)
329 : {
330 : int32 id;
331 0 : if ((!(__v))) {
332 0 : if ((!(__nullable))) {
333 0 : NS_RUNTIMEABORT("NULL actor value passed to non-nullable param");
334 : }
335 0 : id = 0;
336 : }
337 : else {
338 0 : id = (__v)->mId;
339 0 : if ((1) == (id)) {
340 0 : NS_RUNTIMEABORT("actor has been |delete|d");
341 : }
342 : }
343 :
344 0 : Write(id, __msg);
345 0 : }
346 :
347 : bool
348 0 : PTestShellCommandChild::Read(
349 : PTestShellCommandChild** __v,
350 : const Message* __msg,
351 : void** __iter,
352 : bool __nullable)
353 : {
354 : int32 id;
355 0 : if ((!(Read((&(id)), __msg, __iter)))) {
356 0 : return false;
357 : }
358 0 : if (((1) == (id)) || (((0) == (id)) && ((!(__nullable))))) {
359 0 : return false;
360 : }
361 :
362 0 : if ((0) == (id)) {
363 0 : (*(__v)) = 0;
364 : }
365 : else {
366 0 : (*(__v)) = static_cast<PTestShellCommandChild*>(Lookup(id));
367 0 : if ((!((*(__v))))) {
368 0 : return false;
369 : }
370 : }
371 0 : return true;
372 : }
373 :
374 :
375 :
376 : } // namespace ipc
377 : } // namespace mozilla
|