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