/work/obj-fuzz/ipc/ipdl/PMessagePortChild.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/PMessagePortChild.h" |
8 | | #include "ipc/IPCMessageUtils.h" |
9 | | |
10 | | #include "mozilla/ipc/PBackgroundChild.h" |
11 | | #include "mozilla/ipc/PChildToParentStreamChild.h" |
12 | | #include "mozilla/ipc/PFileDescriptorSetChild.h" |
13 | | #include "mozilla/ipc/PIPCBlobInputStreamChild.h" |
14 | | #include "mozilla/ipc/PParentToChildStreamChild.h" |
15 | | |
16 | | #include "nsIFile.h" |
17 | | #include "GeckoProfiler.h" |
18 | | |
19 | | namespace mozilla { |
20 | | namespace dom { |
21 | | |
22 | | |
23 | | auto PMessagePortChild::Recv__delete__() -> mozilla::ipc::IPCResult |
24 | 0 | { |
25 | 0 | return IPC_OK(); |
26 | 0 | } |
27 | | |
28 | | auto PMessagePortChild::ActorDestroy(ActorDestroyReason aWhy) -> void |
29 | 0 | { |
30 | 0 | } |
31 | | |
32 | | MOZ_IMPLICIT PMessagePortChild::PMessagePortChild() : |
33 | | mozilla::ipc::IProtocol(mozilla::ipc::ChildSide), |
34 | | mLivenessState(mozilla::ipc::LivenessState::Dead) |
35 | 0 | { |
36 | 0 | MOZ_COUNT_CTOR(PMessagePortChild); |
37 | 0 | } |
38 | | |
39 | | PMessagePortChild::~PMessagePortChild() |
40 | 0 | { |
41 | 0 | MOZ_COUNT_DTOR(PMessagePortChild); |
42 | 0 | } |
43 | | |
44 | | auto PMessagePortChild::Manager() const -> PBackgroundChild* |
45 | 0 | { |
46 | 0 | return static_cast<PBackgroundChild*>(IProtocol::Manager()); |
47 | 0 | } |
48 | | |
49 | | auto PMessagePortChild::SendPostMessages(const nsTArray<ClonedMessageData>& messages) -> bool |
50 | 0 | { |
51 | 0 | IPC::Message* msg__ = PMessagePort::Msg_PostMessages(Id()); |
52 | 0 |
|
53 | 0 | WriteIPDLParam(msg__, this, messages); |
54 | 0 | // Sentinel = 'messages' |
55 | 0 | (msg__)->WriteSentinel(4217553644); |
56 | 0 |
|
57 | 0 |
|
58 | 0 |
|
59 | 0 |
|
60 | 0 | if (mozilla::ipc::LoggingEnabledFor("PMessagePortChild")) { |
61 | 0 | mozilla::ipc::LogMessageForProtocol("PMessagePortChild", OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending); |
62 | 0 | } |
63 | 0 | AUTO_PROFILER_LABEL("PMessagePort::Msg_PostMessages", OTHER); |
64 | 0 | if ((!(StateTransition(false, (&(mLivenessState)))))) { |
65 | 0 | mozilla::ipc::LogicError("Transition error"); |
66 | 0 | } |
67 | 0 |
|
68 | 0 | bool sendok__ = (GetIPCChannel())->Send(msg__); |
69 | 0 | return sendok__; |
70 | 0 | } |
71 | | |
72 | | auto PMessagePortChild::SendDisentangle(const nsTArray<ClonedMessageData>& messages) -> bool |
73 | 0 | { |
74 | 0 | IPC::Message* msg__ = PMessagePort::Msg_Disentangle(Id()); |
75 | 0 |
|
76 | 0 | WriteIPDLParam(msg__, this, messages); |
77 | 0 | // Sentinel = 'messages' |
78 | 0 | (msg__)->WriteSentinel(4217553644); |
79 | 0 |
|
80 | 0 |
|
81 | 0 |
|
82 | 0 |
|
83 | 0 | if (mozilla::ipc::LoggingEnabledFor("PMessagePortChild")) { |
84 | 0 | mozilla::ipc::LogMessageForProtocol("PMessagePortChild", OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending); |
85 | 0 | } |
86 | 0 | AUTO_PROFILER_LABEL("PMessagePort::Msg_Disentangle", OTHER); |
87 | 0 | if ((!(StateTransition(false, (&(mLivenessState)))))) { |
88 | 0 | mozilla::ipc::LogicError("Transition error"); |
89 | 0 | } |
90 | 0 |
|
91 | 0 | bool sendok__ = (GetIPCChannel())->Send(msg__); |
92 | 0 | return sendok__; |
93 | 0 | } |
94 | | |
95 | | auto PMessagePortChild::SendStopSendingData() -> bool |
96 | 0 | { |
97 | 0 | IPC::Message* msg__ = PMessagePort::Msg_StopSendingData(Id()); |
98 | 0 |
|
99 | 0 |
|
100 | 0 |
|
101 | 0 |
|
102 | 0 |
|
103 | 0 | if (mozilla::ipc::LoggingEnabledFor("PMessagePortChild")) { |
104 | 0 | mozilla::ipc::LogMessageForProtocol("PMessagePortChild", OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending); |
105 | 0 | } |
106 | 0 | AUTO_PROFILER_LABEL("PMessagePort::Msg_StopSendingData", OTHER); |
107 | 0 | if ((!(StateTransition(false, (&(mLivenessState)))))) { |
108 | 0 | mozilla::ipc::LogicError("Transition error"); |
109 | 0 | } |
110 | 0 |
|
111 | 0 | bool sendok__ = (GetIPCChannel())->Send(msg__); |
112 | 0 | return sendok__; |
113 | 0 | } |
114 | | |
115 | | auto PMessagePortChild::SendClose() -> bool |
116 | 0 | { |
117 | 0 | IPC::Message* msg__ = PMessagePort::Msg_Close(Id()); |
118 | 0 |
|
119 | 0 |
|
120 | 0 |
|
121 | 0 |
|
122 | 0 |
|
123 | 0 | if (mozilla::ipc::LoggingEnabledFor("PMessagePortChild")) { |
124 | 0 | mozilla::ipc::LogMessageForProtocol("PMessagePortChild", OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending); |
125 | 0 | } |
126 | 0 | AUTO_PROFILER_LABEL("PMessagePort::Msg_Close", 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 | return sendok__; |
133 | 0 | } |
134 | | |
135 | | auto PMessagePortChild::RemoveManagee( |
136 | | int32_t aProtocolId, |
137 | | IProtocol* aListener) -> void |
138 | 0 | { |
139 | 0 | FatalError("unreached"); |
140 | 0 | return; |
141 | 0 | } |
142 | | |
143 | | auto PMessagePortChild::OnMessageReceived(const Message& msg__) -> PMessagePortChild::Result |
144 | 0 | { |
145 | 0 | switch ((msg__).type()) { |
146 | 0 | case PMessagePort::Msg_Entangled__ID: |
147 | 0 | { |
148 | 0 | if (mozilla::ipc::LoggingEnabledFor("PMessagePortChild")) { |
149 | 0 | mozilla::ipc::LogMessageForProtocol("PMessagePortChild", OtherPid(), "Received ", ((&(msg__)))->type(), mozilla::ipc::MessageDirection::eReceiving); |
150 | 0 | } |
151 | 0 | AUTO_PROFILER_LABEL("PMessagePort::Msg_Entangled", OTHER); |
152 | 0 |
|
153 | 0 | PickleIterator iter__(msg__); |
154 | 0 | nsTArray<ClonedMessageData> messages; |
155 | 0 |
|
156 | 0 | if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(messages)))))) { |
157 | 0 | FatalError("Error deserializing 'nsTArray'"); |
158 | 0 | return MsgValueError; |
159 | 0 | } |
160 | 0 | // Sentinel = 'messages' |
161 | 0 | if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 4217553644)))) { |
162 | 0 | mozilla::ipc::SentinelReadError("Error deserializing 'nsTArray'"); |
163 | 0 | return MsgValueError; |
164 | 0 | } |
165 | 0 | (msg__).EndRead(iter__, (msg__).type()); |
166 | 0 | if ((!(StateTransition(false, (&(mLivenessState)))))) { |
167 | 0 | FatalError("Transition error"); |
168 | 0 | return MsgValueError; |
169 | 0 | } |
170 | 0 | if ((!(RecvEntangled(std::move(messages))))) { |
171 | 0 | mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!"); |
172 | 0 | // Error handled in mozilla::ipc::IPCResult |
173 | 0 | return MsgProcessingError; |
174 | 0 | } |
175 | 0 | |
176 | 0 | return MsgProcessed; |
177 | 0 | } |
178 | 0 | case PMessagePort::Msg_ReceiveData__ID: |
179 | 0 | { |
180 | 0 | if (mozilla::ipc::LoggingEnabledFor("PMessagePortChild")) { |
181 | 0 | mozilla::ipc::LogMessageForProtocol("PMessagePortChild", OtherPid(), "Received ", ((&(msg__)))->type(), mozilla::ipc::MessageDirection::eReceiving); |
182 | 0 | } |
183 | 0 | AUTO_PROFILER_LABEL("PMessagePort::Msg_ReceiveData", OTHER); |
184 | 0 |
|
185 | 0 | PickleIterator iter__(msg__); |
186 | 0 | nsTArray<ClonedMessageData> messages; |
187 | 0 |
|
188 | 0 | if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(messages)))))) { |
189 | 0 | FatalError("Error deserializing 'nsTArray'"); |
190 | 0 | return MsgValueError; |
191 | 0 | } |
192 | 0 | // Sentinel = 'messages' |
193 | 0 | if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 4217553644)))) { |
194 | 0 | mozilla::ipc::SentinelReadError("Error deserializing 'nsTArray'"); |
195 | 0 | return MsgValueError; |
196 | 0 | } |
197 | 0 | (msg__).EndRead(iter__, (msg__).type()); |
198 | 0 | if ((!(StateTransition(false, (&(mLivenessState)))))) { |
199 | 0 | FatalError("Transition error"); |
200 | 0 | return MsgValueError; |
201 | 0 | } |
202 | 0 | if ((!(RecvReceiveData(std::move(messages))))) { |
203 | 0 | mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!"); |
204 | 0 | // Error handled in mozilla::ipc::IPCResult |
205 | 0 | return MsgProcessingError; |
206 | 0 | } |
207 | 0 | |
208 | 0 | return MsgProcessed; |
209 | 0 | } |
210 | 0 | case PMessagePort::Msg_StopSendingDataConfirmed__ID: |
211 | 0 | { |
212 | 0 | if (mozilla::ipc::LoggingEnabledFor("PMessagePortChild")) { |
213 | 0 | mozilla::ipc::LogMessageForProtocol("PMessagePortChild", OtherPid(), "Received ", ((&(msg__)))->type(), mozilla::ipc::MessageDirection::eReceiving); |
214 | 0 | } |
215 | 0 | AUTO_PROFILER_LABEL("PMessagePort::Msg_StopSendingDataConfirmed", OTHER); |
216 | 0 |
|
217 | 0 | if ((!(StateTransition(false, (&(mLivenessState)))))) { |
218 | 0 | FatalError("Transition error"); |
219 | 0 | return MsgValueError; |
220 | 0 | } |
221 | 0 | if ((!(RecvStopSendingDataConfirmed()))) { |
222 | 0 | mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!"); |
223 | 0 | // Error handled in mozilla::ipc::IPCResult |
224 | 0 | return MsgProcessingError; |
225 | 0 | } |
226 | 0 | |
227 | 0 | return MsgProcessed; |
228 | 0 | } |
229 | 0 | case PMessagePort::Msg___delete____ID: |
230 | 0 | { |
231 | 0 | if (mozilla::ipc::LoggingEnabledFor("PMessagePortChild")) { |
232 | 0 | mozilla::ipc::LogMessageForProtocol("PMessagePortChild", OtherPid(), "Received ", ((&(msg__)))->type(), mozilla::ipc::MessageDirection::eReceiving); |
233 | 0 | } |
234 | 0 | AUTO_PROFILER_LABEL("PMessagePort::Msg___delete__", OTHER); |
235 | 0 |
|
236 | 0 | PickleIterator iter__(msg__); |
237 | 0 | PMessagePortChild* actor; |
238 | 0 |
|
239 | 0 | if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(actor)))))) { |
240 | 0 | FatalError("Error deserializing 'PMessagePortChild'"); |
241 | 0 | return MsgValueError; |
242 | 0 | } |
243 | 0 | if ((!((*((&(actor))))))) { |
244 | 0 | FatalError("Error deserializing 'PMessagePortChild'"); |
245 | 0 | return MsgValueError; |
246 | 0 | } |
247 | 0 | // Sentinel = 'actor' |
248 | 0 | if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 875202478)))) { |
249 | 0 | mozilla::ipc::SentinelReadError("Error deserializing 'PMessagePortChild'"); |
250 | 0 | return MsgValueError; |
251 | 0 | } |
252 | 0 | (msg__).EndRead(iter__, (msg__).type()); |
253 | 0 | if ((!(StateTransition(true, (&(mLivenessState)))))) { |
254 | 0 | FatalError("Transition error"); |
255 | 0 | return MsgValueError; |
256 | 0 | } |
257 | 0 | if ((!(Recv__delete__()))) { |
258 | 0 | mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!"); |
259 | 0 | // Error handled in mozilla::ipc::IPCResult |
260 | 0 | return MsgProcessingError; |
261 | 0 | } |
262 | 0 | |
263 | 0 | |
264 | 0 | IProtocol* mgr = (actor)->Manager(); |
265 | 0 | (actor)->DestroySubtree(Deletion); |
266 | 0 | (actor)->DeallocSubtree(); |
267 | 0 | (mgr)->RemoveManagee(PMessagePortMsgStart, actor); |
268 | 0 |
|
269 | 0 | return MsgProcessed; |
270 | 0 | } |
271 | 0 | default: |
272 | 0 | { |
273 | 0 | return MsgNotKnown; |
274 | 0 | } |
275 | 0 | } |
276 | 0 | } |
277 | | |
278 | | auto PMessagePortChild::OnMessageReceived( |
279 | | const Message& msg__, |
280 | | Message*& reply__) -> PMessagePortChild::Result |
281 | 0 | { |
282 | 0 | return MsgNotKnown; |
283 | 0 | } |
284 | | |
285 | | auto PMessagePortChild::OnCallReceived( |
286 | | const Message& msg__, |
287 | | Message*& reply__) -> PMessagePortChild::Result |
288 | 0 | { |
289 | 0 | MOZ_ASSERT_UNREACHABLE("message protocol not supported"); |
290 | 0 | return MsgNotKnown; |
291 | 0 | } |
292 | | |
293 | | auto PMessagePortChild::GetProtocolTypeId() -> int32_t |
294 | 0 | { |
295 | 0 | return PMessagePortMsgStart; |
296 | 0 | } |
297 | | |
298 | | auto PMessagePortChild::DestroySubtree(ActorDestroyReason why) -> void |
299 | 0 | { |
300 | 0 | // Unregister from our manager. |
301 | 0 | Unregister(Id()); |
302 | 0 |
|
303 | 0 | // Reject owning pending responses. |
304 | 0 | (GetIPCChannel())->RejectPendingResponsesForActor(this); |
305 | 0 |
|
306 | 0 | // Finally, destroy "us". |
307 | 0 | ActorDestroy(why); |
308 | 0 | } |
309 | | |
310 | | auto PMessagePortChild::DeallocSubtree() -> void |
311 | 0 | { |
312 | 0 | } |
313 | | |
314 | | |
315 | | |
316 | | } // namespace dom |
317 | | } // namespace mozilla |
318 | | namespace mozilla { |
319 | | namespace ipc { |
320 | | auto IPDLParamTraits<mozilla::dom::PMessagePortChild>::Write( |
321 | | IPC::Message* aMsg, |
322 | | mozilla::ipc::IProtocol* aActor, |
323 | | const paramType& aVar) -> void |
324 | 0 | { |
325 | 0 | int32_t id; |
326 | 0 | if ((!(aVar))) { |
327 | 0 | id = 0; |
328 | 0 | } |
329 | 0 | else { |
330 | 0 | id = (aVar)->Id(); |
331 | 0 | if ((1) == (id)) { |
332 | 0 | (aActor)->FatalError("actor has been |delete|d"); |
333 | 0 | } |
334 | 0 | } |
335 | 0 | WriteIPDLParam(aMsg, aActor, id); |
336 | 0 | } |
337 | | |
338 | | auto IPDLParamTraits<mozilla::dom::PMessagePortChild>::Read( |
339 | | const IPC::Message* aMsg, |
340 | | PickleIterator* aIter, |
341 | | mozilla::ipc::IProtocol* aActor, |
342 | | paramType* aVar) -> bool |
343 | 0 | { |
344 | 0 | mozilla::Maybe<mozilla::ipc::IProtocol*> actor = (aActor)->ReadActor(aMsg, aIter, true, "PMessagePort", PMessagePortMsgStart); |
345 | 0 | if ((actor).isNothing()) { |
346 | 0 | return false; |
347 | 0 | } |
348 | 0 | |
349 | 0 | (*(aVar)) = static_cast<mozilla::dom::PMessagePortChild*>((actor).value()); |
350 | 0 | return true; |
351 | 0 | } |
352 | | |
353 | | } // namespace ipc |
354 | | } // namespace mozilla |