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