mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 613442, part 4: Library support of |opens| API. r=bent
This commit is contained in:
parent
cc130518ca
commit
109cb23caa
@ -45,6 +45,7 @@
|
||||
#include "mozilla/ipc/Transport.h"
|
||||
|
||||
using namespace base;
|
||||
using namespace IPC;
|
||||
|
||||
namespace mozilla {
|
||||
namespace ipc {
|
||||
@ -111,9 +112,44 @@ Bridge(const PrivateIPDLInterface&,
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
Open(const PrivateIPDLInterface&,
|
||||
AsyncChannel* aOpenerChannel, ProcessHandle aOtherProcess,
|
||||
Transport::Mode aOpenerMode,
|
||||
ProtocolId aProtocol)
|
||||
{
|
||||
bool isParent = (Transport::MODE_SERVER == aOpenerMode);
|
||||
ProcessHandle thisHandle = GetCurrentProcessHandle();
|
||||
ProcessHandle parentHandle = isParent ? thisHandle : aOtherProcess;
|
||||
ProcessHandle childHandle = !isParent ? thisHandle : aOtherProcess;
|
||||
ProcessId parentId = GetProcId(parentHandle);
|
||||
ProcessId childId = GetProcId(childHandle);
|
||||
if (!parentId || !childId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
TransportDescriptor parentSide, childSide;
|
||||
if (!CreateTransport(parentHandle, childHandle,
|
||||
&parentSide, &childSide)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Message* parentMsg = new ChannelOpened(parentSide, childId, aProtocol);
|
||||
Message* childMsg = new ChannelOpened(childSide, parentId, aProtocol);
|
||||
nsAutoPtr<Message> messageForUs(isParent ? parentMsg : childMsg);
|
||||
nsAutoPtr<Message> messageForOtherSide(!isParent ? parentMsg : childMsg);
|
||||
if (!aOpenerChannel->Echo(messageForUs.forget()) ||
|
||||
!aOpenerChannel->Send(messageForOtherSide.forget())) {
|
||||
CloseDescriptor(parentSide);
|
||||
CloseDescriptor(childSide);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
UnpackChannelOpened(const PrivateIPDLInterface&,
|
||||
const IPC::Message& aMsg,
|
||||
const Message& aMsg,
|
||||
TransportDescriptor* aTransport,
|
||||
ProcessId* aOtherProcess,
|
||||
ProtocolId* aProtocol)
|
||||
|
@ -153,6 +153,11 @@ Bridge(const PrivateIPDLInterface&,
|
||||
AsyncChannel*, base::ProcessHandle, AsyncChannel*, base::ProcessHandle,
|
||||
ProtocolId);
|
||||
|
||||
bool
|
||||
Open(const PrivateIPDLInterface&,
|
||||
AsyncChannel*, base::ProcessHandle, Transport::Mode,
|
||||
ProtocolId);
|
||||
|
||||
bool
|
||||
UnpackChannelOpened(const PrivateIPDLInterface&,
|
||||
const IPC::Message&,
|
||||
|
Loading…
Reference in New Issue
Block a user