Bug 938470 - Part 2: IPC actor should clone actors created on the parent side for the Nuwa process. r=bent

This commit is contained in:
Cervantes Yu 2013-12-05 20:10:04 +08:00
Родитель c26ba7e72d
Коммит 38d6789b0d
1 изменённых файлов: 23 добавлений и 2 удалений

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

@ -3812,6 +3812,15 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
static=1))
clonemanagees.addstmt(otherstmt)
# Keep track of types created with an INOUT ctor. We need to call
# Register() or RegisterID() for them depending on the side the managee
# is created.
inoutCtorTypes = []
for msg in p.messageDecls:
msgtype = msg.decl.type
if msgtype.isCtor() and msgtype.isInout():
inoutCtorTypes.append(msgtype.constructedType())
actorvar = ExprVar('actor')
for managee in p.managesStmts:
block = StmtBlock()
@ -3827,6 +3836,19 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
init=Param(Type.UINT32, ivar.name, ExprLiteral.ZERO),
cond=ExprBinary(ivar, '<', _callCxxArrayLength(kidsvar)),
update=ExprPrefixUnop(ivar, '++'))
registerstmt = StmtExpr(ExprCall(p.registerIDMethod(),
args=[actorvar, _actorId(actorvar)]))
# Implement if (actor id > 0) then Register() else RegisterID()
if manageeipdltype in inoutCtorTypes:
registerif = StmtIf(ExprBinary(_actorId(actorvar),
'>',
ExprLiteral.ZERO))
registerif.addifstmt(StmtExpr(ExprCall(p.registerMethod(),
args=[actorvar])))
registerif.addelsestmt(registerstmt)
registerstmt = registerif
forstmt.addstmts([
StmtExpr(ExprAssn(
actorvar,
@ -3847,8 +3869,7 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
p.channelForSubactor())),
StmtExpr(ExprAssn(_actorState(actorvar), _actorState(ithkid))),
StmtExpr(_callCxxArrayInsertSorted(manageearray, actorvar)),
StmtExpr(ExprCall(p.registerIDMethod(),
args=[actorvar, _actorId(actorvar)])),
registerstmt,
StmtExpr(ExprCall(
ExprSelect(actorvar,
'->',