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