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