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