зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1448896 - Change some messages to WebRenderParentCommand r=nical
This commit is contained in:
Родитель
42bc3542cc
Коммит
fb2b919e09
|
@ -18,14 +18,6 @@ using mozilla::layers::APZTestData from "mozilla/layers/APZTestData.h";
|
|||
using struct mozilla::layers::ScrollableLayerGuid from "FrameMetrics.h";
|
||||
using struct mozilla::layers::TextureInfo from "mozilla/layers/CompositorTypes.h";
|
||||
using mozilla::layers::CompositableHandle from "mozilla/layers/LayersTypes.h";
|
||||
using mozilla::wr::ByteBuffer from "mozilla/webrender/WebRenderTypes.h";
|
||||
using mozilla::wr::ExternalImageId from "mozilla/webrender/WebRenderTypes.h";
|
||||
using mozilla::wr::ImageKey from "mozilla/webrender/WebRenderTypes.h";
|
||||
using mozilla::wr::FontKey from "mozilla/webrender/WebRenderTypes.h";
|
||||
using mozilla::wr::FontInstanceKey from "mozilla/webrender/WebRenderTypes.h";
|
||||
using mozilla::wr::MaybeFontInstanceOptions from "mozilla/webrender/WebRenderTypes.h";
|
||||
using mozilla::wr::MaybeFontInstancePlatformOptions from "mozilla/webrender/WebRenderTypes.h";
|
||||
using mozilla::wr::PipelineId from "mozilla/webrender/WebRenderTypes.h";
|
||||
using mozilla::wr::BuiltDisplayListDescriptor from "mozilla/webrender/webrender_ffi.h";
|
||||
using mozilla::wr::IdNamespace from "mozilla/webrender/WebRenderTypes.h";
|
||||
using mozilla::layers::WebRenderScrollData from "mozilla/layers/WebRenderScrollData.h";
|
||||
|
@ -56,10 +48,6 @@ parent:
|
|||
async UpdateResources(OpUpdateResource[] aResourceUpdates, RefCountedShmem[] aSmallShmems, Shmem[] aLargeShmems);
|
||||
async ParentCommands(WebRenderParentCommand[] commands);
|
||||
sync GetSnapshot(PTexture texture);
|
||||
async AddPipelineIdForCompositable(PipelineId aImageId, CompositableHandle aHandle, bool aAsync);
|
||||
async RemovePipelineIdForCompositable(PipelineId aPipelineId);
|
||||
async AddExternalImageIdForCompositable(ExternalImageId aImageId, CompositableHandle aHandle);
|
||||
async RemoveExternalImageId(ExternalImageId aImageId);
|
||||
async SetLayerObserverEpoch(uint64_t layerObserverEpoch);
|
||||
async ClearCachedResources();
|
||||
// Schedule a composite if one isn't already scheduled.
|
||||
|
|
|
@ -11,12 +11,11 @@ include LayersSurfaces;
|
|||
include LayersMessages;
|
||||
include protocol PTexture;
|
||||
|
||||
using mozilla::wr::ByteBuffer from "mozilla/webrender/WebRenderTypes.h";
|
||||
using mozilla::layers::CompositableHandle from "mozilla/layers/LayersTypes.h";
|
||||
using mozilla::wr::LayoutSize from "mozilla/webrender/webrender_ffi.h";
|
||||
using mozilla::wr::ImageDescriptor from "mozilla/webrender/webrender_ffi.h";
|
||||
using mozilla::wr::ImageRendering from "mozilla/webrender/webrender_ffi.h";
|
||||
using mozilla::wr::MixBlendMode from "mozilla/webrender/webrender_ffi.h";
|
||||
using mozilla::wr::MaybeImageMask from "mozilla/webrender/WebRenderTypes.h";
|
||||
using mozilla::wr::ExternalImageId from "mozilla/webrender/WebRenderTypes.h";
|
||||
using mozilla::wr::MaybeFontInstanceOptions from "mozilla/webrender/WebRenderTypes.h";
|
||||
using mozilla::wr::MaybeFontInstancePlatformOptions from "mozilla/webrender/WebRenderTypes.h";
|
||||
|
@ -58,6 +57,25 @@ struct OpAddCompositorAnimations {
|
|||
OptionalOpacity opacity;
|
||||
};
|
||||
|
||||
struct OpAddPipelineIdForCompositable {
|
||||
PipelineId pipelineId;
|
||||
CompositableHandle handle;
|
||||
bool isAsync;
|
||||
};
|
||||
|
||||
struct OpRemovePipelineIdForCompositable {
|
||||
PipelineId pipelineId;
|
||||
};
|
||||
|
||||
struct OpAddExternalImageIdForCompositable {
|
||||
ExternalImageId externalImageId;
|
||||
CompositableHandle handle;
|
||||
};
|
||||
|
||||
struct OpRemoveExternalImageId {
|
||||
ExternalImageId externalImageId;
|
||||
};
|
||||
|
||||
struct OpUpdateAsyncImagePipeline {
|
||||
PipelineId pipelineId;
|
||||
LayoutDeviceRect scBounds;
|
||||
|
@ -68,6 +86,10 @@ struct OpUpdateAsyncImagePipeline {
|
|||
};
|
||||
|
||||
union WebRenderParentCommand {
|
||||
OpAddPipelineIdForCompositable;
|
||||
OpRemovePipelineIdForCompositable;
|
||||
OpAddExternalImageIdForCompositable;
|
||||
OpRemoveExternalImageId;
|
||||
OpUpdateAsyncImagePipeline;
|
||||
CompositableOperation;
|
||||
OpAddCompositorAnimations;
|
||||
|
|
|
@ -83,7 +83,6 @@ WebRenderBridgeChild::DoDestroy()
|
|||
void
|
||||
WebRenderBridgeChild::AddWebRenderParentCommand(const WebRenderParentCommand& aCmd)
|
||||
{
|
||||
MOZ_ASSERT(mIsInTransaction || mIsInClearCachedResources);
|
||||
mParentCommands.AppendElement(aCmd);
|
||||
}
|
||||
|
||||
|
@ -198,25 +197,23 @@ void
|
|||
WebRenderBridgeChild::AddPipelineIdForAsyncCompositable(const wr::PipelineId& aPipelineId,
|
||||
const CompositableHandle& aHandle)
|
||||
{
|
||||
MOZ_ASSERT(!mDestroyed);
|
||||
SendAddPipelineIdForCompositable(aPipelineId, aHandle, true);
|
||||
AddWebRenderParentCommand(
|
||||
OpAddPipelineIdForCompositable(aPipelineId, aHandle, /* isAsync */ true));
|
||||
}
|
||||
|
||||
void
|
||||
WebRenderBridgeChild::AddPipelineIdForCompositable(const wr::PipelineId& aPipelineId,
|
||||
const CompositableHandle& aHandle)
|
||||
{
|
||||
MOZ_ASSERT(!mDestroyed);
|
||||
SendAddPipelineIdForCompositable(aPipelineId, aHandle, false);
|
||||
AddWebRenderParentCommand(
|
||||
OpAddPipelineIdForCompositable(aPipelineId, aHandle, /* isAsync */ false));
|
||||
}
|
||||
|
||||
void
|
||||
WebRenderBridgeChild::RemovePipelineIdForCompositable(const wr::PipelineId& aPipelineId)
|
||||
{
|
||||
if (!IPCOpen()) {
|
||||
return;
|
||||
}
|
||||
SendRemovePipelineIdForCompositable(aPipelineId);
|
||||
AddWebRenderParentCommand(
|
||||
OpRemovePipelineIdForCompositable(aPipelineId));
|
||||
}
|
||||
|
||||
wr::ExternalImageId
|
||||
|
@ -230,23 +227,17 @@ WebRenderBridgeChild::GetNextExternalImageId()
|
|||
wr::ExternalImageId
|
||||
WebRenderBridgeChild::AllocExternalImageIdForCompositable(CompositableClient* aCompositable)
|
||||
{
|
||||
MOZ_ASSERT(!mDestroyed);
|
||||
MOZ_ASSERT(aCompositable->IsConnected());
|
||||
|
||||
wr::ExternalImageId imageId = GetNextExternalImageId();
|
||||
SendAddExternalImageIdForCompositable(imageId, aCompositable->GetIPCHandle());
|
||||
AddWebRenderParentCommand(
|
||||
OpAddExternalImageIdForCompositable(imageId, aCompositable->GetIPCHandle()));
|
||||
return imageId;
|
||||
}
|
||||
|
||||
void
|
||||
WebRenderBridgeChild::DeallocExternalImageId(const wr::ExternalImageId& aImageId)
|
||||
{
|
||||
if (mDestroyed) {
|
||||
// This can happen if the IPC connection was torn down, because, e.g.
|
||||
// the GPU process died.
|
||||
return;
|
||||
}
|
||||
SendRemoveExternalImageId(aImageId);
|
||||
AddWebRenderParentCommand(
|
||||
OpRemoveExternalImageId(aImageId));
|
||||
}
|
||||
|
||||
struct FontFileDataSink
|
||||
|
|
|
@ -725,14 +725,37 @@ WebRenderBridgeParent::ProcessWebRenderParentCommands(const InfallibleTArray<Web
|
|||
for (InfallibleTArray<WebRenderParentCommand>::index_type i = 0; i < aCommands.Length(); ++i) {
|
||||
const WebRenderParentCommand& cmd = aCommands[i];
|
||||
switch (cmd.type()) {
|
||||
case WebRenderParentCommand::TOpAddPipelineIdForCompositable: {
|
||||
const OpAddPipelineIdForCompositable& op = cmd.get_OpAddPipelineIdForCompositable();
|
||||
AddPipelineIdForCompositable(op.pipelineId(),
|
||||
op.handle(),
|
||||
op.isAsync());
|
||||
break;
|
||||
}
|
||||
case WebRenderParentCommand::TOpRemovePipelineIdForCompositable: {
|
||||
const OpRemovePipelineIdForCompositable& op = cmd.get_OpRemovePipelineIdForCompositable();
|
||||
RemovePipelineIdForCompositable(op.pipelineId());
|
||||
break;
|
||||
}
|
||||
case WebRenderParentCommand::TOpAddExternalImageIdForCompositable: {
|
||||
const OpAddExternalImageIdForCompositable& op = cmd.get_OpAddExternalImageIdForCompositable();
|
||||
AddExternalImageIdForCompositable(op.externalImageId(),
|
||||
op.handle());
|
||||
break;
|
||||
}
|
||||
case WebRenderParentCommand::TOpRemoveExternalImageId: {
|
||||
const OpRemoveExternalImageId& op = cmd.get_OpRemoveExternalImageId();
|
||||
RemoveExternalImageId(op.externalImageId());
|
||||
break;
|
||||
}
|
||||
case WebRenderParentCommand::TOpUpdateAsyncImagePipeline: {
|
||||
const OpUpdateAsyncImagePipeline& op = cmd.get_OpUpdateAsyncImagePipeline();
|
||||
mAsyncImageManager->UpdateAsyncImagePipeline(op.pipelineId(),
|
||||
op.scBounds(),
|
||||
op.scTransform(),
|
||||
op.scaleToSize(),
|
||||
op.filter(),
|
||||
op.mixBlendMode());
|
||||
op.scBounds(),
|
||||
op.scTransform(),
|
||||
op.scaleToSize(),
|
||||
op.filter(),
|
||||
op.mixBlendMode());
|
||||
break;
|
||||
}
|
||||
case WebRenderParentCommand::TCompositableOperation: {
|
||||
|
@ -816,13 +839,13 @@ WebRenderBridgeParent::RecvGetSnapshot(PTextureParent* aTexture)
|
|||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult
|
||||
WebRenderBridgeParent::RecvAddPipelineIdForCompositable(const wr::PipelineId& aPipelineId,
|
||||
const CompositableHandle& aHandle,
|
||||
const bool& aAsync)
|
||||
void
|
||||
WebRenderBridgeParent::AddPipelineIdForCompositable(const wr::PipelineId& aPipelineId,
|
||||
const CompositableHandle& aHandle,
|
||||
const bool& aAsync)
|
||||
{
|
||||
if (mDestroyed) {
|
||||
return IPC_OK();
|
||||
return;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(!mAsyncCompositables.Get(wr::AsUint64(aPipelineId)).get());
|
||||
|
@ -831,14 +854,14 @@ WebRenderBridgeParent::RecvAddPipelineIdForCompositable(const wr::PipelineId& aP
|
|||
if (aAsync) {
|
||||
RefPtr<ImageBridgeParent> imageBridge = ImageBridgeParent::GetInstance(OtherPid());
|
||||
if (!imageBridge) {
|
||||
return IPC_FAIL_NO_REASON(this);
|
||||
return;
|
||||
}
|
||||
host = imageBridge->FindCompositable(aHandle);
|
||||
} else {
|
||||
host = FindCompositable(aHandle);
|
||||
}
|
||||
if (!host) {
|
||||
return IPC_FAIL_NO_REASON(this);
|
||||
return;
|
||||
}
|
||||
|
||||
WebRenderImageHost* wrHost = host->AsWebRenderImageHost();
|
||||
|
@ -848,7 +871,7 @@ WebRenderBridgeParent::RecvAddPipelineIdForCompositable(const wr::PipelineId& aP
|
|||
}
|
||||
|
||||
if (!wrHost) {
|
||||
return IPC_OK();
|
||||
return;
|
||||
}
|
||||
|
||||
wrHost->SetWrBridge(this);
|
||||
|
@ -856,19 +879,19 @@ WebRenderBridgeParent::RecvAddPipelineIdForCompositable(const wr::PipelineId& aP
|
|||
mAsyncCompositables.Put(wr::AsUint64(aPipelineId), wrHost);
|
||||
mAsyncImageManager->AddAsyncImagePipeline(aPipelineId, wrHost);
|
||||
|
||||
return IPC_OK();
|
||||
return;
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult
|
||||
WebRenderBridgeParent::RecvRemovePipelineIdForCompositable(const wr::PipelineId& aPipelineId)
|
||||
void
|
||||
WebRenderBridgeParent::RemovePipelineIdForCompositable(const wr::PipelineId& aPipelineId)
|
||||
{
|
||||
if (mDestroyed) {
|
||||
return IPC_OK();
|
||||
return;
|
||||
}
|
||||
|
||||
WebRenderImageHost* wrHost = mAsyncCompositables.Get(wr::AsUint64(aPipelineId)).get();
|
||||
if (!wrHost) {
|
||||
return IPC_OK();
|
||||
return;
|
||||
}
|
||||
|
||||
wr::TransactionBuilder txn;
|
||||
|
@ -878,15 +901,15 @@ WebRenderBridgeParent::RecvRemovePipelineIdForCompositable(const wr::PipelineId&
|
|||
txn.RemovePipeline(aPipelineId);
|
||||
mApi->SendTransaction(txn);
|
||||
mAsyncCompositables.Remove(wr::AsUint64(aPipelineId));
|
||||
return IPC_OK();
|
||||
return;
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult
|
||||
WebRenderBridgeParent::RecvAddExternalImageIdForCompositable(const ExternalImageId& aImageId,
|
||||
const CompositableHandle& aHandle)
|
||||
void
|
||||
WebRenderBridgeParent::AddExternalImageIdForCompositable(const ExternalImageId& aImageId,
|
||||
const CompositableHandle& aHandle)
|
||||
{
|
||||
if (mDestroyed) {
|
||||
return IPC_OK();
|
||||
return;
|
||||
}
|
||||
MOZ_ASSERT(!mExternalImageIds.Get(wr::AsUint64(aImageId)).get());
|
||||
|
||||
|
@ -899,31 +922,31 @@ WebRenderBridgeParent::RecvAddExternalImageIdForCompositable(const ExternalImage
|
|||
}
|
||||
|
||||
if (!wrHost) {
|
||||
return IPC_OK();
|
||||
return;
|
||||
}
|
||||
|
||||
wrHost->SetWrBridge(this);
|
||||
mExternalImageIds.Put(wr::AsUint64(aImageId), wrHost);
|
||||
|
||||
return IPC_OK();
|
||||
return;
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult
|
||||
WebRenderBridgeParent::RecvRemoveExternalImageId(const ExternalImageId& aImageId)
|
||||
void
|
||||
WebRenderBridgeParent::RemoveExternalImageId(const ExternalImageId& aImageId)
|
||||
{
|
||||
if (mDestroyed) {
|
||||
return IPC_OK();
|
||||
return;
|
||||
}
|
||||
|
||||
WebRenderImageHost* wrHost = mExternalImageIds.Get(wr::AsUint64(aImageId)).get();
|
||||
if (!wrHost) {
|
||||
return IPC_OK();
|
||||
return;
|
||||
}
|
||||
|
||||
wrHost->ClearWrBridge();
|
||||
mExternalImageIds.Remove(wr::AsUint64(aImageId));
|
||||
|
||||
return IPC_OK();
|
||||
return;
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult
|
||||
|
|
|
@ -101,14 +101,6 @@ public:
|
|||
mozilla::ipc::IPCResult RecvParentCommands(nsTArray<WebRenderParentCommand>&& commands) override;
|
||||
mozilla::ipc::IPCResult RecvGetSnapshot(PTextureParent* aTexture) override;
|
||||
|
||||
mozilla::ipc::IPCResult RecvAddPipelineIdForCompositable(const wr::PipelineId& aPipelineIds,
|
||||
const CompositableHandle& aHandle,
|
||||
const bool& aAsync) override;
|
||||
mozilla::ipc::IPCResult RecvRemovePipelineIdForCompositable(const wr::PipelineId& aPipelineId) override;
|
||||
|
||||
mozilla::ipc::IPCResult RecvAddExternalImageIdForCompositable(const ExternalImageId& aImageId,
|
||||
const CompositableHandle& aHandle) override;
|
||||
mozilla::ipc::IPCResult RecvRemoveExternalImageId(const ExternalImageId& aImageId) override;
|
||||
mozilla::ipc::IPCResult RecvSetLayerObserverEpoch(const uint64_t& aLayerObserverEpoch) override;
|
||||
|
||||
mozilla::ipc::IPCResult RecvClearCachedResources() override;
|
||||
|
@ -205,6 +197,15 @@ private:
|
|||
bool AddExternalImage(wr::ExternalImageId aExtId, wr::ImageKey aKey,
|
||||
wr::TransactionBuilder& aResources);
|
||||
|
||||
void AddPipelineIdForCompositable(const wr::PipelineId& aPipelineIds,
|
||||
const CompositableHandle& aHandle,
|
||||
const bool& aAsync);
|
||||
void RemovePipelineIdForCompositable(const wr::PipelineId& aPipelineId);
|
||||
|
||||
void AddExternalImageIdForCompositable(const ExternalImageId& aImageId,
|
||||
const CompositableHandle& aHandle);
|
||||
void RemoveExternalImageId(const ExternalImageId& aImageId);
|
||||
|
||||
LayersId GetLayersId() const;
|
||||
void ProcessWebRenderParentCommands(const InfallibleTArray<WebRenderParentCommand>& aCommands);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче