Bug 1781129 - Part 4: Fix issues caused by Shmem arguments no longer being visible to ipdl, r=ipc-reviewers,jld

Due to Shmem implementing ParamTraits, it is possible for a Shmem argument to
not be visible to the IPDL compiler as it is only serialized within an opaque
type included with `using`. If that happens, it would cause the construction of
the Shmem to fail on the other side, in a hard to diagnose manner. This changes
the logic to always allow any actor to manage shmems, to make it more in line
with the `AllocShmem` method being directly declared on IProtocol.

This specifically caused issues after this patch stack with PContent, which no
longer has any shmem arguments visible to IPDL after these changes, but still
is used as a manager for Shmems included in some messages.

Differential Revision: https://phabricator.services.mozilla.com/D151855
This commit is contained in:
Nika Layzell 2022-08-26 16:08:06 +00:00
Родитель fc835b08d2
Коммит dd21530757
1 изменённых файлов: 12 добавлений и 24 удалений

Просмотреть файл

@ -4321,30 +4321,18 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
methods = []
if p.decl.type.isToplevel():
# "private" message that passes shmem mappings from one process
# to the other
if p.subtreeUsesShmem():
self.asyncSwitch.addcase(
CaseLabel("SHMEM_CREATED_MESSAGE_TYPE"),
self.genShmemCreatedHandler(),
)
self.asyncSwitch.addcase(
CaseLabel("SHMEM_DESTROYED_MESSAGE_TYPE"),
self.genShmemDestroyedHandler(),
)
else:
abort = StmtBlock()
abort.addstmts(
[
_fatalError("this protocol tree does not use shmem"),
StmtReturn(_Result.NotKnown),
]
)
self.asyncSwitch.addcase(CaseLabel("SHMEM_CREATED_MESSAGE_TYPE"), abort)
self.asyncSwitch.addcase(
CaseLabel("SHMEM_DESTROYED_MESSAGE_TYPE"), abort
)
# FIXME: This used to be declared conditionally based on whether
# shmem appeared somewhere in the protocol hierarchy, however that
# caused issues due to Shmem instances hidden within custom C++
# types.
self.asyncSwitch.addcase(
CaseLabel("SHMEM_CREATED_MESSAGE_TYPE"),
self.genShmemCreatedHandler(),
)
self.asyncSwitch.addcase(
CaseLabel("SHMEM_DESTROYED_MESSAGE_TYPE"),
self.genShmemDestroyedHandler(),
)
# Keep track of types created with an INOUT ctor. We need to call
# Register() or RegisterID() for them depending on the side the managee