Bug 1496003 - Add sync ipc WebRenderBridgeChild::SendEnsureConnected() r=mattwoodrow,froydnj

This commit is contained in:
sotaro 2018-10-05 16:35:29 +09:00
Родитель ca53c9933c
Коммит 28923c3278
13 изменённых файлов: 46 добавлений и 36 удалений

Просмотреть файл

@ -1097,9 +1097,7 @@ CompositorBridgeChild::WillEndTransaction()
PWebRenderBridgeChild*
CompositorBridgeChild::AllocPWebRenderBridgeChild(const wr::PipelineId& aPipelineId,
const LayoutDeviceIntSize&,
TextureFactoryIdentifier*,
wr::IdNamespace *aIdNamespace)
const LayoutDeviceIntSize&)
{
WebRenderBridgeChild* child = new WebRenderBridgeChild(aPipelineId);
child->AddIPDLReference();

Просмотреть файл

@ -210,9 +210,7 @@ public:
void WillEndTransaction();
PWebRenderBridgeChild* AllocPWebRenderBridgeChild(const wr::PipelineId& aPipelineId,
const LayoutDeviceIntSize&,
TextureFactoryIdentifier*,
wr::IdNamespace*) override;
const LayoutDeviceIntSize&) override;
bool DeallocPWebRenderBridgeChild(PWebRenderBridgeChild* aActor) override;
wr::MaybeExternalImageId GetNextExternalImageId() override;

Просмотреть файл

@ -1854,9 +1854,7 @@ CompositorBridgeParent::RecvAdoptChild(const LayersId& child)
PWebRenderBridgeParent*
CompositorBridgeParent::AllocPWebRenderBridgeParent(const wr::PipelineId& aPipelineId,
const LayoutDeviceIntSize& aSize,
TextureFactoryIdentifier* aTextureFactoryIdentifier,
wr::IdNamespace* aIdNamespace)
const LayoutDeviceIntSize& aSize)
{
#ifndef MOZ_BUILD_WEBRENDER
// Extra guard since this in the parent process and we don't want a malicious
@ -1885,8 +1883,6 @@ CompositorBridgeParent::AllocPWebRenderBridgeParent(const wr::PipelineId& aPipel
if (!api) {
mWrBridge = WebRenderBridgeParent::CreateDestroyed(aPipelineId);
mWrBridge.get()->AddRef(); // IPDL reference
*aIdNamespace = mWrBridge->GetIdNamespace();
*aTextureFactoryIdentifier = TextureFactoryIdentifier(LayersBackend::LAYERS_NONE);
return mWrBridge;
}
mAsyncImageManager = new AsyncImagePipelineManager(api->Clone());
@ -1898,7 +1894,6 @@ CompositorBridgeParent::AllocPWebRenderBridgeParent(const wr::PipelineId& aPipel
mWrBridge = new WebRenderBridgeParent(this, aPipelineId, mWidget, nullptr, std::move(api), std::move(asyncMgr), std::move(animStorage), mVsyncRate);
mWrBridge.get()->AddRef(); // IPDL reference
*aIdNamespace = mWrBridge->GetIdNamespace();
mCompositorScheduler = mWrBridge->CompositorScheduler();
MOZ_ASSERT(mCompositorScheduler);
{ // scope lock
@ -1906,7 +1901,6 @@ CompositorBridgeParent::AllocPWebRenderBridgeParent(const wr::PipelineId& aPipel
MOZ_ASSERT(sIndirectLayerTrees[mRootLayerTreeID].mWrBridge == nullptr);
sIndirectLayerTrees[mRootLayerTreeID].mWrBridge = mWrBridge;
}
*aTextureFactoryIdentifier = mWrBridge->GetTextureFactoryIdentifier();
return mWrBridge;
}

Просмотреть файл

@ -487,9 +487,7 @@ public:
}
PWebRenderBridgeParent* AllocPWebRenderBridgeParent(const wr::PipelineId& aPipelineId,
const LayoutDeviceIntSize& aSize,
TextureFactoryIdentifier* aTextureFactoryIdentifier,
wr::IdNamespace* aIdNamespace) override;
const LayoutDeviceIntSize& aSize) override;
bool DeallocPWebRenderBridgeParent(PWebRenderBridgeParent* aActor) override;
RefPtr<WebRenderBridgeParent> GetWebRenderBridgeParent() const;
Maybe<TimeStamp> GetTestingTimeStamp() const;

Просмотреть файл

@ -195,9 +195,7 @@ CrossProcessCompositorBridgeParent::DeallocPAPZParent(PAPZParent* aActor)
PWebRenderBridgeParent*
CrossProcessCompositorBridgeParent::AllocPWebRenderBridgeParent(const wr::PipelineId& aPipelineId,
const LayoutDeviceIntSize& aSize,
TextureFactoryIdentifier* aTextureFactoryIdentifier,
wr::IdNamespace *aIdNamespace)
const LayoutDeviceIntSize& aSize)
{
#ifndef MOZ_BUILD_WEBRENDER
// Extra guard since this in the parent process and we don't want a malicious
@ -235,8 +233,6 @@ CrossProcessCompositorBridgeParent::AllocPWebRenderBridgeParent(const wr::Pipeli
NS_WARNING(nsPrintfCString("Created child without a matching parent? root %p", root.get()).get());
WebRenderBridgeParent* parent = WebRenderBridgeParent::CreateDestroyed(aPipelineId);
parent->AddRef(); // IPDL reference
*aIdNamespace = parent->GetIdNamespace();
*aTextureFactoryIdentifier = TextureFactoryIdentifier(LayersBackend::LAYERS_NONE);
return parent;
}
@ -252,8 +248,6 @@ CrossProcessCompositorBridgeParent::AllocPWebRenderBridgeParent(const wr::Pipeli
sIndirectLayerTrees[layersId].mCrossProcessParent = this;
sIndirectLayerTrees[layersId].mWrBridge = parent;
}
*aTextureFactoryIdentifier = parent->GetTextureFactoryIdentifier();
*aIdNamespace = parent->GetIdNamespace();
return parent;
}

Просмотреть файл

@ -145,9 +145,7 @@ public:
void UpdatePaintTime(LayerTransactionParent* aLayerTree, const TimeDuration& aPaintTime) override;
PWebRenderBridgeParent* AllocPWebRenderBridgeParent(const wr::PipelineId& aPipelineId,
const LayoutDeviceIntSize& aSize,
TextureFactoryIdentifier* aTextureFactoryIdentifier,
wr::IdNamespace* aIdNamespace) override;
const LayoutDeviceIntSize& aSize) override;
bool DeallocPWebRenderBridgeParent(PWebRenderBridgeParent* aActor) override;
void ObserveLayersUpdate(LayersId aLayersId, LayersObserverEpoch aEpoch, bool aActive) override;

Просмотреть файл

@ -242,8 +242,7 @@ parent:
sync SyncWithCompositor();
// The pipelineId is the same as the layersId
sync PWebRenderBridge(PipelineId pipelineId, LayoutDeviceIntSize aSize)
returns (TextureFactoryIdentifier textureFactoryIdentifier, IdNamespace idNamespace);
async PWebRenderBridge(PipelineId pipelineId, LayoutDeviceIntSize aSize);
sync CheckContentOnlyTDR(uint32_t sequenceNum)
returns (bool isContentOnlyTDR);

Просмотреть файл

@ -22,6 +22,7 @@ using struct mozilla::layers::TextureInfo from "mozilla/layers/CompositorTypes.h
using mozilla::layers::CompositableHandle from "mozilla/layers/LayersTypes.h";
using mozilla::wr::BuiltDisplayListDescriptor from "mozilla/webrender/webrender_ffi.h";
using mozilla::wr::IdNamespace from "mozilla/webrender/WebRenderTypes.h";
using mozilla::wr::MaybeIdNamespace from "mozilla/webrender/WebRenderTypes.h";
using mozilla::layers::WebRenderScrollData from "mozilla/layers/WebRenderScrollData.h";
using mozilla::layers::FocusTarget from "mozilla/layers/FocusTarget.h";
using mozilla::layers::LayersObserverEpoch from "mozilla/layers/LayersTypes.h";
@ -35,6 +36,9 @@ sync protocol PWebRenderBridge
manager PCompositorBridge;
parent:
sync EnsureConnected()
returns (TextureFactoryIdentifier textureFactoryIdentifier, MaybeIdNamespace maybeIdNamespace);
async NewCompositable(CompositableHandle handle, TextureInfo info);
async ReleaseCompositable(CompositableHandle compositable);

Просмотреть файл

@ -262,6 +262,23 @@ WebRenderBridgeParent::~WebRenderBridgeParent()
{
}
mozilla::ipc::IPCResult
WebRenderBridgeParent::RecvEnsureConnected(TextureFactoryIdentifier* aTextureFactoryIdentifier,
MaybeIdNamespace* aMaybeIdNamespace)
{
if (mDestroyed) {
*aTextureFactoryIdentifier = TextureFactoryIdentifier(LayersBackend::LAYERS_NONE);
*aMaybeIdNamespace = Nothing();
return IPC_OK();
}
MOZ_ASSERT(mIdNamespace.mHandle != 0);
*aTextureFactoryIdentifier = GetTextureFactoryIdentifier();
*aMaybeIdNamespace = Some(mIdNamespace);
return IPC_OK();
}
mozilla::ipc::IPCResult
WebRenderBridgeParent::RecvShutdown()
{

Просмотреть файл

@ -65,6 +65,9 @@ public:
AsyncImagePipelineManager* AsyncImageManager() { return mAsyncImageManager; }
CompositorVsyncScheduler* CompositorScheduler() { return mCompositorScheduler.get(); }
mozilla::ipc::IPCResult RecvEnsureConnected(TextureFactoryIdentifier* aTextureFactoryIdentifier,
MaybeIdNamespace* aMaybeIdNamespace) override;
mozilla::ipc::IPCResult RecvNewCompositable(const CompositableHandle& aHandle,
const TextureInfo& aInfo) override;
mozilla::ipc::IPCResult RecvReleaseCompositable(const CompositableHandle& aHandle) override;

Просмотреть файл

@ -61,12 +61,8 @@ WebRenderLayerManager::Initialize(PCompositorBridgeChild* aCBChild,
MOZ_ASSERT(aTextureFactoryIdentifier);
LayoutDeviceIntSize size = mWidget->GetClientSize();
TextureFactoryIdentifier textureFactoryIdentifier;
wr::IdNamespace id_namespace;
PWebRenderBridgeChild* bridge = aCBChild->SendPWebRenderBridgeConstructor(aLayersId,
size,
&textureFactoryIdentifier,
&id_namespace);
size);
if (!bridge) {
// This should only fail if we attempt to access a layer we don't have
// permission for, or more likely, the GPU process crashed again during
@ -76,10 +72,20 @@ WebRenderLayerManager::Initialize(PCompositorBridgeChild* aCBChild,
return false;
}
TextureFactoryIdentifier textureFactoryIdentifier;
wr::MaybeIdNamespace idNamespace;
// Sync ipc
bridge->SendEnsureConnected(&textureFactoryIdentifier, &idNamespace);
if (textureFactoryIdentifier.mParentBackend == LayersBackend::LAYERS_NONE ||
idNamespace.isNothing()) {
gfxCriticalNote << "Failed to connect WebRenderBridgeChild.";
return false;
}
mWrChild = static_cast<WebRenderBridgeChild*>(bridge);
WrBridge()->SetWebRenderLayerManager(this);
WrBridge()->IdentifyTextureHost(textureFactoryIdentifier);
WrBridge()->SetNamespace(id_namespace);
WrBridge()->SetNamespace(idNamespace.ref());
*aTextureFactoryIdentifier = textureFactoryIdentifier;
return true;
}

Просмотреть файл

@ -43,6 +43,7 @@ typedef wr::WrEpoch Epoch;
typedef wr::WrExternalImageId ExternalImageId;
typedef wr::WrDebugFlags DebugFlags;
typedef mozilla::Maybe<mozilla::wr::IdNamespace> MaybeIdNamespace;
typedef mozilla::Maybe<mozilla::wr::WrImageMask> MaybeImageMask;
typedef Maybe<ExternalImageId> MaybeExternalImageId;

Просмотреть файл

@ -980,8 +980,6 @@ description =
description =
[PCompositorBridge::SyncWithCompositor]
description =
[PCompositorBridge::PWebRenderBridge]
description =
[PCompositorBridge::CheckContentOnlyTDR]
description =
[PCompositorWidget::EnterPresentLock]
@ -1021,6 +1019,8 @@ description =
description =
[PUiCompositorController::ResumeAndResize]
description =
[PWebRenderBridge::EnsureConnected]
description =
[PWebRenderBridge::GetSnapshot]
description =
[PWebRenderBridge::SetTestSampleTime]