зеркало из https://github.com/mozilla/gecko-dev.git
Bug 844996 - DeallocShmem failures will abort in debug builds. r=cjones,benjamin
This commit is contained in:
Родитель
e8aa91a4a3
Коммит
2e9c45b7dc
|
@ -3851,6 +3851,11 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
|
||||||
|
|
||||||
# bool DeallocShmem(Shmem& mem):
|
# bool DeallocShmem(Shmem& mem):
|
||||||
# bool ok = DestroySharedMemory(mem);
|
# bool ok = DestroySharedMemory(mem);
|
||||||
|
##ifdef DEBUG
|
||||||
|
# if (!ok) {
|
||||||
|
# NS_RUNTIMEABORT("bad Shmem");
|
||||||
|
# }
|
||||||
|
##endif // DEBUG
|
||||||
# mem.forget();
|
# mem.forget();
|
||||||
# return ok;
|
# return ok;
|
||||||
deallocShmem = MethodDefn(MethodDecl(
|
deallocShmem = MethodDefn(MethodDecl(
|
||||||
|
@ -3859,10 +3864,16 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
|
||||||
ret=Type.BOOL))
|
ret=Type.BOOL))
|
||||||
okvar = ExprVar('ok')
|
okvar = ExprVar('ok')
|
||||||
|
|
||||||
|
ifbad = StmtIf(ExprNot(okvar))
|
||||||
|
ifbad.addifstmt(_runtimeAbort('bad Shmem'))
|
||||||
|
|
||||||
deallocShmem.addstmts([
|
deallocShmem.addstmts([
|
||||||
StmtDecl(Decl(Type.BOOL, okvar.name),
|
StmtDecl(Decl(Type.BOOL, okvar.name),
|
||||||
init=ExprCall(p.destroySharedMemory(),
|
init=ExprCall(p.destroySharedMemory(),
|
||||||
args=[ memvar ])),
|
args=[ memvar ])),
|
||||||
|
CppDirective('ifdef', 'DEBUG'),
|
||||||
|
ifbad,
|
||||||
|
CppDirective('endif', '// DEBUG'),
|
||||||
StmtExpr(_shmemForget(memvar)),
|
StmtExpr(_shmemForget(memvar)),
|
||||||
StmtReturn(okvar)
|
StmtReturn(okvar)
|
||||||
])
|
])
|
||||||
|
|
Загрузка…
Ссылка в новой задаче