Bug 1492925 - Ensure we release the shared surfaces when a WebRender pipeline is removed. r=sotaro
authorAndrew Osmond <aosmond@mozilla.com>
Thu, 20 Sep 2018 21:27:50 -0400
changeset 437590 0e28dd35739698fc6794ca4aa218975c512acef1
parent 437589 bfb9062ec18bb386bf3cf851b75fcf2f1de55756
child 437591 7e05c2752c5a2a16082854a01e76e53c1b03659b
push id34686
push userrgurzau@mozilla.com
push dateFri, 21 Sep 2018 04:14:16 +0000
treeherdermozilla-central@ebeba937ca2a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssotaro
bugs1492925
milestone64.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 1492925 - Ensure we release the shared surfaces when a WebRender pipeline is removed. r=sotaro
gfx/layers/wr/AsyncImagePipelineManager.cpp
--- a/gfx/layers/wr/AsyncImagePipelineManager.cpp
+++ b/gfx/layers/wr/AsyncImagePipelineManager.cpp
@@ -616,17 +616,26 @@ AsyncImagePipelineManager::ProcessPipeli
 
 void
 AsyncImagePipelineManager::ProcessPipelineRemoved(const wr::PipelineId& aPipelineId)
 {
   if (mDestroyed) {
     return;
   }
   if (auto entry = mPipelineTexturesHolders.Lookup(wr::AsUint64(aPipelineId))) {
-    if (entry.Data()->mDestroyedEpoch.isSome()) {
+    PipelineTexturesHolder* holder = entry.Data();
+    if (holder->mDestroyedEpoch.isSome()) {
+      // Explicitly release all of the shared surfaces.
+      while (!holder->mExternalImages.empty()) {
+        DebugOnly<bool> released =
+          SharedSurfacesParent::Release(holder->mExternalImages.front().mImageId);
+        MOZ_ASSERT(released);
+        holder->mExternalImages.pop();
+      }
+
       // Remove Pipeline
       entry.Remove();
     }
     // If mDestroyedEpoch contains nothing it means we reused the same pipeline id (probably because
     // we moved the tab to another window). In this case we need to keep the holder.
   }
 }