Bug 879475 - Rename the MsgStart messages to MsgStartChild for child protocols r=jlebar

This commit is contained in:
David Zbarsky
2013-08-20 15:46:41 -04:00
parent 7e9db3b875
commit ad87b82c7b
4 changed files with 16 additions and 10 deletions

View File

@@ -52,7 +52,7 @@ bool
Bridge(const PrivateIPDLInterface&,
AsyncChannel* aParentChannel, ProcessHandle aParentProcess,
AsyncChannel* aChildChannel, ProcessHandle aChildProcess,
ProtocolId aProtocol)
ProtocolId aProtocol, ProtocolId aChildProtocol)
{
ProcessId parentId = GetProcId(aParentProcess);
ProcessId childId = GetProcId(aChildProcess);
@@ -71,7 +71,7 @@ Bridge(const PrivateIPDLInterface&,
aProtocol)) ||
!aChildChannel->Send(new ChannelOpened(childSide,
parentId,
aProtocol))) {
aChildProtocol))) {
CloseDescriptor(parentSide);
CloseDescriptor(childSide);
return false;
@@ -83,7 +83,7 @@ bool
Open(const PrivateIPDLInterface&,
AsyncChannel* aOpenerChannel, ProcessHandle aOtherProcess,
Transport::Mode aOpenerMode,
ProtocolId aProtocol)
ProtocolId aProtocol, ProtocolId aChildProtocol)
{
bool isParent = (Transport::MODE_SERVER == aOpenerMode);
ProcessHandle thisHandle = GetCurrentProcessHandle();
@@ -102,7 +102,7 @@ Open(const PrivateIPDLInterface&,
}
Message* parentMsg = new ChannelOpened(parentSide, childId, aProtocol);
Message* childMsg = new ChannelOpened(childSide, parentId, aProtocol);
Message* childMsg = new ChannelOpened(childSide, parentId, aChildProtocol);
nsAutoPtr<Message> messageForUs(isParent ? parentMsg : childMsg);
nsAutoPtr<Message> messageForOtherSide(!isParent ? parentMsg : childMsg);
if (!aOpenerChannel->Echo(messageForUs.forget()) ||

View File

@@ -122,12 +122,12 @@ struct PrivateIPDLInterface {};
bool
Bridge(const PrivateIPDLInterface&,
AsyncChannel*, base::ProcessHandle, AsyncChannel*, base::ProcessHandle,
ProtocolId);
ProtocolId, ProtocolId);
bool
Open(const PrivateIPDLInterface&,
AsyncChannel*, base::ProcessHandle, Transport::Mode,
ProtocolId);
ProtocolId, ProtocolId);
bool
UnpackChannelOpened(const PrivateIPDLInterface&,

View File

@@ -158,6 +158,7 @@ enum IPCMessageStart {
for name in allprotocols:
print >>ipcmsgstart, " %s," % name
print >>ipcmsgstart, " %sChild," % name
print >>ipcmsgstart, """
LastMsgIndex

View File

@@ -1539,7 +1539,7 @@ class _GenerateProtocolCode(ipdl.ast.Visitor):
msgenum = TypeEnum('MessageType')
msgstart = _messageStartName(self.protocol.decl.type) +' << 16'
msgenum.addId(self.protocol.name + 'Start', msgstart)
msgenum.addId(self.protocol.name +'PreStart', '('+ msgstart +') - 1')
#msgenum.addId(self.protocol.name +'PreStart', '('+ msgstart +') - 1')
for md in p.messageDecls:
msgenum.addId(md.msgId())
@@ -1593,7 +1593,8 @@ class _GenerateProtocolCode(ipdl.ast.Visitor):
args=[ _backstagePass(),
p.callGetChannel(parentvar), p.callOtherProcess(parentvar),
p.callGetChannel(childvar), p.callOtherProcess(childvar),
_protocolId(p.decl.type)
_protocolId(p.decl.type),
ExprVar(_messageStartName(p.decl.type) + 'Child')
])))
return bridgefunc
@@ -1613,7 +1614,8 @@ class _GenerateProtocolCode(ipdl.ast.Visitor):
args=[ _backstagePass(),
p.callGetChannel(openervar), p.callOtherProcess(openervar),
_sideToTransportMode(localside),
_protocolId(p.decl.type)
_protocolId(p.decl.type),
ExprVar(_messageStartName(p.decl.type) + 'Child')
])))
return openfunc
@@ -3992,7 +3994,10 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
iffailalloc,
StmtBreak()
])
return CaseLabel(_protocolId(actor.ptype).name), case
label = _messageStartName(actor.ptype)
if actor.side is 'child':
label += 'Child'
return CaseLabel(label), case
pswitch = StmtSwitch(pvar)
for actor in actors: