Line data Source code
1 : //
2 : // Automatically generated by ipdlc.
3 : // Edit at your own risk
4 : //
5 :
6 :
7 : #include "mozilla/layers/PCompositorManagerParent.h"
8 : #include "ipc/IPCMessageUtils.h"
9 : #ifdef MOZ_CRASHREPORTER
10 : # include "nsXULAppAPI.h"
11 : #endif
12 :
13 : #include "mozilla/layers/PCompositorBridgeParent.h"
14 :
15 : #include "nsIFile.h"
16 : #include "GeckoProfiler.h"
17 :
18 : namespace mozilla {
19 : namespace layers {
20 :
21 :
22 2 : auto PCompositorManagerParent::RecvPCompositorBridgeConstructor(
23 : PCompositorBridgeParent* actor,
24 : const CompositorBridgeOptions& options) -> mozilla::ipc::IPCResult
25 : {
26 2 : return IPC_OK();
27 : }
28 :
29 :
30 0 : auto PCompositorManagerParent::ProcessingError(
31 : Result aCode,
32 : const char* aReason) -> void
33 : {
34 0 : }
35 :
36 0 : auto PCompositorManagerParent::ShouldContinueFromReplyTimeout() -> bool
37 : {
38 0 : return true;
39 : }
40 :
41 200 : auto PCompositorManagerParent::EnteredCxxStack() -> void
42 : {
43 200 : }
44 :
45 200 : auto PCompositorManagerParent::ExitedCxxStack() -> void
46 : {
47 200 : }
48 :
49 0 : auto PCompositorManagerParent::EnteredCall() -> void
50 : {
51 0 : }
52 :
53 0 : auto PCompositorManagerParent::ExitedCall() -> void
54 : {
55 0 : }
56 :
57 3 : MOZ_IMPLICIT PCompositorManagerParent::PCompositorManagerParent() :
58 : mozilla::ipc::IToplevelProtocol(PCompositorManagerMsgStart, mozilla::ipc::ParentSide),
59 : mChannel("PCompositorManagerParent", ALLOW_THIS_IN_INITIALIZER_LIST(this)),
60 3 : mState(PCompositorManager::__Start)
61 : {
62 3 : MOZ_COUNT_CTOR(PCompositorManagerParent);
63 3 : }
64 :
65 0 : PCompositorManagerParent::~PCompositorManagerParent()
66 : {
67 0 : MOZ_COUNT_DTOR(PCompositorManagerParent);
68 0 : }
69 :
70 0 : auto PCompositorManagerParent::ManagedPCompositorBridgeParent(nsTArray<PCompositorBridgeParent*>& aArr) const -> void
71 : {
72 0 : (mManagedPCompositorBridgeParent).ToArray(aArr);
73 0 : }
74 :
75 0 : auto PCompositorManagerParent::ManagedPCompositorBridgeParent() const -> const ManagedContainer<PCompositorBridgeParent>&
76 : {
77 0 : return mManagedPCompositorBridgeParent;
78 : }
79 :
80 5 : auto PCompositorManagerParent::GetIPCChannel() -> MessageChannel*
81 : {
82 5 : return (&(mChannel));
83 : }
84 :
85 0 : auto PCompositorManagerParent::GetIPCChannel() const -> const MessageChannel*
86 : {
87 0 : return (&(mChannel));
88 : }
89 :
90 0 : auto PCompositorManagerParent::RemoveManagee(
91 : int32_t aProtocolId,
92 : ProtocolBase* aListener) -> void
93 : {
94 0 : switch (aProtocolId) {
95 : case PCompositorBridgeMsgStart:
96 : {
97 0 : PCompositorBridgeParent* actor = static_cast<PCompositorBridgeParent*>(aListener);
98 0 : auto& container = mManagedPCompositorBridgeParent;
99 0 : MOZ_RELEASE_ASSERT((container).Contains(actor), "actor not managed by this!");
100 :
101 0 : (container).RemoveEntry(actor);
102 0 : DeallocPCompositorBridgeParent(actor);
103 0 : return;
104 : }
105 : default:
106 : {
107 0 : FatalError("unreached");
108 0 : return;
109 : }
110 : }
111 : }
112 :
113 141 : auto PCompositorManagerParent::OnMessageReceived(const Message& msg__) -> PCompositorManagerParent::Result
114 : {
115 141 : int32_t route__ = (msg__).routing_id();
116 141 : if ((MSG_ROUTING_CONTROL) != (route__)) {
117 138 : ChannelListener* routed__ = Lookup(route__);
118 138 : if ((!(routed__))) {
119 0 : return MsgRouteError;
120 : }
121 138 : return (routed__)->OnMessageReceived(msg__);
122 : }
123 :
124 3 : switch ((msg__).type()) {
125 : case PCompositorManager::Msg_PCompositorBridgeConstructor__ID:
126 : {
127 2 : if (mozilla::ipc::LoggingEnabledFor("PCompositorManagerParent")) {
128 0 : mozilla::ipc::LogMessageForProtocol("PCompositorManagerParent", OtherPid(), "Received ", ((&(msg__)))->type(), mozilla::ipc::MessageDirection::eReceiving);
129 : }
130 4 : AUTO_PROFILER_LABEL("PCompositorManager::Msg_PCompositorBridgeConstructor", OTHER);
131 :
132 2 : PickleIterator iter__(msg__);
133 : ActorHandle handle__;
134 : PCompositorBridgeParent* actor;
135 4 : CompositorBridgeOptions options;
136 :
137 2 : if ((!(Read((&(handle__)), (&(msg__)), (&(iter__)))))) {
138 0 : FatalError("Error deserializing 'ActorHandle'");
139 0 : return MsgValueError;
140 : }
141 : // Sentinel = 'actor'
142 2 : if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 875202478)))) {
143 0 : mozilla::ipc::SentinelReadError("Error deserializing 'ActorHandle'");
144 0 : return MsgValueError;
145 : }
146 2 : if ((!(Read((&(options)), (&(msg__)), (&(iter__)))))) {
147 0 : FatalError("Error deserializing 'CompositorBridgeOptions'");
148 0 : return MsgValueError;
149 : }
150 : // Sentinel = 'options'
151 2 : if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 33222909)))) {
152 0 : mozilla::ipc::SentinelReadError("Error deserializing 'CompositorBridgeOptions'");
153 0 : return MsgValueError;
154 : }
155 2 : (msg__).EndRead(iter__, (msg__).type());
156 2 : PCompositorManager::Transition(PCompositorManager::Msg_PCompositorBridgeConstructor__ID, (&(mState)));
157 2 : actor = AllocPCompositorBridgeParent(options);
158 2 : if ((!(actor))) {
159 0 : NS_WARNING("Error constructing actor PCompositorBridgeParent");
160 0 : return MsgValueError;
161 : }
162 2 : (actor)->SetManager(this);
163 2 : RegisterID(actor, (handle__).mId);
164 2 : (actor)->SetIPCChannel(GetIPCChannel());
165 2 : (mManagedPCompositorBridgeParent).PutEntry(actor);
166 2 : (actor)->mState = mozilla::layers::PCompositorBridge::__Start;
167 :
168 2 : if ((!(RecvPCompositorBridgeConstructor(mozilla::Move(actor), mozilla::Move(options))))) {
169 0 : mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
170 : // Error handled in mozilla::ipc::IPCResult
171 0 : return MsgProcessingError;
172 : }
173 :
174 2 : return MsgProcessed;
175 : }
176 : default:
177 : {
178 0 : return MsgNotKnown;
179 : }
180 : case SHMEM_CREATED_MESSAGE_TYPE:
181 : {
182 1 : if ((!(ShmemCreated(msg__)))) {
183 0 : return MsgPayloadError;
184 : }
185 1 : return MsgProcessed;
186 : }
187 : case SHMEM_DESTROYED_MESSAGE_TYPE:
188 : {
189 0 : if ((!(ShmemDestroyed(msg__)))) {
190 0 : return MsgPayloadError;
191 : }
192 0 : return MsgProcessed;
193 : }
194 : }
195 : }
196 :
197 3 : auto PCompositorManagerParent::OnMessageReceived(
198 : const Message& msg__,
199 : Message*& reply__) -> PCompositorManagerParent::Result
200 : {
201 3 : int32_t route__ = (msg__).routing_id();
202 3 : if ((MSG_ROUTING_CONTROL) != (route__)) {
203 3 : ChannelListener* routed__ = Lookup(route__);
204 3 : if ((!(routed__))) {
205 0 : return MsgRouteError;
206 : }
207 3 : return (routed__)->OnMessageReceived(msg__, reply__);
208 : }
209 :
210 0 : return MsgNotKnown;
211 : }
212 :
213 0 : auto PCompositorManagerParent::OnCallReceived(
214 : const Message& msg__,
215 : Message*& reply__) -> PCompositorManagerParent::Result
216 : {
217 0 : MOZ_ASSERT_UNREACHABLE("message protocol not supported");
218 : return MsgNotKnown;
219 : }
220 :
221 0 : auto PCompositorManagerParent::GetProtocolTypeId() -> int32_t
222 : {
223 0 : return PCompositorManagerMsgStart;
224 : }
225 :
226 0 : auto PCompositorManagerParent::OnChannelClose() -> void
227 : {
228 0 : DestroySubtree(NormalShutdown);
229 0 : DeallocSubtree();
230 0 : DeallocShmems();
231 0 : DeallocPCompositorManagerParent();
232 0 : }
233 :
234 0 : auto PCompositorManagerParent::OnChannelError() -> void
235 : {
236 0 : DestroySubtree(AbnormalShutdown);
237 0 : DeallocSubtree();
238 0 : DeallocShmems();
239 0 : DeallocPCompositorManagerParent();
240 0 : }
241 :
242 0 : auto PCompositorManagerParent::ProtocolName() const -> const char*
243 : {
244 0 : return "PCompositorManagerParent";
245 : }
246 :
247 0 : auto PCompositorManagerParent::DestroySubtree(ActorDestroyReason why) -> void
248 : {
249 0 : ActorDestroyReason subtreewhy = (((why) == (Deletion)) || ((why) == (FailedConstructor)) ? AncestorDeletion : why);
250 :
251 : {
252 : // Recursively shutting down PCompositorBridge kids
253 0 : nsTArray<PCompositorBridgeParent*> kids;
254 : // Accumulate kids into a stable structure to iterate over
255 0 : ManagedPCompositorBridgeParent(kids);
256 0 : for (auto& kid : kids) {
257 : // Guarding against a child removing a sibling from the list during the iteration.
258 0 : if ((mManagedPCompositorBridgeParent).Contains(kid)) {
259 0 : (kid)->DestroySubtree(subtreewhy);
260 : }
261 : }
262 : }
263 :
264 : // Reject owning pending promises.
265 0 : (GetIPCChannel())->RejectPendingPromisesForActor(this);
266 :
267 : // Finally, destroy "us".
268 0 : ActorDestroy(why);
269 0 : }
270 :
271 0 : auto PCompositorManagerParent::DeallocSubtree() -> void
272 : {
273 : {
274 : // Recursively deleting PCompositorBridge kids
275 0 : for (auto iter = (mManagedPCompositorBridgeParent).Iter(); (!((iter).Done())); (iter).Next()) {
276 0 : (((iter).Get())->GetKey())->DeallocSubtree();
277 : }
278 :
279 0 : for (auto iter = (mManagedPCompositorBridgeParent).Iter(); (!((iter).Done())); (iter).Next()) {
280 0 : DeallocPCompositorBridgeParent(((iter).Get())->GetKey());
281 : }
282 0 : (mManagedPCompositorBridgeParent).Clear();
283 : }
284 0 : }
285 :
286 0 : auto PCompositorManagerParent::DeallocPCompositorManagerParent() -> void
287 : {
288 0 : }
289 :
290 0 : auto PCompositorManagerParent::Write(
291 : const CompositorBridgeOptions& v__,
292 : Message* msg__) -> void
293 : {
294 : typedef CompositorBridgeOptions type__;
295 0 : Write(int((v__).type()), msg__);
296 : // Sentinel = 'CompositorBridgeOptions'
297 0 : (msg__)->WriteSentinel(1223334017);
298 :
299 0 : switch ((v__).type()) {
300 : case type__::TContentCompositorOptions:
301 : {
302 0 : Write((v__).get_ContentCompositorOptions(), msg__);
303 : // Sentinel = 'TContentCompositorOptions'
304 0 : (msg__)->WriteSentinel(660265439);
305 0 : return;
306 : }
307 : case type__::TWidgetCompositorOptions:
308 : {
309 0 : Write((v__).get_WidgetCompositorOptions(), msg__);
310 : // Sentinel = 'TWidgetCompositorOptions'
311 0 : (msg__)->WriteSentinel(1740490067);
312 0 : return;
313 : }
314 : case type__::TSameProcessWidgetCompositorOptions:
315 : {
316 0 : Write((v__).get_SameProcessWidgetCompositorOptions(), msg__);
317 : // Sentinel = 'TSameProcessWidgetCompositorOptions'
318 0 : (msg__)->WriteSentinel(3995034615);
319 0 : return;
320 : }
321 : default:
322 : {
323 0 : FatalError("unknown union type");
324 0 : return;
325 : }
326 : }
327 : }
328 :
329 2 : auto PCompositorManagerParent::Read(
330 : CompositorBridgeOptions* v__,
331 : const Message* msg__,
332 : PickleIterator* iter__) -> bool
333 : {
334 : typedef CompositorBridgeOptions type__;
335 : int type;
336 2 : if ((!(Read((&(type)), msg__, iter__)))) {
337 0 : mozilla::ipc::UnionTypeReadError("CompositorBridgeOptions");
338 0 : return false;
339 : }
340 : // Sentinel = 'CompositorBridgeOptions'
341 2 : if ((!((msg__)->ReadSentinel(iter__, 1223334017)))) {
342 0 : mozilla::ipc::SentinelReadError("CompositorBridgeOptions");
343 0 : return false;
344 : }
345 :
346 2 : switch (type) {
347 : case type__::TContentCompositorOptions:
348 : {
349 2 : ContentCompositorOptions tmp = ContentCompositorOptions();
350 1 : (*(v__)) = tmp;
351 1 : if ((!(Read((&((v__)->get_ContentCompositorOptions())), msg__, iter__)))) {
352 0 : FatalError("Error deserializing Union type");
353 0 : return false;
354 : }
355 : // Sentinel = 'TContentCompositorOptions'
356 1 : if ((!((msg__)->ReadSentinel(iter__, 660265439)))) {
357 0 : mozilla::ipc::SentinelReadError("Error deserializing Union type");
358 0 : return false;
359 : }
360 1 : return true;
361 : }
362 : case type__::TWidgetCompositorOptions:
363 : {
364 0 : WidgetCompositorOptions tmp = WidgetCompositorOptions();
365 0 : (*(v__)) = tmp;
366 0 : if ((!(Read((&((v__)->get_WidgetCompositorOptions())), msg__, iter__)))) {
367 0 : FatalError("Error deserializing Union type");
368 0 : return false;
369 : }
370 : // Sentinel = 'TWidgetCompositorOptions'
371 0 : if ((!((msg__)->ReadSentinel(iter__, 1740490067)))) {
372 0 : mozilla::ipc::SentinelReadError("Error deserializing Union type");
373 0 : return false;
374 : }
375 0 : return true;
376 : }
377 : case type__::TSameProcessWidgetCompositorOptions:
378 : {
379 2 : SameProcessWidgetCompositorOptions tmp = SameProcessWidgetCompositorOptions();
380 1 : (*(v__)) = tmp;
381 1 : if ((!(Read((&((v__)->get_SameProcessWidgetCompositorOptions())), msg__, iter__)))) {
382 0 : FatalError("Error deserializing Union type");
383 0 : return false;
384 : }
385 : // Sentinel = 'TSameProcessWidgetCompositorOptions'
386 1 : if ((!((msg__)->ReadSentinel(iter__, 3995034615)))) {
387 0 : mozilla::ipc::SentinelReadError("Error deserializing Union type");
388 0 : return false;
389 : }
390 1 : return true;
391 : }
392 : default:
393 : {
394 0 : FatalError("unknown union type");
395 0 : return false;
396 : }
397 : }
398 : }
399 :
400 0 : auto PCompositorManagerParent::Write(
401 : const SameProcessWidgetCompositorOptions& v__,
402 : Message* msg__) -> void
403 : {
404 0 : }
405 :
406 1 : auto PCompositorManagerParent::Read(
407 : SameProcessWidgetCompositorOptions* v__,
408 : const Message* msg__,
409 : PickleIterator* iter__) -> bool
410 : {
411 1 : return true;
412 : }
413 :
414 0 : auto PCompositorManagerParent::Write(
415 : const PCompositorBridgeParent* v__,
416 : Message* msg__,
417 : bool nullable__) -> void
418 : {
419 : int32_t id;
420 0 : if ((!(v__))) {
421 0 : if ((!(nullable__))) {
422 0 : FatalError("NULL actor value passed to non-nullable param");
423 : }
424 0 : id = 0;
425 : }
426 : else {
427 0 : id = (v__)->Id();
428 0 : if ((1) == (id)) {
429 0 : FatalError("actor has been |delete|d");
430 : }
431 : }
432 :
433 0 : Write(id, msg__);
434 0 : }
435 :
436 0 : auto PCompositorManagerParent::Read(
437 : PCompositorBridgeParent** v__,
438 : const Message* msg__,
439 : PickleIterator* iter__,
440 : bool nullable__) -> bool
441 : {
442 0 : Maybe<mozilla::ipc::IProtocol*> actor = ReadActor(msg__, iter__, nullable__, "PCompositorBridge", PCompositorBridgeMsgStart);
443 0 : if ((actor).isNothing()) {
444 0 : return false;
445 : }
446 :
447 0 : (*(v__)) = static_cast<PCompositorBridgeParent*>((actor).value());
448 0 : return true;
449 : }
450 :
451 0 : auto PCompositorManagerParent::Write(
452 : const ContentCompositorOptions& v__,
453 : Message* msg__) -> void
454 : {
455 0 : }
456 :
457 1 : auto PCompositorManagerParent::Read(
458 : ContentCompositorOptions* v__,
459 : const Message* msg__,
460 : PickleIterator* iter__) -> bool
461 : {
462 1 : return true;
463 : }
464 :
465 0 : auto PCompositorManagerParent::Write(
466 : const WidgetCompositorOptions& v__,
467 : Message* msg__) -> void
468 : {
469 0 : Write((v__).scale(), msg__);
470 : // Sentinel = 'scale'
471 0 : (msg__)->WriteSentinel(590599843);
472 0 : Write((v__).vsyncRate(), msg__);
473 : // Sentinel = 'vsyncRate'
474 0 : (msg__)->WriteSentinel(1568351920);
475 0 : Write((v__).options(), msg__);
476 : // Sentinel = 'options'
477 0 : (msg__)->WriteSentinel(33222909);
478 0 : Write((v__).useExternalSurfaceSize(), msg__);
479 : // Sentinel = 'useExternalSurfaceSize'
480 0 : (msg__)->WriteSentinel(778777080);
481 0 : Write((v__).surfaceSize(), msg__);
482 : // Sentinel = 'surfaceSize'
483 0 : (msg__)->WriteSentinel(87441173);
484 0 : }
485 :
486 0 : auto PCompositorManagerParent::Read(
487 : WidgetCompositorOptions* v__,
488 : const Message* msg__,
489 : PickleIterator* iter__) -> bool
490 : {
491 0 : if ((!(Read((&((v__)->scale())), msg__, iter__)))) {
492 0 : FatalError("Error deserializing 'scale' (CSSToLayoutDeviceScale) member of 'WidgetCompositorOptions'");
493 0 : return false;
494 : }
495 : // Sentinel = 'scale'
496 0 : if ((!((msg__)->ReadSentinel(iter__, 590599843)))) {
497 0 : mozilla::ipc::SentinelReadError("Error deserializing 'scale' (CSSToLayoutDeviceScale) member of 'WidgetCompositorOptions'");
498 0 : return false;
499 : }
500 0 : if ((!(Read((&((v__)->vsyncRate())), msg__, iter__)))) {
501 0 : FatalError("Error deserializing 'vsyncRate' (TimeDuration) member of 'WidgetCompositorOptions'");
502 0 : return false;
503 : }
504 : // Sentinel = 'vsyncRate'
505 0 : if ((!((msg__)->ReadSentinel(iter__, 1568351920)))) {
506 0 : mozilla::ipc::SentinelReadError("Error deserializing 'vsyncRate' (TimeDuration) member of 'WidgetCompositorOptions'");
507 0 : return false;
508 : }
509 0 : if ((!(Read((&((v__)->options())), msg__, iter__)))) {
510 0 : FatalError("Error deserializing 'options' (CompositorOptions) member of 'WidgetCompositorOptions'");
511 0 : return false;
512 : }
513 : // Sentinel = 'options'
514 0 : if ((!((msg__)->ReadSentinel(iter__, 33222909)))) {
515 0 : mozilla::ipc::SentinelReadError("Error deserializing 'options' (CompositorOptions) member of 'WidgetCompositorOptions'");
516 0 : return false;
517 : }
518 0 : if ((!(Read((&((v__)->useExternalSurfaceSize())), msg__, iter__)))) {
519 0 : FatalError("Error deserializing 'useExternalSurfaceSize' (bool) member of 'WidgetCompositorOptions'");
520 0 : return false;
521 : }
522 : // Sentinel = 'useExternalSurfaceSize'
523 0 : if ((!((msg__)->ReadSentinel(iter__, 778777080)))) {
524 0 : mozilla::ipc::SentinelReadError("Error deserializing 'useExternalSurfaceSize' (bool) member of 'WidgetCompositorOptions'");
525 0 : return false;
526 : }
527 0 : if ((!(Read((&((v__)->surfaceSize())), msg__, iter__)))) {
528 0 : FatalError("Error deserializing 'surfaceSize' (IntSize) member of 'WidgetCompositorOptions'");
529 0 : return false;
530 : }
531 : // Sentinel = 'surfaceSize'
532 0 : if ((!((msg__)->ReadSentinel(iter__, 87441173)))) {
533 0 : mozilla::ipc::SentinelReadError("Error deserializing 'surfaceSize' (IntSize) member of 'WidgetCompositorOptions'");
534 0 : return false;
535 : }
536 0 : return true;
537 : }
538 :
539 :
540 :
541 : } // namespace layers
542 : } // namespace mozilla
|