Bug 1383041 - Update bindings for IdNamespace changes in WR cset 6a2662c. r?kvark
MozReview-Commit-ID: 32dsMgqoOvf
--- a/gfx/layers/wr/WebRenderBridgeChild.cpp
+++ b/gfx/layers/wr/WebRenderBridgeChild.cpp
@@ -202,17 +202,17 @@ void
WebRenderBridgeChild::PushGlyphs(wr::DisplayListBuilder& aBuilder, const nsTArray<GlyphArray>& aGlyphs,
gfx::ScaledFont* aFont, const StackingContextHelper& aSc,
const LayerRect& aBounds, const LayerRect& aClip)
{
MOZ_ASSERT(aFont);
MOZ_ASSERT(!aGlyphs.IsEmpty());
wr::WrFontKey key = GetFontKeyForScaledFont(aFont);
- MOZ_ASSERT(key.mNamespace && key.mHandle);
+ MOZ_ASSERT(key.mNamespace.mHandle && key.mHandle);
for (size_t i = 0; i < aGlyphs.Length(); i++) {
GlyphArray glyph_array = aGlyphs[i];
nsTArray<gfx::Glyph>& glyphs = glyph_array.glyphs();
nsTArray<wr::GlyphInstance> wr_glyph_instances;
wr_glyph_instances.SetLength(glyphs.Length());
@@ -239,28 +239,28 @@ WebRenderBridgeChild::GetFontKeyForScale
MOZ_ASSERT(aScaledFont);
MOZ_ASSERT((aScaledFont->GetType() == gfx::FontType::DWRITE) ||
(aScaledFont->GetType() == gfx::FontType::MAC) ||
(aScaledFont->GetType() == gfx::FontType::FONTCONFIG));
RefPtr<gfx::UnscaledFont> unscaled = aScaledFont->GetUnscaledFont();
MOZ_ASSERT(unscaled);
- wr::FontKey key = {0, 0};
+ wr::FontKey key = { wr::IdNamespace { 0 }, 0};
if (mFontKeys.Get(unscaled, &key)) {
return key;
}
FontFileData data;
if (!unscaled->GetFontFileData(WriteFontFileData, &data) ||
!data.mFontBuffer.mData) {
return key;
}
- key.mNamespace = GetNamespace();
+ key.mNamespace.mHandle = GetNamespace();
key.mHandle = GetNextResourceId();
SendAddRawFont(key, data.mFontBuffer, data.mFontIndex);
mFontKeys.Put(unscaled, key);
return key;
}
--- a/gfx/layers/wr/WebRenderBridgeChild.h
+++ b/gfx/layers/wr/WebRenderBridgeChild.h
@@ -93,17 +93,17 @@ public:
uint32_t GetNamespace() { return mIdNamespace; }
void SetNamespace(uint32_t aIdNamespace)
{
mIdNamespace = aIdNamespace;
}
wr::WrImageKey GetNextImageKey()
{
- return wr::WrImageKey{ GetNamespace(), GetNextResourceId() };
+ return wr::WrImageKey{ wr::WrIdNamespace { 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);
--- a/gfx/layers/wr/WebRenderBridgeParent.cpp
+++ b/gfx/layers/wr/WebRenderBridgeParent.cpp
@@ -227,17 +227,17 @@ WebRenderBridgeParent::RecvAddImage(cons
const gfx::SurfaceFormat& aFormat,
const ByteBuffer& aBuffer)
{
if (mDestroyed) {
return IPC_OK();
}
// Check if key is obsoleted.
- if (aImageKey.mNamespace != mIdNameSpace) {
+ if (aImageKey.mNamespace.mHandle != 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));
@@ -254,17 +254,17 @@ WebRenderBridgeParent::RecvAddBlobImage(
const gfx::SurfaceFormat& aFormat,
const ByteBuffer& aBuffer)
{
if (mDestroyed) {
return IPC_OK();
}
// Check if key is obsoleted.
- if (aImageKey.mNamespace != mIdNameSpace) {
+ if (aImageKey.mNamespace.mHandle != 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));
@@ -279,17 +279,17 @@ WebRenderBridgeParent::RecvAddRawFont(co
const ByteBuffer& aBuffer,
const uint32_t& aFontIndex)
{
if (mDestroyed) {
return IPC_OK();
}
// Check if key is obsoleted.
- if (aFontKey.mNamespace != mIdNameSpace) {
+ if (aFontKey.mNamespace.mHandle != 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));
@@ -302,17 +302,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 != mIdNameSpace) {
+ if (aFontKey.mNamespace.mHandle != 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");
@@ -328,17 +328,17 @@ WebRenderBridgeParent::RecvUpdateImage(c
const ByteBuffer& aBuffer)
{
if (mDestroyed) {
return IPC_OK();
}
MOZ_ASSERT(mApi);
// Check if key is obsoleted.
- if (aImageKey.mNamespace != mIdNameSpace) {
+ if (aImageKey.mNamespace.mHandle != mIdNameSpace) {
return IPC_OK();
}
wr::ImageDescriptor descriptor(aSize, aFormat);
mApi->UpdateImageBuffer(aImageKey, descriptor, aBuffer.AsSlice());
return IPC_OK();
}
@@ -347,17 +347,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 != mIdNameSpace) {
+ if (aImageKey.mNamespace.mHandle != 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");
@@ -562,17 +562,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 != mIdNameSpace) {
+ if (keys[0].mNamespace.mHandle != 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) {
--- a/gfx/layers/wr/WebRenderCompositableHolder.h
+++ b/gfx/layers/wr/WebRenderCompositableHolder.h
@@ -82,17 +82,17 @@ public:
private:
void DeleteOldAsyncImages(wr::WebRenderAPI* aApi);
uint32_t GetNextResourceId() { return ++mResourceId; }
uint32_t GetNamespace() { return mIdNamespace; }
wr::ImageKey GetImageKey()
{
wr::ImageKey key;
- key.mNamespace = GetNamespace();
+ key.mNamespace.mHandle = GetNamespace();
key.mHandle = GetNextResourceId();
return key;
}
bool GetImageKeyForTextureHost(wr::WebRenderAPI* aApi, TextureHost* aTexture, nsTArray<wr::ImageKey>& aKeys);
struct ForwardingTextureHost {
ForwardingTextureHost(const wr::Epoch& aEpoch, TextureHost* aTexture)
: mEpoch(aEpoch)
--- a/gfx/layers/wr/WebRenderLayer.cpp
+++ b/gfx/layers/wr/WebRenderLayer.cpp
@@ -30,17 +30,17 @@ WebRenderLayer::WrBridge()
{
return WrManager()->WrBridge();
}
wr::WrImageKey
WebRenderLayer::GetImageKey()
{
wr::WrImageKey key;
- key.mNamespace = WrBridge()->GetNamespace();
+ key.mNamespace.mHandle = WrBridge()->GetNamespace();
key.mHandle = WrBridge()->GetNextResourceId();
return key;
}
Maybe<wr::WrImageMask>
WebRenderLayer::BuildWrMaskLayer(const StackingContextHelper& aRelativeTo)
{
if (GetLayer()->GetMaskLayer()) {
--- a/gfx/layers/wr/WebRenderMessageUtils.h
+++ b/gfx/layers/wr/WebRenderMessageUtils.h
@@ -31,16 +31,32 @@ struct ParamTraits<mozilla::wr::ByteBuff
size_t length;
return ReadParam(aMsg, aIter, &length)
&& aResult->Allocate(length)
&& aMsg->ReadBytesInto(aIter, aResult->mData, length);
}
};
template<>
+struct ParamTraits<mozilla::wr::IdNamespace>
+{
+ static void
+ Write(Message* aMsg, const mozilla::wr::IdNamespace& aParam)
+ {
+ WriteParam(aMsg, aParam.mHandle);
+ }
+
+ static bool
+ Read(const Message* aMsg, PickleIterator* aIter, mozilla::wr::IdNamespace* aResult)
+ {
+ return ReadParam(aMsg, aIter, &aResult->mHandle);
+ }
+};
+
+template<>
struct ParamTraits<mozilla::wr::ImageKey>
{
static void
Write(Message* aMsg, const mozilla::wr::ImageKey& aParam)
{
WriteParam(aMsg, aParam.mNamespace);
WriteParam(aMsg, aParam.mHandle);
}
--- a/gfx/webrender_bindings/WebRenderTypes.h
+++ b/gfx/webrender_bindings/WebRenderTypes.h
@@ -102,36 +102,36 @@ struct ImageDescriptor: public wr::WrIma
// Whenever possible, use wr::WindowId instead of manipulating uint64_t.
inline uint64_t AsUint64(const WindowId& aId) {
return static_cast<uint64_t>(aId.mHandle);
}
// Whenever possible, use wr::ImageKey instead of manipulating uint64_t.
inline uint64_t AsUint64(const ImageKey& aId) {
- return (static_cast<uint64_t>(aId.mNamespace) << 32)
+ return (static_cast<uint64_t>(aId.mNamespace.mHandle) << 32)
+ static_cast<uint64_t>(aId.mHandle);
}
inline ImageKey AsImageKey(const uint64_t& aId) {
ImageKey imageKey;
- imageKey.mNamespace = aId >> 32;
+ imageKey.mNamespace.mHandle = aId >> 32;
imageKey.mHandle = aId;
return imageKey;
}
// Whenever possible, use wr::FontKey instead of manipulating uint64_t.
inline uint64_t AsUint64(const FontKey& aId) {
- return (static_cast<uint64_t>(aId.mNamespace) << 32)
+ return (static_cast<uint64_t>(aId.mNamespace.mHandle) << 32)
+ static_cast<uint64_t>(aId.mHandle);
}
inline FontKey AsFontKey(const uint64_t& aId) {
FontKey fontKey;
- fontKey.mNamespace = aId >> 32;
+ fontKey.mNamespace.mHandle = aId >> 32;
fontKey.mHandle = aId;
return fontKey;
}
// Whenever possible, use wr::PipelineId instead of manipulating uint64_t.
inline uint64_t AsUint64(const PipelineId& aId) {
return (static_cast<uint64_t>(aId.mNamespace) << 32)
+ static_cast<uint64_t>(aId.mHandle);
--- a/gfx/webrender_bindings/webrender_ffi_generated.h
+++ b/gfx/webrender_bindings/webrender_ffi_generated.h
@@ -157,18 +157,32 @@ struct WrRenderedEpochs;
struct WrState;
struct WrThreadPool;
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;
+ }
+};
+
struct ImageKey {
- uint32_t mNamespace;
+ IdNamespace mNamespace;
uint32_t mHandle;
bool operator==(const ImageKey& aOther) const {
return mNamespace == aOther.mNamespace &&
mHandle == aOther.mHandle;
}
};
@@ -206,17 +220,17 @@ struct WrExternalImageId {
bool operator==(const WrExternalImageId& aOther) const {
return mHandle == aOther.mHandle;
}
};
typedef ExternalImageType WrExternalImageBufferType;
struct FontKey {
- uint32_t mNamespace;
+ IdNamespace mNamespace;
uint32_t mHandle;
bool operator==(const FontKey& aOther) const {
return mNamespace == aOther.mNamespace &&
mHandle == aOther.mHandle;
}
};
@@ -262,20 +276,22 @@ struct TypedSize2D_f32__LayerPixel {
typedef TypedSize2D_f32__LayerPixel LayerSize;
typedef LayerSize LayoutSize;
struct BuiltDisplayListDescriptor {
uint64_t builder_start_time;
uint64_t builder_finish_time;
+ uint64_t send_start_time;
bool operator==(const BuiltDisplayListDescriptor& aOther) const {
return builder_start_time == aOther.builder_start_time &&
- builder_finish_time == aOther.builder_finish_time;
+ builder_finish_time == aOther.builder_finish_time &&
+ send_start_time == aOther.send_start_time;
}
};
struct WrVecU8 {
uint8_t *data;
size_t length;
size_t capacity;
@@ -338,30 +354,16 @@ typedef LayerPixel LayoutPixel;
typedef TypedTransform3D_f32__LayoutPixel__LayoutPixel LayoutTransform;
struct WrTransformProperty {
uint64_t id;
LayoutTransform transform;
};
-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;
- }
-};
-
typedef IdNamespace WrIdNamespace;
struct ColorF {
float r;
float g;
float b;
float a;
@@ -444,44 +446,44 @@ struct GradientStop {
ColorF color;
bool operator==(const GradientStop& aOther) const {
return offset == aOther.offset &&
color == aOther.color;
}
};
+struct SideOffsets2D_f32 {
+ float top;
+ float right;
+ float bottom;
+ float left;
+
+ bool operator==(const SideOffsets2D_f32& aOther) const {
+ return top == aOther.top &&
+ right == aOther.right &&
+ bottom == aOther.bottom &&
+ left == aOther.left;
+ }
+};
+
struct SideOffsets2D_u32 {
uint32_t top;
uint32_t right;
uint32_t bottom;
uint32_t left;
bool operator==(const SideOffsets2D_u32& aOther) const {
return top == aOther.top &&
right == aOther.right &&
bottom == aOther.bottom &&
left == aOther.left;
}
};
-struct SideOffsets2D_f32 {
- float top;
- float right;
- float bottom;
- float left;
-
- bool operator==(const SideOffsets2D_f32& aOther) const {
- return top == aOther.top &&
- right == aOther.right &&
- bottom == aOther.bottom &&
- left == aOther.left;
- }
-};
-
struct NinePatchDescriptor {
uint32_t width;
uint32_t height;
SideOffsets2D_u32 slice;
bool operator==(const NinePatchDescriptor& aOther) const {
return width == aOther.width &&
height == aOther.height &&