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 257925 844bfdb58072f4a376e3af87c111a5fd6d377724
parent 257924 04ad18f8377c88e88e37db4729b07cac783553df
child 257926 47d0d08c131c0dd508dd71ab9db11f3bf61edd7e
push id29238
push userryanvm@gmail.com
push dateMon, 17 Aug 2015 13:06:57 +0000
treeherdermozilla-central@a6eeb28458fd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssotaro
bugs1135935
milestone43.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 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);
   }
 
   {