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