Bug 1365927 - Part 4. Replace PCompositorBridge integration hooks with PCompositorManager. r=dvander

This commit is contained in:
Andrew Osmond 2017-06-14 11:39:59 -04:00
parent 9abc5f52d5
commit 27eaaaed2f
16 changed files with 200 additions and 126 deletions

View File

@ -54,7 +54,7 @@
#include "mozilla/ipc/TestShellChild.h"
#include "mozilla/jsipc/CrossProcessObjectWrappers.h"
#include "mozilla/layers/APZChild.h"
#include "mozilla/layers/CompositorBridgeChild.h"
#include "mozilla/layers/CompositorManagerChild.h"
#include "mozilla/layers/ContentProcessController.h"
#include "mozilla/layers/ImageBridgeChild.h"
#include "mozilla/layout/RenderFrameChild.h"
@ -1177,18 +1177,21 @@ ContentChild::RecvInitProcessHangMonitor(Endpoint<PProcessHangMonitorChild>&& aH
}
mozilla::ipc::IPCResult
ContentChild::RecvInitRendering(Endpoint<PCompositorBridgeChild>&& aCompositor,
ContentChild::RecvInitRendering(Endpoint<PCompositorManagerChild>&& aCompositor,
Endpoint<PImageBridgeChild>&& aImageBridge,
Endpoint<PVRManagerChild>&& aVRBridge,
Endpoint<PVideoDecoderManagerChild>&& aVideoManager,
nsTArray<uint32_t>&& namespaces)
{
MOZ_ASSERT(namespaces.Length() == 2);
MOZ_ASSERT(namespaces.Length() == 3);
if (!CompositorBridgeChild::InitForContent(Move(aCompositor), namespaces[0])) {
if (!CompositorManagerChild::Init(Move(aCompositor), namespaces[0])) {
return IPC_FAIL_NO_REASON(this);
}
if (!ImageBridgeChild::InitForContent(Move(aImageBridge), namespaces[1])) {
if (!CompositorManagerChild::CreateContentCompositorBridge(namespaces[1])) {
return IPC_FAIL_NO_REASON(this);
}
if (!ImageBridgeChild::InitForContent(Move(aImageBridge), namespaces[2])) {
return IPC_FAIL_NO_REASON(this);
}
if (!gfx::VRManagerChild::InitForContent(Move(aVRBridge))) {
@ -1199,13 +1202,13 @@ ContentChild::RecvInitRendering(Endpoint<PCompositorBridgeChild>&& aCompositor,
}
mozilla::ipc::IPCResult
ContentChild::RecvReinitRendering(Endpoint<PCompositorBridgeChild>&& aCompositor,
ContentChild::RecvReinitRendering(Endpoint<PCompositorManagerChild>&& aCompositor,
Endpoint<PImageBridgeChild>&& aImageBridge,
Endpoint<PVRManagerChild>&& aVRBridge,
Endpoint<PVideoDecoderManagerChild>&& aVideoManager,
nsTArray<uint32_t>&& namespaces)
{
MOZ_ASSERT(namespaces.Length() == 2);
MOZ_ASSERT(namespaces.Length() == 3);
nsTArray<RefPtr<TabChild>> tabs = TabChild::GetAll();
// Zap all the old layer managers we have lying around.
@ -1216,10 +1219,13 @@ ContentChild::RecvReinitRendering(Endpoint<PCompositorBridgeChild>&& aCompositor
}
// Re-establish singleton bridges to the compositor.
if (!CompositorBridgeChild::ReinitForContent(Move(aCompositor), namespaces[0])) {
if (!CompositorManagerChild::Init(Move(aCompositor), namespaces[0])) {
return IPC_FAIL_NO_REASON(this);
}
if (!ImageBridgeChild::ReinitForContent(Move(aImageBridge), namespaces[1])) {
if (!CompositorManagerChild::CreateContentCompositorBridge(namespaces[1])) {
return IPC_FAIL_NO_REASON(this);
}
if (!ImageBridgeChild::ReinitForContent(Move(aImageBridge), namespaces[2])) {
return IPC_FAIL_NO_REASON(this);
}
if (!gfx::VRManagerChild::ReinitForContent(Move(aVRBridge))) {

View File

@ -161,7 +161,7 @@ public:
mozilla::ipc::IPCResult
RecvInitRendering(
Endpoint<PCompositorBridgeChild>&& aCompositor,
Endpoint<PCompositorManagerChild>&& aCompositor,
Endpoint<PImageBridgeChild>&& aImageBridge,
Endpoint<PVRManagerChild>&& aVRBridge,
Endpoint<PVideoDecoderManagerChild>&& aVideoManager,
@ -169,7 +169,7 @@ public:
mozilla::ipc::IPCResult
RecvReinitRendering(
Endpoint<PCompositorBridgeChild>&& aCompositor,
Endpoint<PCompositorManagerChild>&& aCompositor,
Endpoint<PImageBridgeChild>&& aImageBridge,
Endpoint<PVRManagerChild>&& aVRBridge,
Endpoint<PVideoDecoderManagerChild>&& aVideoManager,

View File

@ -2363,11 +2363,11 @@ ContentParent::InitInternal(ProcessPriority aInitialPriority,
if (useOffMainThreadCompositing) {
GPUProcessManager* gpm = GPUProcessManager::Get();
Endpoint<PCompositorBridgeChild> compositor;
Endpoint<PCompositorManagerChild> compositor;
Endpoint<PImageBridgeChild> imageBridge;
Endpoint<PVRManagerChild> vrBridge;
Endpoint<PVideoDecoderManagerChild> videoManager;
nsTArray<uint32_t> namespaces;
AutoTArray<uint32_t, 3> namespaces;
DebugOnly<bool> opened = gpm->CreateContentBridges(
OtherPid(),
@ -2383,7 +2383,7 @@ ContentParent::InitInternal(ProcessPriority aInitialPriority,
Move(imageBridge),
Move(vrBridge),
Move(videoManager),
Move(namespaces));
namespaces);
gpm->AddListener(this);
}
@ -2529,11 +2529,11 @@ ContentParent::OnCompositorUnexpectedShutdown()
{
GPUProcessManager* gpm = GPUProcessManager::Get();
Endpoint<PCompositorBridgeChild> compositor;
Endpoint<PCompositorManagerChild> compositor;
Endpoint<PImageBridgeChild> imageBridge;
Endpoint<PVRManagerChild> vrBridge;
Endpoint<PVideoDecoderManagerChild> videoManager;
nsTArray<uint32_t> namespaces;
AutoTArray<uint32_t, 3> namespaces;
DebugOnly<bool> opened = gpm->CreateContentBridges(
OtherPid(),
@ -2549,7 +2549,7 @@ ContentParent::OnCompositorUnexpectedShutdown()
Move(imageBridge),
Move(vrBridge),
Move(videoManager),
Move(namespaces));
namespaces);
}
void

View File

@ -6,7 +6,7 @@
include protocol PBackground;
include protocol PBrowser;
include protocol PCompositorBridge;
include protocol PCompositorManager;
include protocol PContentBridge;
include protocol PContentPermissionRequest;
include protocol PCycleCollectWithLogs;
@ -353,7 +353,7 @@ child:
// Give the content process its endpoints to the compositor.
async InitRendering(
Endpoint<PCompositorBridgeChild> compositor,
Endpoint<PCompositorManagerChild> compositor,
Endpoint<PImageBridgeChild> imageBridge,
Endpoint<PVRManagerChild> vr,
Endpoint<PVideoDecoderManagerChild> video,
@ -363,7 +363,7 @@ child:
// after the compositor process has crashed. The new endpoints may be to a
// newly launched GPU process, or the compositor thread of the UI process.
async ReinitRendering(
Endpoint<PCompositorBridgeChild> compositor,
Endpoint<PCompositorManagerChild> compositor,
Endpoint<PImageBridgeChild> bridge,
Endpoint<PVRManagerChild> vr,
Endpoint<PVideoDecoderManagerChild> video,

View File

@ -24,6 +24,7 @@
#include "mozilla/layers/APZThreadUtils.h"
#include "mozilla/layers/APZCTreeManager.h"
#include "mozilla/layers/CompositorBridgeParent.h"
#include "mozilla/layers/CompositorManagerParent.h"
#include "mozilla/layers/CompositorThread.h"
#include "mozilla/layers/ImageBridgeParent.h"
#include "mozilla/layers/LayerTreeOwnerTracker.h"
@ -214,6 +215,13 @@ GPUParent::RecvInit(nsTArray<GfxPrefSetting>&& prefs,
return IPC_OK();
}
mozilla::ipc::IPCResult
GPUParent::RecvInitCompositorManager(Endpoint<PCompositorManagerParent>&& aEndpoint)
{
CompositorManagerParent::Create(Move(aEndpoint));
return IPC_OK();
}
mozilla::ipc::IPCResult
GPUParent::RecvInitVsyncBridge(Endpoint<PVsyncBridgeParent>&& aVsyncEndpoint)
{
@ -306,37 +314,10 @@ GPUParent::RecvGetDeviceStatus(GPUDeviceData* aOut)
return IPC_OK();
}
static void
OpenParent(RefPtr<CompositorBridgeParent> aParent,
Endpoint<PCompositorBridgeParent>&& aEndpoint)
{
if (!aParent->Bind(Move(aEndpoint))) {
MOZ_CRASH("Failed to bind compositor");
}
}
mozilla::ipc::IPCResult
GPUParent::RecvNewWidgetCompositor(Endpoint<layers::PCompositorBridgeParent>&& aEndpoint,
const CSSToLayoutDeviceScale& aScale,
const TimeDuration& aVsyncRate,
const CompositorOptions& aOptions,
const bool& aUseExternalSurfaceSize,
const IntSize& aSurfaceSize)
GPUParent::RecvNewContentCompositorManager(Endpoint<PCompositorManagerParent>&& aEndpoint)
{
RefPtr<CompositorBridgeParent> cbp =
new CompositorBridgeParent(aScale, aVsyncRate, aOptions, aUseExternalSurfaceSize, aSurfaceSize);
MessageLoop* loop = CompositorThreadHolder::Loop();
loop->PostTask(NewRunnableFunction(OpenParent, cbp, Move(aEndpoint)));
return IPC_OK();
}
mozilla::ipc::IPCResult
GPUParent::RecvNewContentCompositorBridge(Endpoint<PCompositorBridgeParent>&& aEndpoint)
{
if (!CompositorBridgeParent::CreateForContent(Move(aEndpoint))) {
return IPC_FAIL_NO_REASON(this);
}
CompositorManagerParent::Create(Move(aEndpoint));
return IPC_OK();
}

View File

@ -35,6 +35,7 @@ public:
nsTArray<GfxVarUpdate>&& vars,
const DevicePrefs& devicePrefs,
nsTArray<LayerTreeIdMapping>&& mappings) override;
mozilla::ipc::IPCResult RecvInitCompositorManager(Endpoint<PCompositorManagerParent>&& aEndpoint) override;
mozilla::ipc::IPCResult RecvInitVsyncBridge(Endpoint<PVsyncBridgeParent>&& aVsyncEndpoint) override;
mozilla::ipc::IPCResult RecvInitImageBridge(Endpoint<PImageBridgeParent>&& aEndpoint) override;
mozilla::ipc::IPCResult RecvInitVRManager(Endpoint<PVRManagerParent>&& aEndpoint) override;
@ -42,14 +43,7 @@ public:
mozilla::ipc::IPCResult RecvInitProfiler(Endpoint<PProfilerChild>&& aEndpoint) override;
mozilla::ipc::IPCResult RecvUpdatePref(const GfxPrefSetting& pref) override;
mozilla::ipc::IPCResult RecvUpdateVar(const GfxVarUpdate& pref) override;
mozilla::ipc::IPCResult RecvNewWidgetCompositor(
Endpoint<PCompositorBridgeParent>&& aEndpoint,
const CSSToLayoutDeviceScale& aScale,
const TimeDuration& aVsyncRate,
const CompositorOptions& aOptions,
const bool& aUseExternalSurface,
const IntSize& aSurfaceSize) override;
mozilla::ipc::IPCResult RecvNewContentCompositorBridge(Endpoint<PCompositorBridgeParent>&& aEndpoint) override;
mozilla::ipc::IPCResult RecvNewContentCompositorManager(Endpoint<PCompositorManagerParent>&& aEndpoint) override;
mozilla::ipc::IPCResult RecvNewContentImageBridge(Endpoint<PImageBridgeParent>&& aEndpoint) override;
mozilla::ipc::IPCResult RecvNewContentVRManager(Endpoint<PVRManagerParent>&& aEndpoint) override;
mozilla::ipc::IPCResult RecvNewContentVideoDecoderManager(Endpoint<PVideoDecoderManagerParent>&& aEndpoint) override;

View File

@ -16,6 +16,8 @@
#include "mozilla/layers/APZCTreeManager.h"
#include "mozilla/layers/APZCTreeManagerChild.h"
#include "mozilla/layers/CompositorBridgeParent.h"
#include "mozilla/layers/CompositorManagerChild.h"
#include "mozilla/layers/CompositorManagerParent.h"
#include "mozilla/layers/CompositorOptions.h"
#include "mozilla/layers/ImageBridgeChild.h"
#include "mozilla/layers/ImageBridgeParent.h"
@ -198,6 +200,34 @@ GPUProcessManager::EnsureGPUReady()
return false;
}
void
GPUProcessManager::EnsureCompositorManagerChild()
{
if (CompositorManagerChild::IsInitialized()) {
return;
}
if (!EnsureGPUReady()) {
CompositorManagerChild::InitSameProcess(AllocateNamespace());
return;
}
ipc::Endpoint<PCompositorManagerParent> parentPipe;
ipc::Endpoint<PCompositorManagerChild> childPipe;
nsresult rv = PCompositorManager::CreateEndpoints(
mGPUChild->OtherPid(),
base::GetCurrentProcId(),
&parentPipe,
&childPipe);
if (NS_FAILED(rv)) {
DisableGPUProcess("Failed to create PCompositorManager endpoints");
return;
}
mGPUChild->SendInitCompositorManager(Move(parentPipe));
CompositorManagerChild::Init(Move(childPipe), AllocateNamespace());
}
void
GPUProcessManager::EnsureImageBridgeChild()
{
@ -568,6 +598,7 @@ GPUProcessManager::CreateTopLevelCompositor(nsBaseWidget* aWidget,
{
uint64_t layerTreeId = AllocateLayerTreeId();
EnsureCompositorManagerChild();
EnsureImageBridgeChild();
EnsureVRManager();
@ -621,43 +652,20 @@ GPUProcessManager::CreateRemoteSession(nsBaseWidget* aWidget,
const gfx::IntSize& aSurfaceSize)
{
#ifdef MOZ_WIDGET_SUPPORTS_OOP_COMPOSITING
ipc::Endpoint<PCompositorBridgeParent> parentPipe;
ipc::Endpoint<PCompositorBridgeChild> childPipe;
nsresult rv = PCompositorBridge::CreateEndpoints(
mGPUChild->OtherPid(),
base::GetCurrentProcId(),
&parentPipe,
&childPipe);
if (NS_FAILED(rv)) {
gfxCriticalNote << "Failed to create PCompositorBridge endpoints: " << hexa(int(rv));
return nullptr;
}
RefPtr<CompositorBridgeChild> child = CompositorBridgeChild::CreateRemote(
mProcessToken,
aLayerManager,
Move(childPipe),
AllocateNamespace());
if (!child) {
gfxCriticalNote << "Failed to create CompositorBridgeChild";
return nullptr;
}
CompositorWidgetInitData initData;
aWidget->GetCompositorWidgetInitData(&initData);
TimeDuration vsyncRate =
gfxPlatform::GetPlatform()->GetHardwareVsync()->GetGlobalDisplay().GetVsyncRate();
bool ok = mGPUChild->SendNewWidgetCompositor(
Move(parentPipe),
aScale,
vsyncRate,
aOptions,
aUseExternalSurfaceSize,
aSurfaceSize);
if (!ok) {
RefPtr<CompositorBridgeChild> child =
CompositorManagerChild::CreateWidgetCompositorBridge(
mProcessToken,
aLayerManager,
AllocateNamespace(),
aScale,
aOptions,
aUseExternalSurfaceSize,
aSurfaceSize);
if (!child) {
gfxCriticalNote << "Failed to create CompositorBridgeChild";
return nullptr;
}
@ -693,13 +701,13 @@ GPUProcessManager::CreateRemoteSession(nsBaseWidget* aWidget,
bool
GPUProcessManager::CreateContentBridges(base::ProcessId aOtherProcess,
ipc::Endpoint<PCompositorBridgeChild>* aOutCompositor,
ipc::Endpoint<PCompositorManagerChild>* aOutCompositor,
ipc::Endpoint<PImageBridgeChild>* aOutImageBridge,
ipc::Endpoint<PVRManagerChild>* aOutVRBridge,
ipc::Endpoint<dom::PVideoDecoderManagerChild>* aOutVideoManager,
nsTArray<uint32_t>* aNamespaces)
{
if (!CreateContentCompositorBridge(aOtherProcess, aOutCompositor) ||
if (!CreateContentCompositorManager(aOtherProcess, aOutCompositor) ||
!CreateContentImageBridge(aOtherProcess, aOutImageBridge) ||
!CreateContentVRManager(aOtherProcess, aOutVRBridge))
{
@ -708,39 +716,38 @@ GPUProcessManager::CreateContentBridges(base::ProcessId aOtherProcess,
// VideoDeocderManager is only supported in the GPU process, so we allow this to be
// fallible.
CreateContentVideoDecoderManager(aOtherProcess, aOutVideoManager);
// Allocates 2 namaspaces(for CompositorBridgeChild and ImageBridgeChild)
// Allocates 3 namespaces(for CompositorManagerChild, CompositorBridgeChild and ImageBridgeChild)
aNamespaces->AppendElement(AllocateNamespace());
aNamespaces->AppendElement(AllocateNamespace());
aNamespaces->AppendElement(AllocateNamespace());
return true;
}
bool
GPUProcessManager::CreateContentCompositorBridge(base::ProcessId aOtherProcess,
ipc::Endpoint<PCompositorBridgeChild>* aOutEndpoint)
GPUProcessManager::CreateContentCompositorManager(base::ProcessId aOtherProcess,
ipc::Endpoint<PCompositorManagerChild>* aOutEndpoint)
{
ipc::Endpoint<PCompositorBridgeParent> parentPipe;
ipc::Endpoint<PCompositorBridgeChild> childPipe;
ipc::Endpoint<PCompositorManagerParent> parentPipe;
ipc::Endpoint<PCompositorManagerChild> childPipe;
base::ProcessId gpuPid = EnsureGPUReady()
? mGPUChild->OtherPid()
: base::GetCurrentProcId();
nsresult rv = PCompositorBridge::CreateEndpoints(
nsresult rv = PCompositorManager::CreateEndpoints(
gpuPid,
aOtherProcess,
&parentPipe,
&childPipe);
if (NS_FAILED(rv)) {
gfxCriticalNote << "Could not create content compositor bridge: " << hexa(int(rv));
gfxCriticalNote << "Could not create content compositor manager: " << hexa(int(rv));
return false;
}
if (EnsureGPUReady()) {
mGPUChild->SendNewContentCompositorBridge(Move(parentPipe));
mGPUChild->SendNewContentCompositorManager(Move(parentPipe));
} else {
if (!CompositorBridgeParent::CreateForContent(Move(parentPipe))) {
return false;
}
CompositorManagerParent::Create(Move(parentPipe));
}
*aOutEndpoint = Move(childPipe);

View File

@ -29,6 +29,7 @@ class CompositorOptions;
class CompositorSession;
class CompositorUpdateObserver;
class PCompositorBridgeChild;
class PCompositorManagerChild;
class PImageBridgeChild;
class RemoteCompositorSession;
class UiCompositorControllerChild;
@ -65,6 +66,7 @@ class GPUProcessManager final : public GPUProcessHost::Listener
typedef layers::IAPZCTreeManager IAPZCTreeManager;
typedef layers::LayerManager LayerManager;
typedef layers::PCompositorBridgeChild PCompositorBridgeChild;
typedef layers::PCompositorManagerChild PCompositorManagerChild;
typedef layers::PImageBridgeChild PImageBridgeChild;
typedef layers::RemoteCompositorSession RemoteCompositorSession;
typedef layers::UiCompositorControllerChild UiCompositorControllerChild;
@ -94,7 +96,7 @@ public:
bool CreateContentBridges(
base::ProcessId aOtherProcess,
ipc::Endpoint<PCompositorBridgeChild>* aOutCompositor,
ipc::Endpoint<PCompositorManagerChild>* aOutCompositor,
ipc::Endpoint<PImageBridgeChild>* aOutImageBridge,
ipc::Endpoint<PVRManagerChild>* aOutVRBridge,
ipc::Endpoint<dom::PVideoDecoderManagerChild>* aOutVideoManager,
@ -176,8 +178,8 @@ private:
// Called from our xpcom-shutdown observer.
void OnXPCOMShutdown();
bool CreateContentCompositorBridge(base::ProcessId aOtherProcess,
ipc::Endpoint<PCompositorBridgeChild>* aOutEndpoint);
bool CreateContentCompositorManager(base::ProcessId aOtherProcess,
ipc::Endpoint<PCompositorManagerChild>* aOutEndpoint);
bool CreateContentImageBridge(base::ProcessId aOtherProcess,
ipc::Endpoint<PImageBridgeChild>* aOutEndpoint);
bool CreateContentVRManager(base::ProcessId aOtherProcess,
@ -207,6 +209,7 @@ private:
void EnsureVsyncIOThread();
void ShutdownVsyncIOThread();
void EnsureCompositorManagerChild();
void EnsureImageBridgeChild();
void EnsureVRManager();

View File

@ -36,9 +36,17 @@ InProcessCompositorSession::Create(nsIWidget* aWidget,
aWidget->GetCompositorWidgetInitData(&initData);
RefPtr<CompositorWidget> widget = CompositorWidget::CreateLocal(initData, aOptions, aWidget);
RefPtr<CompositorBridgeChild> child = new CompositorBridgeChild(aLayerManager, aNamespace);
RefPtr<CompositorBridgeParent> parent =
child->InitSameProcess(widget, aRootLayerTreeId, aScale, aOptions, aUseExternalSurfaceSize, aSurfaceSize);
CompositorManagerParent::CreateSameProcessWidgetCompositorBridge(aScale, aOptions,
aUseExternalSurfaceSize,
aSurfaceSize);
MOZ_ASSERT(parent);
parent->InitSameProcess(widget, aRootLayerTreeId);
RefPtr<CompositorBridgeChild> child =
CompositorManagerChild::CreateSameProcessWidgetCompositorBridge(aLayerManager,
aNamespace);
MOZ_ASSERT(child);
return new InProcessCompositorSession(widget, child, parent);
}

View File

@ -5,7 +5,7 @@
include GraphicsMessages;
include MemoryReportTypes;
include protocol PCompositorBridge;
include protocol PCompositorManager;
include protocol PImageBridge;
include protocol PProfiler;
include protocol PVRManager;
@ -14,11 +14,7 @@ include protocol PUiCompositorController;
include protocol PVideoDecoderManager;
using base::ProcessId from "base/process.h";
using mozilla::TimeDuration from "mozilla/TimeStamp.h";
using mozilla::CSSToLayoutDeviceScale from "Units.h";
using mozilla::dom::NativeThreadId from "mozilla/dom/TabMessageUtils.h";
using mozilla::gfx::IntSize from "mozilla/gfx/2D.h";
using mozilla::layers::CompositorOptions from "mozilla/layers/CompositorOptions.h";
using mozilla::Telemetry::Accumulation from "mozilla/TelemetryComms.h";
using mozilla::Telemetry::KeyedAccumulation from "mozilla/TelemetryComms.h";
using mozilla::Telemetry::ScalarAction from "mozilla/TelemetryComms.h";
@ -55,6 +51,7 @@ parent:
DevicePrefs devicePrefs,
LayerTreeIdMapping[] mapping);
async InitCompositorManager(Endpoint<PCompositorManagerParent> endpoint);
async InitVsyncBridge(Endpoint<PVsyncBridgeParent> endpoint);
async InitImageBridge(Endpoint<PImageBridgeParent> endpoint);
async InitVRManager(Endpoint<PVRManagerParent> endpoint);
@ -65,16 +62,8 @@ parent:
async UpdatePref(GfxPrefSetting pref);
async UpdateVar(GfxVarUpdate var);
// Create a new top-level compositor.
async NewWidgetCompositor(Endpoint<PCompositorBridgeParent> endpoint,
CSSToLayoutDeviceScale scale,
TimeDuration vsyncRate,
CompositorOptions options,
bool useExternalSurface,
IntSize surfaceSize);
// Create a new content-process compositor bridge.
async NewContentCompositorBridge(Endpoint<PCompositorBridgeParent> endpoint);
async NewContentCompositorManager(Endpoint<PCompositorManagerParent> endpoint);
async NewContentImageBridge(Endpoint<PImageBridgeParent> endpoint);
async NewContentVRManager(Endpoint<PVRManagerParent> endpoint);
async NewContentVideoDecoderManager(Endpoint<PVideoDecoderManagerParent> endpoint);

View File

@ -66,6 +66,31 @@ CompositorManagerChild::Shutdown()
sInstance = nullptr;
}
/* static */ bool
CompositorManagerChild::CreateContentCompositorBridge(uint32_t aNamespace)
{
return false;
}
/* static */ already_AddRefed<CompositorBridgeChild>
CompositorManagerChild::CreateWidgetCompositorBridge(uint64_t aProcessToken,
LayerManager* aLayerManager,
uint32_t aNamespace,
CSSToLayoutDeviceScale aScale,
const CompositorOptions& aOptions,
bool aUseExternalSurfaceSize,
const gfx::IntSize& aSurfaceSize)
{
return nullptr;
}
/* static */ already_AddRefed<CompositorBridgeChild>
CompositorManagerChild::CreateSameProcessWidgetCompositorBridge(LayerManager* aLayerManager,
uint32_t aNamespace)
{
return nullptr;
}
CompositorManagerChild::CompositorManagerChild(CompositorManagerParent* aParent,
uint32_t aNamespace)
: mCanSend(false)

View File

@ -30,6 +30,22 @@ public:
uint32_t aNamespace);
static void Shutdown();
static bool
CreateContentCompositorBridge(uint32_t aNamespace);
static already_AddRefed<CompositorBridgeChild>
CreateWidgetCompositorBridge(uint64_t aProcessToken,
LayerManager* aLayerManager,
uint32_t aNamespace,
CSSToLayoutDeviceScale aScale,
const CompositorOptions& aOptions,
bool aUseExternalSurfaceSize,
const gfx::IntSize& aSurfaceSize);
static already_AddRefed<CompositorBridgeChild>
CreateSameProcessWidgetCompositorBridge(LayerManager* aLayerManager,
uint32_t aNamespace);
uint32_t GetNextResourceId()
{
return ++mResourceId;

View File

@ -5,6 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/layers/CompositorManagerParent.h"
#include "mozilla/layers/CompositorBridgeParent.h"
#include "mozilla/layers/CompositorThread.h"
namespace mozilla {
@ -59,6 +60,15 @@ CompositorManagerParent::Create(Endpoint<PCompositorManagerParent>&& aEndpoint)
CompositorThreadHolder::Loop()->PostTask(runnable.forget());
}
/* static */ already_AddRefed<CompositorBridgeParent>
CompositorManagerParent::CreateSameProcessWidgetCompositorBridge(CSSToLayoutDeviceScale aScale,
const CompositorOptions& aOptions,
bool aUseExternalSurfaceSize,
const gfx::IntSize& aSurfaceSize)
{
return nullptr;
}
CompositorManagerParent::CompositorManagerParent()
: mCompositorThreadHolder(CompositorThreadHolder::GetSingleton())
{

View File

@ -17,6 +17,7 @@
namespace mozilla {
namespace layers {
class CompositorBridgeParent;
class CompositorThreadHolder;
class CompositorManagerParent final : public PCompositorManagerParent
@ -27,6 +28,12 @@ public:
static already_AddRefed<CompositorManagerParent> CreateSameProcess();
static void Create(Endpoint<PCompositorManagerParent>&& aEndpoint);
static already_AddRefed<CompositorBridgeParent>
CreateSameProcessWidgetCompositorBridge(CSSToLayoutDeviceScale aScale,
const CompositorOptions& aOptions,
bool aUseExternalSurfaceSize,
const gfx::IntSize& aSurfaceSize);
void ActorDestroy(ActorDestroyReason aReason) override;
ipc::IPCResult RecvIgnoreTemporarySkeletonMessage() override { return IPC_OK(); }

View File

@ -5,9 +5,37 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
include protocol PCompositorBridge;
using struct mozilla::void_t from "ipc/IPCMessageUtils.h";
using mozilla::TimeDuration from "mozilla/TimeStamp.h";
using mozilla::CSSToLayoutDeviceScale from "Units.h";
using mozilla::gfx::IntSize from "mozilla/gfx/2D.h";
using mozilla::layers::CompositorOptions from "mozilla/layers/CompositorOptions.h";
namespace mozilla {
namespace layers {
struct WidgetCompositorOptions {
CSSToLayoutDeviceScale scale;
TimeDuration vsyncRate;
CompositorOptions options;
bool useExternalSurfaceSize;
IntSize surfaceSize;
};
struct ContentCompositorOptions {
};
struct SameProcessWidgetCompositorOptions {
};
union CompositorBridgeOptions {
ContentCompositorOptions;
WidgetCompositorOptions;
SameProcessWidgetCompositorOptions;
};
/**
* The PCompositorManager protocol is the top-level protocol between the
* compositor thread and the creators of compositors. It exists in the

View File

@ -3,7 +3,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/layers/CompositorBridgeChild.h"
#include "mozilla/layers/CompositorManagerChild.h"
#include "mozilla/layers/CompositorThread.h"
#include "mozilla/layers/ImageBridgeChild.h"
#include "mozilla/layers/ISurfaceAllocator.h" // for GfxMemoryImageReporter
@ -968,12 +968,12 @@ gfxPlatform::ShutdownLayersIPC()
gfx::VRManagerChild::ShutDown();
// cf bug 1215265.
if (gfxPrefs::ChildProcessShutdown()) {
layers::CompositorBridgeChild::ShutDown();
layers::CompositorManagerChild::Shutdown();
layers::ImageBridgeChild::ShutDown();
}
} else if (XRE_IsParentProcess()) {
gfx::VRManagerChild::ShutDown();
layers::CompositorBridgeChild::ShutDown();
layers::CompositorManagerChild::Shutdown();
layers::ImageBridgeChild::ShutDown();
// This has to happen after shutting down the child protocols.
layers::CompositorThreadHolder::Shutdown();