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