зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1561179 - P5: Remove separate VideoBridgeChild Singletons. r=mattwoodrow
Combine sVideoBridgeToParentProcess and sVideoBridgeToGPUProcess into one sVideoBridge. Each producing process, GPU or RDD, is only ever started with one VideoBridgeChild endpoint. This is enough to get RemoteVideoDecoders in RDD process to start using GPU memory to send video to compositor over PVideoBridge. Differential Revision: https://phabricator.services.mozilla.com/D50402 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
3332a9ad27
Коммит
b1baf91ae9
|
@ -186,7 +186,7 @@ bool RemoteDecoderManagerParent::CreateVideoBridgeToOtherProcess(
|
|||
}
|
||||
|
||||
RefPtr<Runnable> task = NewRunnableFunction(
|
||||
"gfx::VideoBridgeChild::Open", &VideoBridgeChild::OpenToParentProcess,
|
||||
"gfx::VideoBridgeChild::Open", &VideoBridgeChild::Open,
|
||||
std::move(aEndpoint));
|
||||
sRemoteDecoderManagerParentThread->Dispatch(task.forget(),
|
||||
NS_DISPATCH_NORMAL);
|
||||
|
|
|
@ -37,9 +37,7 @@ class KnowsCompositorVideo : public layers::KnowsCompositor {
|
|||
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(KnowsCompositorVideo, override)
|
||||
|
||||
layers::TextureForwarder* GetTextureForwarder() override {
|
||||
return mTextureFactoryIdentifier.mParentProcessType == GeckoProcessType_GPU
|
||||
? VideoBridgeChild::GetSingletonToGPUProcess()
|
||||
: VideoBridgeChild::GetSingletonToParentProcess();
|
||||
return VideoBridgeChild::GetSingleton();
|
||||
}
|
||||
layers::LayersIPCActor* GetLayersIPCActor() override {
|
||||
return GetTextureForwarder();
|
||||
|
@ -47,10 +45,7 @@ class KnowsCompositorVideo : public layers::KnowsCompositor {
|
|||
|
||||
static already_AddRefed<KnowsCompositorVideo> TryCreateForIdentifier(
|
||||
const layers::TextureFactoryIdentifier& aIdentifier) {
|
||||
VideoBridgeChild* child =
|
||||
(aIdentifier.mParentProcessType == GeckoProcessType_GPU)
|
||||
? VideoBridgeChild::GetSingletonToGPUProcess()
|
||||
: VideoBridgeChild::GetSingletonToParentProcess();
|
||||
VideoBridgeChild* child = VideoBridgeChild::GetSingleton();
|
||||
if (!child) {
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -11,8 +11,7 @@
|
|||
namespace mozilla {
|
||||
namespace layers {
|
||||
|
||||
StaticRefPtr<VideoBridgeChild> sVideoBridgeToParentProcess;
|
||||
StaticRefPtr<VideoBridgeChild> sVideoBridgeToGPUProcess;
|
||||
StaticRefPtr<VideoBridgeChild> sVideoBridge;
|
||||
|
||||
/* static */
|
||||
void VideoBridgeChild::StartupForGPUProcess() {
|
||||
|
@ -23,25 +22,17 @@ void VideoBridgeChild::StartupForGPUProcess() {
|
|||
base::GetCurrentProcId(), &parentPipe,
|
||||
&childPipe);
|
||||
|
||||
VideoBridgeChild::OpenToGPUProcess(std::move(childPipe));
|
||||
VideoBridgeChild::Open(std::move(childPipe));
|
||||
VideoBridgeParent::Open(std::move(parentPipe), VideoBridgeSource::GpuProcess);
|
||||
}
|
||||
|
||||
void VideoBridgeChild::OpenToParentProcess(
|
||||
Endpoint<PVideoBridgeChild>&& aEndpoint) {
|
||||
sVideoBridgeToParentProcess = new VideoBridgeChild();
|
||||
void VideoBridgeChild::Open(Endpoint<PVideoBridgeChild>&& aEndpoint) {
|
||||
// TODO(djg): This is for testing and probably incorrect. What happens when
|
||||
// the IPC fails and is rebound?
|
||||
MOZ_ASSERT(!sVideoBridge);
|
||||
sVideoBridge = new VideoBridgeChild();
|
||||
|
||||
if (!aEndpoint.Bind(sVideoBridgeToParentProcess)) {
|
||||
// We can't recover from this.
|
||||
MOZ_CRASH("Failed to bind VideoBridgeChild to endpoint");
|
||||
}
|
||||
}
|
||||
|
||||
void VideoBridgeChild::OpenToGPUProcess(
|
||||
Endpoint<PVideoBridgeChild>&& aEndpoint) {
|
||||
sVideoBridgeToGPUProcess = new VideoBridgeChild();
|
||||
|
||||
if (!aEndpoint.Bind(sVideoBridgeToGPUProcess)) {
|
||||
if (!aEndpoint.Bind(sVideoBridge)) {
|
||||
// We can't recover from this.
|
||||
MOZ_CRASH("Failed to bind VideoBridgeChild to endpoint");
|
||||
}
|
||||
|
@ -49,13 +40,9 @@ void VideoBridgeChild::OpenToGPUProcess(
|
|||
|
||||
/* static */
|
||||
void VideoBridgeChild::Shutdown() {
|
||||
if (sVideoBridgeToParentProcess) {
|
||||
sVideoBridgeToParentProcess->Close();
|
||||
sVideoBridgeToParentProcess = nullptr;
|
||||
}
|
||||
if (sVideoBridgeToGPUProcess) {
|
||||
sVideoBridgeToGPUProcess->Close();
|
||||
sVideoBridgeToGPUProcess = nullptr;
|
||||
if (sVideoBridge) {
|
||||
sVideoBridge->Close();
|
||||
sVideoBridge = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -66,13 +53,7 @@ VideoBridgeChild::VideoBridgeChild()
|
|||
|
||||
VideoBridgeChild::~VideoBridgeChild() {}
|
||||
|
||||
VideoBridgeChild* VideoBridgeChild::GetSingletonToParentProcess() {
|
||||
return sVideoBridgeToParentProcess;
|
||||
}
|
||||
|
||||
VideoBridgeChild* VideoBridgeChild::GetSingletonToGPUProcess() {
|
||||
return sVideoBridgeToGPUProcess;
|
||||
}
|
||||
VideoBridgeChild* VideoBridgeChild::GetSingleton() { return sVideoBridge; }
|
||||
|
||||
bool VideoBridgeChild::AllocUnsafeShmem(
|
||||
size_t aSize, ipc::SharedMemory::SharedMemoryType aType,
|
||||
|
|
|
@ -23,8 +23,7 @@ class VideoBridgeChild final : public PVideoBridgeChild,
|
|||
static void StartupForGPUProcess();
|
||||
static void Shutdown();
|
||||
|
||||
static VideoBridgeChild* GetSingletonToParentProcess();
|
||||
static VideoBridgeChild* GetSingletonToGPUProcess();
|
||||
static VideoBridgeChild* GetSingleton();
|
||||
|
||||
// PVideoBridgeChild
|
||||
PTextureChild* AllocPTextureChild(const SurfaceDescriptor& aSharedData,
|
||||
|
@ -66,8 +65,7 @@ class VideoBridgeChild final : public PVideoBridgeChild,
|
|||
|
||||
bool CanSend() { return mCanSend; }
|
||||
|
||||
static void OpenToParentProcess(Endpoint<PVideoBridgeChild>&& aEndpoint);
|
||||
static void OpenToGPUProcess(Endpoint<PVideoBridgeChild>&& aEndpoint);
|
||||
static void Open(Endpoint<PVideoBridgeChild>&& aEndpoint);
|
||||
|
||||
private:
|
||||
VideoBridgeChild();
|
||||
|
|
Загрузка…
Ссылка в новой задаче