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