зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1149971 Part 1: Follow-up to bug 1119878 to fix broken IPDL tests. r=dvander
This commit is contained in:
Родитель
b0b531a524
Коммит
967713e4e9
|
@ -19,7 +19,7 @@ bool
|
|||
IPDLUnitTestProcessChild::Init()
|
||||
{
|
||||
IPDLUnitTestChildInit(IOThreadChild::channel(),
|
||||
ParentId(),
|
||||
ParentPid(),
|
||||
IOThreadChild::message_loop());
|
||||
|
||||
if (NS_FAILED(nsRegion::InitStatic()))
|
||||
|
|
|
@ -181,7 +181,7 @@ ${PARENT_ENABLED_CASES_PROC}
|
|||
if (!transport)
|
||||
fail("no transport");
|
||||
|
||||
base::ProcessHandle child = gSubprocess->GetChildProcessHandle();
|
||||
base::ProcessId child = base::GetProcId(gSubprocess->GetChildProcessHandle());
|
||||
|
||||
switch (test) {
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
|
@ -27,15 +27,10 @@ TestBridgeMainParent::Main()
|
|||
|
||||
PTestBridgeMainSubParent*
|
||||
TestBridgeMainParent::AllocPTestBridgeMainSubParent(Transport* transport,
|
||||
ProcessId otherProcess)
|
||||
ProcessId otherPid)
|
||||
{
|
||||
ProcessHandle h;
|
||||
if (!base::OpenProcessHandle(otherProcess, &h)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsAutoPtr<TestBridgeMainSubParent> a(new TestBridgeMainSubParent(transport));
|
||||
if (!a->Open(transport, h, XRE_GetIOMessageLoop(), ipc::ParentSide)) {
|
||||
if (!a->Open(transport, otherPid, XRE_GetIOMessageLoop(), ipc::ParentSide)) {
|
||||
return nullptr;
|
||||
}
|
||||
return a.forget();
|
||||
|
@ -110,7 +105,7 @@ TestBridgeMainChild::RecvStart()
|
|||
fail("no transport");
|
||||
|
||||
TestBridgeSubParent* bsp = new TestBridgeSubParent();
|
||||
bsp->Open(transport, mSubprocess->GetChildProcessHandle());
|
||||
bsp->Open(transport, base::GetProcId(mSubprocess->GetChildProcessHandle()));
|
||||
|
||||
bsp->Main();
|
||||
return true;
|
||||
|
@ -178,15 +173,10 @@ TestBridgeSubChild::RecvPing()
|
|||
|
||||
PTestBridgeMainSubChild*
|
||||
TestBridgeSubChild::AllocPTestBridgeMainSubChild(Transport* transport,
|
||||
ProcessId otherProcess)
|
||||
ProcessId otherPid)
|
||||
{
|
||||
ProcessHandle h;
|
||||
if (!base::OpenProcessHandle(otherProcess, &h)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsAutoPtr<TestBridgeMainSubChild> a(new TestBridgeMainSubChild(transport));
|
||||
if (!a->Open(transport, h, XRE_GetIOMessageLoop(), ipc::ChildSide)) {
|
||||
if (!a->Open(transport, otherPid, XRE_GetIOMessageLoop(), ipc::ChildSide)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
|
|
@ -494,7 +494,7 @@ TestDataStructuresChild::RecvStart()
|
|||
Test15();
|
||||
Test16();
|
||||
Test17();
|
||||
if (OtherProcess() != 0) {
|
||||
if (OtherPid() != ipc::kCurrentProcessId) {
|
||||
//FIXME/bug 703317 allocation of nsIntRegion uses a global
|
||||
//region pool which breaks threads
|
||||
Test18();
|
||||
|
|
|
@ -110,7 +110,7 @@ TestFailedCtorChild::DeallocPTestFailedCtorSubChild(PTestFailedCtorSubChild* act
|
|||
void
|
||||
TestFailedCtorChild::ProcessingError(Result aCode, const char* aReason)
|
||||
{
|
||||
if (OtherProcess() != 0) // thread-mode
|
||||
if (OtherPid() != ipc::kCurrentProcessId) // thread-mode
|
||||
_exit(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -111,8 +111,14 @@ TestHangsParent::AnswerStackFrame()
|
|||
void
|
||||
TestHangsParent::CleanUp()
|
||||
{
|
||||
if (!KillProcess(OtherProcess(), 0, false))
|
||||
fail("terminating child process");
|
||||
ipc::ScopedProcessHandle otherProcessHandle;
|
||||
if (!base::OpenProcessHandle(OtherPid(), &otherProcessHandle.rwget())) {
|
||||
fail("couldn't open child process");
|
||||
} else {
|
||||
if (!KillProcess(otherProcessHandle, 0, false)) {
|
||||
fail("terminating child process");
|
||||
}
|
||||
}
|
||||
Close();
|
||||
}
|
||||
|
||||
|
|
|
@ -54,29 +54,24 @@ TestOpensParent::Main()
|
|||
|
||||
static void
|
||||
OpenParent(TestOpensOpenedParent* aParent,
|
||||
Transport* aTransport, ProcessHandle aOtherProcess)
|
||||
Transport* aTransport, base::ProcessId aOtherPid)
|
||||
{
|
||||
AssertNotMainThread();
|
||||
|
||||
// Open the actor on the off-main thread to park it there.
|
||||
// Messages will be delivered to this thread's message loop
|
||||
// instead of the main thread's.
|
||||
if (!aParent->Open(aTransport, aOtherProcess,
|
||||
if (!aParent->Open(aTransport, aOtherPid,
|
||||
XRE_GetIOMessageLoop(), ipc::ParentSide))
|
||||
fail("opening Parent");
|
||||
}
|
||||
|
||||
PTestOpensOpenedParent*
|
||||
TestOpensParent::AllocPTestOpensOpenedParent(Transport* transport,
|
||||
ProcessId otherProcess)
|
||||
ProcessId otherPid)
|
||||
{
|
||||
gMainThread = MessageLoop::current();
|
||||
|
||||
ProcessHandle h;
|
||||
if (!base::OpenProcessHandle(otherProcess, &h)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
gParentThread = new Thread("ParentThread");
|
||||
if (!gParentThread->Start())
|
||||
fail("starting parent thread");
|
||||
|
@ -84,7 +79,7 @@ TestOpensParent::AllocPTestOpensOpenedParent(Transport* transport,
|
|||
TestOpensOpenedParent* a = new TestOpensOpenedParent(transport);
|
||||
gParentThread->message_loop()->PostTask(
|
||||
FROM_HERE,
|
||||
NewRunnableFunction(OpenParent, a, transport, h));
|
||||
NewRunnableFunction(OpenParent, a, transport, otherPid));
|
||||
|
||||
return a;
|
||||
}
|
||||
|
@ -174,14 +169,14 @@ TestOpensChild::RecvStart()
|
|||
|
||||
static void
|
||||
OpenChild(TestOpensOpenedChild* aChild,
|
||||
Transport* aTransport, ProcessHandle aOtherProcess)
|
||||
Transport* aTransport, base::ProcessId aOtherPid)
|
||||
{
|
||||
AssertNotMainThread();
|
||||
|
||||
// Open the actor on the off-main thread to park it there.
|
||||
// Messages will be delivered to this thread's message loop
|
||||
// instead of the main thread's.
|
||||
if (!aChild->Open(aTransport, aOtherProcess,
|
||||
if (!aChild->Open(aTransport, aOtherPid,
|
||||
XRE_GetIOMessageLoop(), ipc::ChildSide))
|
||||
fail("opening Child");
|
||||
|
||||
|
@ -192,15 +187,10 @@ OpenChild(TestOpensOpenedChild* aChild,
|
|||
|
||||
PTestOpensOpenedChild*
|
||||
TestOpensChild::AllocPTestOpensOpenedChild(Transport* transport,
|
||||
ProcessId otherProcess)
|
||||
ProcessId otherPid)
|
||||
{
|
||||
gMainThread = MessageLoop::current();
|
||||
|
||||
ProcessHandle h;
|
||||
if (!base::OpenProcessHandle(otherProcess, &h)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
gChildThread = new Thread("ChildThread");
|
||||
if (!gChildThread->Start())
|
||||
fail("starting child thread");
|
||||
|
@ -208,7 +198,7 @@ TestOpensChild::AllocPTestOpensOpenedChild(Transport* transport,
|
|||
TestOpensOpenedChild* a = new TestOpensOpenedChild(transport);
|
||||
gChildThread->message_loop()->PostTask(
|
||||
FROM_HERE,
|
||||
NewRunnableFunction(OpenChild, a, transport, h));
|
||||
NewRunnableFunction(OpenChild, a, transport, otherPid));
|
||||
|
||||
return a;
|
||||
}
|
||||
|
|
|
@ -116,7 +116,7 @@ def main(argv):
|
|||
%sChild** child =
|
||||
reinterpret_cast<%sChild**>(&gChildActor);
|
||||
*child = new %sChild();
|
||||
(*child)->Open(transport, parent, worker);
|
||||
(*child)->Open(transport, parentPid, worker);
|
||||
return;
|
||||
}
|
||||
'''% (t, t, t, t) for t in unittests+extras ])
|
||||
|
|
Загрузка…
Ссылка в новой задаче