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