зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
f8bd2627a7
Коммит
12585264a1
|
@ -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() ])
|
||||
|
|
Загрузка…
Ссылка в новой задаче