Bug 1135935 - Part 1: Don't implement ISurfaceAllocator for the texture recycler. r=sotaro
authorMatt Woodrow <mwoodrow@mozilla.com>
Mon, 10 Aug 2015 16:00:54 -0400
changeset 285460 844bfdb58072f4a376e3af87c111a5fd6d377724
parent 285459 04ad18f8377c88e88e37db4729b07cac783553df
child 285461 47d0d08c131c0dd508dd71ab9db11f3bf61edd7e
push id4450
push userrocallahan@mozilla.com
push dateMon, 17 Aug 2015 07:35:48 +0000
reviewerssotaro
bugs1135935
milestone43.0a1
Bug 1135935 - Part 1: Don't implement ISurfaceAllocator for the texture recycler. r=sotaro
gfx/layers/client/TextureClientRecycleAllocator.cpp
--- a/gfx/layers/client/TextureClientRecycleAllocator.cpp
+++ b/gfx/layers/client/TextureClientRecycleAllocator.cpp
@@ -11,21 +11,23 @@
 #include "mozilla/layers/ISurfaceAllocator.h"
 #include "mozilla/Mutex.h"
 
 #include "TextureClientRecycleAllocator.h"
 
 namespace mozilla {
 namespace layers {
 
-class TextureClientRecycleAllocatorImp : public ISurfaceAllocator
+class TextureClientRecycleAllocatorImp
 {
   ~TextureClientRecycleAllocatorImp();
 
 public:
+  NS_INLINE_DECL_THREADSAFE_REFCOUNTING(TextureClientRecycleAllocatorImp)
+
   explicit TextureClientRecycleAllocatorImp(ISurfaceAllocator* aAllocator);
 
   void SetMaxPoolSize(uint32_t aMax)
   {
     if (aMax > 0) {
       mMaxPooledSize = aMax;
     }
   }
@@ -39,58 +41,16 @@ public:
                             TextureAllocationFlags flags);
 
   void Destroy();
 
   void RecycleCallbackImp(TextureClient* aClient);
 
   static void RecycleCallback(TextureClient* aClient, void* aClosure);
 
-  // ISurfaceAllocator
-  virtual LayersBackend GetCompositorBackendType() const override
-  {
-    return mSurfaceAllocator->GetCompositorBackendType();
-  }
-
-  virtual bool AllocShmem(size_t aSize,
-                          mozilla::ipc::SharedMemory::SharedMemoryType aType,
-                          mozilla::ipc::Shmem* aShmem) override
-  {
-    return mSurfaceAllocator->AllocShmem(aSize, aType, aShmem);
-  }
-
-  virtual bool AllocUnsafeShmem(size_t aSize,
-                                mozilla::ipc::SharedMemory::SharedMemoryType aType,
-                                mozilla::ipc::Shmem* aShmem) override
-  {
-    return mSurfaceAllocator->AllocUnsafeShmem(aSize, aType, aShmem);
-  }
-
-  virtual void DeallocShmem(mozilla::ipc::Shmem& aShmem) override
-  {
-    mSurfaceAllocator->DeallocShmem(aShmem);
-  }
-
-  virtual bool IsSameProcess() const override
-  {
-    return mSurfaceAllocator->IsSameProcess();
-  }
-
-  virtual MessageLoop * GetMessageLoop() const override
-  {
-    return mSurfaceAllocator->GetMessageLoop();
-  }
-
-protected:
-  // ISurfaceAllocator
-  virtual bool IsOnCompositorSide() const override
-  {
-    return false;
-  }
-
 private:
   static const uint32_t kMaxPooledSized = 2;
 
   // Used to keep TextureClient's reference count stable as not to disrupt recycling.
   class TextureClientHolder
   {
     ~TextureClientHolder() {}
   public:
@@ -174,17 +134,17 @@ TextureClientRecycleAllocatorImp::Create
         textureHolder->GetTextureClient()->RecycleTexture(aTextureFlags);
       }
     }
   }
 
   if (!textureHolder) {
     // Allocate new TextureClient
     RefPtr<TextureClient> texture;
-    texture = TextureClient::CreateForDrawing(this, aFormat, aSize, aSelector,
+    texture = TextureClient::CreateForDrawing(mSurfaceAllocator, aFormat, aSize, aSelector,
                                               aTextureFlags, aAllocFlags);
     if (!texture) {
       return nullptr;
     }
     textureHolder = new TextureClientHolder(texture);
   }
 
   {