Bug 1405950 - Corrected bug in SurfaceFactory::NewTextClient preventing matching textures from being located in mRecycleFreePool draft
authorKearwood "Kip" Gilbert <kgilbert@mozilla.com>
Thu, 05 Oct 2017 12:54:32 -0700
changeset 675770 0afada81107ec02f0431e047bcaa0fecc78a9d7e
parent 675689 19b32a138d08f73961df878a29de6f0aad441683
child 734708 69747441f78644e9b14c6a5e004157fd263cf928
push id83239
push userkgilbert@mozilla.com
push dateThu, 05 Oct 2017 21:28:57 +0000
bugs1405950
milestone58.0a1
Bug 1405950 - Corrected bug in SurfaceFactory::NewTextClient preventing matching textures from being located in mRecycleFreePool - As the aLayersChannel parameter is never passed and now no longer used, it has been removed from the SurfaceFactory::NewTextClient. MozReview-Commit-ID: 58K4Tbj92gO
gfx/gl/SharedSurface.cpp
gfx/gl/SharedSurface.h
--- a/gfx/gl/SharedSurface.cpp
+++ b/gfx/gl/SharedSurface.cpp
@@ -311,27 +311,25 @@ SurfaceFactory::~SurfaceFactory()
     MOZ_RELEASE_ASSERT(mRecycleTotalPool.empty(),"GFX: Surface recycle pool not empty.");
 
     // If we mRecycleFreePool.clear() before StopRecycling(), we may try to recycle it,
     // fail, call StopRecycling(), then return here and call it again.
     mRecycleFreePool.clear();
 }
 
 already_AddRefed<layers::SharedSurfaceTextureClient>
-SurfaceFactory::NewTexClient(const gfx::IntSize& size, const layers::LayersIPCChannel* aLayersChannel)
+SurfaceFactory::NewTexClient(const gfx::IntSize& size)
 {
     while (!mRecycleFreePool.empty()) {
         RefPtr<layers::SharedSurfaceTextureClient> cur = mRecycleFreePool.front();
         mRecycleFreePool.pop();
 
-        if (cur->Surf()->mSize == size){
-            if (aLayersChannel && aLayersChannel == cur->GetAllocator()) {
-                cur->Surf()->WaitForBufferOwnership();
-                return cur.forget();
-            }
+        if (cur->Surf()->mSize == size) {
+            cur->Surf()->WaitForBufferOwnership();
+            return cur.forget();
         }
 
         StopRecycling(cur);
     }
 
     UniquePtr<SharedSurface> surf = Move(CreateShared(size));
     if (!surf)
         return nullptr;
--- a/gfx/gl/SharedSurface.h
+++ b/gfx/gl/SharedSurface.h
@@ -298,18 +298,17 @@ protected:
 
     void StartRecycling(layers::SharedSurfaceTextureClient* tc);
     void SetRecycleCallback(layers::SharedSurfaceTextureClient* tc);
     void StopRecycling(layers::SharedSurfaceTextureClient* tc);
 
 public:
     UniquePtr<SharedSurface> NewSharedSurface(const gfx::IntSize& size);
     //already_AddRefed<ShSurfHandle> NewShSurfHandle(const gfx::IntSize& size);
-    already_AddRefed<layers::SharedSurfaceTextureClient> NewTexClient(const gfx::IntSize& size,
-                                                                      const layers::LayersIPCChannel* aLayersChannel = nullptr);
+    already_AddRefed<layers::SharedSurfaceTextureClient> NewTexClient(const gfx::IntSize& size);
 
     static void RecycleCallback(layers::TextureClient* tc, void* /*closure*/);
 
     // Auto-deletes surfs of the wrong type.
     bool Recycle(layers::SharedSurfaceTextureClient* texClient);
 };
 
 class ScopedReadbackFB