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