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