Bug 1357320 - Dispatches the discarded compositor animations id list in one async call, r?kats
authorpeter chang <pchang@mozilla.com>
Wed, 26 Apr 2017 10:58:50 +0800
changeset 357017 588a50945a7f67fd7932aa3bbb7f86b64802bbaf
parent 357016 ccd2f70fc8d4848babf04e2b5a8c9ade7f1839ae
child 357018 f877064cf25c2eafef32df87deb02f16107ce705
push id31780
push userkwierso@gmail.com
push dateMon, 08 May 2017 20:34:47 +0000
treeherdermozilla-central@bab7046ee2d8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskats
bugs1357320
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1357320 - Dispatches the discarded compositor animations id list in one async call, r?kats MozReview-Commit-ID: 8cCNCzxMKpY
gfx/layers/ipc/PWebRenderBridge.ipdl
gfx/layers/wr/WebRenderBridgeParent.cpp
gfx/layers/wr/WebRenderBridgeParent.h
gfx/layers/wr/WebRenderLayerManager.cpp
gfx/layers/wr/WebRenderLayerManager.h
--- a/gfx/layers/ipc/PWebRenderBridge.ipdl
+++ b/gfx/layers/ipc/PWebRenderBridge.ipdl
@@ -43,17 +43,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,
               WebRenderScrollData aScrollData);
   sync DPSyncEnd(IntSize aSize, WebRenderParentCommand[] commands, OpDestroy[] toDestroy, uint64_t fwdTransactionId, uint64_t transactionId,
                  ByteBuffer aDL, WrBuiltDisplayListDescriptor aDLDesc, ByteBuffer aAux, WrAuxiliaryListsDescriptor aAuxDesc,
--- a/gfx/layers/wr/WebRenderBridgeParent.cpp
+++ b/gfx/layers/wr/WebRenderBridgeParent.cpp
@@ -192,17 +192,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);
@@ -265,27 +265,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
@@ -74,17 +74,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
@@ -306,26 +306,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::DiscardLocalImages()
 {
   // Removes images but doesn't tell the parent side about them
   // This is useful in empty / failed transactions where we created
   // image keys but didn't tell the parent about them yet.
--- a/gfx/layers/wr/WebRenderLayerManager.h
+++ b/gfx/layers/wr/WebRenderLayerManager.h
@@ -140,17 +140,17 @@ private:
   bool EndTransactionInternal(DrawPaintedLayerCallback aCallback,
                               void* aCallbackData,
                               EndTransactionFlags aFlags);
 
 
 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;