зеркало из https://github.com/mozilla/gecko-dev.git
bug 539552 - Add a GetMinidump() method to top-level, parent-side IPDL classes. r=bent
This commit is contained in:
Родитель
e35c34ae50
Коммит
71d511c249
|
@ -90,5 +90,6 @@ Includes = (
|
||||||
'nsAutoPtr.h',
|
'nsAutoPtr.h',
|
||||||
'nsStringGlue.h',
|
'nsStringGlue.h',
|
||||||
'nsTArray.h',
|
'nsTArray.h',
|
||||||
|
'nsIFile.h',
|
||||||
'mozilla/ipc/ProtocolUtils.h',
|
'mozilla/ipc/ProtocolUtils.h',
|
||||||
)
|
)
|
||||||
|
|
|
@ -275,7 +275,7 @@ class File(Node):
|
||||||
|
|
||||||
class CppDirective(Node):
|
class CppDirective(Node):
|
||||||
'''represents |#[directive] [rest]|, where |rest| is any string'''
|
'''represents |#[directive] [rest]|, where |rest| is any string'''
|
||||||
def __init__(self, directive, rest):
|
def __init__(self, directive, rest=''):
|
||||||
Node.__init__(self)
|
Node.__init__(self)
|
||||||
self.directive = directive
|
self.directive = directive
|
||||||
self.rest = rest
|
self.rest = rest
|
||||||
|
|
|
@ -2448,14 +2448,23 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
|
||||||
+ _includeGuardEnd(hf))
|
+ _includeGuardEnd(hf))
|
||||||
|
|
||||||
# make the .cpp file
|
# make the .cpp file
|
||||||
cf.addthings((
|
cf.addthings([
|
||||||
[ disclaimer,
|
disclaimer,
|
||||||
Whitespace.NL,
|
Whitespace.NL,
|
||||||
CppDirective(
|
CppDirective(
|
||||||
'include',
|
'include',
|
||||||
'"'+ _protocolHeaderName(self.protocol, self.side) +'.h"'),
|
'"'+ _protocolHeaderName(self.protocol, self.side) +'.h"')
|
||||||
Whitespace.NL
|
])
|
||||||
]
|
|
||||||
|
if self.protocol.decl.type.isToplevel():
|
||||||
|
cf.addthings([
|
||||||
|
CppDirective('ifdef', 'MOZ_CRASHREPORTER'),
|
||||||
|
CppDirective(' include', '"nsXULAppAPI.h"'),
|
||||||
|
CppDirective('endif')
|
||||||
|
])
|
||||||
|
|
||||||
|
cf.addthings((
|
||||||
|
[ Whitespace.NL ]
|
||||||
+ self.protocolCxxIncludes
|
+ self.protocolCxxIncludes
|
||||||
+ [ Whitespace.NL ]
|
+ [ Whitespace.NL ]
|
||||||
+ self.standardTypedefs()
|
+ self.standardTypedefs()
|
||||||
|
@ -2807,6 +2816,39 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
|
||||||
if p.usesShmem():
|
if p.usesShmem():
|
||||||
self.cls.addstmts(self.makeShmemIface())
|
self.cls.addstmts(self.makeShmemIface())
|
||||||
|
|
||||||
|
if p.decl.type.isToplevel() and self.side is 'parent':
|
||||||
|
## bool GetMinidump(nsIFile** dump)
|
||||||
|
self.cls.addstmt(Label.PROTECTED)
|
||||||
|
|
||||||
|
otherpidvar = ExprVar('OtherSidePID')
|
||||||
|
otherpid = MethodDefn(MethodDecl(
|
||||||
|
otherpidvar.name, params=[ ],
|
||||||
|
ret=Type('base::ProcessId'),
|
||||||
|
const=1))
|
||||||
|
otherpid.addstmts([
|
||||||
|
StmtReturn(ExprCall(
|
||||||
|
ExprVar('base::GetProcId'),
|
||||||
|
args=[ p.otherProcessVar() ])),
|
||||||
|
])
|
||||||
|
|
||||||
|
dumpvar = ExprVar('aDump')
|
||||||
|
getdump = MethodDefn(MethodDecl(
|
||||||
|
'GetMinidump',
|
||||||
|
params=[ Decl(Type('nsIFile', ptrptr=1), dumpvar.name) ],
|
||||||
|
ret=Type.BOOL,
|
||||||
|
const=1))
|
||||||
|
getdump.addstmts([
|
||||||
|
CppDirective('ifdef', 'MOZ_CRASHREPORTER'),
|
||||||
|
StmtReturn(ExprCall(
|
||||||
|
ExprVar('XRE_GetMinidumpForChild'),
|
||||||
|
args=[ ExprCall(otherpidvar), dumpvar ])),
|
||||||
|
CppDirective('else'),
|
||||||
|
StmtReturn(ExprLiteral.FALSE),
|
||||||
|
CppDirective('endif')
|
||||||
|
])
|
||||||
|
self.cls.addstmts([ otherpid, Whitespace.NL,
|
||||||
|
getdump, Whitespace.NL ])
|
||||||
|
|
||||||
## private methods
|
## private methods
|
||||||
self.cls.addstmt(Label.PRIVATE)
|
self.cls.addstmt(Label.PRIVATE)
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче