/work/obj-fuzz/ipc/ipdl/PProfilerChild.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/PProfilerChild.h" |
8 | | |
9 | | |
10 | | #include "nsIFile.h" |
11 | | #include "GeckoProfiler.h" |
12 | | |
13 | | namespace mozilla { |
14 | | |
15 | | |
16 | | auto PProfilerChild::ActorDestroy(ActorDestroyReason aWhy) -> void |
17 | 0 | { |
18 | 0 | } |
19 | | |
20 | | auto PProfilerChild::ProcessingError( |
21 | | Result aCode, |
22 | | const char* aReason) -> void |
23 | 0 | { |
24 | 0 | } |
25 | | |
26 | | auto PProfilerChild::ShouldContinueFromReplyTimeout() -> bool |
27 | 0 | { |
28 | 0 | return true; |
29 | 0 | } |
30 | | |
31 | | auto PProfilerChild::EnteredCxxStack() -> void |
32 | 0 | { |
33 | 0 | } |
34 | | |
35 | | auto PProfilerChild::ExitedCxxStack() -> void |
36 | 0 | { |
37 | 0 | } |
38 | | |
39 | | auto PProfilerChild::EnteredCall() -> void |
40 | 0 | { |
41 | 0 | } |
42 | | |
43 | | auto PProfilerChild::ExitedCall() -> void |
44 | 0 | { |
45 | 0 | } |
46 | | |
47 | | MOZ_IMPLICIT PProfilerChild::PProfilerChild() : |
48 | | mozilla::ipc::IToplevelProtocol("PProfilerChild", PProfilerMsgStart, mozilla::ipc::ChildSide), |
49 | | mLivenessState(mozilla::ipc::LivenessState::Start) |
50 | 0 | { |
51 | 0 | MOZ_COUNT_CTOR(PProfilerChild); |
52 | 0 | } |
53 | | |
54 | | PProfilerChild::~PProfilerChild() |
55 | 0 | { |
56 | 0 | MOZ_COUNT_DTOR(PProfilerChild); |
57 | 0 | } |
58 | | |
59 | | auto PProfilerChild::RemoveManagee( |
60 | | int32_t aProtocolId, |
61 | | IProtocol* aListener) -> void |
62 | 0 | { |
63 | 0 | FatalError("unreached"); |
64 | 0 | return; |
65 | 0 | } |
66 | | |
67 | | auto PProfilerChild::OnMessageReceived(const Message& msg__) -> PProfilerChild::Result |
68 | 0 | { |
69 | 0 | switch ((msg__).type()) { |
70 | 0 | case PProfiler::Msg_Start__ID: |
71 | 0 | { |
72 | 0 | if (mozilla::ipc::LoggingEnabledFor("PProfilerChild")) { |
73 | 0 | mozilla::ipc::LogMessageForProtocol("PProfilerChild", OtherPid(), "Received ", ((&(msg__)))->type(), mozilla::ipc::MessageDirection::eReceiving); |
74 | 0 | } |
75 | 0 | AUTO_PROFILER_LABEL("PProfiler::Msg_Start", OTHER); |
76 | 0 |
|
77 | 0 | PickleIterator iter__(msg__); |
78 | 0 | ProfilerInitParams params; |
79 | 0 |
|
80 | 0 | if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(params)))))) { |
81 | 0 | FatalError("Error deserializing 'ProfilerInitParams'"); |
82 | 0 | return MsgValueError; |
83 | 0 | } |
84 | 0 | // Sentinel = 'params' |
85 | 0 | if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 1677790004)))) { |
86 | 0 | mozilla::ipc::SentinelReadError("Error deserializing 'ProfilerInitParams'"); |
87 | 0 | return MsgValueError; |
88 | 0 | } |
89 | 0 | (msg__).EndRead(iter__, (msg__).type()); |
90 | 0 | if ((!(StateTransition(false, (&(mLivenessState)))))) { |
91 | 0 | FatalError("Transition error"); |
92 | 0 | return MsgValueError; |
93 | 0 | } |
94 | 0 | if ((!(RecvStart(params)))) { |
95 | 0 | mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!"); |
96 | 0 | // Error handled in mozilla::ipc::IPCResult |
97 | 0 | return MsgProcessingError; |
98 | 0 | } |
99 | 0 | |
100 | 0 | return MsgProcessed; |
101 | 0 | } |
102 | 0 | case PProfiler::Msg_EnsureStarted__ID: |
103 | 0 | { |
104 | 0 | if (mozilla::ipc::LoggingEnabledFor("PProfilerChild")) { |
105 | 0 | mozilla::ipc::LogMessageForProtocol("PProfilerChild", OtherPid(), "Received ", ((&(msg__)))->type(), mozilla::ipc::MessageDirection::eReceiving); |
106 | 0 | } |
107 | 0 | AUTO_PROFILER_LABEL("PProfiler::Msg_EnsureStarted", OTHER); |
108 | 0 |
|
109 | 0 | PickleIterator iter__(msg__); |
110 | 0 | ProfilerInitParams params; |
111 | 0 |
|
112 | 0 | if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(params)))))) { |
113 | 0 | FatalError("Error deserializing 'ProfilerInitParams'"); |
114 | 0 | return MsgValueError; |
115 | 0 | } |
116 | 0 | // Sentinel = 'params' |
117 | 0 | if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 1677790004)))) { |
118 | 0 | mozilla::ipc::SentinelReadError("Error deserializing 'ProfilerInitParams'"); |
119 | 0 | return MsgValueError; |
120 | 0 | } |
121 | 0 | (msg__).EndRead(iter__, (msg__).type()); |
122 | 0 | if ((!(StateTransition(false, (&(mLivenessState)))))) { |
123 | 0 | FatalError("Transition error"); |
124 | 0 | return MsgValueError; |
125 | 0 | } |
126 | 0 | if ((!(RecvEnsureStarted(params)))) { |
127 | 0 | mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!"); |
128 | 0 | // Error handled in mozilla::ipc::IPCResult |
129 | 0 | return MsgProcessingError; |
130 | 0 | } |
131 | 0 | |
132 | 0 | return MsgProcessed; |
133 | 0 | } |
134 | 0 | case PProfiler::Msg_Stop__ID: |
135 | 0 | { |
136 | 0 | if (mozilla::ipc::LoggingEnabledFor("PProfilerChild")) { |
137 | 0 | mozilla::ipc::LogMessageForProtocol("PProfilerChild", OtherPid(), "Received ", ((&(msg__)))->type(), mozilla::ipc::MessageDirection::eReceiving); |
138 | 0 | } |
139 | 0 | AUTO_PROFILER_LABEL("PProfiler::Msg_Stop", OTHER); |
140 | 0 |
|
141 | 0 | if ((!(StateTransition(false, (&(mLivenessState)))))) { |
142 | 0 | FatalError("Transition error"); |
143 | 0 | return MsgValueError; |
144 | 0 | } |
145 | 0 | if ((!(RecvStop()))) { |
146 | 0 | mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!"); |
147 | 0 | // Error handled in mozilla::ipc::IPCResult |
148 | 0 | return MsgProcessingError; |
149 | 0 | } |
150 | 0 | |
151 | 0 | return MsgProcessed; |
152 | 0 | } |
153 | 0 | case PProfiler::Msg_Pause__ID: |
154 | 0 | { |
155 | 0 | if (mozilla::ipc::LoggingEnabledFor("PProfilerChild")) { |
156 | 0 | mozilla::ipc::LogMessageForProtocol("PProfilerChild", OtherPid(), "Received ", ((&(msg__)))->type(), mozilla::ipc::MessageDirection::eReceiving); |
157 | 0 | } |
158 | 0 | AUTO_PROFILER_LABEL("PProfiler::Msg_Pause", OTHER); |
159 | 0 |
|
160 | 0 | if ((!(StateTransition(false, (&(mLivenessState)))))) { |
161 | 0 | FatalError("Transition error"); |
162 | 0 | return MsgValueError; |
163 | 0 | } |
164 | 0 | if ((!(RecvPause()))) { |
165 | 0 | mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!"); |
166 | 0 | // Error handled in mozilla::ipc::IPCResult |
167 | 0 | return MsgProcessingError; |
168 | 0 | } |
169 | 0 | |
170 | 0 | return MsgProcessed; |
171 | 0 | } |
172 | 0 | case PProfiler::Msg_Resume__ID: |
173 | 0 | { |
174 | 0 | if (mozilla::ipc::LoggingEnabledFor("PProfilerChild")) { |
175 | 0 | mozilla::ipc::LogMessageForProtocol("PProfilerChild", OtherPid(), "Received ", ((&(msg__)))->type(), mozilla::ipc::MessageDirection::eReceiving); |
176 | 0 | } |
177 | 0 | AUTO_PROFILER_LABEL("PProfiler::Msg_Resume", OTHER); |
178 | 0 |
|
179 | 0 | if ((!(StateTransition(false, (&(mLivenessState)))))) { |
180 | 0 | FatalError("Transition error"); |
181 | 0 | return MsgValueError; |
182 | 0 | } |
183 | 0 | if ((!(RecvResume()))) { |
184 | 0 | mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!"); |
185 | 0 | // Error handled in mozilla::ipc::IPCResult |
186 | 0 | return MsgProcessingError; |
187 | 0 | } |
188 | 0 | |
189 | 0 | return MsgProcessed; |
190 | 0 | } |
191 | 0 | case PProfiler::Msg_GatherProfile__ID: |
192 | 0 | { |
193 | 0 | if (mozilla::ipc::LoggingEnabledFor("PProfilerChild")) { |
194 | 0 | mozilla::ipc::LogMessageForProtocol("PProfilerChild", OtherPid(), "Received ", ((&(msg__)))->type(), mozilla::ipc::MessageDirection::eReceiving); |
195 | 0 | } |
196 | 0 | AUTO_PROFILER_LABEL("PProfiler::Msg_GatherProfile", OTHER); |
197 | 0 |
|
198 | 0 | if ((!(StateTransition(false, (&(mLivenessState)))))) { |
199 | 0 | FatalError("Transition error"); |
200 | 0 | return MsgValueError; |
201 | 0 | } |
202 | 0 | int32_t id__ = MSG_ROUTING_CONTROL; |
203 | 0 |
|
204 | 0 | int32_t seqno__ = (msg__).seqno(); |
205 | 0 | WeakPtr<PProfilerChild> self__ = this; |
206 | 0 | GatherProfileResolver resolver = [this, self__, id__, seqno__](Shmem&& aParam) { |
207 | 0 | if ((!(self__))) { |
208 | 0 | NS_WARNING("Not resolving response because actor is dead."); |
209 | 0 | return; |
210 | 0 | } |
211 | 0 | if ((mLivenessState) == (mozilla::ipc::LivenessState::Dead)) { |
212 | 0 | NS_WARNING("Not resolving response because actor is destroyed."); |
213 | 0 | return; |
214 | 0 | } |
215 | 0 | bool resolve__ = true; |
216 | 0 | Shmem profile; |
217 | 0 | profile = std::move(aParam); |
218 | 0 | IPC::Message* reply__ = PProfiler::Reply_GatherProfile(id__); |
219 | 0 | WriteIPDLParam(reply__, self__, resolve__); |
220 | 0 | // Sentinel = 'resolve__' |
221 | 0 | (reply__)->WriteSentinel(3997392463); |
222 | 0 | WriteIPDLParam(reply__, self__, profile); |
223 | 0 | // Sentinel = 'profile' |
224 | 0 | (reply__)->WriteSentinel(1885624768); |
225 | 0 | (reply__)->set_seqno(seqno__); |
226 | 0 |
|
227 | 0 | if (mozilla::ipc::LoggingEnabledFor("PProfilerChild")) { |
228 | 0 | mozilla::ipc::LogMessageForProtocol("PProfilerChild", OtherPid(), "Sending reply ", (reply__)->type(), mozilla::ipc::MessageDirection::eSending); |
229 | 0 | } |
230 | 0 | bool sendok__ = (GetIPCChannel())->Send(reply__); |
231 | 0 | if ((!(sendok__))) { |
232 | 0 | NS_WARNING("Error sending reply"); |
233 | 0 | } |
234 | 0 | }; |
235 | 0 | if ((!(RecvGatherProfile(std::move(resolver))))) { |
236 | 0 | mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!"); |
237 | 0 | // Error handled in mozilla::ipc::IPCResult |
238 | 0 | return MsgProcessingError; |
239 | 0 | } |
240 | 0 | |
241 | 0 | return MsgProcessed; |
242 | 0 | } |
243 | 0 | default: |
244 | 0 | { |
245 | 0 | return MsgNotKnown; |
246 | 0 | } |
247 | 0 | case SHMEM_CREATED_MESSAGE_TYPE: |
248 | 0 | { |
249 | 0 | if ((!(ShmemCreated(msg__)))) { |
250 | 0 | return MsgPayloadError; |
251 | 0 | } |
252 | 0 | return MsgProcessed; |
253 | 0 | } |
254 | 0 | case SHMEM_DESTROYED_MESSAGE_TYPE: |
255 | 0 | { |
256 | 0 | if ((!(ShmemDestroyed(msg__)))) { |
257 | 0 | return MsgPayloadError; |
258 | 0 | } |
259 | 0 | return MsgProcessed; |
260 | 0 | } |
261 | 0 | } |
262 | 0 | } |
263 | | |
264 | | auto PProfilerChild::OnMessageReceived( |
265 | | const Message& msg__, |
266 | | Message*& reply__) -> PProfilerChild::Result |
267 | 0 | { |
268 | 0 | MOZ_ASSERT_UNREACHABLE("message protocol not supported"); |
269 | 0 | return MsgNotKnown; |
270 | 0 | } |
271 | | |
272 | | auto PProfilerChild::OnCallReceived( |
273 | | const Message& msg__, |
274 | | Message*& reply__) -> PProfilerChild::Result |
275 | 0 | { |
276 | 0 | MOZ_ASSERT_UNREACHABLE("message protocol not supported"); |
277 | 0 | return MsgNotKnown; |
278 | 0 | } |
279 | | |
280 | | auto PProfilerChild::GetProtocolTypeId() -> int32_t |
281 | 0 | { |
282 | 0 | return PProfilerMsgStart; |
283 | 0 | } |
284 | | |
285 | | auto PProfilerChild::OnChannelClose() -> void |
286 | 0 | { |
287 | 0 | DestroySubtree(NormalShutdown); |
288 | 0 | DeallocSubtree(); |
289 | 0 | DeallocShmems(); |
290 | 0 | DeallocPProfilerChild(); |
291 | 0 | } |
292 | | |
293 | | auto PProfilerChild::OnChannelError() -> void |
294 | 0 | { |
295 | 0 | DestroySubtree(AbnormalShutdown); |
296 | 0 | DeallocSubtree(); |
297 | 0 | DeallocShmems(); |
298 | 0 | DeallocPProfilerChild(); |
299 | 0 | } |
300 | | |
301 | | auto PProfilerChild::DestroySubtree(ActorDestroyReason why) -> void |
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 PProfilerChild::DeallocSubtree() -> void |
311 | 0 | { |
312 | 0 | } |
313 | | |
314 | | auto PProfilerChild::DeallocPProfilerChild() -> void |
315 | 0 | { |
316 | 0 | } |
317 | | |
318 | | |
319 | | |
320 | | } // namespace mozilla |
321 | | namespace mozilla { |
322 | | namespace ipc { |
323 | | auto IPDLParamTraits<mozilla::PProfilerChild>::Write( |
324 | | IPC::Message* aMsg, |
325 | | mozilla::ipc::IProtocol* aActor, |
326 | | const paramType& aVar) -> void |
327 | 0 | { |
328 | 0 | int32_t id; |
329 | 0 | if ((!(aVar))) { |
330 | 0 | id = 0; |
331 | 0 | } |
332 | 0 | else { |
333 | 0 | id = (aVar)->Id(); |
334 | 0 | if ((1) == (id)) { |
335 | 0 | (aActor)->FatalError("actor has been |delete|d"); |
336 | 0 | } |
337 | 0 | } |
338 | 0 | WriteIPDLParam(aMsg, aActor, id); |
339 | 0 | } |
340 | | |
341 | | auto IPDLParamTraits<mozilla::PProfilerChild>::Read( |
342 | | const IPC::Message* aMsg, |
343 | | PickleIterator* aIter, |
344 | | mozilla::ipc::IProtocol* aActor, |
345 | | paramType* aVar) -> bool |
346 | 0 | { |
347 | 0 | mozilla::Maybe<mozilla::ipc::IProtocol*> actor = (aActor)->ReadActor(aMsg, aIter, true, "PProfiler", PProfilerMsgStart); |
348 | 0 | if ((actor).isNothing()) { |
349 | 0 | return false; |
350 | 0 | } |
351 | 0 | |
352 | 0 | (*(aVar)) = static_cast<mozilla::PProfilerChild*>((actor).value()); |
353 | 0 | return true; |
354 | 0 | } |
355 | | |
356 | | } // namespace ipc |
357 | | } // namespace mozilla |