Line data Source code
1 : //
2 : // Automatically generated by ipdlc.
3 : // Edit at your own risk
4 : //
5 :
6 :
7 : #include "mozilla/ipc/PTestShellParent.h"
8 :
9 : #include "mozilla/dom/PContentParent.h"
10 : #include "mozilla/ipc/PTestShellCommandParent.h"
11 :
12 : #include "nsIFile.h"
13 : #include "GeckoProfiler.h"
14 :
15 : namespace mozilla {
16 : namespace ipc {
17 :
18 :
19 :
20 0 : MOZ_IMPLICIT PTestShellParent::PTestShellParent() :
21 : mozilla::ipc::IProtocol(mozilla::ipc::ParentSide),
22 0 : mState(PTestShell::__Dead)
23 : {
24 0 : MOZ_COUNT_CTOR(PTestShellParent);
25 0 : }
26 :
27 0 : PTestShellParent::~PTestShellParent()
28 : {
29 0 : MOZ_COUNT_DTOR(PTestShellParent);
30 0 : }
31 :
32 0 : auto PTestShellParent::Manager() const -> PContentParent*
33 : {
34 0 : return static_cast<PContentParent*>(IProtocol::Manager());
35 : }
36 :
37 0 : auto PTestShellParent::ManagedPTestShellCommandParent(nsTArray<PTestShellCommandParent*>& aArr) const -> void
38 : {
39 0 : (mManagedPTestShellCommandParent).ToArray(aArr);
40 0 : }
41 :
42 0 : auto PTestShellParent::ManagedPTestShellCommandParent() const -> const ManagedContainer<PTestShellCommandParent>&
43 : {
44 0 : return mManagedPTestShellCommandParent;
45 : }
46 :
47 0 : auto PTestShellParent::Send__delete__(PTestShellParent* actor) -> bool
48 : {
49 0 : if ((!(actor))) {
50 0 : return false;
51 : }
52 :
53 0 : IPC::Message* msg__ = PTestShell::Msg___delete__((actor)->Id());
54 :
55 0 : (actor)->Write(actor, msg__, false);
56 : // Sentinel = 'actor'
57 0 : (msg__)->WriteSentinel(875202478);
58 :
59 :
60 :
61 0 : if (mozilla::ipc::LoggingEnabledFor("PTestShellParent")) {
62 0 : mozilla::ipc::LogMessageForProtocol("PTestShellParent", (actor)->OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending);
63 : }
64 0 : AUTO_PROFILER_LABEL("PTestShell::Msg___delete__", OTHER);
65 0 : PTestShell::Transition(PTestShell::Msg___delete____ID, (&((actor)->mState)));
66 :
67 0 : bool sendok__ = ((actor)->GetIPCChannel())->Send(msg__);
68 :
69 0 : IProtocol* mgr = (actor)->Manager();
70 0 : (actor)->DestroySubtree(Deletion);
71 0 : (actor)->DeallocSubtree();
72 0 : (mgr)->RemoveManagee(PTestShellMsgStart, actor);
73 0 : return sendok__;
74 : }
75 :
76 0 : auto PTestShellParent::SendExecuteCommand(const nsString& aCommand) -> bool
77 : {
78 0 : IPC::Message* msg__ = PTestShell::Msg_ExecuteCommand(Id());
79 :
80 0 : Write(aCommand, msg__);
81 : // Sentinel = 'aCommand'
82 0 : (msg__)->WriteSentinel(4067353464);
83 :
84 :
85 :
86 :
87 0 : if (mozilla::ipc::LoggingEnabledFor("PTestShellParent")) {
88 0 : mozilla::ipc::LogMessageForProtocol("PTestShellParent", OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending);
89 : }
90 0 : AUTO_PROFILER_LABEL("PTestShell::Msg_ExecuteCommand", OTHER);
91 0 : PTestShell::Transition(PTestShell::Msg_ExecuteCommand__ID, (&(mState)));
92 :
93 0 : bool sendok__ = (GetIPCChannel())->Send(msg__);
94 0 : return sendok__;
95 : }
96 :
97 0 : auto PTestShellParent::SendPTestShellCommandConstructor(const nsString& aCommand) -> PTestShellCommandParent*
98 : {
99 0 : return SendPTestShellCommandConstructor(AllocPTestShellCommandParent(aCommand), aCommand);
100 : }
101 :
102 0 : auto PTestShellParent::SendPTestShellCommandConstructor(
103 : PTestShellCommandParent* actor,
104 : const nsString& aCommand) -> PTestShellCommandParent*
105 : {
106 0 : if ((!(actor))) {
107 0 : NS_WARNING("Error constructing actor PTestShellCommandParent");
108 0 : return nullptr;
109 : }
110 0 : (actor)->SetManager(this);
111 0 : Register(actor);
112 0 : (actor)->SetIPCChannel(GetIPCChannel());
113 0 : (mManagedPTestShellCommandParent).PutEntry(actor);
114 0 : (actor)->mState = mozilla::ipc::PTestShellCommand::__Start;
115 :
116 0 : IPC::Message* msg__ = PTestShell::Msg_PTestShellCommandConstructor(Id());
117 :
118 0 : Write(actor, msg__, false);
119 : // Sentinel = 'actor'
120 0 : (msg__)->WriteSentinel(875202478);
121 0 : Write(aCommand, msg__);
122 : // Sentinel = 'aCommand'
123 0 : (msg__)->WriteSentinel(4067353464);
124 :
125 0 : (msg__)->set_constructor();
126 :
127 :
128 0 : if (mozilla::ipc::LoggingEnabledFor("PTestShellParent")) {
129 0 : mozilla::ipc::LogMessageForProtocol("PTestShellParent", OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending);
130 : }
131 0 : AUTO_PROFILER_LABEL("PTestShell::Msg_PTestShellCommandConstructor", OTHER);
132 0 : PTestShell::Transition(PTestShell::Msg_PTestShellCommandConstructor__ID, (&(mState)));
133 :
134 0 : bool sendok__ = (GetIPCChannel())->Send(msg__);
135 0 : if ((!(sendok__))) {
136 0 : IProtocol* mgr = (actor)->Manager();
137 0 : (actor)->DestroySubtree(FailedConstructor);
138 0 : (actor)->DeallocSubtree();
139 0 : (mgr)->RemoveManagee(PTestShellCommandMsgStart, actor);
140 0 : return nullptr;
141 : }
142 0 : return actor;
143 : }
144 :
145 0 : auto PTestShellParent::RemoveManagee(
146 : int32_t aProtocolId,
147 : ProtocolBase* aListener) -> void
148 : {
149 0 : switch (aProtocolId) {
150 : case PTestShellCommandMsgStart:
151 : {
152 0 : PTestShellCommandParent* actor = static_cast<PTestShellCommandParent*>(aListener);
153 0 : auto& container = mManagedPTestShellCommandParent;
154 0 : MOZ_RELEASE_ASSERT((container).Contains(actor), "actor not managed by this!");
155 :
156 0 : (container).RemoveEntry(actor);
157 0 : DeallocPTestShellCommandParent(actor);
158 0 : return;
159 : }
160 : default:
161 : {
162 0 : FatalError("unreached");
163 0 : return;
164 : }
165 : }
166 : }
167 :
168 0 : auto PTestShellParent::OnMessageReceived(const Message& msg__) -> PTestShellParent::Result
169 : {
170 0 : switch ((msg__).type()) {
171 : case PTestShell::Reply___delete____ID:
172 : {
173 0 : return MsgProcessed;
174 : }
175 : case PTestShell::Reply_PTestShellCommandConstructor__ID:
176 : {
177 0 : return MsgProcessed;
178 : }
179 : default:
180 : {
181 0 : return MsgNotKnown;
182 : }
183 : }
184 : }
185 :
186 0 : auto PTestShellParent::OnMessageReceived(
187 : const Message& msg__,
188 : Message*& reply__) -> PTestShellParent::Result
189 : {
190 0 : return MsgNotKnown;
191 : }
192 :
193 0 : auto PTestShellParent::OnCallReceived(
194 : const Message& msg__,
195 : Message*& reply__) -> PTestShellParent::Result
196 : {
197 0 : MOZ_ASSERT_UNREACHABLE("message protocol not supported");
198 : return MsgNotKnown;
199 : }
200 :
201 0 : auto PTestShellParent::GetProtocolTypeId() -> int32_t
202 : {
203 0 : return PTestShellMsgStart;
204 : }
205 :
206 0 : auto PTestShellParent::ProtocolName() const -> const char*
207 : {
208 0 : return "PTestShellParent";
209 : }
210 :
211 0 : auto PTestShellParent::DestroySubtree(ActorDestroyReason why) -> void
212 : {
213 : // Unregister from our manager.
214 0 : Unregister(Id());
215 :
216 0 : ActorDestroyReason subtreewhy = (((why) == (Deletion)) || ((why) == (FailedConstructor)) ? AncestorDeletion : why);
217 :
218 : {
219 : // Recursively shutting down PTestShellCommand kids
220 0 : nsTArray<PTestShellCommandParent*> kids;
221 : // Accumulate kids into a stable structure to iterate over
222 0 : ManagedPTestShellCommandParent(kids);
223 0 : for (auto& kid : kids) {
224 : // Guarding against a child removing a sibling from the list during the iteration.
225 0 : if ((mManagedPTestShellCommandParent).Contains(kid)) {
226 0 : (kid)->DestroySubtree(subtreewhy);
227 : }
228 : }
229 : }
230 :
231 : // Reject owning pending promises.
232 0 : (GetIPCChannel())->RejectPendingPromisesForActor(this);
233 :
234 : // Finally, destroy "us".
235 0 : ActorDestroy(why);
236 0 : }
237 :
238 0 : auto PTestShellParent::DeallocSubtree() -> void
239 : {
240 : {
241 : // Recursively deleting PTestShellCommand kids
242 0 : for (auto iter = (mManagedPTestShellCommandParent).Iter(); (!((iter).Done())); (iter).Next()) {
243 0 : (((iter).Get())->GetKey())->DeallocSubtree();
244 : }
245 :
246 0 : for (auto iter = (mManagedPTestShellCommandParent).Iter(); (!((iter).Done())); (iter).Next()) {
247 0 : DeallocPTestShellCommandParent(((iter).Get())->GetKey());
248 : }
249 0 : (mManagedPTestShellCommandParent).Clear();
250 : }
251 0 : }
252 :
253 0 : auto PTestShellParent::Write(
254 : const PTestShellParent* v__,
255 : Message* msg__,
256 : bool nullable__) -> void
257 : {
258 : int32_t id;
259 0 : if ((!(v__))) {
260 0 : if ((!(nullable__))) {
261 0 : FatalError("NULL actor value passed to non-nullable param");
262 : }
263 0 : id = 0;
264 : }
265 : else {
266 0 : id = (v__)->Id();
267 0 : if ((1) == (id)) {
268 0 : FatalError("actor has been |delete|d");
269 : }
270 : }
271 :
272 0 : Write(id, msg__);
273 0 : }
274 :
275 0 : auto PTestShellParent::Read(
276 : PTestShellParent** v__,
277 : const Message* msg__,
278 : PickleIterator* iter__,
279 : bool nullable__) -> bool
280 : {
281 0 : Maybe<mozilla::ipc::IProtocol*> actor = ReadActor(msg__, iter__, nullable__, "PTestShell", PTestShellMsgStart);
282 0 : if ((actor).isNothing()) {
283 0 : return false;
284 : }
285 :
286 0 : (*(v__)) = static_cast<PTestShellParent*>((actor).value());
287 0 : return true;
288 : }
289 :
290 0 : auto PTestShellParent::Write(
291 : const PTestShellCommandParent* v__,
292 : Message* msg__,
293 : bool nullable__) -> void
294 : {
295 : int32_t id;
296 0 : if ((!(v__))) {
297 0 : if ((!(nullable__))) {
298 0 : FatalError("NULL actor value passed to non-nullable param");
299 : }
300 0 : id = 0;
301 : }
302 : else {
303 0 : id = (v__)->Id();
304 0 : if ((1) == (id)) {
305 0 : FatalError("actor has been |delete|d");
306 : }
307 : }
308 :
309 0 : Write(id, msg__);
310 0 : }
311 :
312 0 : auto PTestShellParent::Read(
313 : PTestShellCommandParent** v__,
314 : const Message* msg__,
315 : PickleIterator* iter__,
316 : bool nullable__) -> bool
317 : {
318 0 : Maybe<mozilla::ipc::IProtocol*> actor = ReadActor(msg__, iter__, nullable__, "PTestShellCommand", PTestShellCommandMsgStart);
319 0 : if ((actor).isNothing()) {
320 0 : return false;
321 : }
322 :
323 0 : (*(v__)) = static_cast<PTestShellCommandParent*>((actor).value());
324 0 : return true;
325 : }
326 :
327 :
328 :
329 : } // namespace ipc
330 : } // namespace mozilla
|