Bug 916116 - Rename CompositableQuirks. r=bjacob
authorNicolas Silva <nical@mozilla.com>
Mon, 30 Sep 2013 14:14:38 +0200
changeset 149263 b6b561566a3e0771be9cf3589063a6f9a7b7fa23
parent 149262 10107fefbfe04f518da4584cc1f3ede60dc1d1e8
child 149264 dcf49a049d3075ca62bc022240e320cf940331d3
push id25380
push userryanvm@gmail.com
push dateMon, 30 Sep 2013 20:16:36 +0000
treeherdermozilla-central@1332fc1c15e1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbjacob
bugs916116
milestone27.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 916116 - Rename CompositableQuirks. r=bjacob
gfx/layers/composite/CompositableHost.cpp
gfx/layers/composite/CompositableHost.h
gfx/layers/composite/TextureHost.cpp
gfx/layers/composite/TextureHost.h
gfx/layers/ipc/CompositableTransactionParent.cpp
gfx/layers/opengl/GrallocTextureHost.cpp
gfx/layers/opengl/GrallocTextureHost.h
gfx/layers/opengl/TextureHostOGL.cpp
gfx/layers/opengl/TextureHostOGL.h
--- a/gfx/layers/composite/CompositableHost.cpp
+++ b/gfx/layers/composite/CompositableHost.cpp
@@ -50,17 +50,17 @@ void
 CompositableHost::AddTextureHost(TextureHost* aTexture)
 {
   MOZ_ASSERT(aTexture);
   MOZ_ASSERT(GetTextureHost(aTexture->GetID()) == nullptr,
              "A texture is already present with this ID");
   RefPtr<TextureHost> second = mFirstTexture;
   mFirstTexture = aTexture;
   aTexture->SetNextSibling(second);
-  aTexture->SetCompositableQuirks(GetCompositableQuirks());
+  aTexture->SetCompositableBackendSpecificData(GetCompositableBackendSpecificData());
 }
 
 void
 CompositableHost::RemoveTextureHost(uint64_t aTextureID)
 {
   if (mFirstTexture && mFirstTexture->GetID() == aTextureID) {
     RefPtr<TextureHost> toRemove = mFirstTexture;
     mFirstTexture = mFirstTexture->GetNextSibling();
@@ -159,17 +159,17 @@ CompositableHost::RemoveMaskEffect()
     RefPtr<TextureHost> host = GetTextureHost();
     if (host) {
       host->Unlock();
     }
   }
 }
 
 // implemented in TextureHostOGL.cpp
-TemporaryRef<CompositableQuirks> CreateCompositableQuirksOGL();
+TemporaryRef<CompositableBackendSpecificData> CreateCompositableBackendSpecificDataOGL();
 
 /* static */ TemporaryRef<CompositableHost>
 CompositableHost::Create(const TextureInfo& aTextureInfo)
 {
   RefPtr<CompositableHost> result;
   switch (aTextureInfo.mCompositableType) {
   case COMPOSITABLE_IMAGE:
     result = new ImageHost(aTextureInfo);
@@ -191,18 +191,18 @@ CompositableHost::Create(const TextureIn
     break;
   case BUFFER_CONTENT_INC:
     result = new ContentHostIncremental(aTextureInfo);
     break;
   default:
     MOZ_CRASH("Unknown CompositableType");
   }
   if (result) {
-    RefPtr<CompositableQuirks> quirks = CreateCompositableQuirksOGL();
-    result->SetCompositableQuirks(quirks);
+    RefPtr<CompositableBackendSpecificData> data = CreateCompositableBackendSpecificDataOGL();
+    result->SetCompositableBackendSpecificData(data);
   }
   return result;
 }
 
 #ifdef MOZ_DUMP_PAINTING
 void
 CompositableHost::DumpDeprecatedTextureHost(FILE* aFile, DeprecatedTextureHost* aTexture)
 {
--- a/gfx/layers/composite/CompositableHost.h
+++ b/gfx/layers/composite/CompositableHost.h
@@ -55,26 +55,26 @@ class Compositor;
 class ISurfaceAllocator;
 class ThebesBufferData;
 class TiledLayerComposer;
 struct EffectChain;
 
 /**
  * A base class for doing CompositableHost and platform dependent task on TextureHost.
  */
-class CompositableQuirks : public RefCounted<CompositableQuirks>
+class CompositableBackendSpecificData : public RefCounted<CompositableBackendSpecificData>
 {
 public:
-  CompositableQuirks()
+  CompositableBackendSpecificData()
   {
-    MOZ_COUNT_CTOR(CompositableQuirks);
+    MOZ_COUNT_CTOR(CompositableBackendSpecificData);
   }
-  virtual ~CompositableQuirks()
+  virtual ~CompositableBackendSpecificData()
   {
-    MOZ_COUNT_DTOR(CompositableQuirks);
+    MOZ_COUNT_DTOR(CompositableBackendSpecificData);
   }
   virtual void SetCompositor(Compositor* aCompositor) {}
 };
 
 /**
  * The compositor-side counterpart to CompositableClient. Responsible for
  * updating textures and data about textures from IPC and how textures are
  * composited (tiling, double buffering, etc.).
@@ -94,21 +94,24 @@ public:
   CompositableHost(const TextureInfo& aTextureInfo);
 
   virtual ~CompositableHost();
 
   static TemporaryRef<CompositableHost> Create(const TextureInfo& aTextureInfo);
 
   virtual CompositableType GetType() = 0;
 
-  virtual CompositableQuirks* GetCompositableQuirks() { return mQuirks; }
+  virtual CompositableBackendSpecificData* GetCompositableBackendSpecificData()
+  {
+    return mBackendData;
+  }
 
-  virtual void SetCompositableQuirks(CompositableQuirks* aQuirks)
+  virtual void SetCompositableBackendSpecificData(CompositableBackendSpecificData* aBackendData)
   {
-    mQuirks = aQuirks;
+    mBackendData = aBackendData;
   }
 
   // If base class overrides, it should still call the parent implementation
   virtual void SetCompositor(Compositor* aCompositor);
 
   // composite the contents of this buffer host to the compositor's surface
   virtual void Composite(EffectChain& aEffectChain,
                          float aOpacity,
@@ -287,17 +290,17 @@ public:
   virtual void UseTextureHost(TextureHost* aTexture) {}
   virtual void RemoveTextureHost(uint64_t aTextureID);
   TextureHost* GetTextureHost(uint64_t aTextureID);
 
 protected:
   TextureInfo mTextureInfo;
   Compositor* mCompositor;
   Layer* mLayer;
-  RefPtr<CompositableQuirks> mQuirks;
+  RefPtr<CompositableBackendSpecificData> mBackendData;
   RefPtr<TextureHost> mFirstTexture;
   bool mAttached;
   bool mKeepAttached;
 };
 
 class CompositableParentManager;
 
 class CompositableParent : public PCompositableParent
--- a/gfx/layers/composite/TextureHost.cpp
+++ b/gfx/layers/composite/TextureHost.cpp
@@ -52,17 +52,17 @@ DeprecatedTextureHost::CreateDeprecatedT
   switch (Compositor::GetBackend()) {
     case LAYERS_OPENGL:
       {
       RefPtr<DeprecatedTextureHost> result;
       result = CreateDeprecatedTextureHostOGL(aDescriptorType,
                                         aDeprecatedTextureHostFlags,
                                         aTextureFlags);
       if (aCompositableHost) {
-        result->SetCompositableQuirks(aCompositableHost->GetCompositableQuirks());
+        result->SetCompositableBackendSpecificData(aCompositableHost->GetCompositableBackendSpecificData());
       }
       return result;
       }
 #ifdef XP_WIN
     case LAYERS_D3D9:
       return CreateDeprecatedTextureHostD3D9(aDescriptorType,
                                          aDeprecatedTextureHostFlags,
                                          aTextureFlags);
@@ -139,19 +139,20 @@ CreateBackendIndependentTextureHost(uint
     }
     default: {
       NS_WARNING("No backend independent TextureHost for this descriptor type");
     }
   }
   return result;
 }
 
-void TextureHost::SetCompositableQuirks(CompositableQuirks* aQuirks)
+void
+TextureHost::SetCompositableBackendSpecificData(CompositableBackendSpecificData* aBackendData)
 {
-    mQuirks = aQuirks;
+    mCompositableBackendData = aBackendData;
 }
 
 
 TextureHost::TextureHost(uint64_t aID,
                          TextureFlags aFlags)
     : mID(aID)
     , mNextTexture(nullptr)
     , mFlags(aFlags)
@@ -170,19 +171,20 @@ TextureHost::PrintInfo(nsACString& aTo, 
   aTo += nsPrintfCString("%s (0x%p)", Name(), this);
   AppendToString(aTo, GetSize(), " [size=", "]");
   AppendToString(aTo, GetFormat(), " [format=", "]");
   AppendToString(aTo, mFlags, " [flags=", "]");
 }
 
 #endif
 
-void TextureSource::SetCompositableQuirks(CompositableQuirks* aQuirks)
+void
+TextureSource::SetCompositableBackendSpecificData(CompositableBackendSpecificData* aBackendData)
 {
-    mQuirks = aQuirks;
+    mCompositableBackendData = aBackendData;
 }
 
 TextureSource::TextureSource()
 {
     MOZ_COUNT_CTOR(TextureSource);
 }
 TextureSource::~TextureSource()
 {
--- a/gfx/layers/composite/TextureHost.h
+++ b/gfx/layers/composite/TextureHost.h
@@ -34,17 +34,17 @@ namespace mozilla {
 namespace ipc {
 class Shmem;
 }
 
 namespace layers {
 
 class Compositor;
 class CompositableHost;
-class CompositableQuirks;
+class CompositableBackendSpecificData;
 class SurfaceDescriptor;
 class ISurfaceAllocator;
 class TextureSourceOGL;
 class TextureSourceD3D9;
 class TextureSourceD3D11;
 class TextureSourceBasic;
 class TextureParent;
 class DataTextureSource;
@@ -113,20 +113,20 @@ public:
   virtual TextureSource* GetSubSource(int index) { return nullptr; }
 
   /**
    * Overload this if the TextureSource supports big textures that don't fit in
    * one device texture and must be tiled internally.
    */
   virtual TileIterator* AsTileIterator() { return nullptr; }
 
-  virtual void SetCompositableQuirks(CompositableQuirks* aQuirks);
+  virtual void SetCompositableBackendSpecificData(CompositableBackendSpecificData* aBackendData);
 
 protected:
-  RefPtr<CompositableQuirks> mQuirks;
+  RefPtr<CompositableBackendSpecificData> mCompositableBackendData;
 };
 
 
 /**
  * XXX - merge this class with TextureSource when deprecated texture classes
  * are completely removed.
  */
 class NewTextureSource : public TextureSource
@@ -377,28 +377,28 @@ public:
    */
   virtual LayerRenderState GetRenderState()
   {
     // By default we return an empty render state, this should be overridden
     // by the TextureHost implementations that are used on B2G with Composer2D
     return LayerRenderState();
   }
 
-  virtual void SetCompositableQuirks(CompositableQuirks* aQuirks);
+  virtual void SetCompositableBackendSpecificData(CompositableBackendSpecificData* aBackendData);
 
 #ifdef MOZ_LAYERS_HAVE_LOG
   virtual const char *Name() { return "TextureHost"; }
   virtual void PrintInfo(nsACString& aTo, const char* aPrefix);
 #endif
 
 protected:
   uint64_t mID;
   RefPtr<TextureHost> mNextTexture;
   TextureFlags mFlags;
-  RefPtr<CompositableQuirks> mQuirks;
+  RefPtr<CompositableBackendSpecificData> mCompositableBackendData;
 };
 
 /**
  * TextureHost that wraps a random access buffer such as a Shmem or some raw
  * memory.
  *
  * This TextureHost is backend-independent and the backend-specific bits are
  * in the TextureSource.
--- a/gfx/layers/ipc/CompositableTransactionParent.cpp
+++ b/gfx/layers/ipc/CompositableTransactionParent.cpp
@@ -234,17 +234,17 @@ CompositableParentManager::ReceiveCompos
       }
       CompositableHost* compositable = AsCompositable(op);
       RefPtr<TextureHost> tex = TextureHost::Create(op.textureID(),
                                                     op.data(),
                                                     this,
                                                     op.textureFlags());
       MOZ_ASSERT(tex.get());
       tex->SetCompositor(compositable->GetCompositor());
-      // set CompositableQuirks
+      // set CompositableBackendSpecificData
       // on gonk, create EGLImage if possible.
       // create EGLImage during buffer swap could reduce the graphic driver's task
       // during rendering.
       compositable->AddTextureHost(tex);
       MOZ_ASSERT(compositable->GetTextureHost(op.textureID()) == tex.get());
       break;
     }
     case CompositableOperation::TOpRemoveTexture: {
--- a/gfx/layers/opengl/GrallocTextureHost.cpp
+++ b/gfx/layers/opengl/GrallocTextureHost.cpp
@@ -161,19 +161,19 @@ GrallocTextureSourceOGL::GetFormat() con
   }
   if (GetTextureTarget() == LOCAL_GL_TEXTURE_EXTERNAL) {
     return gfx::FORMAT_R8G8B8A8;
   }
   return mFormat;
 }
 
 void
-GrallocTextureSourceOGL::SetCompositableQuirks(CompositableQuirks* aQuirks)
+GrallocTextureSourceOGL::SetCompositableBackendSpecificData(CompositableBackendSpecificData* aBackendData)
 {
-  mQuirks = aQuirks;
+  mCompositableBackendData = aBackendData;
 
   if (!mCompositor) {
     return;
   }
 
   // delete old EGLImage
   DeallocateDeviceData();
 
@@ -321,23 +321,23 @@ GrallocTextureSourceOGL::GetAsSurface() 
 
   gl()->fActiveTexture(LOCAL_GL_TEXTURE0);
   return surf.forget();
 }
 
 GLuint
 GrallocTextureSourceOGL::GetGLTexture()
 {
-  mQuirks->SetCompositor(mCompositor);
-  return static_cast<CompositableQuirksGonkOGL*>(mQuirks.get())->GetTexture();
+  mCompositableBackendData->SetCompositor(mCompositor);
+  return static_cast<CompositableDataGonkOGL*>(mCompositableBackendData.get())->GetTexture();
 }
 
 void
-GrallocTextureHostOGL::SetCompositableQuirks(CompositableQuirks* aQuirks)
+GrallocTextureHostOGL::SetCompositableBackendSpecificData(CompositableBackendSpecificData* aBackendData)
 {
-  mQuirks = aQuirks;
+  mCompositableBackendData = aBackendData;
   if (mTextureSource) {
-    mTextureSource->SetCompositableQuirks(aQuirks);
+    mTextureSource->SetCompositableBackendSpecificData(aBackendData);
   }
 }
 
 } // namepsace layers
 } // namepsace mozilla
--- a/gfx/layers/opengl/GrallocTextureHost.h
+++ b/gfx/layers/opengl/GrallocTextureHost.h
@@ -42,17 +42,17 @@ public:
 
   virtual gfx::SurfaceFormat GetFormat() const MOZ_OVERRIDE;
 
   virtual GLenum GetWrapMode() const MOZ_OVERRIDE
   {
     return LOCAL_GL_CLAMP_TO_EDGE;
   }
 
-  virtual void SetCompositableQuirks(CompositableQuirks* aQuirks) MOZ_OVERRIDE;
+  virtual void SetCompositableBackendSpecificData(CompositableBackendSpecificData* aBackendData) MOZ_OVERRIDE;
 
   void DeallocateDeviceData();
 
   gl::GLContext* gl() const;
 
   void SetCompositor(CompositorOGL* aCompositor);
 
   void ForgetBuffer()
@@ -101,17 +101,17 @@ public:
 
   virtual NewTextureSource* GetTextureSources() MOZ_OVERRIDE
   {
     return mTextureSource;
   }
 
   virtual already_AddRefed<gfxImageSurface> GetAsSurface() MOZ_OVERRIDE;
 
-  virtual void SetCompositableQuirks(CompositableQuirks* aQuirks) MOZ_OVERRIDE;
+  virtual void SetCompositableBackendSpecificData(CompositableBackendSpecificData* aBackendData) MOZ_OVERRIDE;
 
   bool IsValid() const;
 
 #ifdef MOZ_LAYERS_HAVE_LOG
   virtual const char* Name() MOZ_OVERRIDE { return "GrallocTextureHostOGL"; }
 #endif
 
 private:
--- a/gfx/layers/opengl/TextureHostOGL.cpp
+++ b/gfx/layers/opengl/TextureHostOGL.cpp
@@ -36,21 +36,21 @@
 using namespace mozilla::gl;
 using namespace mozilla::gfx;
 
 namespace mozilla {
 namespace layers {
 
 class Compositor; 
 
-TemporaryRef<CompositableQuirks>
-CreateCompositableQuirksOGL()
+TemporaryRef<CompositableBackendSpecificData>
+CreateCompositableBackendSpecificDataOGL()
 {
 #ifdef MOZ_WIDGET_GONK
-  return new CompositableQuirksGonkOGL();
+  return new CompositableDataGonkOGL();
 #else
   return nullptr;
 #endif
 }
 
 TemporaryRef<DeprecatedTextureHost>
 CreateDeprecatedTextureHostOGL(SurfaceDescriptorType aDescriptorType,
                      uint32_t aDeprecatedTextureHostFlags,
@@ -161,47 +161,47 @@ WrapMode(gl::GLContext *aGl, bool aAllow
   if (aAllowRepeat &&
       (aGl->IsExtensionSupported(GLContext::ARB_texture_non_power_of_two) ||
        aGl->IsExtensionSupported(GLContext::OES_texture_npot))) {
     return LOCAL_GL_REPEAT;
   }
   return LOCAL_GL_CLAMP_TO_EDGE;
 }
 
-CompositableQuirksGonkOGL::CompositableQuirksGonkOGL()
+CompositableDataGonkOGL::CompositableDataGonkOGL()
  : mTexture(0)
 {
 }
-CompositableQuirksGonkOGL::~CompositableQuirksGonkOGL()
+CompositableDataGonkOGL::~CompositableDataGonkOGL()
 {
   DeleteTextureIfPresent();
 }
 
 gl::GLContext*
-CompositableQuirksGonkOGL::gl() const
+CompositableDataGonkOGL::gl() const
 {
   return mCompositor ? mCompositor->gl() : nullptr;
 }
 
-void CompositableQuirksGonkOGL::SetCompositor(Compositor* aCompositor)
+void CompositableDataGonkOGL::SetCompositor(Compositor* aCompositor)
 {
   mCompositor = static_cast<CompositorOGL*>(aCompositor);
 }
 
-GLuint CompositableQuirksGonkOGL::GetTexture()
+GLuint CompositableDataGonkOGL::GetTexture()
 {
   if (!mTexture) {
     gl()->MakeCurrent();
     gl()->fGenTextures(1, &mTexture);
   }
   return mTexture;
 }
 
 void
-CompositableQuirksGonkOGL::DeleteTextureIfPresent()
+CompositableDataGonkOGL::DeleteTextureIfPresent()
 {
   if (mTexture) {
     gl()->MakeCurrent();
     gl()->fDeleteTextures(1, &mTexture);
   }
 }
 
 bool
@@ -502,25 +502,25 @@ TextureImageDeprecatedTextureHostOGL::Up
                                        nsIntPoint* aOffset)
 {
   if (!mGL) {
     NS_WARNING("trying to update TextureImageDeprecatedTextureHostOGL without a compositor?");
     return;
   }
 
 #ifdef MOZ_WIDGET_GONK
-  if (mQuirks) {
+  if (mCompositableBackendData) {
     // on gonk, this class is used as a fallback from gralloc buffer.
     // There is a case this class is used with GrallocDeprecatedTextureHostOGL
     // under same CompositableHost. if it happens, a gralloc buffer of
     // GrallocDeprecatedTextureHostOGL needs to be unbounded from a texture,
     // when the gralloc buffer is not rendered.
     // Establish the unbound by deleting the texture.
     // See Bug 916264.
-    static_cast<CompositableQuirksGonkOGL*>(mQuirks.get())->DeleteTextureIfPresent();
+    static_cast<CompositableDataGonkOGL*>(mCompositableBackendData.get())->DeleteTextureIfPresent();
   }
 #endif
 
   AutoOpenSurface surf(OPEN_READ_ONLY, aImage);
   nsIntSize size = surf.Size();
   TextureImage::ImageFormat format = surf.ImageFormat();
 
   if (!mTexture ||
@@ -1263,18 +1263,18 @@ GrallocDeprecatedTextureHostOGL::GetRend
   }
 
   return LayerRenderState();
 }
 
 GLuint
 GrallocDeprecatedTextureHostOGL::GetGLTexture()
 {
-  mQuirks->SetCompositor(mCompositor);
-  return static_cast<CompositableQuirksGonkOGL*>(mQuirks.get())->GetTexture();
+  mCompositableBackendData->SetCompositor(mCompositor);
+  return static_cast<CompositableDataGonkOGL*>(mCompositableBackendData.get())->GetTexture();
 }
 
 #endif // MOZ_WIDGET_GONK
 
 already_AddRefed<gfxImageSurface>
 TextureImageDeprecatedTextureHostOGL::GetAsSurface() {
   nsRefPtr<gfxImageSurface> surf = IsValid() ?
     mGL->GetTexImage(mTexture->GetTextureID(),
--- a/gfx/layers/opengl/TextureHostOGL.h
+++ b/gfx/layers/opengl/TextureHostOGL.h
@@ -50,29 +50,29 @@ class SurfaceStream;
 
 namespace layers {
 
 class Compositor;
 class CompositorOGL;
 class TextureImageDeprecatedTextureHostOGL;
 
 /**
- * CompositableQuirks implementation for the Gonk OpenGL backend.
+ * CompositableBackendSpecificData implementation for the Gonk OpenGL backend.
  * Share a same texture between TextureHosts in the same CompositableHost.
  * By shareing the texture among the TextureHosts, number of texture allocations
  * can be reduced than texture allocation in every TextureHosts.
  * From Bug 912134, use only one texture among all TextureHosts degrade
  * the rendering performance.
- * CompositableQuirksGonkOGL chooses in a middile of them.
+ * CompositableDataGonkOGL chooses in a middile of them.
  */
-class CompositableQuirksGonkOGL : public CompositableQuirks
+class CompositableDataGonkOGL : public CompositableBackendSpecificData
 {
 public:
-  CompositableQuirksGonkOGL();
-  virtual ~CompositableQuirksGonkOGL();
+  CompositableDataGonkOGL();
+  virtual ~CompositableDataGonkOGL();
 
   virtual void SetCompositor(Compositor* aCompositor) MOZ_OVERRIDE;
   GLuint GetTexture();
   void DeleteTextureIfPresent();
   gl::GLContext* gl() const;
 protected:
   RefPtr<CompositorOGL> mCompositor;
   GLuint mTexture;