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