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