forked from mirrors/gecko-dev
Bug 1824465 - Part 24: Require toplevel protocols to be refcounted, r=ipc-reviewers,mccr8
Differential Revision: https://phabricator.services.mozilla.com/D173739
This commit is contained in:
parent
47eb8459bf
commit
a73c63f734
7 changed files with 30 additions and 6 deletions
|
|
@ -385,6 +385,9 @@ class IToplevelProtocol : public IProtocol {
|
|||
~IToplevelProtocol() = default;
|
||||
|
||||
public:
|
||||
// All top-level protocols are refcounted.
|
||||
NS_INLINE_DECL_PURE_VIRTUAL_REFCOUNTING
|
||||
|
||||
// Shadow methods on IProtocol which are implemented directly on toplevel
|
||||
// actors.
|
||||
int32_t Register(IProtocol* aRouted);
|
||||
|
|
|
|||
|
|
@ -3838,11 +3838,12 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
|
|||
self.cls.addstmts([dtor, Whitespace.NL])
|
||||
|
||||
if ptype.isRefcounted():
|
||||
self.cls.addcode(
|
||||
"""
|
||||
NS_INLINE_DECL_PURE_VIRTUAL_REFCOUNTING
|
||||
"""
|
||||
)
|
||||
if not ptype.isToplevel():
|
||||
self.cls.addcode(
|
||||
"""
|
||||
NS_INLINE_DECL_PURE_VIRTUAL_REFCOUNTING
|
||||
"""
|
||||
)
|
||||
self.cls.addstmt(Label.PROTECTED)
|
||||
self.cls.addcode(
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -1278,6 +1278,9 @@ class GatherDecls(TcheckVisitor):
|
|||
if not p.decl.type.isToplevel() and p.decl.type.needsotherpid:
|
||||
self.error(p.loc, "[NeedsOtherPid] only applies to toplevel protocols")
|
||||
|
||||
if p.decl.type.isToplevel() and not p.decl.type.isRefcounted():
|
||||
self.error(p.loc, "Toplevel protocols cannot be [ManualDealloc]")
|
||||
|
||||
# FIXME/cjones declare all the little C++ thingies that will
|
||||
# be generated. they're not relevant to IPDL itself, but
|
||||
# those ("invisible") symbols can clash with others in the
|
||||
|
|
|
|||
6
ipc/ipdl/test/ipdl/error/PToplevelManualDealloc.ipdl
Normal file
6
ipc/ipdl/test/ipdl/error/PToplevelManualDealloc.ipdl
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
//error: Toplevel protocols cannot be [ManualDealloc]
|
||||
|
||||
[ManualDealloc] async protocol PToplevelManualDealloc {
|
||||
child:
|
||||
async __delete__();
|
||||
};
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
[NestedUpTo=inside_sync, ManualDealloc] async protocol PExtendedAttrMultipleAttributes {
|
||||
[NestedUpTo=inside_sync, NeedsOtherPid] async protocol PExtendedAttrMultipleAttributes {
|
||||
parent:
|
||||
async Msg();
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,4 +1,8 @@
|
|||
include protocol PManualDealloc_manager;
|
||||
|
||||
[ManualDealloc] async protocol PManualDealloc {
|
||||
manager PManualDealloc_manager;
|
||||
|
||||
child:
|
||||
async __delete__();
|
||||
};
|
||||
|
|
|
|||
7
ipc/ipdl/test/ipdl/ok/PManualDealloc_manager.ipdl
Normal file
7
ipc/ipdl/test/ipdl/ok/PManualDealloc_manager.ipdl
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
include protocol PManualDealloc;
|
||||
|
||||
// [ManualDealloc] types must have a manager, as all toplevel protocols are
|
||||
// refcounted.
|
||||
async protocol PManualDealloc_manager {
|
||||
manages PManualDealloc;
|
||||
};
|
||||
Loading…
Reference in a new issue