mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-28 05:10:49 +00:00
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:
parent
f8bd2627a7
commit
12585264a1
@ -53,8 +53,9 @@ MOZ_TYPE_SPECIFIC_SCOPED_POINTER_TEMPLATE(ScopedPSecurityDescriptor, \
|
|||||||
|
|
||||||
namespace ipc {
|
namespace ipc {
|
||||||
|
|
||||||
IToplevelProtocol::IToplevelProtocol(ProtocolId aProtoId)
|
IToplevelProtocol::IToplevelProtocol(ProtocolId aProtoId, Side aSide)
|
||||||
: mProtocolId(aProtoId)
|
: IProtocol(aSide),
|
||||||
|
mProtocolId(aProtoId)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,7 +152,7 @@ public:
|
|||||||
typedef IPC::Message Message;
|
typedef IPC::Message Message;
|
||||||
typedef IPC::MessageInfo MessageInfo;
|
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 Register(IProtocol*);
|
||||||
virtual int32_t RegisterID(IProtocol*, int32_t);
|
virtual int32_t RegisterID(IProtocol*, int32_t);
|
||||||
@ -189,6 +189,7 @@ protected:
|
|||||||
void SetIPCChannel(MessageChannel* aChannel) { mChannel = aChannel; }
|
void SetIPCChannel(MessageChannel* aChannel) { mChannel = aChannel; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Side mSide;
|
||||||
IProtocol* mManager;
|
IProtocol* mManager;
|
||||||
MessageChannel* mChannel;
|
MessageChannel* mChannel;
|
||||||
};
|
};
|
||||||
@ -209,7 +210,7 @@ class IToplevelProtocol : public IProtocol
|
|||||||
template<class PFooSide> friend class Endpoint;
|
template<class PFooSide> friend class Endpoint;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
explicit IToplevelProtocol(ProtocolId aProtoId);
|
explicit IToplevelProtocol(ProtocolId aProtoId, Side aSide);
|
||||||
~IToplevelProtocol();
|
~IToplevelProtocol();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -2946,8 +2946,11 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
|
|||||||
self.cls.addstmt(Label.PUBLIC)
|
self.cls.addstmt(Label.PUBLIC)
|
||||||
# Actor()
|
# Actor()
|
||||||
ctor = ConstructorDefn(ConstructorDecl(self.clsname))
|
ctor = ConstructorDefn(ConstructorDecl(self.clsname))
|
||||||
|
side = ExprVar('mozilla::ipc::' + self.side.title() + 'Side')
|
||||||
if ptype.isToplevel():
|
if ptype.isToplevel():
|
||||||
ctor.memberinits = [
|
ctor.memberinits = [
|
||||||
|
ExprMemberInit(ExprVar('mozilla::ipc::IToplevelProtocol'),
|
||||||
|
[_protocolId(ptype), side]),
|
||||||
ExprMemberInit(p.channelVar(), [
|
ExprMemberInit(p.channelVar(), [
|
||||||
ExprCall(ExprVar('ALLOW_THIS_IN_INITIALIZER_LIST'),
|
ExprCall(ExprVar('ALLOW_THIS_IN_INITIALIZER_LIST'),
|
||||||
[ ExprVar.THIS ]) ]),
|
[ ExprVar.THIS ]) ]),
|
||||||
@ -2960,12 +2963,9 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
|
|||||||
ExprMemberInit(p.stateVar(),
|
ExprMemberInit(p.stateVar(),
|
||||||
[ p.startState() ])
|
[ p.startState() ])
|
||||||
]
|
]
|
||||||
if ptype.isToplevel():
|
|
||||||
ctor.memberinits = [ExprMemberInit(
|
|
||||||
p.openedProtocolInterfaceType(),
|
|
||||||
[ _protocolId(ptype) ])] + ctor.memberinits
|
|
||||||
else:
|
else:
|
||||||
ctor.memberinits = [
|
ctor.memberinits = [
|
||||||
|
ExprMemberInit(ExprVar('mozilla::ipc::IProtocol'), [side]),
|
||||||
ExprMemberInit(p.idVar(), [ ExprLiteral.ZERO ]),
|
ExprMemberInit(p.idVar(), [ ExprLiteral.ZERO ]),
|
||||||
ExprMemberInit(p.stateVar(),
|
ExprMemberInit(p.stateVar(),
|
||||||
[ p.deadState() ])
|
[ p.deadState() ])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user