Bug 792652 - Add mSide to IProtocol (r=dvander)

This patch adds a field to hold ParentSide/ChildSide state. Useful for
later changes.
This commit is contained in:
Bill McCloskey 2016-10-31 16:27:08 -07:00
Родитель 0991523235
Коммит 215c366d52
3 изменённых файлов: 10 добавлений и 8 удалений

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

@ -53,8 +53,9 @@ MOZ_TYPE_SPECIFIC_SCOPED_POINTER_TEMPLATE(ScopedPSecurityDescriptor, \
namespace ipc {
IToplevelProtocol::IToplevelProtocol(ProtocolId aProtoId)
: mProtocolId(aProtoId)
IToplevelProtocol::IToplevelProtocol(ProtocolId aProtoId, Side aSide)
: IProtocol(aSide),
mProtocolId(aProtoId)
{
}

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

@ -152,7 +152,7 @@ public:
typedef IPC::Message Message;
typedef IPC::MessageInfo MessageInfo;
IProtocol() : mManager(nullptr), mChannel(nullptr) {}
IProtocol(Side aSide) : mSide(aSide), mManager(nullptr), mChannel(nullptr) {}
virtual int32_t Register(IProtocol*);
virtual int32_t RegisterID(IProtocol*, int32_t);
@ -189,6 +189,7 @@ protected:
void SetIPCChannel(MessageChannel* aChannel) { mChannel = aChannel; }
private:
Side mSide;
IProtocol* mManager;
MessageChannel* mChannel;
};
@ -209,7 +210,7 @@ class IToplevelProtocol : public IProtocol
template<class PFooSide> friend class Endpoint;
protected:
explicit IToplevelProtocol(ProtocolId aProtoId);
explicit IToplevelProtocol(ProtocolId aProtoId, Side aSide);
~IToplevelProtocol();
public:

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

@ -2946,8 +2946,11 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
self.cls.addstmt(Label.PUBLIC)
# Actor()
ctor = ConstructorDefn(ConstructorDecl(self.clsname))
side = ExprVar('mozilla::ipc::' + self.side.title() + 'Side')
if ptype.isToplevel():
ctor.memberinits = [
ExprMemberInit(ExprVar('mozilla::ipc::IToplevelProtocol'),
[_protocolId(ptype), side]),
ExprMemberInit(p.channelVar(), [
ExprCall(ExprVar('ALLOW_THIS_IN_INITIALIZER_LIST'),
[ ExprVar.THIS ]) ]),
@ -2960,12 +2963,9 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
ExprMemberInit(p.stateVar(),
[ p.startState() ])
]
if ptype.isToplevel():
ctor.memberinits = [ExprMemberInit(
p.openedProtocolInterfaceType(),
[ _protocolId(ptype) ])] + ctor.memberinits
else:
ctor.memberinits = [
ExprMemberInit(ExprVar('mozilla::ipc::IProtocol'), [side]),
ExprMemberInit(p.idVar(), [ ExprLiteral.ZERO ]),
ExprMemberInit(p.stateVar(),
[ p.deadState() ])