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