зеркало из https://github.com/mozilla/pjs.git
Bug 545455, part 2: Expose override-able hooks for top-level IPDL actors to be notified on stack entrance/exit. r=bent
--HG-- extra : rebase_source : e50ede6dbffc9d864ba62eda6d2a622c8b99dece
This commit is contained in:
Родитель
40a5e9f8b9
Коммит
5225241793
|
@ -68,6 +68,16 @@ public:
|
|||
Message*& aReply) = 0;
|
||||
virtual Result OnCallReceived(const Message& aMessage,
|
||||
Message*& aReply) = 0;
|
||||
|
||||
virtual void OnEnteredCxxStack()
|
||||
{
|
||||
NS_RUNTIMEABORT("default impl shouldn't be invoked");
|
||||
}
|
||||
|
||||
virtual void OnExitedCxxStack()
|
||||
{
|
||||
NS_RUNTIMEABORT("default impl shouldn't be invoked");
|
||||
}
|
||||
};
|
||||
|
||||
// What happens if RPC calls race?
|
||||
|
@ -166,14 +176,12 @@ protected:
|
|||
// for when the depth goes from non-zero to zero;
|
||||
void EnteredCxxStack()
|
||||
{
|
||||
// FIXME/bug 545455: call mListener hook
|
||||
printf("[%s] +++ CXX STACK\n", mChild ? "child" : "parent");
|
||||
static_cast<RPCListener*>(mListener)->OnEnteredCxxStack();
|
||||
}
|
||||
|
||||
void ExitedCxxStack()
|
||||
{
|
||||
// FIXME/bug 545455: call mListener hook
|
||||
printf("[%s] --- CXX STACK\n", mChild ? "child" : "parent");
|
||||
static_cast<RPCListener*>(mListener)->OnExitedCxxStack();
|
||||
}
|
||||
|
||||
class NS_STACK_CLASS CxxStackFrame
|
||||
|
|
|
@ -1348,6 +1348,14 @@ class Protocol(ipdl.ast.Protocol):
|
|||
assert self.decl.type.isToplevel()
|
||||
return ExprVar('ShouldContinueFromReplyTimeout')
|
||||
|
||||
def enteredCxxStackVar(self):
|
||||
assert self.decl.type.isToplevel()
|
||||
return ExprVar('EnteredCxxStack')
|
||||
|
||||
def exitedCxxStackVar(self):
|
||||
assert self.decl.type.isToplevel()
|
||||
return ExprVar('ExitedCxxStack')
|
||||
|
||||
def nextActorIdExpr(self, side):
|
||||
assert self.decl.type.isToplevel()
|
||||
if side is 'parent': op = '++'
|
||||
|
@ -2639,7 +2647,15 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
|
|||
MethodDecl(p.shouldContinueFromTimeoutVar().name,
|
||||
ret=Type.BOOL, virtual=1))
|
||||
shouldcontinue.addstmt(StmtReturn(ExprLiteral.TRUE))
|
||||
self.cls.addstmts([ shouldcontinue, Whitespace.NL ])
|
||||
|
||||
# void EnteredCxxStack(); default to no-op
|
||||
entered = MethodDefn(
|
||||
MethodDecl(p.enteredCxxStackVar().name, virtual=1))
|
||||
exited = MethodDefn(
|
||||
MethodDecl(p.exitedCxxStackVar().name, virtual=1))
|
||||
|
||||
self.cls.addstmts([ shouldcontinue, entered, exited,
|
||||
Whitespace.NL ])
|
||||
|
||||
self.cls.addstmts((
|
||||
[ Label.PRIVATE ]
|
||||
|
@ -2860,6 +2876,16 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
|
|||
|
||||
self.cls.addstmts([ ontimeout, Whitespace.NL ])
|
||||
|
||||
# On[Entered/Exited]CxxStack()
|
||||
if ptype.isToplevel() and toplevel.talksRpc():
|
||||
onentered = MethodDefn(MethodDecl('OnEnteredCxxStack'))
|
||||
onentered.addstmt(StmtReturn(ExprCall(p.enteredCxxStackVar())))
|
||||
|
||||
onexited = MethodDefn(MethodDecl('OnExitedCxxStack'))
|
||||
onexited.addstmt(StmtReturn(ExprCall(p.exitedCxxStackVar())))
|
||||
|
||||
self.cls.addstmts([ onentered, onexited, Whitespace.NL ])
|
||||
|
||||
# OnChannelClose()
|
||||
onclose = MethodDefn(MethodDecl('OnChannelClose'))
|
||||
if ptype.isToplevel():
|
||||
|
|
Загрузка…
Ссылка в новой задаче