Bug 1357320 - Dispatches the discarded compositor animations id list in one async call, r?kats
MozReview-Commit-ID: 8cCNCzxMKpY
--- a/gfx/layers/ipc/PWebRenderBridge.ipdl
+++ b/gfx/layers/ipc/PWebRenderBridge.ipdl
@@ -40,17 +40,17 @@ parent:
sync Create(IntSize aSize);
sync AddImage(ImageKey aImageKey, IntSize aSize, uint32_t aStride,
SurfaceFormat aFormat, ByteBuffer aBytes);
async AddBlobImage(ImageKey aImageKey, IntSize aSize, uint32_t aStride,
SurfaceFormat aFormat, ByteBuffer aBytes);
sync UpdateImage(ImageKey aImageKey, IntSize aSize,
SurfaceFormat aFormat, ByteBuffer aBytes);
sync DeleteImage(ImageKey aImageKey);
- async DeleteCompositorAnimations(uint64_t aId);
+ 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,
ByteBuffer aDL, WrBuiltDisplayListDescriptor aDLDesc, ByteBuffer aAux, WrAuxiliaryListsDescriptor aAuxDesc);
sync DPSyncEnd(IntSize aSize, WebRenderParentCommand[] commands, OpDestroy[] toDestroy, uint64_t fwdTransactionId, uint64_t transactionId,
ByteBuffer aDL, WrBuiltDisplayListDescriptor aDLDesc, ByteBuffer aAux, WrAuxiliaryListsDescriptor aAuxDesc);
sync DPGetSnapshot(PTexture texture);
--- a/gfx/layers/wr/WebRenderBridgeParent.cpp
+++ b/gfx/layers/wr/WebRenderBridgeParent.cpp
@@ -191,17 +191,17 @@ WebRenderBridgeParent::RecvAddImage(cons
mApi->AddImage(aImageKey, descriptor,
aBuffer.AsSlice());
return IPC_OK();
}
mozilla::ipc::IPCResult
WebRenderBridgeParent::RecvAddBlobImage(const wr::ImageKey& aImageKey,
- const gfx::IntSize& aSize,
+ const gfx::IntSize& aSize,
const uint32_t& aStride,
const gfx::SurfaceFormat& aFormat,
const ByteBuffer& aBuffer)
{
if (mDestroyed) {
return IPC_OK();
}
MOZ_ASSERT(mApi);
@@ -264,27 +264,30 @@ WebRenderBridgeParent::RecvDeleteImage(c
if (mActiveKeys.Get(wr::AsUint64(aImageKey), nullptr)) {
mActiveKeys.Remove(wr::AsUint64(aImageKey));
}
mKeysToDelete.push_back(aImageKey);
return IPC_OK();
}
mozilla::ipc::IPCResult
-WebRenderBridgeParent::RecvDeleteCompositorAnimations(const uint64_t& aId)
+WebRenderBridgeParent::RecvDeleteCompositorAnimations(InfallibleTArray<uint64_t>&& aIds)
{
if (mDestroyed) {
return IPC_OK();
}
- uint64_t id = mWidget ? 0 : mPipelineId.mHandle;
+
+ uint64_t storageId = mWidget ? 0 : mPipelineId.mHandle;
CompositorAnimationStorage* storage =
- mCompositorBridge->GetAnimationStorage(id);
+ mCompositorBridge->GetAnimationStorage(storageId);
+ MOZ_ASSERT(storage);
- MOZ_ASSERT(storage);
- storage->ClearById(aId);
+ for (uint32_t i=0; i < aIds.Length(); i++) {
+ storage->ClearById(aIds[i]);
+ }
return IPC_OK();
}
mozilla::ipc::IPCResult
WebRenderBridgeParent::RecvDPBegin(const gfx::IntSize& aSize)
{
--- a/gfx/layers/wr/WebRenderBridgeParent.h
+++ b/gfx/layers/wr/WebRenderBridgeParent.h
@@ -73,17 +73,17 @@ public:
const uint32_t& aStride,
const gfx::SurfaceFormat& aFormat,
const ByteBuffer& aBuffer) override;
mozilla::ipc::IPCResult RecvUpdateImage(const wr::ImageKey& aImageKey,
const gfx::IntSize& aSize,
const gfx::SurfaceFormat& aFormat,
const ByteBuffer& aBuffer) override;
mozilla::ipc::IPCResult RecvDeleteImage(const wr::ImageKey& a1) override;
- mozilla::ipc::IPCResult RecvDeleteCompositorAnimations(const uint64_t& aId) override;
+ mozilla::ipc::IPCResult RecvDeleteCompositorAnimations(InfallibleTArray<uint64_t>&& aIds) override;
mozilla::ipc::IPCResult RecvAddRawFont(const wr::FontKey& aFontKey,
const ByteBuffer& aBuffer,
const uint32_t& aFontIndex) override;
mozilla::ipc::IPCResult RecvDeleteFont(const wr::FontKey& aFontKey) override;
mozilla::ipc::IPCResult RecvDPBegin(const gfx::IntSize& aSize) override;
mozilla::ipc::IPCResult RecvDPEnd(const gfx::IntSize& aSize,
InfallibleTArray<WebRenderParentCommand>&& aCommands,
InfallibleTArray<OpDestroy>&& aToDestroy,
--- a/gfx/layers/wr/WebRenderLayerManager.cpp
+++ b/gfx/layers/wr/WebRenderLayerManager.cpp
@@ -454,26 +454,27 @@ WebRenderLayerManager::DiscardImages()
WrBridge()->SendDeleteImage(key);
}
mImageKeys.clear();
}
void
WebRenderLayerManager::AddCompositorAnimationsIdForDiscard(uint64_t aId)
{
- mDiscardedCompositorAnimationsIds.push_back(aId);
+ mDiscardedCompositorAnimationsIds.AppendElement(aId);
}
void
WebRenderLayerManager::DiscardCompositorAnimations()
{
- for (auto id : mDiscardedCompositorAnimationsIds) {
- WrBridge()->SendDeleteCompositorAnimations(id);
+ if (!mDiscardedCompositorAnimationsIds.IsEmpty()) {
+ WrBridge()->
+ SendDeleteCompositorAnimations(mDiscardedCompositorAnimationsIds);
+ mDiscardedCompositorAnimationsIds.Clear();
}
- mDiscardedCompositorAnimationsIds.clear();
}
void
WebRenderLayerManager::Hold(Layer* aLayer)
{
mKeepAlive.AppendElement(aLayer);
}
--- a/gfx/layers/wr/WebRenderLayerManager.h
+++ b/gfx/layers/wr/WebRenderLayerManager.h
@@ -171,17 +171,17 @@ private:
*/
void MakeSnapshotIfRequired(LayoutDeviceIntSize aSize);
void ClearLayer(Layer* aLayer);
private:
nsIWidget* MOZ_NON_OWNING_REF mWidget;
std::vector<wr::ImageKey> mImageKeys;
- std::vector<uint64_t> mDiscardedCompositorAnimationsIds;
+ nsTArray<uint64_t> mDiscardedCompositorAnimationsIds;
/* PaintedLayer callbacks; valid at the end of a transaciton,
* while rendering */
DrawPaintedLayerCallback mPaintedLayerCallback;
void *mPaintedLayerCallbackData;
RefPtr<WebRenderBridgeChild> mWrChild;