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