Bug 1119878 Part 2: Change IPC code to hold ProcessID instead of ProcessHandle. r=billm, r=dvander, r=aklotz, r=cpearce

This commit is contained in:
Bob Owen
2015-04-01 09:40:35 +01:00
parent 6317648fb0
commit 7517f0b07d
69 changed files with 467 additions and 470 deletions

View File

@@ -110,16 +110,11 @@ struct RunnableMethodTraits<PluginModuleChild>
/* static */
PluginModuleChild*
PluginModuleChild::CreateForContentProcess(mozilla::ipc::Transport* aTransport,
base::ProcessId aOtherProcess)
base::ProcessId aOtherPid)
{
PluginModuleChild* child = new PluginModuleChild(false);
ProcessHandle handle;
if (!base::OpenProcessHandle(aOtherProcess, &handle)) {
// XXX need to kill |aOtherProcess|, it's boned
return nullptr;
}
if (!child->InitForContent(handle, XRE_GetIOMessageLoop(), aTransport)) {
if (!child->InitForContent(aOtherPid, XRE_GetIOMessageLoop(), aTransport)) {
return nullptr;
}
@@ -206,7 +201,7 @@ PluginModuleChild::GetChrome()
}
bool
PluginModuleChild::CommonInit(base::ProcessHandle aParentProcessHandle,
PluginModuleChild::CommonInit(base::ProcessId aParentPid,
MessageLoop* aIOLoop,
IPC::Channel* aChannel)
{
@@ -218,8 +213,9 @@ PluginModuleChild::CommonInit(base::ProcessHandle aParentProcessHandle,
// Bug 1090573 - Don't do this for connections to content processes.
GetIPCChannel()->SetChannelFlags(MessageChannel::REQUIRE_DEFERRED_MESSAGE_PROTECTION);
if (!Open(aChannel, aParentProcessHandle, aIOLoop))
if (!Open(aChannel, aParentPid, aIOLoop)) {
return false;
}
memset((void*) &mFunctions, 0, sizeof(mFunctions));
mFunctions.size = sizeof(mFunctions);
@@ -229,11 +225,11 @@ PluginModuleChild::CommonInit(base::ProcessHandle aParentProcessHandle,
}
bool
PluginModuleChild::InitForContent(base::ProcessHandle aParentProcessHandle,
PluginModuleChild::InitForContent(base::ProcessId aParentPid,
MessageLoop* aIOLoop,
IPC::Channel* aChannel)
{
if (!CommonInit(aParentProcessHandle, aIOLoop, aChannel)) {
if (!CommonInit(aParentPid, aIOLoop, aChannel)) {
return false;
}
@@ -259,7 +255,7 @@ PluginModuleChild::RecvDisableFlashProtectedMode()
bool
PluginModuleChild::InitForChrome(const std::string& aPluginFilename,
base::ProcessHandle aParentProcessHandle,
base::ProcessId aParentPid,
MessageLoop* aIOLoop,
IPC::Channel* aChannel)
{
@@ -312,7 +308,7 @@ PluginModuleChild::InitForChrome(const std::string& aPluginFilename,
}
NS_ASSERTION(mLibrary, "couldn't open shared object");
if (!CommonInit(aParentProcessHandle, aIOLoop, aChannel)) {
if (!CommonInit(aParentPid, aIOLoop, aChannel)) {
return false;
}
@@ -791,9 +787,9 @@ PluginModuleChild::QuickExit()
PPluginModuleChild*
PluginModuleChild::AllocPPluginModuleChild(mozilla::ipc::Transport* aTransport,
base::ProcessId aOtherProcess)
base::ProcessId aOtherPid)
{
return PluginModuleChild::CreateForContentProcess(aTransport, aOtherProcess);
return PluginModuleChild::CreateForContentProcess(aTransport, aOtherPid);
}
PCrashReporterChild*