forked from mirrors/gecko-dev
Bug 1854669. r=gfx-reviewers,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D194537
This commit is contained in:
parent
c80362f527
commit
fa0605af64
49 changed files with 308 additions and 157 deletions
|
|
@ -3222,7 +3222,8 @@ bool ContentParent::InitInternal(ProcessPriority aInitialPriority) {
|
|||
AutoTArray<uint32_t, 3> namespaces;
|
||||
|
||||
if (!gpm->CreateContentBridges(OtherPid(), &compositor, &imageBridge,
|
||||
&vrBridge, &videoManager, &namespaces)) {
|
||||
&vrBridge, &videoManager, mChildID,
|
||||
&namespaces)) {
|
||||
// This can fail if we've already started shutting down the compositor
|
||||
// thread. See Bug 1562763 comment 8.
|
||||
MOZ_ASSERT(AppShutdown::IsInOrBeyond(ShutdownPhase::AppShutdown));
|
||||
|
|
@ -3390,7 +3391,8 @@ void ContentParent::OnCompositorUnexpectedShutdown() {
|
|||
AutoTArray<uint32_t, 3> namespaces;
|
||||
|
||||
if (!gpm->CreateContentBridges(OtherPid(), &compositor, &imageBridge,
|
||||
&vrBridge, &videoManager, &namespaces)) {
|
||||
&vrBridge, &videoManager, mChildID,
|
||||
&namespaces)) {
|
||||
MOZ_ASSERT(AppShutdown::IsInOrBeyond(ShutdownPhase::AppShutdown));
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ include protocol PSandboxTesting;
|
|||
|
||||
include "mozilla/ipc/ByteBufUtils.h";
|
||||
|
||||
using mozilla::dom::ContentParentId from "mozilla/dom/ipc/IdType.h";
|
||||
using mozilla::dom::NativeThreadId from "mozilla/dom/NativeThreadId.h";
|
||||
using mozilla::media::MediaCodecsSupported from "MediaCodecsSupport.h";
|
||||
|
||||
|
|
@ -52,7 +53,7 @@ parent:
|
|||
async InitProfiler(Endpoint<PProfilerChild> endpoint);
|
||||
|
||||
async NewContentRemoteDecoderManager(
|
||||
Endpoint<PRemoteDecoderManagerParent> endpoint);
|
||||
Endpoint<PRemoteDecoderManagerParent> endpoint, ContentParentId childId);
|
||||
|
||||
async RequestMemoryReport(uint32_t generation,
|
||||
bool anonymize,
|
||||
|
|
|
|||
|
|
@ -182,8 +182,10 @@ mozilla::ipc::IPCResult RDDParent::RecvInitProfiler(
|
|||
}
|
||||
|
||||
mozilla::ipc::IPCResult RDDParent::RecvNewContentRemoteDecoderManager(
|
||||
Endpoint<PRemoteDecoderManagerParent>&& aEndpoint) {
|
||||
if (!RemoteDecoderManagerParent::CreateForContent(std::move(aEndpoint))) {
|
||||
Endpoint<PRemoteDecoderManagerParent>&& aEndpoint,
|
||||
const ContentParentId& aParentId) {
|
||||
if (!RemoteDecoderManagerParent::CreateForContent(std::move(aEndpoint),
|
||||
aParentId)) {
|
||||
return IPC_FAIL_NO_REASON(this);
|
||||
}
|
||||
return IPC_OK();
|
||||
|
|
|
|||
|
|
@ -40,7 +40,8 @@ class RDDParent final : public PRDDParent {
|
|||
Endpoint<PProfilerChild>&& aEndpoint);
|
||||
|
||||
mozilla::ipc::IPCResult RecvNewContentRemoteDecoderManager(
|
||||
Endpoint<PRemoteDecoderManagerParent>&& aEndpoint);
|
||||
Endpoint<PRemoteDecoderManagerParent>&& aEndpoint,
|
||||
const ContentParentId& aParentId);
|
||||
mozilla::ipc::IPCResult RecvInitVideoBridge(
|
||||
Endpoint<PVideoBridgeChild>&& aEndpoint,
|
||||
const bool& aCreateHardwareDevice,
|
||||
|
|
|
|||
|
|
@ -192,19 +192,20 @@ RefPtr<GenericNonExclusivePromise> RDDProcessManager::LaunchRDDProcess() {
|
|||
}
|
||||
|
||||
auto RDDProcessManager::EnsureRDDProcessAndCreateBridge(
|
||||
base::ProcessId aOtherProcess) -> RefPtr<EnsureRDDPromise> {
|
||||
base::ProcessId aOtherProcess, dom::ContentParentId aParentId)
|
||||
-> RefPtr<EnsureRDDPromise> {
|
||||
return InvokeAsync(
|
||||
GetMainThreadSerialEventTarget(), __func__,
|
||||
[aOtherProcess, this]() -> RefPtr<EnsureRDDPromise> {
|
||||
[aOtherProcess, aParentId, this]() -> RefPtr<EnsureRDDPromise> {
|
||||
return LaunchRDDProcess()->Then(
|
||||
GetMainThreadSerialEventTarget(), __func__,
|
||||
[aOtherProcess, this]() {
|
||||
[aOtherProcess, aParentId, this]() {
|
||||
if (IsShutdown()) {
|
||||
return EnsureRDDPromise::CreateAndReject(NS_ERROR_NOT_AVAILABLE,
|
||||
__func__);
|
||||
}
|
||||
ipc::Endpoint<PRemoteDecoderManagerChild> endpoint;
|
||||
if (!CreateContentBridge(aOtherProcess, &endpoint)) {
|
||||
if (!CreateContentBridge(aOtherProcess, aParentId, &endpoint)) {
|
||||
return EnsureRDDPromise::CreateAndReject(NS_ERROR_NOT_AVAILABLE,
|
||||
__func__);
|
||||
}
|
||||
|
|
@ -275,7 +276,7 @@ void RDDProcessManager::DestroyProcess() {
|
|||
}
|
||||
|
||||
bool RDDProcessManager::CreateContentBridge(
|
||||
base::ProcessId aOtherProcess,
|
||||
base::ProcessId aOtherProcess, dom::ContentParentId aParentId,
|
||||
ipc::Endpoint<PRemoteDecoderManagerChild>* aOutRemoteDecoderManager) {
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
|
|
@ -296,7 +297,8 @@ bool RDDProcessManager::CreateContentBridge(
|
|||
return false;
|
||||
}
|
||||
|
||||
mRDDChild->SendNewContentRemoteDecoderManager(std::move(parentPipe));
|
||||
mRDDChild->SendNewContentRemoteDecoderManager(std::move(parentPipe),
|
||||
aParentId);
|
||||
|
||||
*aOutRemoteDecoderManager = std::move(childPipe);
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
#include "mozilla/MozPromise.h"
|
||||
#include "mozilla/PRemoteDecoderManagerChild.h"
|
||||
#include "mozilla/RDDProcessHost.h"
|
||||
#include "mozilla/dom/ipc/IdType.h"
|
||||
#include "mozilla/ipc/TaskFactory.h"
|
||||
#include "mozilla/PRDDChild.h"
|
||||
#include "nsIObserver.h"
|
||||
|
|
@ -38,7 +39,7 @@ class RDDProcessManager final : public RDDProcessHost::Listener {
|
|||
// If not using a RDD process, launch a new RDD process asynchronously and
|
||||
// create a RemoteDecoderManager bridge
|
||||
RefPtr<EnsureRDDPromise> EnsureRDDProcessAndCreateBridge(
|
||||
base::ProcessId aOtherProcess);
|
||||
base::ProcessId aOtherProcess, dom::ContentParentId aParentId);
|
||||
|
||||
void OnProcessUnexpectedShutdown(RDDProcessHost* aHost) override;
|
||||
|
||||
|
|
@ -101,7 +102,7 @@ class RDDProcessManager final : public RDDProcessHost::Listener {
|
|||
friend class Observer;
|
||||
|
||||
bool CreateContentBridge(
|
||||
base::ProcessId aOtherProcess,
|
||||
base::ProcessId aOtherProcess, dom::ContentParentId aParentId,
|
||||
ipc::Endpoint<PRemoteDecoderManagerChild>* aOutRemoteDecoderManager);
|
||||
|
||||
const RefPtr<Observer> mObserver;
|
||||
|
|
|
|||
|
|
@ -127,7 +127,8 @@ PDMFactory& RemoteDecoderManagerParent::EnsurePDMFactory() {
|
|||
}
|
||||
|
||||
bool RemoteDecoderManagerParent::CreateForContent(
|
||||
Endpoint<PRemoteDecoderManagerParent>&& aEndpoint) {
|
||||
Endpoint<PRemoteDecoderManagerParent>&& aEndpoint,
|
||||
dom::ContentParentId aChildId) {
|
||||
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_RDD ||
|
||||
XRE_GetProcessType() == GeckoProcessType_Utility ||
|
||||
XRE_GetProcessType() == GeckoProcessType_GPU);
|
||||
|
|
@ -137,8 +138,8 @@ bool RemoteDecoderManagerParent::CreateForContent(
|
|||
return false;
|
||||
}
|
||||
|
||||
RefPtr<RemoteDecoderManagerParent> parent =
|
||||
new RemoteDecoderManagerParent(sRemoteDecoderManagerParentThread);
|
||||
RefPtr<RemoteDecoderManagerParent> parent = new RemoteDecoderManagerParent(
|
||||
sRemoteDecoderManagerParentThread, aChildId);
|
||||
|
||||
RefPtr<Runnable> task =
|
||||
NewRunnableMethod<Endpoint<PRemoteDecoderManagerParent>&&>(
|
||||
|
|
@ -176,8 +177,8 @@ bool RemoteDecoderManagerParent::CreateVideoBridgeToOtherProcess(
|
|||
}
|
||||
|
||||
RemoteDecoderManagerParent::RemoteDecoderManagerParent(
|
||||
nsISerialEventTarget* aThread)
|
||||
: mThread(aThread) {
|
||||
nsISerialEventTarget* aThread, dom::ContentParentId aContentId)
|
||||
: mThread(aThread), mContentId(aContentId) {
|
||||
MOZ_COUNT_CTOR(RemoteDecoderManagerParent);
|
||||
auto& registrar =
|
||||
XRE_IsGPUProcess() ? GPUParent::GetSingleton()->AsyncShutdownService()
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include "GPUVideoImage.h"
|
||||
#include "mozilla/PRemoteDecoderManagerParent.h"
|
||||
#include "mozilla/dom/ipc/IdType.h"
|
||||
#include "mozilla/layers/VideoBridgeChild.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
|
@ -25,7 +26,8 @@ class RemoteDecoderManagerParent final
|
|||
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(RemoteDecoderManagerParent, override)
|
||||
|
||||
static bool CreateForContent(
|
||||
Endpoint<PRemoteDecoderManagerParent>&& aEndpoint);
|
||||
Endpoint<PRemoteDecoderManagerParent>&& aEndpoint,
|
||||
dom::ContentParentId aContentId);
|
||||
|
||||
static bool CreateVideoBridgeToOtherProcess(
|
||||
Endpoint<layers::PVideoBridgeChild>&& aEndpoint);
|
||||
|
|
@ -55,6 +57,8 @@ class RemoteDecoderManagerParent final
|
|||
// Can be called from manager thread only
|
||||
PDMFactory& EnsurePDMFactory();
|
||||
|
||||
const dom::ContentParentId& GetContentId() const { return mContentId; }
|
||||
|
||||
protected:
|
||||
PRemoteDecoderParent* AllocPRemoteDecoderParent(
|
||||
const RemoteDecoderInfoIPDL& aRemoteDecoderInfo,
|
||||
|
|
@ -78,7 +82,8 @@ class RemoteDecoderManagerParent final
|
|||
void ActorDestroy(mozilla::ipc::IProtocol::ActorDestroyReason) override;
|
||||
|
||||
private:
|
||||
explicit RemoteDecoderManagerParent(nsISerialEventTarget* aThread);
|
||||
RemoteDecoderManagerParent(nsISerialEventTarget* aThread,
|
||||
dom::ContentParentId aContentId);
|
||||
~RemoteDecoderManagerParent();
|
||||
|
||||
void Open(Endpoint<PRemoteDecoderManagerParent>&& aEndpoint);
|
||||
|
|
@ -88,6 +93,7 @@ class RemoteDecoderManagerParent final
|
|||
|
||||
nsCOMPtr<nsISerialEventTarget> mThread;
|
||||
RefPtr<PDMFactory> mPDMFactory;
|
||||
dom::ContentParentId mContentId;
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
|
|
|||
|
|
@ -228,7 +228,7 @@ MediaResult RemoteVideoDecoderParent::ProcessDecodedData(
|
|||
|
||||
if (texture) {
|
||||
if (!texture->IsAddedToCompositableClient()) {
|
||||
texture->InitIPDLActor(mKnowsCompositor);
|
||||
texture->InitIPDLActor(mKnowsCompositor, mParent->GetContentId());
|
||||
texture->SetAddedToCompositableClient();
|
||||
}
|
||||
needStorage = true;
|
||||
|
|
|
|||
|
|
@ -484,7 +484,8 @@ mozilla::ipc::IPCResult GPUParent::RecvInitSandboxTesting(
|
|||
|
||||
mozilla::ipc::IPCResult GPUParent::RecvInitCompositorManager(
|
||||
Endpoint<PCompositorManagerParent>&& aEndpoint) {
|
||||
CompositorManagerParent::Create(std::move(aEndpoint), /* aIsRoot */ true);
|
||||
CompositorManagerParent::Create(std::move(aEndpoint), ContentParentId(),
|
||||
/* aIsRoot */ true);
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
|
|
@ -615,30 +616,34 @@ mozilla::ipc::IPCResult GPUParent::RecvSimulateDeviceReset() {
|
|||
}
|
||||
|
||||
mozilla::ipc::IPCResult GPUParent::RecvNewContentCompositorManager(
|
||||
Endpoint<PCompositorManagerParent>&& aEndpoint) {
|
||||
CompositorManagerParent::Create(std::move(aEndpoint), /* aIsRoot */ false);
|
||||
Endpoint<PCompositorManagerParent>&& aEndpoint,
|
||||
const ContentParentId& aChildId) {
|
||||
CompositorManagerParent::Create(std::move(aEndpoint), aChildId,
|
||||
/* aIsRoot */ false);
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult GPUParent::RecvNewContentImageBridge(
|
||||
Endpoint<PImageBridgeParent>&& aEndpoint) {
|
||||
if (!ImageBridgeParent::CreateForContent(std::move(aEndpoint))) {
|
||||
Endpoint<PImageBridgeParent>&& aEndpoint, const ContentParentId& aChildId) {
|
||||
if (!ImageBridgeParent::CreateForContent(std::move(aEndpoint), aChildId)) {
|
||||
return IPC_FAIL_NO_REASON(this);
|
||||
}
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult GPUParent::RecvNewContentVRManager(
|
||||
Endpoint<PVRManagerParent>&& aEndpoint) {
|
||||
if (!VRManagerParent::CreateForContent(std::move(aEndpoint))) {
|
||||
Endpoint<PVRManagerParent>&& aEndpoint, const ContentParentId& aChildId) {
|
||||
if (!VRManagerParent::CreateForContent(std::move(aEndpoint), aChildId)) {
|
||||
return IPC_FAIL_NO_REASON(this);
|
||||
}
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult GPUParent::RecvNewContentRemoteDecoderManager(
|
||||
Endpoint<PRemoteDecoderManagerParent>&& aEndpoint) {
|
||||
if (!RemoteDecoderManagerParent::CreateForContent(std::move(aEndpoint))) {
|
||||
Endpoint<PRemoteDecoderManagerParent>&& aEndpoint,
|
||||
const ContentParentId& aChildId) {
|
||||
if (!RemoteDecoderManagerParent::CreateForContent(std::move(aEndpoint),
|
||||
aChildId)) {
|
||||
return IPC_FAIL_NO_REASON(this);
|
||||
}
|
||||
return IPC_OK();
|
||||
|
|
|
|||
|
|
@ -75,13 +75,16 @@ class GPUParent final : public PGPUParent {
|
|||
mozilla::ipc::IPCResult RecvUpdateVar(const GfxVarUpdate& pref);
|
||||
mozilla::ipc::IPCResult RecvPreferenceUpdate(const Pref& pref);
|
||||
mozilla::ipc::IPCResult RecvNewContentCompositorManager(
|
||||
Endpoint<PCompositorManagerParent>&& aEndpoint);
|
||||
Endpoint<PCompositorManagerParent>&& aEndpoint,
|
||||
const ContentParentId& aChildId);
|
||||
mozilla::ipc::IPCResult RecvNewContentImageBridge(
|
||||
Endpoint<PImageBridgeParent>&& aEndpoint);
|
||||
Endpoint<PImageBridgeParent>&& aEndpoint,
|
||||
const ContentParentId& aChildId);
|
||||
mozilla::ipc::IPCResult RecvNewContentVRManager(
|
||||
Endpoint<PVRManagerParent>&& aEndpoint);
|
||||
Endpoint<PVRManagerParent>&& aEndpoint, const ContentParentId& aChildId);
|
||||
mozilla::ipc::IPCResult RecvNewContentRemoteDecoderManager(
|
||||
Endpoint<PRemoteDecoderManagerParent>&& aEndpoint);
|
||||
Endpoint<PRemoteDecoderManagerParent>&& aEndpoint,
|
||||
const ContentParentId& aChildId);
|
||||
mozilla::ipc::IPCResult RecvGetDeviceStatus(GPUDeviceData* aOutStatus);
|
||||
mozilla::ipc::IPCResult RecvSimulateDeviceReset();
|
||||
mozilla::ipc::IPCResult RecvAddLayerTreeIdMapping(
|
||||
|
|
|
|||
|
|
@ -1148,15 +1148,16 @@ bool GPUProcessManager::CreateContentBridges(
|
|||
ipc::Endpoint<PImageBridgeChild>* aOutImageBridge,
|
||||
ipc::Endpoint<PVRManagerChild>* aOutVRBridge,
|
||||
ipc::Endpoint<PRemoteDecoderManagerChild>* aOutVideoManager,
|
||||
nsTArray<uint32_t>* aNamespaces) {
|
||||
if (!CreateContentCompositorManager(aOtherProcess, aOutCompositor) ||
|
||||
!CreateContentImageBridge(aOtherProcess, aOutImageBridge) ||
|
||||
!CreateContentVRManager(aOtherProcess, aOutVRBridge)) {
|
||||
dom::ContentParentId aChildId, nsTArray<uint32_t>* aNamespaces) {
|
||||
if (!CreateContentCompositorManager(aOtherProcess, aChildId,
|
||||
aOutCompositor) ||
|
||||
!CreateContentImageBridge(aOtherProcess, aChildId, aOutImageBridge) ||
|
||||
!CreateContentVRManager(aOtherProcess, aChildId, aOutVRBridge)) {
|
||||
return false;
|
||||
}
|
||||
// VideoDeocderManager is only supported in the GPU process, so we allow this
|
||||
// to be fallible.
|
||||
CreateContentRemoteDecoderManager(aOtherProcess, aOutVideoManager);
|
||||
CreateContentRemoteDecoderManager(aOtherProcess, aChildId, aOutVideoManager);
|
||||
// Allocates 3 namespaces(for CompositorManagerChild, CompositorBridgeChild
|
||||
// and ImageBridgeChild)
|
||||
aNamespaces->AppendElement(AllocateNamespace());
|
||||
|
|
@ -1166,7 +1167,7 @@ bool GPUProcessManager::CreateContentBridges(
|
|||
}
|
||||
|
||||
bool GPUProcessManager::CreateContentCompositorManager(
|
||||
base::ProcessId aOtherProcess,
|
||||
base::ProcessId aOtherProcess, dom::ContentParentId aChildId,
|
||||
ipc::Endpoint<PCompositorManagerChild>* aOutEndpoint) {
|
||||
ipc::Endpoint<PCompositorManagerParent> parentPipe;
|
||||
ipc::Endpoint<PCompositorManagerChild> childPipe;
|
||||
|
|
@ -1188,8 +1189,8 @@ bool GPUProcessManager::CreateContentCompositorManager(
|
|||
}
|
||||
|
||||
if (mGPUChild) {
|
||||
mGPUChild->SendNewContentCompositorManager(std::move(parentPipe));
|
||||
} else if (!CompositorManagerParent::Create(std::move(parentPipe),
|
||||
mGPUChild->SendNewContentCompositorManager(std::move(parentPipe), aChildId);
|
||||
} else if (!CompositorManagerParent::Create(std::move(parentPipe), aChildId,
|
||||
/* aIsRoot */ false)) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -1199,7 +1200,7 @@ bool GPUProcessManager::CreateContentCompositorManager(
|
|||
}
|
||||
|
||||
bool GPUProcessManager::CreateContentImageBridge(
|
||||
base::ProcessId aOtherProcess,
|
||||
base::ProcessId aOtherProcess, dom::ContentParentId aChildId,
|
||||
ipc::Endpoint<PImageBridgeChild>* aOutEndpoint) {
|
||||
if (!EnsureImageBridgeChild()) {
|
||||
return false;
|
||||
|
|
@ -1224,9 +1225,9 @@ bool GPUProcessManager::CreateContentImageBridge(
|
|||
}
|
||||
|
||||
if (mGPUChild) {
|
||||
mGPUChild->SendNewContentImageBridge(std::move(parentPipe));
|
||||
mGPUChild->SendNewContentImageBridge(std::move(parentPipe), aChildId);
|
||||
} else {
|
||||
if (!ImageBridgeParent::CreateForContent(std::move(parentPipe))) {
|
||||
if (!ImageBridgeParent::CreateForContent(std::move(parentPipe), aChildId)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -1242,7 +1243,7 @@ base::ProcessId GPUProcessManager::GPUProcessPid() {
|
|||
}
|
||||
|
||||
bool GPUProcessManager::CreateContentVRManager(
|
||||
base::ProcessId aOtherProcess,
|
||||
base::ProcessId aOtherProcess, dom::ContentParentId aChildId,
|
||||
ipc::Endpoint<PVRManagerChild>* aOutEndpoint) {
|
||||
if (NS_WARN_IF(!EnsureVRManager())) {
|
||||
return false;
|
||||
|
|
@ -1267,9 +1268,9 @@ bool GPUProcessManager::CreateContentVRManager(
|
|||
}
|
||||
|
||||
if (mGPUChild) {
|
||||
mGPUChild->SendNewContentVRManager(std::move(parentPipe));
|
||||
mGPUChild->SendNewContentVRManager(std::move(parentPipe), aChildId);
|
||||
} else {
|
||||
if (!VRManagerParent::CreateForContent(std::move(parentPipe))) {
|
||||
if (!VRManagerParent::CreateForContent(std::move(parentPipe), aChildId)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -1279,7 +1280,7 @@ bool GPUProcessManager::CreateContentVRManager(
|
|||
}
|
||||
|
||||
void GPUProcessManager::CreateContentRemoteDecoderManager(
|
||||
base::ProcessId aOtherProcess,
|
||||
base::ProcessId aOtherProcess, dom::ContentParentId aChildId,
|
||||
ipc::Endpoint<PRemoteDecoderManagerChild>* aOutEndpoint) {
|
||||
nsresult rv = EnsureGPUReady();
|
||||
if (NS_WARN_IF(rv == NS_ERROR_ILLEGAL_DURING_SHUTDOWN)) {
|
||||
|
|
@ -1302,7 +1303,8 @@ void GPUProcessManager::CreateContentRemoteDecoderManager(
|
|||
return;
|
||||
}
|
||||
|
||||
mGPUChild->SendNewContentRemoteDecoderManager(std::move(parentPipe));
|
||||
mGPUChild->SendNewContentRemoteDecoderManager(std::move(parentPipe),
|
||||
aChildId);
|
||||
|
||||
*aOutEndpoint = std::move(childPipe);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ class GPUProcessManager final : public GPUProcessHost::Listener {
|
|||
mozilla::ipc::Endpoint<PImageBridgeChild>* aOutImageBridge,
|
||||
mozilla::ipc::Endpoint<PVRManagerChild>* aOutVRBridge,
|
||||
mozilla::ipc::Endpoint<PRemoteDecoderManagerChild>* aOutVideoManager,
|
||||
nsTArray<uint32_t>* aNamespaces);
|
||||
dom::ContentParentId aChildId, nsTArray<uint32_t>* aNamespaces);
|
||||
|
||||
// Initialize GPU process with consuming end of PVideoBridge.
|
||||
void InitVideoBridge(
|
||||
|
|
@ -216,16 +216,16 @@ class GPUProcessManager final : public GPUProcessHost::Listener {
|
|||
void OnPreferenceChange(const char16_t* aData);
|
||||
|
||||
bool CreateContentCompositorManager(
|
||||
base::ProcessId aOtherProcess,
|
||||
base::ProcessId aOtherProcess, dom::ContentParentId aChildId,
|
||||
mozilla::ipc::Endpoint<PCompositorManagerChild>* aOutEndpoint);
|
||||
bool CreateContentImageBridge(
|
||||
base::ProcessId aOtherProcess,
|
||||
base::ProcessId aOtherProcess, dom::ContentParentId aChildId,
|
||||
mozilla::ipc::Endpoint<PImageBridgeChild>* aOutEndpoint);
|
||||
bool CreateContentVRManager(
|
||||
base::ProcessId aOtherProcess,
|
||||
base::ProcessId aOtherProcess, dom::ContentParentId aChildId,
|
||||
mozilla::ipc::Endpoint<PVRManagerChild>* aOutEndpoint);
|
||||
void CreateContentRemoteDecoderManager(
|
||||
base::ProcessId aOtherProcess,
|
||||
base::ProcessId aOtherProcess, dom::ContentParentId aChildId,
|
||||
mozilla::ipc::Endpoint<PRemoteDecoderManagerChild>* aOutEndPoint);
|
||||
|
||||
// Called from RemoteCompositorSession. We track remote sessions so we can
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ include "mozilla/ipc/ByteBufUtils.h";
|
|||
include "mozilla/layers/LayersMessageUtils.h";
|
||||
|
||||
using base::ProcessId from "base/process.h";
|
||||
using mozilla::dom::ContentParentId from "mozilla/dom/ipc/IdType.h";
|
||||
using mozilla::dom::NativeThreadId from "mozilla/dom/NativeThreadId.h";
|
||||
using mozilla::Telemetry::HistogramAccumulation from "mozilla/TelemetryComms.h";
|
||||
using mozilla::Telemetry::KeyedHistogramAccumulation from "mozilla/TelemetryComms.h";
|
||||
|
|
@ -80,10 +81,10 @@ parent:
|
|||
async PreferenceUpdate(Pref pref);
|
||||
|
||||
// Create a new content-process compositor bridge.
|
||||
async NewContentCompositorManager(Endpoint<PCompositorManagerParent> endpoint);
|
||||
async NewContentImageBridge(Endpoint<PImageBridgeParent> endpoint);
|
||||
async NewContentVRManager(Endpoint<PVRManagerParent> endpoint);
|
||||
async NewContentRemoteDecoderManager(Endpoint<PRemoteDecoderManagerParent> endpoint);
|
||||
async NewContentCompositorManager(Endpoint<PCompositorManagerParent> endpoint, ContentParentId childId);
|
||||
async NewContentImageBridge(Endpoint<PImageBridgeParent> endpoint, ContentParentId childId);
|
||||
async NewContentVRManager(Endpoint<PVRManagerParent> endpoint, ContentParentId childId);
|
||||
async NewContentRemoteDecoderManager(Endpoint<PRemoteDecoderManagerParent> endpoint, ContentParentId childId);
|
||||
|
||||
// Called to notify the GPU process of who owns a layersId.
|
||||
sync AddLayerTreeIdMapping(LayerTreeIdMapping mapping);
|
||||
|
|
|
|||
|
|
@ -1029,8 +1029,8 @@ bool TextureClient::InitIPDLActor(CompositableForwarder* aForwarder) {
|
|||
|
||||
PTextureChild* actor = aForwarder->GetTextureForwarder()->CreateTexture(
|
||||
desc, std::move(readLockDescriptor),
|
||||
aForwarder->GetCompositorBackendType(), GetFlags(), mSerial,
|
||||
mExternalImageId);
|
||||
aForwarder->GetCompositorBackendType(), GetFlags(),
|
||||
dom::ContentParentId(), mSerial, mExternalImageId);
|
||||
|
||||
if (!actor) {
|
||||
gfxCriticalNote << static_cast<int32_t>(desc.type()) << ", "
|
||||
|
|
@ -1055,7 +1055,8 @@ bool TextureClient::InitIPDLActor(CompositableForwarder* aForwarder) {
|
|||
return mActor->IPCOpen();
|
||||
}
|
||||
|
||||
bool TextureClient::InitIPDLActor(KnowsCompositor* aKnowsCompositor) {
|
||||
bool TextureClient::InitIPDLActor(KnowsCompositor* aKnowsCompositor,
|
||||
const dom::ContentParentId& aContentId) {
|
||||
MOZ_ASSERT(aKnowsCompositor &&
|
||||
aKnowsCompositor->GetTextureForwarder()->GetThread() ==
|
||||
mAllocator->GetThread());
|
||||
|
|
@ -1098,7 +1099,7 @@ bool TextureClient::InitIPDLActor(KnowsCompositor* aKnowsCompositor) {
|
|||
PTextureChild* actor =
|
||||
fwd->CreateTexture(desc, std::move(readLockDescriptor),
|
||||
aKnowsCompositor->GetCompositorBackendType(),
|
||||
GetFlags(), mSerial, mExternalImageId);
|
||||
GetFlags(), aContentId, mSerial, mExternalImageId);
|
||||
if (!actor) {
|
||||
gfxCriticalNote << static_cast<int32_t>(desc.type()) << ", "
|
||||
<< static_cast<int32_t>(
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
#include "mozilla/Attributes.h" // for override
|
||||
#include "mozilla/DebugOnly.h"
|
||||
#include "mozilla/RefPtr.h" // for RefPtr, RefCounted
|
||||
#include "mozilla/dom/ipc/IdType.h"
|
||||
#include "mozilla/gfx/2D.h" // for DrawTarget
|
||||
#include "mozilla/gfx/CriticalSection.h"
|
||||
#include "mozilla/gfx/Point.h" // for IntSize
|
||||
|
|
@ -554,7 +555,8 @@ class TextureClient : public AtomicRefCountedWithFinalize<TextureClient> {
|
|||
* Should be called only once per TextureClient.
|
||||
* The TextureClient must not be locked when calling this method.
|
||||
*/
|
||||
bool InitIPDLActor(KnowsCompositor* aKnowsCompositor);
|
||||
bool InitIPDLActor(KnowsCompositor* aKnowsCompositor,
|
||||
const dom::ContentParentId& aContentId);
|
||||
|
||||
/**
|
||||
* Return a pointer to the IPDLActor.
|
||||
|
|
|
|||
|
|
@ -17,8 +17,11 @@ namespace mozilla {
|
|||
namespace layers {
|
||||
|
||||
GPUVideoTextureHost::GPUVideoTextureHost(
|
||||
TextureFlags aFlags, const SurfaceDescriptorGPUVideo& aDescriptor)
|
||||
: TextureHost(TextureHostType::Unknown, aFlags), mDescriptor(aDescriptor) {
|
||||
const dom::ContentParentId& aContentId, TextureFlags aFlags,
|
||||
const SurfaceDescriptorGPUVideo& aDescriptor)
|
||||
: TextureHost(TextureHostType::Unknown, aFlags),
|
||||
mContentId(aContentId),
|
||||
mDescriptor(aDescriptor) {
|
||||
MOZ_COUNT_CTOR(GPUVideoTextureHost);
|
||||
}
|
||||
|
||||
|
|
@ -27,8 +30,9 @@ GPUVideoTextureHost::~GPUVideoTextureHost() {
|
|||
}
|
||||
|
||||
GPUVideoTextureHost* GPUVideoTextureHost::CreateFromDescriptor(
|
||||
TextureFlags aFlags, const SurfaceDescriptorGPUVideo& aDescriptor) {
|
||||
return new GPUVideoTextureHost(aFlags, aDescriptor);
|
||||
const dom::ContentParentId& aContentId, TextureFlags aFlags,
|
||||
const SurfaceDescriptorGPUVideo& aDescriptor) {
|
||||
return new GPUVideoTextureHost(aContentId, aFlags, aDescriptor);
|
||||
}
|
||||
|
||||
TextureHost* GPUVideoTextureHost::EnsureWrappedTextureHost() {
|
||||
|
|
@ -44,7 +48,8 @@ TextureHost* GPUVideoTextureHost::EnsureWrappedTextureHost() {
|
|||
// crashes.
|
||||
return nullptr;
|
||||
}
|
||||
mWrappedTextureHost = parent->LookupTexture(sd.handle());
|
||||
|
||||
mWrappedTextureHost = parent->LookupTexture(mContentId, sd.handle());
|
||||
|
||||
if (!mWrappedTextureHost) {
|
||||
// The TextureHost hasn't been registered yet. This is due to a race
|
||||
|
|
|
|||
|
|
@ -15,7 +15,8 @@ namespace layers {
|
|||
class GPUVideoTextureHost : public TextureHost {
|
||||
public:
|
||||
static GPUVideoTextureHost* CreateFromDescriptor(
|
||||
TextureFlags aFlags, const SurfaceDescriptorGPUVideo& aDescriptor);
|
||||
const dom::ContentParentId& aContentId, TextureFlags aFlags,
|
||||
const SurfaceDescriptorGPUVideo& aDescriptor);
|
||||
|
||||
virtual ~GPUVideoTextureHost();
|
||||
|
||||
|
|
@ -71,13 +72,17 @@ class GPUVideoTextureHost : public TextureHost {
|
|||
|
||||
bool NeedsDeferredDeletion() const override;
|
||||
|
||||
const dom::ContentParentId& GetContentId() const { return mContentId; }
|
||||
|
||||
protected:
|
||||
GPUVideoTextureHost(TextureFlags aFlags,
|
||||
GPUVideoTextureHost(const dom::ContentParentId& aContentId,
|
||||
TextureFlags aFlags,
|
||||
const SurfaceDescriptorGPUVideo& aDescriptor);
|
||||
|
||||
TextureHost* EnsureWrappedTextureHost();
|
||||
|
||||
RefPtr<TextureHost> mWrappedTextureHost;
|
||||
dom::ContentParentId mContentId;
|
||||
SurfaceDescriptorGPUVideo mDescriptor;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -72,7 +72,8 @@ namespace layers {
|
|||
*/
|
||||
class TextureParent : public ParentActor<PTextureParent> {
|
||||
public:
|
||||
TextureParent(HostIPCAllocator* aAllocator, uint64_t aSerial,
|
||||
TextureParent(HostIPCAllocator* aAllocator,
|
||||
const dom::ContentParentId& aContentId, uint64_t aSerial,
|
||||
const wr::MaybeExternalImageId& aExternalImageId);
|
||||
|
||||
virtual ~TextureParent();
|
||||
|
|
@ -90,10 +91,13 @@ class TextureParent : public ParentActor<PTextureParent> {
|
|||
|
||||
void Destroy() override;
|
||||
|
||||
const dom::ContentParentId& GetContentId() const { return mContentId; }
|
||||
|
||||
uint64_t GetSerial() const { return mSerial; }
|
||||
|
||||
HostIPCAllocator* mSurfaceAllocator;
|
||||
RefPtr<TextureHost> mTextureHost;
|
||||
dom::ContentParentId mContentId;
|
||||
// mSerial is unique in TextureClient's process.
|
||||
const uint64_t mSerial;
|
||||
wr::MaybeExternalImageId mExternalImageId;
|
||||
|
|
@ -117,10 +121,10 @@ static bool WrapWithWebRenderTextureHost(ISurfaceAllocator* aDeallocator,
|
|||
PTextureParent* TextureHost::CreateIPDLActor(
|
||||
HostIPCAllocator* aAllocator, const SurfaceDescriptor& aSharedData,
|
||||
ReadLockDescriptor&& aReadLock, LayersBackend aLayersBackend,
|
||||
TextureFlags aFlags, uint64_t aSerial,
|
||||
const wr::MaybeExternalImageId& aExternalImageId) {
|
||||
TextureFlags aFlags, const dom::ContentParentId& aContentId,
|
||||
uint64_t aSerial, const wr::MaybeExternalImageId& aExternalImageId) {
|
||||
TextureParent* actor =
|
||||
new TextureParent(aAllocator, aSerial, aExternalImageId);
|
||||
new TextureParent(aAllocator, aContentId, aSerial, aExternalImageId);
|
||||
if (!actor->Init(aSharedData, std::move(aReadLock), aLayersBackend, aFlags)) {
|
||||
actor->ActorDestroy(ipc::IProtocol::ActorDestroyReason::FailedConstructor);
|
||||
delete actor;
|
||||
|
|
@ -156,6 +160,14 @@ uint64_t TextureHost::GetTextureSerial(PTextureParent* actor) {
|
|||
return static_cast<TextureParent*>(actor)->mSerial;
|
||||
}
|
||||
|
||||
// static
|
||||
dom::ContentParentId TextureHost::GetTextureContentId(PTextureParent* actor) {
|
||||
if (!actor) {
|
||||
return dom::ContentParentId();
|
||||
}
|
||||
return static_cast<TextureParent*>(actor)->mContentId;
|
||||
}
|
||||
|
||||
PTextureParent* TextureHost::GetIPDLActor() { return mActor; }
|
||||
|
||||
void TextureHost::SetLastFwdTransactionId(uint64_t aTransactionId) {
|
||||
|
|
@ -344,7 +356,8 @@ already_AddRefed<TextureHost> CreateBackendIndependentTextureHost(
|
|||
MOZ_ASSERT(aDesc.get_SurfaceDescriptorGPUVideo().type() ==
|
||||
SurfaceDescriptorGPUVideo::TSurfaceDescriptorRemoteDecoder);
|
||||
result = GPUVideoTextureHost::CreateFromDescriptor(
|
||||
aFlags, aDesc.get_SurfaceDescriptorGPUVideo());
|
||||
aDeallocator->GetContentId(), aFlags,
|
||||
aDesc.get_SurfaceDescriptorGPUVideo());
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
|
|
@ -822,9 +835,11 @@ size_t MemoryTextureHost::GetBufferSize() {
|
|||
}
|
||||
|
||||
TextureParent::TextureParent(HostIPCAllocator* aSurfaceAllocator,
|
||||
const dom::ContentParentId& aContentId,
|
||||
uint64_t aSerial,
|
||||
const wr::MaybeExternalImageId& aExternalImageId)
|
||||
: mSurfaceAllocator(aSurfaceAllocator),
|
||||
mContentId(aContentId),
|
||||
mSerial(aSerial),
|
||||
mExternalImageId(aExternalImageId) {
|
||||
MOZ_COUNT_CTOR(TextureParent);
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
#include "mozilla/Assertions.h" // for MOZ_ASSERT, etc
|
||||
#include "mozilla/Attributes.h" // for override
|
||||
#include "mozilla/RefPtr.h" // for RefPtr, already_AddRefed, etc
|
||||
#include "mozilla/dom/ipc/IdType.h"
|
||||
#include "mozilla/gfx/Logging.h"
|
||||
#include "mozilla/gfx/Matrix.h"
|
||||
#include "mozilla/gfx/Point.h" // for IntSize, IntPoint
|
||||
|
|
@ -528,8 +529,8 @@ class TextureHost : public AtomicRefCountedWithFinalize<TextureHost> {
|
|||
static PTextureParent* CreateIPDLActor(
|
||||
HostIPCAllocator* aAllocator, const SurfaceDescriptor& aSharedData,
|
||||
ReadLockDescriptor&& aDescriptor, LayersBackend aLayersBackend,
|
||||
TextureFlags aFlags, uint64_t aSerial,
|
||||
const wr::MaybeExternalImageId& aExternalImageId);
|
||||
TextureFlags aFlags, const dom::ContentParentId& aContentId,
|
||||
uint64_t aSerial, const wr::MaybeExternalImageId& aExternalImageId);
|
||||
static bool DestroyIPDLActor(PTextureParent* actor);
|
||||
|
||||
/**
|
||||
|
|
@ -546,6 +547,8 @@ class TextureHost : public AtomicRefCountedWithFinalize<TextureHost> {
|
|||
|
||||
static uint64_t GetTextureSerial(PTextureParent* actor);
|
||||
|
||||
static dom::ContentParentId GetTextureContentId(PTextureParent* actor);
|
||||
|
||||
/**
|
||||
* Return a pointer to the IPDLActor.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -504,7 +504,8 @@ CompositorBridgeChild::GetTileLockAllocator() {
|
|||
|
||||
PTextureChild* CompositorBridgeChild::CreateTexture(
|
||||
const SurfaceDescriptor& aSharedData, ReadLockDescriptor&& aReadLock,
|
||||
LayersBackend aLayersBackend, TextureFlags aFlags, uint64_t aSerial,
|
||||
LayersBackend aLayersBackend, TextureFlags aFlags,
|
||||
const dom::ContentParentId& aContentId, uint64_t aSerial,
|
||||
wr::MaybeExternalImageId& aExternalImageId) {
|
||||
PTextureChild* textureChild =
|
||||
AllocPTextureChild(aSharedData, aReadLock, aLayersBackend, aFlags,
|
||||
|
|
|
|||
|
|
@ -97,7 +97,8 @@ class CompositorBridgeChild final : public PCompositorBridgeChild,
|
|||
nsTArray<AsyncParentMessageData>&& aMessages);
|
||||
PTextureChild* CreateTexture(
|
||||
const SurfaceDescriptor& aSharedData, ReadLockDescriptor&& aReadLock,
|
||||
LayersBackend aLayersBackend, TextureFlags aFlags, uint64_t aSerial,
|
||||
LayersBackend aLayersBackend, TextureFlags aFlags,
|
||||
const dom::ContentParentId& aContentId, uint64_t aSerial,
|
||||
wr::MaybeExternalImageId& aExternalImageId) override;
|
||||
|
||||
already_AddRefed<CanvasChild> GetCanvasChild() final;
|
||||
|
|
|
|||
|
|
@ -119,6 +119,10 @@ CompositorBridgeParentBase::~CompositorBridgeParentBase() = default;
|
|||
|
||||
ProcessId CompositorBridgeParentBase::GetChildProcessId() { return OtherPid(); }
|
||||
|
||||
dom::ContentParentId CompositorBridgeParentBase::GetContentId() {
|
||||
return mCompositorManager->GetContentId();
|
||||
}
|
||||
|
||||
void CompositorBridgeParentBase::NotifyNotUsed(PTextureParent* aTexture,
|
||||
uint64_t aTransactionId) {
|
||||
RefPtr<TextureHost> texture = TextureHost::AsTextureHost(aTexture);
|
||||
|
|
@ -1725,9 +1729,9 @@ PTextureParent* CompositorBridgeParent::AllocPTextureParent(
|
|||
const LayersBackend& aLayersBackend, const TextureFlags& aFlags,
|
||||
const LayersId& aId, const uint64_t& aSerial,
|
||||
const wr::MaybeExternalImageId& aExternalImageId) {
|
||||
return TextureHost::CreateIPDLActor(this, aSharedData, std::move(aReadLock),
|
||||
aLayersBackend, aFlags, aSerial,
|
||||
aExternalImageId);
|
||||
return TextureHost::CreateIPDLActor(
|
||||
this, aSharedData, std::move(aReadLock), aLayersBackend, aFlags,
|
||||
mCompositorManager->GetContentId(), aSerial, aExternalImageId);
|
||||
}
|
||||
|
||||
bool CompositorBridgeParent::DeallocPTextureParent(PTextureParent* actor) {
|
||||
|
|
|
|||
|
|
@ -124,6 +124,7 @@ class CompositorBridgeParentBase : public PCompositorBridgeParent,
|
|||
|
||||
// HostIPCAllocator
|
||||
base::ProcessId GetChildProcessId() override;
|
||||
dom::ContentParentId GetContentId() override;
|
||||
void NotifyNotUsed(PTextureParent* aTexture,
|
||||
uint64_t aTransactionId) override;
|
||||
void SendAsyncMessage(
|
||||
|
|
@ -210,7 +211,7 @@ class CompositorBridgeParentBase : public PCompositorBridgeParent,
|
|||
|
||||
bool mCanSend;
|
||||
|
||||
private:
|
||||
protected:
|
||||
RefPtr<CompositorManagerParent> mCompositorManager;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -47,14 +47,16 @@ CompositorManagerParent::CreateSameProcess() {
|
|||
// The child is responsible for setting up the IPC channel in the same
|
||||
// process case because if we open from the child perspective, we can do it
|
||||
// on the main thread and complete before we return the manager handles.
|
||||
RefPtr<CompositorManagerParent> parent = new CompositorManagerParent();
|
||||
RefPtr<CompositorManagerParent> parent =
|
||||
new CompositorManagerParent(dom::ContentParentId());
|
||||
parent->SetOtherProcessId(base::GetCurrentProcId());
|
||||
return parent.forget();
|
||||
}
|
||||
|
||||
/* static */
|
||||
bool CompositorManagerParent::Create(
|
||||
Endpoint<PCompositorManagerParent>&& aEndpoint, bool aIsRoot) {
|
||||
Endpoint<PCompositorManagerParent>&& aEndpoint,
|
||||
dom::ContentParentId aChildId, bool aIsRoot) {
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
// We are creating a manager for the another process, inside the GPU process
|
||||
|
|
@ -65,7 +67,8 @@ bool CompositorManagerParent::Create(
|
|||
return false;
|
||||
}
|
||||
|
||||
RefPtr<CompositorManagerParent> bridge = new CompositorManagerParent();
|
||||
RefPtr<CompositorManagerParent> bridge =
|
||||
new CompositorManagerParent(aChildId);
|
||||
|
||||
RefPtr<Runnable> runnable =
|
||||
NewRunnableMethod<Endpoint<PCompositorManagerParent>&&, bool>(
|
||||
|
|
@ -115,8 +118,10 @@ CompositorManagerParent::CreateSameProcessWidgetCompositorBridge(
|
|||
return bridge.forget();
|
||||
}
|
||||
|
||||
CompositorManagerParent::CompositorManagerParent()
|
||||
: mCompositorThreadHolder(CompositorThreadHolder::GetSingleton()) {}
|
||||
CompositorManagerParent::CompositorManagerParent(
|
||||
dom::ContentParentId aContentId)
|
||||
: mContentId(aContentId),
|
||||
mCompositorThreadHolder(CompositorThreadHolder::GetSingleton()) {}
|
||||
|
||||
CompositorManagerParent::~CompositorManagerParent() = default;
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
#include "mozilla/StaticPtr.h" // for StaticRefPtr
|
||||
#include "mozilla/StaticMutex.h" // for StaticMutex
|
||||
#include "mozilla/RefPtr.h" // for already_AddRefed
|
||||
#include "mozilla/dom/ipc/IdType.h"
|
||||
#include "mozilla/layers/PCompositorManagerParent.h"
|
||||
#include "nsTArray.h" // for AutoTArray
|
||||
|
||||
|
|
@ -31,7 +32,7 @@ class CompositorManagerParent final : public PCompositorManagerParent {
|
|||
public:
|
||||
static already_AddRefed<CompositorManagerParent> CreateSameProcess();
|
||||
static bool Create(Endpoint<PCompositorManagerParent>&& aEndpoint,
|
||||
bool aIsRoot);
|
||||
dom::ContentParentId aContentId, bool aIsRoot);
|
||||
static void Shutdown();
|
||||
|
||||
static already_AddRefed<CompositorBridgeParent>
|
||||
|
|
@ -63,6 +64,8 @@ class CompositorManagerParent final : public PCompositorManagerParent {
|
|||
|
||||
static void NotifyWebRenderError(wr::WebRenderError aError);
|
||||
|
||||
const dom::ContentParentId& GetContentId() const { return mContentId; }
|
||||
|
||||
private:
|
||||
static StaticRefPtr<CompositorManagerParent> sInstance;
|
||||
static StaticMutex sMutex MOZ_UNANNOTATED;
|
||||
|
|
@ -72,13 +75,15 @@ class CompositorManagerParent final : public PCompositorManagerParent {
|
|||
static void ShutdownInternal();
|
||||
#endif
|
||||
|
||||
CompositorManagerParent();
|
||||
explicit CompositorManagerParent(dom::ContentParentId aChildId);
|
||||
virtual ~CompositorManagerParent();
|
||||
|
||||
void Bind(Endpoint<PCompositorManagerParent>&& aEndpoint, bool aIsRoot);
|
||||
|
||||
void DeferredDestroy();
|
||||
|
||||
dom::ContentParentId mContentId;
|
||||
|
||||
RefPtr<CompositorThreadHolder> mCompositorThreadHolder;
|
||||
|
||||
AutoTArray<RefPtr<CompositorBridgeParent>, 1> mPendingCompositorBridges;
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
#include "mozilla/layers/AnimationHelper.h" // for CompositorAnimationStorage
|
||||
#include "mozilla/layers/APZCTreeManagerParent.h" // for APZCTreeManagerParent
|
||||
#include "mozilla/layers/APZUpdater.h" // for APZUpdater
|
||||
#include "mozilla/layers/CompositorManagerParent.h"
|
||||
#include "mozilla/layers/CompositorOptions.h"
|
||||
#include "mozilla/layers/CompositorThread.h"
|
||||
#include "mozilla/layers/LayerTreeOwnerTracker.h"
|
||||
|
|
@ -403,9 +404,9 @@ PTextureParent* ContentCompositorBridgeParent::AllocPTextureParent(
|
|||
<< "Texture backend is wrong";
|
||||
}
|
||||
|
||||
return TextureHost::CreateIPDLActor(this, aSharedData, std::move(aReadLock),
|
||||
aLayersBackend, aFlags, aSerial,
|
||||
aExternalImageId);
|
||||
return TextureHost::CreateIPDLActor(
|
||||
this, aSharedData, std::move(aReadLock), aLayersBackend, aFlags,
|
||||
mCompositorManager->GetContentId(), aSerial, aExternalImageId);
|
||||
}
|
||||
|
||||
bool ContentCompositorBridgeParent::DeallocPTextureParent(
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
#include <stddef.h> // for size_t
|
||||
#include <stdint.h> // for uint32_t
|
||||
#include "gfxTypes.h"
|
||||
#include "mozilla/dom/ipc/IdType.h"
|
||||
#include "mozilla/gfx/Point.h" // for IntSize
|
||||
#include "mozilla/ipc/SharedMemory.h" // for SharedMemory, etc
|
||||
#include "mozilla/RefPtr.h"
|
||||
|
|
@ -101,6 +102,8 @@ class ISurfaceAllocator {
|
|||
|
||||
virtual bool UsesWebRenderBridge() const { return false; }
|
||||
|
||||
virtual dom::ContentParentId GetContentId() { return dom::ContentParentId(); }
|
||||
|
||||
protected:
|
||||
void Finalize() {}
|
||||
|
||||
|
|
|
|||
|
|
@ -826,7 +826,8 @@ mozilla::ipc::IPCResult ImageBridgeChild::RecvReportFramesDropped(
|
|||
|
||||
PTextureChild* ImageBridgeChild::CreateTexture(
|
||||
const SurfaceDescriptor& aSharedData, ReadLockDescriptor&& aReadLock,
|
||||
LayersBackend aLayersBackend, TextureFlags aFlags, uint64_t aSerial,
|
||||
LayersBackend aLayersBackend, TextureFlags aFlags,
|
||||
const dom::ContentParentId& aContentId, uint64_t aSerial,
|
||||
wr::MaybeExternalImageId& aExternalImageId) {
|
||||
MOZ_ASSERT(CanSend());
|
||||
return SendPTextureConstructor(aSharedData, std::move(aReadLock),
|
||||
|
|
|
|||
|
|
@ -302,7 +302,8 @@ class ImageBridgeChild final : public PImageBridgeChild,
|
|||
|
||||
PTextureChild* CreateTexture(
|
||||
const SurfaceDescriptor& aSharedData, ReadLockDescriptor&& aReadLock,
|
||||
LayersBackend aLayersBackend, TextureFlags aFlags, uint64_t aSerial,
|
||||
LayersBackend aLayersBackend, TextureFlags aFlags,
|
||||
const dom::ContentParentId& aContentId, uint64_t aSerial,
|
||||
wr::MaybeExternalImageId& aExternalImageId) override;
|
||||
|
||||
bool IsSameProcess() const override;
|
||||
|
|
|
|||
|
|
@ -62,8 +62,10 @@ void ImageBridgeParent::Setup() {
|
|||
}
|
||||
|
||||
ImageBridgeParent::ImageBridgeParent(nsISerialEventTarget* aThread,
|
||||
ProcessId aChildProcessId)
|
||||
ProcessId aChildProcessId,
|
||||
dom::ContentParentId aContentId)
|
||||
: mThread(aThread),
|
||||
mContentId(aContentId),
|
||||
mClosed(false),
|
||||
mCompositorThreadHolder(CompositorThreadHolder::GetSingleton()) {
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
|
@ -76,7 +78,7 @@ ImageBridgeParent::~ImageBridgeParent() = default;
|
|||
ImageBridgeParent* ImageBridgeParent::CreateSameProcess() {
|
||||
base::ProcessId pid = base::GetCurrentProcId();
|
||||
RefPtr<ImageBridgeParent> parent =
|
||||
new ImageBridgeParent(CompositorThread(), pid);
|
||||
new ImageBridgeParent(CompositorThread(), pid, dom::ContentParentId());
|
||||
|
||||
{
|
||||
MonitorAutoLock lock(*sImageBridgesLock);
|
||||
|
|
@ -98,8 +100,8 @@ bool ImageBridgeParent::CreateForGPUProcess(
|
|||
return false;
|
||||
}
|
||||
|
||||
RefPtr<ImageBridgeParent> parent =
|
||||
new ImageBridgeParent(compositorThread, aEndpoint.OtherPid());
|
||||
RefPtr<ImageBridgeParent> parent = new ImageBridgeParent(
|
||||
compositorThread, aEndpoint.OtherPid(), dom::ContentParentId());
|
||||
|
||||
compositorThread->Dispatch(NewRunnableMethod<Endpoint<PImageBridgeParent>&&>(
|
||||
"layers::ImageBridgeParent::Bind", parent, &ImageBridgeParent::Bind,
|
||||
|
|
@ -215,14 +217,14 @@ mozilla::ipc::IPCResult ImageBridgeParent::RecvUpdate(
|
|||
|
||||
/* static */
|
||||
bool ImageBridgeParent::CreateForContent(
|
||||
Endpoint<PImageBridgeParent>&& aEndpoint) {
|
||||
Endpoint<PImageBridgeParent>&& aEndpoint, dom::ContentParentId aContentId) {
|
||||
nsCOMPtr<nsISerialEventTarget> compositorThread = CompositorThread();
|
||||
if (!compositorThread) {
|
||||
return false;
|
||||
}
|
||||
|
||||
RefPtr<ImageBridgeParent> bridge =
|
||||
new ImageBridgeParent(compositorThread, aEndpoint.OtherPid());
|
||||
new ImageBridgeParent(compositorThread, aEndpoint.OtherPid(), aContentId);
|
||||
compositorThread->Dispatch(NewRunnableMethod<Endpoint<PImageBridgeParent>&&>(
|
||||
"layers::ImageBridgeParent::Bind", bridge, &ImageBridgeParent::Bind,
|
||||
std::move(aEndpoint)));
|
||||
|
|
@ -292,8 +294,8 @@ PTextureParent* ImageBridgeParent::AllocPTextureParent(
|
|||
const LayersBackend& aLayersBackend, const TextureFlags& aFlags,
|
||||
const uint64_t& aSerial, const wr::MaybeExternalImageId& aExternalImageId) {
|
||||
return TextureHost::CreateIPDLActor(this, aSharedData, std::move(aReadLock),
|
||||
aLayersBackend, aFlags, aSerial,
|
||||
aExternalImageId);
|
||||
aLayersBackend, aFlags, mContentId,
|
||||
aSerial, aExternalImageId);
|
||||
}
|
||||
|
||||
bool ImageBridgeParent::DeallocPTextureParent(PTextureParent* actor) {
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
#include "CompositableTransactionParent.h"
|
||||
#include "mozilla/Assertions.h" // for MOZ_ASSERT_HELPER2
|
||||
#include "mozilla/Attributes.h" // for override
|
||||
#include "mozilla/dom/ipc/IdType.h"
|
||||
#include "mozilla/ipc/ProtocolUtils.h"
|
||||
#include "mozilla/ipc/SharedMemory.h" // for SharedMemory, etc
|
||||
#include "mozilla/layers/CompositorThread.h"
|
||||
|
|
@ -39,7 +40,8 @@ class ImageBridgeParent final : public PImageBridgeParent,
|
|||
typedef nsTArray<OpDestroy> OpDestroyArray;
|
||||
|
||||
protected:
|
||||
ImageBridgeParent(nsISerialEventTarget* aThread, ProcessId aChildProcessId);
|
||||
ImageBridgeParent(nsISerialEventTarget* aThread, ProcessId aChildProcessId,
|
||||
dom::ContentParentId aContentId);
|
||||
|
||||
public:
|
||||
NS_IMETHOD_(MozExternalRefCountType) AddRef() override {
|
||||
|
|
@ -56,7 +58,8 @@ class ImageBridgeParent final : public PImageBridgeParent,
|
|||
|
||||
static ImageBridgeParent* CreateSameProcess();
|
||||
static bool CreateForGPUProcess(Endpoint<PImageBridgeParent>&& aEndpoint);
|
||||
static bool CreateForContent(Endpoint<PImageBridgeParent>&& aEndpoint);
|
||||
static bool CreateForContent(Endpoint<PImageBridgeParent>&& aEndpoint,
|
||||
dom::ContentParentId aContentId);
|
||||
static void Shutdown();
|
||||
|
||||
IShmemAllocator* AsShmemAllocator() override { return this; }
|
||||
|
|
@ -71,6 +74,7 @@ class ImageBridgeParent final : public PImageBridgeParent,
|
|||
uint64_t aTransactionId) override;
|
||||
|
||||
base::ProcessId GetChildProcessId() override { return OtherPid(); }
|
||||
dom::ContentParentId GetContentId() override { return mContentId; }
|
||||
|
||||
// PImageBridge
|
||||
mozilla::ipc::IPCResult RecvUpdate(EditArray&& aEdits,
|
||||
|
|
@ -128,6 +132,8 @@ class ImageBridgeParent final : public PImageBridgeParent,
|
|||
void DeferredDestroy();
|
||||
nsCOMPtr<nsISerialEventTarget> mThread;
|
||||
|
||||
dom::ContentParentId mContentId;
|
||||
|
||||
bool mClosed;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ include protocol PTexture;
|
|||
include "mozilla/GfxMessageUtils.h";
|
||||
include "mozilla/layers/LayersMessageUtils.h";
|
||||
|
||||
using mozilla::dom::ContentParentId from "mozilla/dom/ipc/IdType.h";
|
||||
using mozilla::layers::TextureFlags from "mozilla/layers/CompositorTypes.h";
|
||||
|
||||
namespace mozilla {
|
||||
|
|
@ -25,8 +26,12 @@ sync protocol PVideoBridge
|
|||
manages PTexture;
|
||||
|
||||
parent:
|
||||
/**
|
||||
* Since PVideoBridge creates textures on behalf of another process, we also
|
||||
* supply ContentParentId of the owning content process.
|
||||
*/
|
||||
async PTexture(SurfaceDescriptor aSharedData, ReadLockDescriptor aReadLock, LayersBackend aBackend,
|
||||
TextureFlags aTextureFlags, uint64_t aSerial);
|
||||
TextureFlags aTextureFlags, ContentParentId aContentId, uint64_t aSerial);
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
#include <stdint.h> // for int32_t, uint64_t
|
||||
#include "gfxTypes.h"
|
||||
#include "mozilla/dom/ipc/IdType.h"
|
||||
#include "mozilla/ipc/ProtocolUtils.h"
|
||||
#include "mozilla/layers/LayersMessages.h" // for Edit, etc
|
||||
#include "mozilla/layers/LayersTypes.h" // for LayersBackend
|
||||
|
|
@ -75,7 +76,8 @@ class TextureForwarder : public LayersIPCChannel {
|
|||
*/
|
||||
virtual PTextureChild* CreateTexture(
|
||||
const SurfaceDescriptor& aSharedData, ReadLockDescriptor&& aReadLock,
|
||||
LayersBackend aLayersBackend, TextureFlags aFlags, uint64_t aSerial,
|
||||
LayersBackend aLayersBackend, TextureFlags aFlags,
|
||||
const dom::ContentParentId& aContentId, uint64_t aSerial,
|
||||
wr::MaybeExternalImageId& aExternalImageId) = 0;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -145,11 +145,10 @@ bool VideoBridgeChild::DeallocShmem(ipc::Shmem& aShmem) {
|
|||
return result;
|
||||
}
|
||||
|
||||
PTextureChild* VideoBridgeChild::AllocPTextureChild(const SurfaceDescriptor&,
|
||||
ReadLockDescriptor&,
|
||||
const LayersBackend&,
|
||||
const TextureFlags&,
|
||||
const uint64_t& aSerial) {
|
||||
PTextureChild* VideoBridgeChild::AllocPTextureChild(
|
||||
const SurfaceDescriptor&, ReadLockDescriptor&, const LayersBackend&,
|
||||
const TextureFlags&, const dom::ContentParentId& aContentId,
|
||||
const uint64_t& aSerial) {
|
||||
MOZ_ASSERT(CanSend());
|
||||
return TextureClient::CreateIPDLActor();
|
||||
}
|
||||
|
|
@ -164,11 +163,12 @@ void VideoBridgeChild::ActorDestroy(ActorDestroyReason aWhy) {
|
|||
|
||||
PTextureChild* VideoBridgeChild::CreateTexture(
|
||||
const SurfaceDescriptor& aSharedData, ReadLockDescriptor&& aReadLock,
|
||||
LayersBackend aLayersBackend, TextureFlags aFlags, uint64_t aSerial,
|
||||
LayersBackend aLayersBackend, TextureFlags aFlags,
|
||||
const dom::ContentParentId& aContentId, uint64_t aSerial,
|
||||
wr::MaybeExternalImageId& aExternalImageId) {
|
||||
MOZ_ASSERT(CanSend());
|
||||
return SendPTextureConstructor(aSharedData, std::move(aReadLock),
|
||||
aLayersBackend, aFlags, aSerial);
|
||||
aLayersBackend, aFlags, aContentId, aSerial);
|
||||
}
|
||||
|
||||
bool VideoBridgeChild::IsSameProcess() const {
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ class VideoBridgeChild final : public PVideoBridgeChild,
|
|||
ReadLockDescriptor& aReadLock,
|
||||
const LayersBackend& aLayersBackend,
|
||||
const TextureFlags& aFlags,
|
||||
const dom::ContentParentId& aContentId,
|
||||
const uint64_t& aSerial);
|
||||
bool DeallocPTextureChild(PTextureChild* actor);
|
||||
|
||||
|
|
@ -45,7 +46,8 @@ class VideoBridgeChild final : public PVideoBridgeChild,
|
|||
// TextureForwarder
|
||||
PTextureChild* CreateTexture(
|
||||
const SurfaceDescriptor& aSharedData, ReadLockDescriptor&& aReadLock,
|
||||
LayersBackend aLayersBackend, TextureFlags aFlags, uint64_t aSerial,
|
||||
LayersBackend aLayersBackend, TextureFlags aFlags,
|
||||
const dom::ContentParentId& aContentId, uint64_t aSerial,
|
||||
wr::MaybeExternalImageId& aExternalImageId) override;
|
||||
|
||||
// ClientIPCAllocator
|
||||
|
|
|
|||
|
|
@ -84,9 +84,19 @@ VideoBridgeParent* VideoBridgeParent::GetSingleton(
|
|||
}
|
||||
}
|
||||
|
||||
TextureHost* VideoBridgeParent::LookupTexture(uint64_t aSerial) {
|
||||
TextureHost* VideoBridgeParent::LookupTexture(
|
||||
const dom::ContentParentId& aContentId, uint64_t aSerial) {
|
||||
MOZ_DIAGNOSTIC_ASSERT(CompositorThread() &&
|
||||
CompositorThread()->IsOnCurrentThread());
|
||||
auto* actor = mTextureMap[aSerial];
|
||||
if (NS_WARN_IF(!actor)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (NS_WARN_IF(aContentId != TextureHost::GetTextureContentId(actor))) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return TextureHost::AsTextureHost(mTextureMap[aSerial]);
|
||||
}
|
||||
|
||||
|
|
@ -146,10 +156,10 @@ void VideoBridgeParent::ReleaseCompositorThread() {
|
|||
PTextureParent* VideoBridgeParent::AllocPTextureParent(
|
||||
const SurfaceDescriptor& aSharedData, ReadLockDescriptor& aReadLock,
|
||||
const LayersBackend& aLayersBackend, const TextureFlags& aFlags,
|
||||
const uint64_t& aSerial) {
|
||||
PTextureParent* parent =
|
||||
TextureHost::CreateIPDLActor(this, aSharedData, std::move(aReadLock),
|
||||
aLayersBackend, aFlags, aSerial, Nothing());
|
||||
const dom::ContentParentId& aContentId, const uint64_t& aSerial) {
|
||||
PTextureParent* parent = TextureHost::CreateIPDLActor(
|
||||
this, aSharedData, std::move(aReadLock), aLayersBackend, aFlags,
|
||||
aContentId, aSerial, Nothing());
|
||||
|
||||
if (!parent) {
|
||||
return nullptr;
|
||||
|
|
|
|||
|
|
@ -30,7 +30,8 @@ class VideoBridgeParent final : public PVideoBridgeParent,
|
|||
static void Shutdown();
|
||||
static void UnregisterExternalImages();
|
||||
|
||||
TextureHost* LookupTexture(uint64_t aSerial);
|
||||
TextureHost* LookupTexture(const dom::ContentParentId& aContentId,
|
||||
uint64_t aSerial);
|
||||
|
||||
// PVideoBridgeParent
|
||||
void ActorDestroy(ActorDestroyReason aWhy) override;
|
||||
|
|
@ -38,6 +39,7 @@ class VideoBridgeParent final : public PVideoBridgeParent,
|
|||
ReadLockDescriptor& aReadLock,
|
||||
const LayersBackend& aLayersBackend,
|
||||
const TextureFlags& aFlags,
|
||||
const dom::ContentParentId& aContentId,
|
||||
const uint64_t& aSerial);
|
||||
bool DeallocPTextureParent(PTextureParent* actor);
|
||||
|
||||
|
|
|
|||
|
|
@ -2755,6 +2755,11 @@ base::ProcessId WebRenderBridgeParent::GetChildProcessId() {
|
|||
return OtherPid();
|
||||
}
|
||||
|
||||
dom::ContentParentId WebRenderBridgeParent::GetContentId() {
|
||||
MOZ_ASSERT(mCompositorBridge);
|
||||
return mCompositorBridge->GetContentId();
|
||||
}
|
||||
|
||||
bool WebRenderBridgeParent::IsSameProcess() const {
|
||||
return OtherPid() == base::GetCurrentProcId();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -191,6 +191,7 @@ class WebRenderBridgeParent final : public PWebRenderBridgeParent,
|
|||
// CompositableParentManager
|
||||
bool IsSameProcess() const override;
|
||||
base::ProcessId GetChildProcessId() override;
|
||||
dom::ContentParentId GetContentId() override;
|
||||
void NotifyNotUsed(PTextureParent* aTexture,
|
||||
uint64_t aTransactionId) override;
|
||||
void SendAsyncMessage(
|
||||
|
|
|
|||
|
|
@ -520,7 +520,10 @@ void WebRenderLayerManager::MakeSnapshotIfRequired(LayoutDeviceIntSize aSize) {
|
|||
return;
|
||||
}
|
||||
|
||||
texture->InitIPDLActor(WrBridge());
|
||||
// The other side knows our ContentParentId and WebRenderBridgeChild will
|
||||
// ignore the one provided here in favour of what WebRenderBridgeParent
|
||||
// already has.
|
||||
texture->InitIPDLActor(WrBridge(), dom::ContentParentId());
|
||||
if (!texture->GetIPDLActor()) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,8 +27,10 @@ namespace gfx {
|
|||
void ReleaseVRManagerParentSingleton();
|
||||
|
||||
VRManagerParent::VRManagerParent(ProcessId aChildProcessId,
|
||||
dom::ContentParentId aChildId,
|
||||
bool aIsContentChild)
|
||||
: mHaveEventListener(false),
|
||||
: mChildId(aChildId),
|
||||
mHaveEventListener(false),
|
||||
mHaveControllerListener(false),
|
||||
mIsContentChild(aIsContentChild),
|
||||
mVRActiveStatus(false) {
|
||||
|
|
@ -79,12 +81,14 @@ void VRManagerParent::UnregisterFromManager() {
|
|||
}
|
||||
|
||||
/* static */
|
||||
bool VRManagerParent::CreateForContent(Endpoint<PVRManagerParent>&& aEndpoint) {
|
||||
bool VRManagerParent::CreateForContent(Endpoint<PVRManagerParent>&& aEndpoint,
|
||||
dom::ContentParentId aChildId) {
|
||||
if (!CompositorThread()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
RefPtr<VRManagerParent> vmp = new VRManagerParent(aEndpoint.OtherPid(), true);
|
||||
RefPtr<VRManagerParent> vmp =
|
||||
new VRManagerParent(aEndpoint.OtherPid(), aChildId, true);
|
||||
CompositorThread()->Dispatch(NewRunnableMethod<Endpoint<PVRManagerParent>&&>(
|
||||
"gfx::VRManagerParent::Bind", vmp, &VRManagerParent::Bind,
|
||||
std::move(aEndpoint)));
|
||||
|
|
@ -109,8 +113,8 @@ void VRManagerParent::RegisterVRManagerInCompositorThread(
|
|||
|
||||
/*static*/
|
||||
already_AddRefed<VRManagerParent> VRManagerParent::CreateSameProcess() {
|
||||
RefPtr<VRManagerParent> vmp =
|
||||
new VRManagerParent(base::GetCurrentProcId(), false);
|
||||
RefPtr<VRManagerParent> vmp = new VRManagerParent(
|
||||
base::GetCurrentProcId(), dom::ContentParentId(), false);
|
||||
vmp->mCompositorThreadHolder = CompositorThreadHolder::GetSingleton();
|
||||
CompositorThread()->Dispatch(
|
||||
NewRunnableFunction("RegisterVRManagerIncompositorThreadRunnable",
|
||||
|
|
@ -121,7 +125,7 @@ already_AddRefed<VRManagerParent> VRManagerParent::CreateSameProcess() {
|
|||
bool VRManagerParent::CreateForGPUProcess(
|
||||
Endpoint<PVRManagerParent>&& aEndpoint) {
|
||||
RefPtr<VRManagerParent> vmp =
|
||||
new VRManagerParent(aEndpoint.OtherPid(), false);
|
||||
new VRManagerParent(aEndpoint.OtherPid(), dom::ContentParentId(), false);
|
||||
vmp->mCompositorThreadHolder = CompositorThreadHolder::GetSingleton();
|
||||
CompositorThread()->Dispatch(NewRunnableMethod<Endpoint<PVRManagerParent>&&>(
|
||||
"gfx::VRManagerParent::Bind", vmp, &VRManagerParent::Bind,
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
#ifndef MOZILLA_GFX_VR_VRMANAGERPARENT_H
|
||||
#define MOZILLA_GFX_VR_VRMANAGERPARENT_H
|
||||
|
||||
#include "mozilla/dom/ipc/IdType.h"
|
||||
#include "mozilla/layers/CompositorThread.h" // for CompositorThreadHolder
|
||||
#include "mozilla/layers/CompositableTransactionParent.h" // need?
|
||||
#include "mozilla/gfx/PVRManagerParent.h" // for PVRManagerParent
|
||||
|
|
@ -27,11 +28,13 @@ class VRManagerParent final : public PVRManagerParent {
|
|||
friend class PVRManagerParent;
|
||||
|
||||
public:
|
||||
explicit VRManagerParent(ProcessId aChildProcessId, bool aIsContentChild);
|
||||
explicit VRManagerParent(ProcessId aChildProcessId,
|
||||
dom::ContentParentId aChildId, bool aIsContentChild);
|
||||
|
||||
static already_AddRefed<VRManagerParent> CreateSameProcess();
|
||||
static bool CreateForGPUProcess(Endpoint<PVRManagerParent>&& aEndpoint);
|
||||
static bool CreateForContent(Endpoint<PVRManagerParent>&& aEndpoint);
|
||||
static bool CreateForContent(Endpoint<PVRManagerParent>&& aEndpoint,
|
||||
dom::ContentParentId aChildId);
|
||||
static void Shutdown();
|
||||
|
||||
bool IsSameProcess() const;
|
||||
|
|
@ -85,6 +88,7 @@ class VRManagerParent final : public PVRManagerParent {
|
|||
|
||||
// Keep the VRManager alive, until we have destroyed ourselves.
|
||||
RefPtr<VRManager> mVRManagerHolder;
|
||||
dom::ContentParentId mChildId;
|
||||
bool mHaveEventListener;
|
||||
bool mHaveControllerListener;
|
||||
bool mIsContentChild;
|
||||
|
|
|
|||
|
|
@ -1290,26 +1290,36 @@ mozilla::ipc::IPCResult BackgroundParentImpl::RecvPEndpointForReportConstructor(
|
|||
mozilla::ipc::IPCResult
|
||||
BackgroundParentImpl::RecvEnsureRDDProcessAndCreateBridge(
|
||||
EnsureRDDProcessAndCreateBridgeResolver&& aResolver) {
|
||||
RDDProcessManager* rdd = RDDProcessManager::Get();
|
||||
using Type = std::tuple<const nsresult&,
|
||||
Endpoint<mozilla::PRemoteDecoderManagerChild>&&>;
|
||||
|
||||
RefPtr<ThreadsafeContentParentHandle> parent =
|
||||
BackgroundParent::GetContentParentHandle(this);
|
||||
if (NS_WARN_IF(!parent)) {
|
||||
aResolver(
|
||||
Type(NS_ERROR_NOT_AVAILABLE, Endpoint<PRemoteDecoderManagerChild>()));
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
RDDProcessManager* rdd = RDDProcessManager::Get();
|
||||
if (!rdd) {
|
||||
aResolver(
|
||||
Type(NS_ERROR_NOT_AVAILABLE, Endpoint<PRemoteDecoderManagerChild>()));
|
||||
} else {
|
||||
rdd->EnsureRDDProcessAndCreateBridge(OtherPid())
|
||||
->Then(GetCurrentSerialEventTarget(), __func__,
|
||||
[resolver = std::move(aResolver)](
|
||||
mozilla::RDDProcessManager::EnsureRDDPromise::
|
||||
ResolveOrRejectValue&& aValue) mutable {
|
||||
if (aValue.IsReject()) {
|
||||
resolver(Type(aValue.RejectValue(),
|
||||
Endpoint<PRemoteDecoderManagerChild>()));
|
||||
return;
|
||||
}
|
||||
resolver(Type(NS_OK, std::move(aValue.ResolveValue())));
|
||||
});
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
rdd->EnsureRDDProcessAndCreateBridge(OtherPid(), parent->ChildID())
|
||||
->Then(GetCurrentSerialEventTarget(), __func__,
|
||||
[resolver = std::move(aResolver)](
|
||||
mozilla::RDDProcessManager::EnsureRDDPromise::
|
||||
ResolveOrRejectValue&& aValue) mutable {
|
||||
if (aValue.IsReject()) {
|
||||
resolver(Type(aValue.RejectValue(),
|
||||
Endpoint<PRemoteDecoderManagerChild>()));
|
||||
return;
|
||||
}
|
||||
resolver(Type(NS_OK, std::move(aValue.ResolveValue())));
|
||||
});
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
|
|
@ -1318,13 +1328,19 @@ BackgroundParentImpl::RecvEnsureUtilityProcessAndCreateBridge(
|
|||
const RemoteDecodeIn& aLocation,
|
||||
EnsureUtilityProcessAndCreateBridgeResolver&& aResolver) {
|
||||
base::ProcessId otherPid = OtherPid();
|
||||
RefPtr<ThreadsafeContentParentHandle> parent =
|
||||
BackgroundParent::GetContentParentHandle(this);
|
||||
if (NS_WARN_IF(!parent)) {
|
||||
return IPC_FAIL_NO_REASON(this);
|
||||
}
|
||||
dom::ContentParentId childId = parent->ChildID();
|
||||
nsCOMPtr<nsISerialEventTarget> managerThread = GetCurrentSerialEventTarget();
|
||||
if (!managerThread) {
|
||||
return IPC_FAIL_NO_REASON(this);
|
||||
}
|
||||
NS_DispatchToMainThread(NS_NewRunnableFunction(
|
||||
"BackgroundParentImpl::RecvEnsureUtilityProcessAndCreateBridge()",
|
||||
[aResolver, managerThread, otherPid, aLocation]() {
|
||||
[aResolver, managerThread, otherPid, childId, aLocation]() {
|
||||
RefPtr<UtilityProcessManager> upm =
|
||||
UtilityProcessManager::GetSingleton();
|
||||
using Type =
|
||||
|
|
@ -1340,7 +1356,7 @@ BackgroundParentImpl::RecvEnsureUtilityProcessAndCreateBridge(
|
|||
}));
|
||||
} else {
|
||||
SandboxingKind sbKind = GetSandboxingKindFromLocation(aLocation);
|
||||
upm->StartProcessForRemoteMediaDecoding(otherPid, sbKind)
|
||||
upm->StartProcessForRemoteMediaDecoding(otherPid, childId, sbKind)
|
||||
->Then(managerThread, __func__,
|
||||
[resolver = aResolver](
|
||||
mozilla::ipc::UtilityProcessManager::
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ include GraphicsMessages;
|
|||
include protocol PRemoteDecoderManager;
|
||||
include protocol PVideoBridge;
|
||||
|
||||
using mozilla::dom::ContentParentId from "mozilla/dom/ipc/IdType.h";
|
||||
using mozilla::media::MediaCodecsSupported from "MediaCodecsSupport.h";
|
||||
using mozilla::RemoteDecodeIn from "mozilla/RemoteDecoderManagerChild.h";
|
||||
|
||||
|
|
@ -20,7 +21,7 @@ protocol PUtilityAudioDecoder
|
|||
{
|
||||
parent:
|
||||
async NewContentRemoteDecoderManager(
|
||||
Endpoint<PRemoteDecoderManagerParent> endpoint);
|
||||
Endpoint<PRemoteDecoderManagerParent> endpoint, ContentParentId parentId);
|
||||
|
||||
#ifdef MOZ_WMF_MEDIA_ENGINE
|
||||
async InitVideoBridge(Endpoint<PVideoBridgeChild> endpoint,
|
||||
|
|
|
|||
|
|
@ -118,9 +118,11 @@ void UtilityAudioDecoderParent::Start(
|
|||
|
||||
mozilla::ipc::IPCResult
|
||||
UtilityAudioDecoderParent::RecvNewContentRemoteDecoderManager(
|
||||
Endpoint<PRemoteDecoderManagerParent>&& aEndpoint) {
|
||||
Endpoint<PRemoteDecoderManagerParent>&& aEndpoint,
|
||||
const ContentParentId& aParentId) {
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
if (!RemoteDecoderManagerParent::CreateForContent(std::move(aEndpoint))) {
|
||||
if (!RemoteDecoderManagerParent::CreateForContent(std::move(aEndpoint),
|
||||
aParentId)) {
|
||||
return IPC_FAIL_NO_REASON(this);
|
||||
}
|
||||
return IPC_OK();
|
||||
|
|
|
|||
|
|
@ -33,7 +33,8 @@ class UtilityAudioDecoderParent final : public PUtilityAudioDecoderParent {
|
|||
void Start(Endpoint<PUtilityAudioDecoderParent>&& aEndpoint);
|
||||
|
||||
mozilla::ipc::IPCResult RecvNewContentRemoteDecoderManager(
|
||||
Endpoint<PRemoteDecoderManagerParent>&& aEndpoint);
|
||||
Endpoint<PRemoteDecoderManagerParent>&& aEndpoint,
|
||||
const ContentParentId& aParentId);
|
||||
|
||||
#ifdef MOZ_WMF_MEDIA_ENGINE
|
||||
mozilla::ipc::IPCResult RecvInitVideoBridge(
|
||||
|
|
|
|||
|
|
@ -311,7 +311,8 @@ RefPtr<GenericNonExclusivePromise> UtilityProcessManager::StartUtility(
|
|||
|
||||
RefPtr<UtilityProcessManager::StartRemoteDecodingUtilityPromise>
|
||||
UtilityProcessManager::StartProcessForRemoteMediaDecoding(
|
||||
base::ProcessId aOtherProcess, SandboxingKind aSandbox) {
|
||||
base::ProcessId aOtherProcess, dom::ContentParentId aChildId,
|
||||
SandboxingKind aSandbox) {
|
||||
// Not supported kinds.
|
||||
if (aSandbox != SandboxingKind::GENERIC_UTILITY
|
||||
#ifdef MOZ_APPLEMEDIA
|
||||
|
|
@ -336,7 +337,8 @@ UtilityProcessManager::StartProcessForRemoteMediaDecoding(
|
|||
return StartUtility(uadc, aSandbox)
|
||||
->Then(
|
||||
GetMainThreadSerialEventTarget(), __func__,
|
||||
[self, uadc, aOtherProcess, aSandbox, remoteDecodingStart]() {
|
||||
[self, uadc, aOtherProcess, aChildId, aSandbox,
|
||||
remoteDecodingStart]() {
|
||||
RefPtr<UtilityProcessParent> parent =
|
||||
self->GetProcessParent(aSandbox);
|
||||
if (!parent) {
|
||||
|
|
@ -363,8 +365,8 @@ UtilityProcessManager::StartProcessForRemoteMediaDecoding(
|
|||
rv, __func__);
|
||||
}
|
||||
|
||||
if (!uadc->SendNewContentRemoteDecoderManager(
|
||||
std::move(parentPipe))) {
|
||||
if (!uadc->SendNewContentRemoteDecoderManager(std::move(parentPipe),
|
||||
aChildId)) {
|
||||
MOZ_ASSERT(false, "SendNewContentRemoteDecoderManager failure");
|
||||
return StartRemoteDecodingUtilityPromise::CreateAndReject(
|
||||
NS_ERROR_FAILURE, __func__);
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
#ifndef _include_ipc_glue_UtilityProcessManager_h_
|
||||
#define _include_ipc_glue_UtilityProcessManager_h_
|
||||
#include "mozilla/MozPromise.h"
|
||||
#include "mozilla/dom/ipc/IdType.h"
|
||||
#include "mozilla/ipc/UtilityProcessHost.h"
|
||||
#include "mozilla/EnumeratedArray.h"
|
||||
#include "mozilla/ProcInfo.h"
|
||||
|
|
@ -62,7 +63,8 @@ class UtilityProcessManager final : public UtilityProcessHost::Listener {
|
|||
SandboxingKind aSandbox);
|
||||
|
||||
RefPtr<StartRemoteDecodingUtilityPromise> StartProcessForRemoteMediaDecoding(
|
||||
base::ProcessId aOtherProcess, SandboxingKind aSandbox);
|
||||
base::ProcessId aOtherProcess, dom::ContentParentId aChildId,
|
||||
SandboxingKind aSandbox);
|
||||
|
||||
RefPtr<JSOraclePromise> StartJSOracle(mozilla::dom::JSOracleParent* aParent);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue