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