зеркало из https://github.com/mozilla/gecko-dev.git
Bug 879475: Allocing an actor for a bridged or opened protocol should return bool r=jlebar
Conflicts: dom/ipc/ContentChild.cpp dom/ipc/ContentChild.h
This commit is contained in:
Родитель
8c43a4f37f
Коммит
9eca84e4d8
|
@ -503,14 +503,14 @@ ContentChild::RecvDumpGCAndCCLogsToFile(const nsString& aIdentifier,
|
|||
return true;
|
||||
}
|
||||
|
||||
PCompositorChild*
|
||||
bool
|
||||
ContentChild::AllocPCompositorChild(mozilla::ipc::Transport* aTransport,
|
||||
base::ProcessId aOtherProcess)
|
||||
{
|
||||
return CompositorChild::Create(aTransport, aOtherProcess);
|
||||
}
|
||||
|
||||
PImageBridgeChild*
|
||||
bool
|
||||
ContentChild::AllocPImageBridgeChild(mozilla::ipc::Transport* aTransport,
|
||||
base::ProcessId aOtherProcess)
|
||||
{
|
||||
|
|
|
@ -77,10 +77,10 @@ public:
|
|||
void SetProcessName(const nsAString& aName);
|
||||
const void GetProcessName(nsAString& aName);
|
||||
|
||||
PCompositorChild*
|
||||
bool
|
||||
AllocPCompositorChild(mozilla::ipc::Transport* aTransport,
|
||||
base::ProcessId aOtherProcess) MOZ_OVERRIDE;
|
||||
PImageBridgeChild*
|
||||
bool
|
||||
AllocPImageBridgeChild(mozilla::ipc::Transport* aTransport,
|
||||
base::ProcessId aOtherProcess) MOZ_OVERRIDE;
|
||||
|
||||
|
|
|
@ -1775,14 +1775,14 @@ ContentParent::Observe(nsISupports* aSubject,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
PCompositorParent*
|
||||
bool
|
||||
ContentParent::AllocPCompositorParent(mozilla::ipc::Transport* aTransport,
|
||||
base::ProcessId aOtherProcess)
|
||||
{
|
||||
return CompositorParent::Create(aTransport, aOtherProcess);
|
||||
}
|
||||
|
||||
PImageBridgeParent*
|
||||
bool
|
||||
ContentParent::AllocPImageBridgeParent(mozilla::ipc::Transport* aTransport,
|
||||
base::ProcessId aOtherProcess)
|
||||
{
|
||||
|
|
|
@ -250,10 +250,10 @@ private:
|
|||
*/
|
||||
void ShutDownProcess(bool aCloseWithError);
|
||||
|
||||
PCompositorParent*
|
||||
bool
|
||||
AllocPCompositorParent(mozilla::ipc::Transport* aTransport,
|
||||
base::ProcessId aOtherProcess) MOZ_OVERRIDE;
|
||||
PImageBridgeParent*
|
||||
bool
|
||||
AllocPImageBridgeParent(mozilla::ipc::Transport* aTransport,
|
||||
base::ProcessId aOtherProcess) MOZ_OVERRIDE;
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ CompositorChild::Destroy()
|
|||
SendStop();
|
||||
}
|
||||
|
||||
/*static*/ PCompositorChild*
|
||||
/*static*/ bool
|
||||
CompositorChild::Create(Transport* aTransport, ProcessId aOtherProcess)
|
||||
{
|
||||
// There's only one compositor per child process.
|
||||
|
@ -62,15 +62,16 @@ CompositorChild::Create(Transport* aTransport, ProcessId aOtherProcess)
|
|||
if (!base::OpenProcessHandle(aOtherProcess, &handle)) {
|
||||
// We can't go on without a compositor.
|
||||
NS_RUNTIMEABORT("Couldn't OpenProcessHandle() to parent process.");
|
||||
return nullptr;
|
||||
return false;
|
||||
}
|
||||
if (!child->Open(aTransport, handle, XRE_GetIOMessageLoop(),
|
||||
AsyncChannel::Child)) {
|
||||
NS_RUNTIMEABORT("Couldn't Open() Compositor channel.");
|
||||
return nullptr;
|
||||
return false;
|
||||
}
|
||||
// We release this ref in ActorDestroy().
|
||||
return sCompositor = child.forget().get();
|
||||
sCompositor = child.forget().get();
|
||||
return true;
|
||||
}
|
||||
|
||||
/*static*/ PCompositorChild*
|
||||
|
|
|
@ -38,7 +38,7 @@ public:
|
|||
* or Bridge() request from our parent process. The Transport is to
|
||||
* the compositor's context.
|
||||
*/
|
||||
static PCompositorChild*
|
||||
static bool
|
||||
Create(Transport* aTransport, ProcessId aOtherProcess);
|
||||
|
||||
static PCompositorChild* Get();
|
||||
|
|
|
@ -905,7 +905,7 @@ OpenCompositor(CrossProcessCompositorParent* aCompositor,
|
|||
MOZ_ASSERT(ok);
|
||||
}
|
||||
|
||||
/*static*/ PCompositorParent*
|
||||
/*static*/ bool
|
||||
CompositorParent::Create(Transport* aTransport, ProcessId aOtherProcess)
|
||||
{
|
||||
nsRefPtr<CrossProcessCompositorParent> cpcp =
|
||||
|
@ -913,16 +913,14 @@ CompositorParent::Create(Transport* aTransport, ProcessId aOtherProcess)
|
|||
ProcessHandle handle;
|
||||
if (!base::OpenProcessHandle(aOtherProcess, &handle)) {
|
||||
// XXX need to kill |aOtherProcess|, it's boned
|
||||
return nullptr;
|
||||
return false;
|
||||
}
|
||||
cpcp->mSelfRef = cpcp;
|
||||
CompositorLoop()->PostTask(
|
||||
FROM_HERE,
|
||||
NewRunnableFunction(OpenCompositor, cpcp.get(),
|
||||
aTransport, handle, XRE_GetIOMessageLoop()));
|
||||
// The return value is just compared to null for success checking,
|
||||
// we're not sharing a ref.
|
||||
return cpcp.get();
|
||||
return true;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -172,7 +172,7 @@ public:
|
|||
* A new child process has been configured to push transactions
|
||||
* directly to us. Transport is to its thread context.
|
||||
*/
|
||||
static PCompositorParent*
|
||||
static bool
|
||||
Create(Transport* aTransport, ProcessId aOtherProcess);
|
||||
|
||||
/**
|
||||
|
|
|
@ -521,7 +521,7 @@ ImageBridgeChild::EndTransaction()
|
|||
}
|
||||
|
||||
|
||||
PImageBridgeChild*
|
||||
bool
|
||||
ImageBridgeChild::StartUpInChildProcess(Transport* aTransport,
|
||||
ProcessId aOtherProcess)
|
||||
{
|
||||
|
@ -529,12 +529,12 @@ ImageBridgeChild::StartUpInChildProcess(Transport* aTransport,
|
|||
|
||||
ProcessHandle processHandle;
|
||||
if (!base::OpenProcessHandle(aOtherProcess, &processHandle)) {
|
||||
return nullptr;
|
||||
return false;
|
||||
}
|
||||
|
||||
sImageBridgeChildThread = new Thread("ImageBridgeChild");
|
||||
if (!sImageBridgeChildThread->Start()) {
|
||||
return nullptr;
|
||||
return false;
|
||||
}
|
||||
|
||||
sImageBridgeChildSingleton = new ImageBridgeChild();
|
||||
|
@ -543,7 +543,7 @@ ImageBridgeChild::StartUpInChildProcess(Transport* aTransport,
|
|||
NewRunnableFunction(ConnectImageBridgeInChildProcess,
|
||||
aTransport, processHandle));
|
||||
|
||||
return sImageBridgeChildSingleton;
|
||||
return true;
|
||||
}
|
||||
|
||||
void ImageBridgeChild::ShutDown()
|
||||
|
|
|
@ -114,7 +114,7 @@ public:
|
|||
*/
|
||||
static void StartUp();
|
||||
|
||||
static PImageBridgeChild*
|
||||
static bool
|
||||
StartUpInChildProcess(Transport* aTransport, ProcessId aOtherProcess);
|
||||
|
||||
/**
|
||||
|
|
|
@ -103,12 +103,12 @@ ConnectImageBridgeInParentProcess(ImageBridgeParent* aBridge,
|
|||
XRE_GetIOMessageLoop(), AsyncChannel::Parent);
|
||||
}
|
||||
|
||||
/*static*/ PImageBridgeParent*
|
||||
/*static*/ bool
|
||||
ImageBridgeParent::Create(Transport* aTransport, ProcessId aOtherProcess)
|
||||
{
|
||||
ProcessHandle processHandle;
|
||||
if (!base::OpenProcessHandle(aOtherProcess, &processHandle)) {
|
||||
return nullptr;
|
||||
return false;
|
||||
}
|
||||
|
||||
MessageLoop* loop = CompositorParent::CompositorLoop();
|
||||
|
@ -117,7 +117,7 @@ ImageBridgeParent::Create(Transport* aTransport, ProcessId aOtherProcess)
|
|||
loop->PostTask(FROM_HERE,
|
||||
NewRunnableFunction(ConnectImageBridgeInParentProcess,
|
||||
bridge.get(), aTransport, processHandle));
|
||||
return bridge.get();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ImageBridgeParent::RecvStop()
|
||||
|
|
|
@ -44,7 +44,7 @@ public:
|
|||
|
||||
virtual void ActorDestroy(ActorDestroyReason aWhy) MOZ_OVERRIDE;
|
||||
|
||||
static PImageBridgeParent*
|
||||
static bool
|
||||
Create(Transport* aTransport, ProcessId aOtherProcess);
|
||||
|
||||
virtual PGrallocBufferParent*
|
||||
|
|
|
@ -2718,7 +2718,7 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
|
|||
_allocMethod(actor.ptype, actor.side).name,
|
||||
params=[ Decl(Type('Transport', ptr=1), 'transport'),
|
||||
Decl(Type('ProcessId'), 'otherProcess') ],
|
||||
ret=actortype,
|
||||
ret=Type.BOOL,
|
||||
virtual=1, pure=1)))
|
||||
|
||||
# optional ActorDestroy() method; default is no-op
|
||||
|
|
|
@ -25,7 +25,7 @@ TestBridgeMainParent::Main()
|
|||
fail("sending Start");
|
||||
}
|
||||
|
||||
PTestBridgeMainSubParent*
|
||||
bool
|
||||
TestBridgeMainParent::AllocPTestBridgeMainSubParent(Transport* transport,
|
||||
ProcessId otherProcess)
|
||||
{
|
||||
|
@ -38,7 +38,8 @@ TestBridgeMainParent::AllocPTestBridgeMainSubParent(Transport* transport,
|
|||
if (!a->Open(transport, h, XRE_GetIOMessageLoop(), AsyncChannel::Parent)) {
|
||||
return nullptr;
|
||||
}
|
||||
return a.forget();
|
||||
a.forget();
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -176,24 +177,25 @@ TestBridgeSubChild::RecvPing()
|
|||
return true;
|
||||
}
|
||||
|
||||
PTestBridgeMainSubChild*
|
||||
bool
|
||||
TestBridgeSubChild::AllocPTestBridgeMainSubChild(Transport* transport,
|
||||
ProcessId otherProcess)
|
||||
{
|
||||
ProcessHandle h;
|
||||
if (!base::OpenProcessHandle(otherProcess, &h)) {
|
||||
return nullptr;
|
||||
return false;
|
||||
}
|
||||
|
||||
nsAutoPtr<TestBridgeMainSubChild> a(new TestBridgeMainSubChild(transport));
|
||||
if (!a->Open(transport, h, XRE_GetIOMessageLoop(), AsyncChannel::Child)) {
|
||||
return nullptr;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!a->SendHello())
|
||||
fail("sending Hello");
|
||||
|
||||
return a.forget();
|
||||
a.forget();
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -31,7 +31,7 @@ public:
|
|||
void Main();
|
||||
|
||||
protected:
|
||||
virtual PTestBridgeMainSubParent*
|
||||
virtual bool
|
||||
AllocPTestBridgeMainSubParent(Transport* transport,
|
||||
ProcessId otherProcess) MOZ_OVERRIDE;
|
||||
|
||||
|
@ -105,7 +105,7 @@ public:
|
|||
protected:
|
||||
virtual bool RecvPing() MOZ_OVERRIDE;
|
||||
|
||||
virtual PTestBridgeMainSubChild*
|
||||
virtual bool
|
||||
AllocPTestBridgeMainSubChild(Transport* transport,
|
||||
ProcessId otherProcess) MOZ_OVERRIDE;
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ OpenParent(TestOpensOpenedParent* aParent,
|
|||
fail("opening Parent");
|
||||
}
|
||||
|
||||
PTestOpensOpenedParent*
|
||||
bool
|
||||
TestOpensParent::AllocPTestOpensOpenedParent(Transport* transport,
|
||||
ProcessId otherProcess)
|
||||
{
|
||||
|
@ -72,7 +72,7 @@ TestOpensParent::AllocPTestOpensOpenedParent(Transport* transport,
|
|||
|
||||
ProcessHandle h;
|
||||
if (!base::OpenProcessHandle(otherProcess, &h)) {
|
||||
return nullptr;
|
||||
return false;
|
||||
}
|
||||
|
||||
gParentThread = new Thread("ParentThread");
|
||||
|
@ -84,7 +84,7 @@ TestOpensParent::AllocPTestOpensOpenedParent(Transport* transport,
|
|||
FROM_HERE,
|
||||
NewRunnableFunction(OpenParent, a, transport, h));
|
||||
|
||||
return a;
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -177,7 +177,7 @@ OpenChild(TestOpensOpenedChild* aChild,
|
|||
fail("sending Hello");
|
||||
}
|
||||
|
||||
PTestOpensOpenedChild*
|
||||
bool
|
||||
TestOpensChild::AllocPTestOpensOpenedChild(Transport* transport,
|
||||
ProcessId otherProcess)
|
||||
{
|
||||
|
@ -185,7 +185,7 @@ TestOpensChild::AllocPTestOpensOpenedChild(Transport* transport,
|
|||
|
||||
ProcessHandle h;
|
||||
if (!base::OpenProcessHandle(otherProcess, &h)) {
|
||||
return nullptr;
|
||||
return false;
|
||||
}
|
||||
|
||||
gChildThread = new Thread("ChildThread");
|
||||
|
@ -197,7 +197,7 @@ TestOpensChild::AllocPTestOpensOpenedChild(Transport* transport,
|
|||
FROM_HERE,
|
||||
NewRunnableFunction(OpenChild, a, transport, h));
|
||||
|
||||
return a;
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -27,7 +27,7 @@ public:
|
|||
void Main();
|
||||
|
||||
protected:
|
||||
virtual PTestOpensOpenedParent*
|
||||
virtual bool
|
||||
AllocPTestOpensOpenedParent(Transport* transport, ProcessId otherProcess) MOZ_OVERRIDE;
|
||||
|
||||
virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE;
|
||||
|
@ -70,7 +70,7 @@ public:
|
|||
protected:
|
||||
virtual bool RecvStart() MOZ_OVERRIDE;
|
||||
|
||||
virtual PTestOpensOpenedChild*
|
||||
virtual bool
|
||||
AllocPTestOpensOpenedChild(Transport* transport, ProcessId otherProcess) MOZ_OVERRIDE;
|
||||
|
||||
virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE;
|
||||
|
|
Загрузка…
Ссылка в новой задаче