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