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