Bug 1429694 - Fix WebRenderLayerManager::ClearCachedResources r=nical
authorsotaro <sotaro.ikeda.g@gmail.com>
Mon, 15 Jan 2018 16:17:40 +0900
changeset 453582 3ae6cbde5225f24eb512aff7acba6be65efd29ec
parent 453562 52397f10a40b2dc2c2e07440e1b9c986eec112fa
child 453583 14a96e730a866b8e7c882f7c6005c8eb3c5c0853
push id1648
push usermtabara@mozilla.com
push dateThu, 01 Mar 2018 12:45:47 +0000
treeherdermozilla-release@cbb9688c2eeb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnical
bugs1429694
milestone59.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 1429694 - Fix WebRenderLayerManager::ClearCachedResources r=nical
gfx/layers/wr/WebRenderBridgeChild.cpp
gfx/layers/wr/WebRenderLayerManager.cpp
gfx/layers/wr/WebRenderUserData.cpp
--- a/gfx/layers/wr/WebRenderBridgeChild.cpp
+++ b/gfx/layers/wr/WebRenderBridgeChild.cpp
@@ -594,27 +594,30 @@ WebRenderBridgeChild::RecvWrUpdated(cons
   mFontKeys.Clear();
   return IPC_OK();
 }
 
 void
 WebRenderBridgeChild::BeginClearCachedResources()
 {
   mIsInClearCachedResources = true;
+  // Clear display list and animtaions at parent side before clearing cached
+  // resources on client side. It prevents to clear resources before clearing
+  // display list at parent side.
+  SendClearCachedResources();
 }
 
 void
 WebRenderBridgeChild::EndClearCachedResources()
 {
   if (!IPCOpen()) {
     mIsInClearCachedResources = false;
     return;
   }
   ProcessWebRenderParentCommands();
-  SendClearCachedResources();
   mIsInClearCachedResources = false;
 }
 
 void
 WebRenderBridgeChild::SetWebRenderLayerManager(WebRenderLayerManager* aManager)
 {
   MOZ_ASSERT(aManager && !mManager);
   mManager = aManager;
--- a/gfx/layers/wr/WebRenderLayerManager.cpp
+++ b/gfx/layers/wr/WebRenderLayerManager.cpp
@@ -509,16 +509,17 @@ WebRenderLayerManager::DidComposite(uint
     mDidCompositeObservers[i]->DidComposite();
   }
 }
 
 void
 WebRenderLayerManager::ClearCachedResources(Layer* aSubtree)
 {
   WrBridge()->BeginClearCachedResources();
+  mWebRenderCommandBuilder.ClearCachedResources();
   DiscardImages();
   WrBridge()->EndClearCachedResources();
 }
 
 void
 WebRenderLayerManager::WrUpdated()
 {
   mWebRenderCommandBuilder.ClearCachedResources();
--- a/gfx/layers/wr/WebRenderUserData.cpp
+++ b/gfx/layers/wr/WebRenderUserData.cpp
@@ -83,16 +83,20 @@ WebRenderImageData::ClearCachedResources
     WrBridge()->DeallocExternalImageId(mExternalImageId.ref());
     mExternalImageId.reset();
   }
 
   if (mPipelineId) {
     WrBridge()->RemovePipelineIdForCompositable(mPipelineId.ref());
     mPipelineId.reset();
   }
+
+  if (mImageClient) {
+    mImageClient = nullptr;
+  }
 }
 
 Maybe<wr::ImageKey>
 WebRenderImageData::UpdateImageKey(ImageContainer* aContainer,
                                    wr::IpcResourceUpdateQueue& aResources,
                                    bool aFallback)
 {
   MOZ_ASSERT(aContainer);