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