--- a/gfx/layers/ipc/CompositorBridgeChild.cpp
+++ b/gfx/layers/ipc/CompositorBridgeChild.cpp
@@ -1086,17 +1086,17 @@ CompositorBridgeChild::WillEndTransactio
{
ResetShmemCounter();
}
PWebRenderBridgeChild*
CompositorBridgeChild::AllocPWebRenderBridgeChild(const wr::PipelineId& aPipelineId,
const LayoutDeviceIntSize&,
TextureFactoryIdentifier*,
- uint32_t *aIdNamespace)
+ wr::IdNamespace *aIdNamespace)
{
WebRenderBridgeChild* child = new WebRenderBridgeChild(aPipelineId);
child->AddIPDLReference();
return child;
}
bool
CompositorBridgeChild::DeallocPWebRenderBridgeChild(PWebRenderBridgeChild* aActor)
--- a/gfx/layers/ipc/CompositorBridgeChild.h
+++ b/gfx/layers/ipc/CompositorBridgeChild.h
@@ -205,17 +205,17 @@ public:
PAPZChild* AllocPAPZChild(const uint64_t& aLayersId) override;
bool DeallocPAPZChild(PAPZChild* aActor) override;
void WillEndTransaction();
PWebRenderBridgeChild* AllocPWebRenderBridgeChild(const wr::PipelineId& aPipelineId,
const LayoutDeviceIntSize&,
TextureFactoryIdentifier*,
- uint32_t*) override;
+ wr::IdNamespace*) override;
bool DeallocPWebRenderBridgeChild(PWebRenderBridgeChild* aActor) override;
uint64_t DeviceResetSequenceNumber() const {
return mDeviceResetSequenceNumber;
}
wr::MaybeExternalImageId GetNextExternalImageId() override;
--- a/gfx/layers/ipc/CompositorBridgeParent.cpp
+++ b/gfx/layers/ipc/CompositorBridgeParent.cpp
@@ -1673,17 +1673,17 @@ CompositorBridgeParent::RecvAdoptChild(c
}
return IPC_OK();
}
PWebRenderBridgeParent*
CompositorBridgeParent::AllocPWebRenderBridgeParent(const wr::PipelineId& aPipelineId,
const LayoutDeviceIntSize& aSize,
TextureFactoryIdentifier* aTextureFactoryIdentifier,
- uint32_t* aIdNamespace)
+ wr::IdNamespace* aIdNamespace)
{
#ifndef MOZ_BUILD_WEBRENDER
// Extra guard since this in the parent process and we don't want a malicious
// child process invoking this codepath before it's ready
MOZ_RELEASE_ASSERT(false);
#endif
MOZ_ASSERT(wr::AsUint64(aPipelineId) == mRootLayerTreeID);
MOZ_ASSERT(!mWrBridge);
@@ -1694,25 +1694,24 @@ CompositorBridgeParent::AllocPWebRenderB
MOZ_ASSERT(mWidget);
RefPtr<widget::CompositorWidget> widget = mWidget;
RefPtr<wr::WebRenderAPI> api = wr::WebRenderAPI::Create(
gfxPrefs::WebRenderProfilerEnabled(), this, Move(widget), aSize);
RefPtr<AsyncImagePipelineManager> asyncMgr =
new AsyncImagePipelineManager(WebRenderBridgeParent::AllocIdNameSpace());
if (!api) {
mWrBridge = WebRenderBridgeParent::CreateDestroyed();
- *aIdNamespace = mWrBridge->GetIdNameSpace();
+ *aIdNamespace = mWrBridge->GetIdNamespace();
*aTextureFactoryIdentifier = TextureFactoryIdentifier(LayersBackend::LAYERS_NONE);
return mWrBridge;
}
- MOZ_ASSERT(api); // TODO have a fallback
api->SetRootPipeline(aPipelineId);
RefPtr<CompositorAnimationStorage> animStorage = GetAnimationStorage();
mWrBridge = new WebRenderBridgeParent(this, aPipelineId, mWidget, nullptr, Move(api), Move(asyncMgr), Move(animStorage));
- *aIdNamespace = mWrBridge->GetIdNameSpace();
+ *aIdNamespace = mWrBridge->GetIdNamespace();
mCompositorScheduler = mWrBridge->CompositorScheduler();
MOZ_ASSERT(mCompositorScheduler);
mWrBridge.get()->AddRef(); // IPDL reference
MonitorAutoLock lock(*sIndirectLayerTreesLock);
MOZ_ASSERT(sIndirectLayerTrees[mRootLayerTreeID].mWrBridge == nullptr);
sIndirectLayerTrees[mRootLayerTreeID].mWrBridge = mWrBridge;
*aTextureFactoryIdentifier = mWrBridge->GetTextureFactoryIdentifier();
--- a/gfx/layers/ipc/CompositorBridgeParent.h
+++ b/gfx/layers/ipc/CompositorBridgeParent.h
@@ -454,17 +454,17 @@ public:
TimeDuration GetVsyncInterval() const {
// the variable is called "rate" but really it's an interval
return mVsyncRate;
}
PWebRenderBridgeParent* AllocPWebRenderBridgeParent(const wr::PipelineId& aPipelineId,
const LayoutDeviceIntSize& aSize,
TextureFactoryIdentifier* aTextureFactoryIdentifier,
- uint32_t* aIdNamespace) override;
+ wr::IdNamespace* aIdNamespace) override;
bool DeallocPWebRenderBridgeParent(PWebRenderBridgeParent* aActor) override;
RefPtr<WebRenderBridgeParent> GetWebRenderBridgeParent() const;
Maybe<TimeStamp> GetTestingTimeStamp() const;
static void SetWebRenderProfilerEnabled(bool aEnabled);
static CompositorBridgeParent* GetCompositorBridgeParentFromLayersId(const uint64_t& aLayersId);
--- a/gfx/layers/ipc/CrossProcessCompositorBridgeParent.cpp
+++ b/gfx/layers/ipc/CrossProcessCompositorBridgeParent.cpp
@@ -189,17 +189,17 @@ CrossProcessCompositorBridgeParent::Deal
controller->Release();
return true;
}
PWebRenderBridgeParent*
CrossProcessCompositorBridgeParent::AllocPWebRenderBridgeParent(const wr::PipelineId& aPipelineId,
const LayoutDeviceIntSize& aSize,
TextureFactoryIdentifier* aTextureFactoryIdentifier,
- uint32_t *aIdNamespace)
+ wr::IdNamespace *aIdNamespace)
{
#ifndef MOZ_BUILD_WEBRENDER
// Extra guard since this in the parent process and we don't want a malicious
// child process invoking this codepath before it's ready
MOZ_RELEASE_ASSERT(false);
#endif
uint64_t layersId = wr::AsUint64(aPipelineId);
// Check to see if this child process has access to this layer tree.
@@ -213,32 +213,32 @@ CrossProcessCompositorBridgeParent::Allo
MOZ_ASSERT(sIndirectLayerTrees[layersId].mWrBridge == nullptr);
WebRenderBridgeParent* parent = nullptr;
CompositorBridgeParent* cbp = sIndirectLayerTrees[layersId].mParent;
if (!cbp) {
// This could happen when this function is called after CompositorBridgeParent destruction.
// This was observed during Tab move between different windows.
NS_WARNING("Created child without a matching parent?");
parent = WebRenderBridgeParent::CreateDestroyed();
- *aIdNamespace = parent->GetIdNameSpace();
+ *aIdNamespace = parent->GetIdNamespace();
*aTextureFactoryIdentifier = TextureFactoryIdentifier(LayersBackend::LAYERS_NONE);
return parent;
}
WebRenderBridgeParent* root = sIndirectLayerTrees[cbp->RootLayerTreeId()].mWrBridge.get();
RefPtr<wr::WebRenderAPI> api = root->GetWebRenderAPI();
RefPtr<AsyncImagePipelineManager> holder = root->AsyncImageManager();
RefPtr<CompositorAnimationStorage> animStorage = cbp->GetAnimationStorage();
parent = new WebRenderBridgeParent(this, aPipelineId, nullptr, root->CompositorScheduler(), Move(api), Move(holder), Move(animStorage));
parent->AddRef(); // IPDL reference
sIndirectLayerTrees[layersId].mCrossProcessParent = this;
sIndirectLayerTrees[layersId].mWrBridge = parent;
*aTextureFactoryIdentifier = parent->GetTextureFactoryIdentifier();
- *aIdNamespace = parent->GetIdNameSpace();
+ *aIdNamespace = parent->GetIdNamespace();
return parent;
}
bool
CrossProcessCompositorBridgeParent::DeallocPWebRenderBridgeParent(PWebRenderBridgeParent* aActor)
{
#ifndef MOZ_BUILD_WEBRENDER
--- a/gfx/layers/ipc/CrossProcessCompositorBridgeParent.h
+++ b/gfx/layers/ipc/CrossProcessCompositorBridgeParent.h
@@ -143,17 +143,17 @@ public:
virtual PAPZParent* AllocPAPZParent(const uint64_t& aLayersId) override;
virtual bool DeallocPAPZParent(PAPZParent* aActor) override;
virtual void UpdatePaintTime(LayerTransactionParent* aLayerTree, const TimeDuration& aPaintTime) override;
PWebRenderBridgeParent* AllocPWebRenderBridgeParent(const wr::PipelineId& aPipelineId,
const LayoutDeviceIntSize& aSize,
TextureFactoryIdentifier* aTextureFactoryIdentifier,
- uint32_t* aIdNamespace) override;
+ wr::IdNamespace* aIdNamespace) override;
bool DeallocPWebRenderBridgeParent(PWebRenderBridgeParent* aActor) override;
void ObserveLayerUpdate(uint64_t aLayersId, uint64_t aEpoch, bool aActive) override;
bool IsRemote() const override {
return true;
}
--- a/gfx/layers/ipc/PCompositorBridge.ipdl
+++ b/gfx/layers/ipc/PCompositorBridge.ipdl
@@ -34,16 +34,17 @@ using mozilla::CSSIntRegion from "Units.
using mozilla::LayoutDeviceIntPoint from "Units.h";
using mozilla::LayoutDeviceIntRegion from "Units.h";
using mozilla::LayoutDeviceIntSize from "Units.h";
using class mozilla::TimeStamp from "mozilla/TimeStamp.h";
using class mozilla::layers::FrameUniformityData from "mozilla/layers/FrameUniformityData.h";
using mozilla::layers::TextureFlags from "mozilla/layers/CompositorTypes.h";
using mozilla::layers::CompositorOptions from "mozilla/layers/CompositorOptions.h";
using mozilla::wr::PipelineId from "mozilla/webrender/WebRenderTypes.h";
+using mozilla::wr::IdNamespace from "mozilla/webrender/WebRenderTypes.h";
using base::ProcessId from "base/process.h";
using mozilla::wr::MaybeExternalImageId from "mozilla/webrender/WebRenderTypes.h";
namespace mozilla {
namespace layers {
/**
@@ -245,17 +246,17 @@ parent:
async AllPluginsCaptured();
async PTexture(SurfaceDescriptor aSharedData, LayersBackend aBackend, TextureFlags aTextureFlags, uint64_t id, uint64_t aSerial, MaybeExternalImageId aExternalImageId);
sync SyncWithCompositor();
// The pipelineId is the same as the layersId
sync PWebRenderBridge(PipelineId pipelineId, LayoutDeviceIntSize aSize)
- returns (TextureFactoryIdentifier textureFactoryIdentifier, uint32_t idNamespace); //XXX: use the WrIdNamespace type
+ returns (TextureFactoryIdentifier textureFactoryIdentifier, IdNamespace idNamespace);
sync CheckContentOnlyTDR(uint32_t sequenceNum)
returns (bool isContentOnlyTDR);
child:
// Send back Compositor Frame Metrics from APZCs so tiled layers can
// update progressively.
async SharedCompositorFrameMetrics(Handle metrics, CrossProcessMutexHandle mutex, uint64_t aLayersId, uint32_t aAPZCId);
--- a/gfx/layers/ipc/PWebRenderBridge.ipdl
+++ b/gfx/layers/ipc/PWebRenderBridge.ipdl
@@ -19,16 +19,17 @@ using struct mozilla::layers::Scrollable
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::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";
namespace mozilla {
namespace layers {
sync protocol PWebRenderBridge
{
manager PCompositorBridge;
@@ -51,20 +52,20 @@ parent:
SurfaceFormat aFormat, ByteBuffer aBytes);
async DeleteImage(ImageKey aImageKey);
async DeleteCompositorAnimations(uint64_t[] aIds);
async AddRawFont(FontKey aFontKey, ByteBuffer aBytes, uint32_t aFontIndex);
async DeleteFont(FontKey aFontKey);
async DPBegin(IntSize aSize);
async DPEnd(IntSize aSize, WebRenderParentCommand[] commands, OpDestroy[] toDestroy, uint64_t fwdTransactionId, uint64_t transactionId,
LayoutSize aContentSize, ByteBuffer aDL, BuiltDisplayListDescriptor aDLDesc,
- WebRenderScrollData aScrollData, uint32_t idNameSpace, TimeStamp fwdTime);
+ WebRenderScrollData aScrollData, IdNamespace aIdNamespace, TimeStamp fwdTime);
sync DPSyncEnd(IntSize aSize, WebRenderParentCommand[] commands, OpDestroy[] toDestroy, uint64_t fwdTransactionId, uint64_t transactionId,
LayoutSize aContentSize, ByteBuffer aDL, BuiltDisplayListDescriptor aDLDesc,
- WebRenderScrollData aScrollData, uint32_t idNameSpace, TimeStamp fwdTime);
+ WebRenderScrollData aScrollData, IdNamespace aIdNamespace, TimeStamp fwdTime);
async ParentCommands(WebRenderParentCommand[] commands);
sync DPGetSnapshot(PTexture texture);
async AddPipelineIdForAsyncCompositable(PipelineId aImageId, CompositableHandle aHandle);
async RemovePipelineIdForAsyncCompositable(PipelineId aPipelineId);
async AddExternalImageIdForCompositable(ExternalImageId aImageId, CompositableHandle aHandle);
async RemoveExternalImageId(ExternalImageId aImageId);
async SetLayerObserverEpoch(uint64_t layerObserverEpoch);
async ClearCachedResources();
@@ -83,14 +84,14 @@ parent:
sync SetAsyncScrollOffset(ViewID scrollId, float x, float y);
sync SetAsyncZoom(ViewID scrollId, float zoom);
async FlushApzRepaints();
sync GetAPZTestData() returns (APZTestData data);
async Shutdown();
sync ShutdownSync();
child:
- async WrUpdated(uint32_t newIdNameSpace);
+ async WrUpdated(IdNamespace aNewIdNamespace);
async __delete__();
};
} // layers
} // mozilla
--- a/gfx/layers/wr/AsyncImagePipelineManager.cpp
+++ b/gfx/layers/wr/AsyncImagePipelineManager.cpp
@@ -18,17 +18,17 @@ namespace layers {
AsyncImagePipelineManager::AsyncImagePipeline::AsyncImagePipeline()
: mInitialised(false)
, mIsChanged(false)
, mUseExternalImage(false)
, mFilter(wr::ImageRendering::Auto)
, mMixBlendMode(wr::MixBlendMode::Normal)
{}
-AsyncImagePipelineManager::AsyncImagePipelineManager(uint32_t aIdNamespace)
+AsyncImagePipelineManager::AsyncImagePipelineManager(wr::IdNamespace aIdNamespace)
: mIdNamespace(aIdNamespace)
, mResourceId(0)
, mAsyncImageEpoch(0)
, mDestroyed(false)
{
MOZ_COUNT_CTOR(AsyncImagePipelineManager);
}
--- a/gfx/layers/wr/AsyncImagePipelineManager.h
+++ b/gfx/layers/wr/AsyncImagePipelineManager.h
@@ -29,17 +29,17 @@ class CompositorVsyncScheduler;
class WebRenderImageHost;
class WebRenderTextureHost;
class AsyncImagePipelineManager final
{
public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(AsyncImagePipelineManager)
- explicit AsyncImagePipelineManager(uint32_t aIdNamespace);
+ explicit AsyncImagePipelineManager(wr::IdNamespace aIdNamespace);
protected:
~AsyncImagePipelineManager();
public:
void Destroy(wr::WebRenderAPI* aApi);
bool HasKeysToDelete();
@@ -89,21 +89,21 @@ public:
{
aNotifications->AppendElements(Move(mImageCompositeNotifications));
}
private:
void DeleteOldAsyncImages(wr::WebRenderAPI* aApi);
uint32_t GetNextResourceId() { return ++mResourceId; }
- uint32_t GetNamespace() { return mIdNamespace; }
+ wr::IdNamespace GetNamespace() { return mIdNamespace; }
wr::ImageKey GenerateImageKey()
{
wr::ImageKey key;
- key.mNamespace.mHandle = GetNamespace();
+ key.mNamespace = GetNamespace();
key.mHandle = GetNextResourceId();
return key;
}
bool GenerateImageKeyForTextureHost(wr::WebRenderAPI* aApi, TextureHost* aTexture, nsTArray<wr::ImageKey>& aKeys);
struct ForwardingTextureHost {
ForwardingTextureHost(const wr::Epoch& aEpoch, TextureHost* aTexture)
: mEpoch(aEpoch)
@@ -136,17 +136,17 @@ private:
};
bool UpdateImageKeys(wr::WebRenderAPI* aApi,
bool& aUseExternalImage,
AsyncImagePipeline* aImageMgr,
nsTArray<wr::ImageKey>& aKeys,
nsTArray<wr::ImageKey>& aKeysToDelete);
- uint32_t mIdNamespace;
+ wr::IdNamespace mIdNamespace;
uint32_t mResourceId;
nsClassHashtable<nsUint64HashKey, PipelineTexturesHolder> mPipelineTexturesHolders;
nsClassHashtable<nsUint64HashKey, AsyncImagePipeline> mAsyncImagePipelines;
uint32_t mAsyncImageEpoch;
nsTArray<wr::ImageKey> mKeysToDelete;
bool mDestroyed;
--- a/gfx/layers/wr/WebRenderBridgeChild.cpp
+++ b/gfx/layers/wr/WebRenderBridgeChild.cpp
@@ -18,17 +18,17 @@ namespace mozilla {
namespace layers {
using namespace mozilla::gfx;
WebRenderBridgeChild::WebRenderBridgeChild(const wr::PipelineId& aPipelineId)
: mReadLockSequenceNumber(0)
, mIsInTransaction(false)
, mIsInClearCachedResources(false)
- , mIdNamespace(0)
+ , mIdNamespace{0}
, mResourceId(0)
, mPipelineId(aPipelineId)
, mIPCOpen(false)
, mDestroyed(false)
, mFontKeysDeleted(0)
{
}
@@ -114,17 +114,17 @@ WebRenderBridgeChild::DPEnd(wr::DisplayL
TimeStamp fwdTime;
#if defined(ENABLE_FRAME_LATENCY_LOG)
fwdTime = TimeStamp::Now();
#endif
if (aIsSync) {
this->SendDPSyncEnd(aSize, mParentCommands, mDestroyedActors, GetFwdTransactionId(), aTransactionId,
- contentSize, dlData, dl.dl_desc, aScrollData, mIdNamespace,fwdTime);
+ contentSize, dlData, dl.dl_desc, aScrollData, mIdNamespace, fwdTime);
} else {
this->SendDPEnd(aSize, mParentCommands, mDestroyedActors, GetFwdTransactionId(), aTransactionId,
contentSize, dlData, dl.dl_desc, aScrollData, mIdNamespace, fwdTime);
}
mParentCommands.Clear();
mDestroyedActors.Clear();
mIsInTransaction = false;
@@ -255,17 +255,17 @@ WebRenderBridgeChild::GetFontKeyForScale
}
FontFileData data;
if (!unscaled->GetFontFileData(WriteFontFileData, &data) ||
!data.mFontBuffer.mData) {
return key;
}
- key.mNamespace.mHandle = GetNamespace();
+ key.mNamespace = GetNamespace();
key.mHandle = GetNextResourceId();
SendAddRawFont(key, data.mFontBuffer, data.mFontIndex);
mFontKeys.Put(unscaled, key);
return key;
}
@@ -447,21 +447,21 @@ WebRenderBridgeChild::GetFwdTransactionI
bool
WebRenderBridgeChild::InForwarderThread()
{
return NS_IsMainThread();
}
mozilla::ipc::IPCResult
-WebRenderBridgeChild::RecvWrUpdated(const uint32_t& aNewIdNameSpace)
+WebRenderBridgeChild::RecvWrUpdated(const wr::IdNamespace& aNewIdNamespace)
{
// Update mIdNamespace to identify obsolete keys and messages by WebRenderBridgeParent.
// Since usage of invalid keys could cause crash in webrender.
- mIdNamespace = aNewIdNameSpace;
+ mIdNamespace = aNewIdNamespace;
// Remove all FontKeys since they are removed by WebRenderBridgeParent
for (auto iter = mFontKeys.Iter(); !iter.Done(); iter.Next()) {
SendDeleteFont(iter.Data());
}
mFontKeys.Clear();
GetCompositorBridgeChild()->RecvInvalidateLayers(wr::AsUint64(mPipelineId));
return IPC_OK();
}
--- a/gfx/layers/wr/WebRenderBridgeChild.h
+++ b/gfx/layers/wr/WebRenderBridgeChild.h
@@ -85,25 +85,25 @@ public:
* Clean this up, finishing with SendShutDown() which will cause __delete__
* to be sent from the parent side.
*/
void Destroy(bool aIsSync);
bool IPCOpen() const { return mIPCOpen && !mDestroyed; }
bool IsDestroyed() const { return mDestroyed; }
uint32_t GetNextResourceId() { return ++mResourceId; }
- uint32_t GetNamespace() { return mIdNamespace; }
- void SetNamespace(uint32_t aIdNamespace)
+ wr::IdNamespace GetNamespace() { return mIdNamespace; }
+ void SetNamespace(wr::IdNamespace aIdNamespace)
{
mIdNamespace = aIdNamespace;
}
wr::WrImageKey GetNextImageKey()
{
- return wr::WrImageKey{ wr::WrIdNamespace { GetNamespace() }, GetNextResourceId() };
+ return wr::WrImageKey{ GetNamespace(), GetNextResourceId() };
}
void PushGlyphs(wr::DisplayListBuilder& aBuilder, const nsTArray<GlyphArray>& aGlyphs,
gfx::ScaledFont* aFont, const StackingContextHelper& aSc,
const LayerRect& aBounds, const LayerRect& aClip);
wr::FontKey GetFontKeyForScaledFont(gfx::ScaledFont* aScaledFont);
@@ -139,17 +139,17 @@ private:
TextureClient* aClientOnBlack,
TextureClient* aClientOnWhite) override;
void UpdateFwdTransactionId() override;
uint64_t GetFwdTransactionId() override;
bool InForwarderThread() override;
void ActorDestroy(ActorDestroyReason why) override;
- virtual mozilla::ipc::IPCResult RecvWrUpdated(const uint32_t& aNewIdNameSpace) override;
+ virtual mozilla::ipc::IPCResult RecvWrUpdated(const wr::IdNamespace& aNewIdNamespace) override;
void AddIPDLReference() {
MOZ_ASSERT(mIPCOpen == false);
mIPCOpen = true;
AddRef();
}
void ReleaseIPDLReference() {
MOZ_ASSERT(mIPCOpen == true);
@@ -161,17 +161,17 @@ private:
nsTArray<WebRenderParentCommand> mParentCommands;
nsTArray<OpDestroy> mDestroyedActors;
nsDataHashtable<nsUint64HashKey, CompositableClient*> mCompositables;
nsTArray<nsTArray<ReadLockInit>> mReadLocks;
uint64_t mReadLockSequenceNumber;
bool mIsInTransaction;
bool mIsInClearCachedResources;
- uint32_t mIdNamespace;
+ wr::IdNamespace mIdNamespace;
uint32_t mResourceId;
wr::PipelineId mPipelineId;
bool mIPCOpen;
bool mDestroyed;
uint32_t mFontKeysDeleted;
nsDataHashtable<UnscaledFontHashKey, wr::FontKey> mFontKeys;
--- a/gfx/layers/wr/WebRenderBridgeParent.cpp
+++ b/gfx/layers/wr/WebRenderBridgeParent.cpp
@@ -125,17 +125,17 @@ WebRenderBridgeParent::WebRenderBridgePa
, mWidget(aWidget)
, mApi(aApi)
, mAsyncImageManager(aImageMgr)
, mCompositorScheduler(aScheduler)
, mAnimStorage(aAnimStorage)
, mChildLayerObserverEpoch(0)
, mParentLayerObserverEpoch(0)
, mWrEpoch(0)
- , mIdNameSpace(AllocIdNameSpace())
+ , mIdNamespace(AllocIdNameSpace())
, mPaused(false)
, mDestroyed(false)
, mForceRendering(false)
{
MOZ_ASSERT(mAsyncImageManager);
MOZ_ASSERT(mAnimStorage);
mAsyncImageManager->AddPipeline(mPipelineId);
if (mWidget) {
@@ -144,17 +144,17 @@ WebRenderBridgeParent::WebRenderBridgePa
}
}
WebRenderBridgeParent::WebRenderBridgeParent()
: mCompositorBridge(nullptr)
, mChildLayerObserverEpoch(0)
, mParentLayerObserverEpoch(0)
, mWrEpoch(0)
- , mIdNameSpace(AllocIdNameSpace())
+ , mIdNamespace(AllocIdNameSpace())
, mPaused(false)
, mDestroyed(true)
, mForceRendering(false)
{
}
/* static */ WebRenderBridgeParent*
WebRenderBridgeParent::CreateDestroyed()
@@ -228,17 +228,17 @@ WebRenderBridgeParent::RecvAddImage(cons
const gfx::SurfaceFormat& aFormat,
const ByteBuffer& aBuffer)
{
if (mDestroyed) {
return IPC_OK();
}
// Check if key is obsoleted.
- if (aImageKey.mNamespace.mHandle != mIdNameSpace) {
+ if (aImageKey.mNamespace != mIdNamespace) {
return IPC_OK();
}
MOZ_ASSERT(mApi);
MOZ_ASSERT(mActiveImageKeys.find(wr::AsUint64(aImageKey)) == mActiveImageKeys.end());
wr::ImageDescriptor descriptor(aSize, aStride, aFormat);
mActiveImageKeys.insert(wr::AsUint64(aImageKey));
@@ -255,17 +255,17 @@ WebRenderBridgeParent::RecvAddBlobImage(
const gfx::SurfaceFormat& aFormat,
const ByteBuffer& aBuffer)
{
if (mDestroyed) {
return IPC_OK();
}
// Check if key is obsoleted.
- if (aImageKey.mNamespace.mHandle != mIdNameSpace) {
+ if (aImageKey.mNamespace != mIdNamespace) {
return IPC_OK();
}
MOZ_ASSERT(mApi);
MOZ_ASSERT(mActiveImageKeys.find(wr::AsUint64(aImageKey)) == mActiveImageKeys.end());
wr::ImageDescriptor descriptor(aSize, aStride, aFormat);
mActiveImageKeys.insert(wr::AsUint64(aImageKey));
@@ -280,17 +280,17 @@ WebRenderBridgeParent::RecvAddRawFont(co
const ByteBuffer& aBuffer,
const uint32_t& aFontIndex)
{
if (mDestroyed) {
return IPC_OK();
}
// Check if key is obsoleted.
- if (aFontKey.mNamespace.mHandle != mIdNameSpace) {
+ if (aFontKey.mNamespace != mIdNamespace) {
return IPC_OK();
}
MOZ_ASSERT(mApi);
MOZ_ASSERT(mFontKeys.find(wr::AsUint64(aFontKey)) == mFontKeys.end());
auto slice = aBuffer.AsSlice();
mFontKeys.insert(wr::AsUint64(aFontKey));
@@ -303,17 +303,17 @@ mozilla::ipc::IPCResult
WebRenderBridgeParent::RecvDeleteFont(const wr::FontKey& aFontKey)
{
if (mDestroyed) {
return IPC_OK();
}
MOZ_ASSERT(mApi);
// Check if key is obsoleted.
- if (aFontKey.mNamespace.mHandle != mIdNameSpace) {
+ if (aFontKey.mNamespace != mIdNamespace) {
return IPC_OK();
}
if (mFontKeys.find(wr::AsUint64(aFontKey)) != mFontKeys.end()) {
mFontKeys.erase(wr::AsUint64(aFontKey));
mApi->DeleteFont(aFontKey);
} else {
MOZ_ASSERT_UNREACHABLE("invalid FontKey");
@@ -329,17 +329,17 @@ WebRenderBridgeParent::RecvUpdateImage(c
const ByteBuffer& aBuffer)
{
if (mDestroyed) {
return IPC_OK();
}
MOZ_ASSERT(mApi);
// Check if key is obsoleted.
- if (aImageKey.mNamespace.mHandle != mIdNameSpace) {
+ if (aImageKey.mNamespace != mIdNamespace) {
return IPC_OK();
}
wr::ImageDescriptor descriptor(aSize, aFormat);
mApi->UpdateImageBuffer(aImageKey, descriptor, aBuffer.AsSlice());
return IPC_OK();
}
@@ -348,17 +348,17 @@ mozilla::ipc::IPCResult
WebRenderBridgeParent::RecvDeleteImage(const wr::ImageKey& aImageKey)
{
if (mDestroyed) {
return IPC_OK();
}
MOZ_ASSERT(mApi);
// Check if key is obsoleted.
- if (aImageKey.mNamespace.mHandle != mIdNameSpace) {
+ if (aImageKey.mNamespace != mIdNamespace) {
return IPC_OK();
}
if (mActiveImageKeys.find(wr::AsUint64(aImageKey)) != mActiveImageKeys.end()) {
mActiveImageKeys.erase(wr::AsUint64(aImageKey));
mKeysToDelete.push_back(aImageKey);
} else {
MOZ_ASSERT_UNREACHABLE("invalid ImageKey");
@@ -400,17 +400,17 @@ WebRenderBridgeParent::HandleDPEnd(const
InfallibleTArray<WebRenderParentCommand>&& aCommands,
InfallibleTArray<OpDestroy>&& aToDestroy,
const uint64_t& aFwdTransactionId,
const uint64_t& aTransactionId,
const wr::LayoutSize& aContentSize,
const wr::ByteBuffer& dl,
const wr::BuiltDisplayListDescriptor& dlDesc,
const WebRenderScrollData& aScrollData,
- const uint32_t& aIdNameSpace,
+ const wr::IdNamespace& aIdNamespace,
const TimeStamp& aFwdTime)
{
AutoProfilerTracing tracing("Paint", "DPTransaction");
UpdateFwdTransactionId(aFwdTransactionId);
AutoClearReadLocks clearLocks(mReadLocks);
if (mDestroyed) {
for (const auto& op : aToDestroy) {
@@ -419,23 +419,23 @@ WebRenderBridgeParent::HandleDPEnd(const
return;
}
// This ensures that destroy operations are always processed. It is not safe
// to early-return from RecvDPEnd without doing so.
AutoWebRenderBridgeParentAsyncMessageSender autoAsyncMessageSender(this, &aToDestroy);
uint32_t wrEpoch = GetNextWrEpoch();
ProcessWebRenderCommands(aSize, aCommands, wr::NewEpoch(wrEpoch),
- aContentSize, dl, dlDesc, aIdNameSpace);
+ aContentSize, dl, dlDesc, aIdNamespace);
HoldPendingTransactionId(wrEpoch, aTransactionId, aFwdTime);
mScrollData = aScrollData;
UpdateAPZ();
- if (mIdNameSpace != aIdNameSpace) {
+ if (mIdNamespace != aIdNamespace) {
// Pretend we composited since someone is wating for this event,
// though DisplayList was not pushed to webrender.
TimeStamp now = TimeStamp::Now();
mCompositorBridge->DidComposite(wr::AsUint64(mPipelineId), now, now);
}
}
CompositorBridgeParent*
@@ -514,45 +514,45 @@ WebRenderBridgeParent::RecvDPEnd(const g
InfallibleTArray<WebRenderParentCommand>&& aCommands,
InfallibleTArray<OpDestroy>&& aToDestroy,
const uint64_t& aFwdTransactionId,
const uint64_t& aTransactionId,
const wr::LayoutSize& aContentSize,
const wr::ByteBuffer& dl,
const wr::BuiltDisplayListDescriptor& dlDesc,
const WebRenderScrollData& aScrollData,
- const uint32_t& aIdNameSpace,
+ const wr::IdNamespace& aIdNamespace,
const TimeStamp& aFwdTime)
{
if (mDestroyed) {
return IPC_OK();
}
HandleDPEnd(aSize, Move(aCommands), Move(aToDestroy), aFwdTransactionId, aTransactionId,
- aContentSize, dl, dlDesc, aScrollData, aIdNameSpace, aFwdTime);
+ aContentSize, dl, dlDesc, aScrollData, aIdNamespace, aFwdTime);
return IPC_OK();
}
mozilla::ipc::IPCResult
WebRenderBridgeParent::RecvDPSyncEnd(const gfx::IntSize &aSize,
InfallibleTArray<WebRenderParentCommand>&& aCommands,
InfallibleTArray<OpDestroy>&& aToDestroy,
const uint64_t& aFwdTransactionId,
const uint64_t& aTransactionId,
const wr::LayoutSize& aContentSize,
const wr::ByteBuffer& dl,
const wr::BuiltDisplayListDescriptor& dlDesc,
const WebRenderScrollData& aScrollData,
- const uint32_t& aIdNameSpace,
+ const wr::IdNamespace& aIdNamespace,
const TimeStamp& aFwdTime)
{
if (mDestroyed) {
return IPC_OK();
}
HandleDPEnd(aSize, Move(aCommands), Move(aToDestroy), aFwdTransactionId, aTransactionId,
- aContentSize, dl, dlDesc, aScrollData, aIdNameSpace, aFwdTime);
+ aContentSize, dl, dlDesc, aScrollData, aIdNamespace, aFwdTime);
return IPC_OK();
}
mozilla::ipc::IPCResult
WebRenderBridgeParent::RecvParentCommands(nsTArray<WebRenderParentCommand>&& aCommands)
{
if (mDestroyed) {
return IPC_OK();
@@ -566,17 +566,17 @@ WebRenderBridgeParent::ProcessWebRenderP
{
for (InfallibleTArray<WebRenderParentCommand>::index_type i = 0; i < aCommands.Length(); ++i) {
const WebRenderParentCommand& cmd = aCommands[i];
switch (cmd.type()) {
case WebRenderParentCommand::TOpAddExternalImage: {
const OpAddExternalImage& op = cmd.get_OpAddExternalImage();
Range<const wr::ImageKey> keys(&op.key(), 1);
// Check if key is obsoleted.
- if (keys[0].mNamespace.mHandle != mIdNameSpace) {
+ if (keys[0].mNamespace != mIdNamespace) {
break;
}
MOZ_ASSERT(mExternalImageIds.Get(wr::AsUint64(op.externalImageId())).get());
MOZ_ASSERT(mActiveImageKeys.find(wr::AsUint64(keys[0])) == mActiveImageKeys.end());
mActiveImageKeys.insert(wr::AsUint64(keys[0]));
RefPtr<WebRenderImageHost> host = mExternalImageIds.Get(wr::AsUint64(op.externalImageId()));
if (!host) {
@@ -657,24 +657,24 @@ WebRenderBridgeParent::ProcessWebRenderP
}
}
void
WebRenderBridgeParent::ProcessWebRenderCommands(const gfx::IntSize &aSize,
InfallibleTArray<WebRenderParentCommand>& aCommands, const wr::Epoch& aEpoch,
const wr::LayoutSize& aContentSize, const wr::ByteBuffer& dl,
const wr::BuiltDisplayListDescriptor& dlDesc,
- const uint32_t& aIdNameSpace)
+ const wr::IdNamespace& aIdNamespace)
{
mAsyncImageManager->SetCompositionTime(TimeStamp::Now());
ProcessWebRenderParentCommands(aCommands);
// The command is obsoleted.
// Do not set the command to webrender since it causes crash in webrender.
- if (mIdNameSpace != aIdNameSpace) {
+ if (mIdNamespace != aIdNamespace) {
return;
}
if (mWidget) {
LayoutDeviceIntSize size = mWidget->GetClientSize();
mApi->SetWindowParameters(size);
}
gfx::Color color = mWidget ? gfx::Color(0.3f, 0.f, 0.f, 1.f) : gfx::Color(0.f, 0.f, 0.f, 0.f);
@@ -875,26 +875,26 @@ WebRenderBridgeParent::UpdateWebRender(C
MOZ_ASSERT(aAnimStorage);
if (mDestroyed) {
return;
}
// Update id name space to identify obsoleted keys.
// Since usage of invalid keys could cause crash in webrender.
- mIdNameSpace = AllocIdNameSpace();
+ mIdNamespace = AllocIdNameSpace();
// XXX Remove it when webrender supports sharing/moving Keys between different webrender instances.
// XXX It requests client to update/reallocate webrender related resources,
// but parent side does not wait end of the update.
// The code could become simpler if we could serialise old keys deallocation and new keys allocation.
// But we do not do it, it is because client side deallocate old layers/webrender keys
// after new layers/webrender keys allocation.
// Without client side's layout refactoring, we could not finish all old layers/webrender keys removals
// before new layer/webrender keys allocation. In future, we could address the problem.
- Unused << SendWrUpdated(mIdNameSpace);
+ Unused << SendWrUpdated(mIdNamespace);
CompositorBridgeParentBase* cBridge = mCompositorBridge;
// XXX Stop to clear resources if webreder supports resources sharing between different webrender instances.
ClearResources();
mCompositorBridge = cBridge;
mCompositorScheduler = aScheduler;
mApi = aApi;
mAsyncImageManager = aImageMgr;
mAnimStorage = aAnimStorage;
--- a/gfx/layers/wr/WebRenderBridgeParent.h
+++ b/gfx/layers/wr/WebRenderBridgeParent.h
@@ -97,28 +97,28 @@ public:
InfallibleTArray<WebRenderParentCommand>&& aCommands,
InfallibleTArray<OpDestroy>&& aToDestroy,
const uint64_t& aFwdTransactionId,
const uint64_t& aTransactionId,
const wr::LayoutSize& aContentSize,
const wr::ByteBuffer& dl,
const wr::BuiltDisplayListDescriptor& dlDesc,
const WebRenderScrollData& aScrollData,
- const uint32_t& aIdNameSpace,
+ const wr::IdNamespace& aIdNamespace,
const TimeStamp& aFwdTime) override;
mozilla::ipc::IPCResult RecvDPSyncEnd(const gfx::IntSize& aSize,
InfallibleTArray<WebRenderParentCommand>&& aCommands,
InfallibleTArray<OpDestroy>&& aToDestroy,
const uint64_t& aFwdTransactionId,
const uint64_t& aTransactionId,
const wr::LayoutSize& aContentSize,
const wr::ByteBuffer& dl,
const wr::BuiltDisplayListDescriptor& dlDesc,
const WebRenderScrollData& aScrollData,
- const uint32_t& aIdNameSpace,
+ const wr::IdNamespace& aIdNamespace,
const TimeStamp& aFwdTime) override;
mozilla::ipc::IPCResult RecvParentCommands(nsTArray<WebRenderParentCommand>&& commands) override;
mozilla::ipc::IPCResult RecvDPGetSnapshot(PTextureParent* aTexture) override;
mozilla::ipc::IPCResult RecvAddPipelineIdForAsyncCompositable(const wr::PipelineId& aPipelineIds,
const CompositableHandle& aHandle) override;
mozilla::ipc::IPCResult RecvRemovePipelineIdForAsyncCompositable(const wr::PipelineId& aPipelineId) override;
@@ -173,26 +173,26 @@ public:
uint64_t LastPendingTransactionId();
uint64_t FlushPendingTransactionIds();
uint64_t FlushTransactionIdsForEpoch(const wr::Epoch& aEpoch, const TimeStamp& aEndTime);
TextureFactoryIdentifier GetTextureFactoryIdentifier();
void ExtractImageCompositeNotifications(nsTArray<ImageCompositeNotificationInfo>* aNotifications);
- uint32_t GetIdNameSpace()
+ wr::IdNamespace GetIdNamespace()
{
- return mIdNameSpace;
+ return mIdNamespace;
}
void UpdateAPZ();
const WebRenderScrollData& GetScrollData() const;
- static uint32_t AllocIdNameSpace() {
- return ++sIdNameSpace;
+ static wr::IdNamespace AllocIdNameSpace() {
+ return wr::IdNamespace { ++sIdNameSpace };
}
void FlushRendering(bool aIsSync);
void ScheduleComposition();
void UpdateWebRender(CompositorVsyncScheduler* aScheduler,
wr::WebRenderAPI* aApi,
@@ -207,30 +207,30 @@ private:
void DeleteOldImages();
void ProcessWebRenderParentCommands(InfallibleTArray<WebRenderParentCommand>& aCommands);
void ProcessWebRenderCommands(const gfx::IntSize &aSize,
InfallibleTArray<WebRenderParentCommand>& commands,
const wr::Epoch& aEpoch,
const wr::LayoutSize& aContentSize,
const wr::ByteBuffer& dl,
const wr::BuiltDisplayListDescriptor& dlDesc,
- const uint32_t& aIdNameSpace);
+ const wr::IdNamespace& aIdNamespace);
void ClearResources();
uint64_t GetChildLayerObserverEpoch() const { return mChildLayerObserverEpoch; }
bool ShouldParentObserveEpoch();
void HandleDPEnd(const gfx::IntSize& aSize,
InfallibleTArray<WebRenderParentCommand>&& aCommands,
InfallibleTArray<OpDestroy>&& aToDestroy,
const uint64_t& aFwdTransactionId,
const uint64_t& aTransactionId,
const wr::LayoutSize& aContentSize,
const wr::ByteBuffer& dl,
const wr::BuiltDisplayListDescriptor& dlDesc,
const WebRenderScrollData& aScrollData,
- const uint32_t& aIdNameSpace,
+ const wr::IdNamespace& aIdNamespace,
const TimeStamp& aFwdTime);
mozilla::ipc::IPCResult HandleShutdown();
void AdvanceAnimations();
void SampleAnimations(nsTArray<wr::WrOpacityProperty>& aOpacityArray,
nsTArray<wr::WrTransformProperty>& aTransformArray);
CompositorBridgeParent* GetRootCompositorBridgeParent() const;
@@ -282,17 +282,17 @@ private:
// parent. mChildLayerObserverEpoch is the latest epoch value received from the child.
// mParentLayerObserverEpoch is the latest epoch value that we have told TabParent about
// (via ObserveLayerUpdate).
uint64_t mChildLayerObserverEpoch;
uint64_t mParentLayerObserverEpoch;
std::queue<PendingTransactionId> mPendingTransactionIds;
uint32_t mWrEpoch;
- uint32_t mIdNameSpace;
+ wr::IdNamespace mIdNamespace;
bool mPaused;
bool mDestroyed;
bool mForceRendering;
// Can only be accessed on the compositor thread.
WebRenderScrollData mScrollData;
--- a/gfx/layers/wr/WebRenderLayer.cpp
+++ b/gfx/layers/wr/WebRenderLayer.cpp
@@ -30,17 +30,17 @@ WebRenderLayer::WrBridge()
{
return WrManager()->WrBridge();
}
wr::WrImageKey
WebRenderLayer::GenerateImageKey()
{
wr::WrImageKey key;
- key.mNamespace.mHandle = WrBridge()->GetNamespace();
+ key.mNamespace = WrBridge()->GetNamespace();
key.mHandle = WrBridge()->GetNextResourceId();
return key;
}
Maybe<wr::WrImageMask>
WebRenderLayer::BuildWrMaskLayer(const StackingContextHelper& aRelativeTo)
{
if (GetLayer()->GetMaskLayer()) {
--- a/gfx/layers/wr/WebRenderLayerManager.cpp
+++ b/gfx/layers/wr/WebRenderLayerManager.cpp
@@ -52,17 +52,17 @@ WebRenderLayerManager::Initialize(PCompo
wr::PipelineId aLayersId,
TextureFactoryIdentifier* aTextureFactoryIdentifier)
{
MOZ_ASSERT(mWrChild == nullptr);
MOZ_ASSERT(aTextureFactoryIdentifier);
LayoutDeviceIntSize size = mWidget->GetClientSize();
TextureFactoryIdentifier textureFactoryIdentifier;
- uint32_t id_namespace;
+ wr::IdNamespace id_namespace;
PWebRenderBridgeChild* bridge = aCBChild->SendPWebRenderBridgeConstructor(aLayersId,
size,
&textureFactoryIdentifier,
&id_namespace);
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
// reinitialization. We can expect to be notified again to reinitialize
--- a/gfx/webrender_bindings/src/bindings.rs
+++ b/gfx/webrender_bindings/src/bindings.rs
@@ -23,16 +23,17 @@ type WrExternalImageBufferType = Externa
/// cbindgen:field-names=[mHandle]
/// cbindgen:derive-lt=true
/// cbindgen:derive-lte=true
type WrEpoch = Epoch;
/// cbindgen:field-names=[mHandle]
/// cbindgen:derive-lt=true
/// cbindgen:derive-lte=true
+/// cbindgen:derive-neq=true
type WrIdNamespace = IdNamespace;
/// cbindgen:field-names=[mNamespace, mHandle]
type WrPipelineId = PipelineId;
/// cbindgen:field-names=[mNamespace, mHandle]
type WrImageKey = ImageKey;
/// cbindgen:field-names=[mNamespace, mHandle]
type WrFontKey = FontKey;
--- a/gfx/webrender_bindings/webrender_ffi_generated.h
+++ b/gfx/webrender_bindings/webrender_ffi_generated.h
@@ -163,16 +163,19 @@ typedef Vec_u8 VecU8;
typedef Arc_VecU8 ArcVecU8;
struct IdNamespace {
uint32_t mHandle;
bool operator==(const IdNamespace& aOther) const {
return mHandle == aOther.mHandle;
}
+ bool operator!=(const IdNamespace& aOther) const {
+ return mHandle != aOther.mHandle;
+ }
bool operator<(const IdNamespace& aOther) const {
return mHandle < aOther.mHandle;
}
bool operator<=(const IdNamespace& aOther) const {
return mHandle <= aOther.mHandle;
}
};