Bug 991032 - Cleanup X11 TextureClient/Host. r=mattwoodrow
☠☠ backed out by 0c70ac0efe06 ☠ ☠
authorNicolas Silva <nical@mozilla.com>
Fri, 04 Apr 2014 11:15:47 +0800
changeset 177065 c28e1344a6da9cfc909bcda23f5032404a0b4421
parent 177064 c85326be7e941752358e64b9a5445b3863f2d977
child 177066 0c70ac0efe0681bb515859889f54a65d9bad128b
push idunknown
push userunknown
push dateunknown
reviewersmattwoodrow
bugs991032
milestone31.0a1
Bug 991032 - Cleanup X11 TextureClient/Host. r=mattwoodrow
gfx/layers/basic/TextureClientX11.cpp
gfx/layers/basic/TextureClientX11.h
gfx/layers/basic/X11TextureSourceBasic.h
gfx/layers/composite/X11TextureHost.h
gfx/layers/opengl/X11TextureSourceOGL.h
--- a/gfx/layers/basic/TextureClientX11.cpp
+++ b/gfx/layers/basic/TextureClientX11.cpp
@@ -35,27 +35,25 @@ bool
 TextureClientX11::IsAllocated() const
 {
   return !!mSurface;
 }
 
 bool
 TextureClientX11::Lock(OpenMode aMode)
 {
-  // XXX - Turn this into a fatal assertion as soon as Bug 952507 is fixed
-  NS_WARN_IF_FALSE(!mLocked, "The TextureClient is already Locked!");
+  MOZ_ASSERT(!mLocked, "The TextureClient is already Locked!");
   mLocked = IsValid() && IsAllocated();
   return mLocked;
 }
 
 void
 TextureClientX11::Unlock()
 {
-  // XXX - Turn this into a fatal assertion as soon as Bug 952507 is fixed
-  NS_WARN_IF_FALSE(mLocked, "The TextureClient is already Unlocked!");
+  MOZ_ASSERT(mLocked, "The TextureClient is already Unlocked!");
   mLocked = false;
 
   if (mSurface) {
     FinishX(DefaultXDisplay());
   }
 }
 
 bool
--- a/gfx/layers/basic/TextureClientX11.h
+++ b/gfx/layers/basic/TextureClientX11.h
@@ -2,49 +2,50 @@
 //  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef MOZILLA_GFX_TEXTURECLIENT_X11_H
 #define MOZILLA_GFX_TEXTURECLIENT_X11_H
 
 #include "mozilla/layers/TextureClient.h"
-#include "ISurfaceAllocator.h" // For IsSurfaceDescriptorValid
 #include "mozilla/layers/ShadowLayerUtilsX11.h"
 
 namespace mozilla {
 namespace layers {
 
 /**
  * A TextureClient implementation based on Xlib.
  */
-class TextureClientX11
- : public TextureClient
+class TextureClientX11 : public TextureClient
 {
  public:
   TextureClientX11(gfx::SurfaceFormat format, TextureFlags aFlags = TEXTURE_FLAGS_DEFAULT);
+
   ~TextureClientX11();
 
-  bool IsAllocated() const MOZ_OVERRIDE;
-  bool ToSurfaceDescriptor(SurfaceDescriptor& aOutDescriptor) MOZ_OVERRIDE;
-  TextureClientData* DropTextureData() MOZ_OVERRIDE;
-  gfx::IntSize GetSize() const {
-    return mSize;
-  }
+  virtual bool IsAllocated() const MOZ_OVERRIDE;
+
+  virtual bool ToSurfaceDescriptor(SurfaceDescriptor& aOutDescriptor) MOZ_OVERRIDE;
+
+  virtual TextureClientData* DropTextureData() MOZ_OVERRIDE;
+
+  virtual gfx::IntSize GetSize() const MOZ_OVERRIDE { return mSize; }
+
+  virtual bool Lock(OpenMode aMode) MOZ_OVERRIDE;
 
-  bool Lock(OpenMode aMode) MOZ_OVERRIDE;
-  void Unlock() MOZ_OVERRIDE;
-  bool IsLocked() const MOZ_OVERRIDE { return mLocked; }
+  virtual void Unlock() MOZ_OVERRIDE;
+
+  virtual bool IsLocked() const MOZ_OVERRIDE { return mLocked; }
 
-  bool AllocateForSurface(gfx::IntSize aSize, TextureAllocationFlags flags) MOZ_OVERRIDE;
+  virtual bool AllocateForSurface(gfx::IntSize aSize, TextureAllocationFlags flags) MOZ_OVERRIDE;
 
-  TemporaryRef<gfx::DrawTarget> GetAsDrawTarget() MOZ_OVERRIDE;
-  gfx::SurfaceFormat GetFormat() const {
-    return mFormat;
-  }
+  virtual TemporaryRef<gfx::DrawTarget> GetAsDrawTarget() MOZ_OVERRIDE;
+
+  virtual gfx::SurfaceFormat GetFormat() const { return mFormat; }
 
   virtual bool HasInternalBuffer() const MOZ_OVERRIDE { return false; }
 
  private:
   gfx::SurfaceFormat mFormat;
   gfx::IntSize mSize;
   RefPtr<gfxXlibSurface> mSurface;
   bool mLocked;
--- a/gfx/layers/basic/X11TextureSourceBasic.h
+++ b/gfx/layers/basic/X11TextureSourceBasic.h
@@ -11,26 +11,28 @@
 
 namespace mozilla {
 namespace layers {
 
 class BasicCompositor;
 
 // TextureSource for Xlib-backed surfaces.
 class X11TextureSourceBasic
-  : public TextureSourceBasic,
-    public NewTextureSource
+  : public TextureSourceBasic
+  , public NewTextureSource
 {
 public:
   X11TextureSourceBasic(BasicCompositor* aCompositor, gfxXlibSurface* aSurface);
 
   virtual X11TextureSourceBasic* AsSourceBasic() MOZ_OVERRIDE { return this; }
 
   virtual gfx::IntSize GetSize() const MOZ_OVERRIDE;
+
   virtual gfx::SurfaceFormat GetFormat() const MOZ_OVERRIDE;
+
   virtual gfx::SourceSurface* GetSurface() MOZ_OVERRIDE;
 
   virtual void DeallocateDeviceData() MOZ_OVERRIDE { }
 
   virtual void SetCompositor(Compositor* aCompositor);
 
   static gfx::SurfaceFormat ContentTypeToSurfaceFormat(gfxContentType aType);
 
--- a/gfx/layers/composite/X11TextureHost.h
+++ b/gfx/layers/composite/X11TextureHost.h
@@ -3,33 +3,36 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef MOZILLA_GFX_X11TEXTUREHOST__H
 #define MOZILLA_GFX_X11TEXTUREHOST__H
 
 #include "mozilla/layers/TextureHost.h"
 #include "mozilla/layers/LayersSurfaces.h"
-#include "mozilla/gfx/2D.h"
+#include "mozilla/gfx/Types.h"
 
 class gfxXlibSurface;
 
 namespace mozilla {
 namespace layers {
 
-// TextureSource for Xlib-backed TextureSources.
+// TextureHost for Xlib-backed TextureSources.
 class X11TextureHost : public TextureHost
 {
 public:
   X11TextureHost(TextureFlags aFlags,
                  const SurfaceDescriptorX11& aDescriptor);
 
   virtual void SetCompositor(Compositor* aCompositor) MOZ_OVERRIDE;
+
   virtual bool Lock() MOZ_OVERRIDE;
+
   virtual gfx::SurfaceFormat GetFormat() const MOZ_OVERRIDE;
+
   virtual gfx::IntSize GetSize() const MOZ_OVERRIDE;
 
   virtual NewTextureSource* GetTextureSources() MOZ_OVERRIDE
   {
     return mTextureSource;
   }
 
   virtual TemporaryRef<gfx::DataSourceSurface> GetAsSurface() MOZ_OVERRIDE
--- a/gfx/layers/opengl/X11TextureSourceOGL.h
+++ b/gfx/layers/opengl/X11TextureSourceOGL.h
@@ -11,41 +11,43 @@
 #include "mozilla/layers/TextureHostOGL.h"
 #include "mozilla/gfx/2D.h"
 
 namespace mozilla {
 namespace layers {
 
 // TextureSource for Xlib-backed surfaces.
 class X11TextureSourceOGL
-  : public TextureSourceOGL,
-    public NewTextureSource
+  : public TextureSourceOGL
+  , public NewTextureSource
 {
 public:
   X11TextureSourceOGL(CompositorOGL* aCompositor, gfxXlibSurface* aSurface);
   ~X11TextureSourceOGL();
 
   virtual X11TextureSourceOGL* AsSourceOGL() MOZ_OVERRIDE { return this; }
 
   virtual bool IsValid() const MOZ_OVERRIDE { return !!gl(); } ;
+
   virtual void BindTexture(GLenum aTextureUnit, gfx::Filter aFilter) MOZ_OVERRIDE;
+
   virtual gfx::IntSize GetSize() const MOZ_OVERRIDE;
-  virtual GLenum GetTextureTarget() const MOZ_OVERRIDE {
-    return LOCAL_GL_TEXTURE_2D;
-  }
+
+  virtual GLenum GetTextureTarget() const MOZ_OVERRIDE { return LOCAL_GL_TEXTURE_2D; }
+
   virtual gfx::SurfaceFormat GetFormat() const MOZ_OVERRIDE;
-  virtual GLenum GetWrapMode() const MOZ_OVERRIDE {
-     return LOCAL_GL_CLAMP_TO_EDGE;
-  }
+
+  virtual GLenum GetWrapMode() const MOZ_OVERRIDE { return LOCAL_GL_CLAMP_TO_EDGE; }
 
   virtual void DeallocateDeviceData() MOZ_OVERRIDE;
 
   virtual void SetCompositor(Compositor* aCompositor) MOZ_OVERRIDE;
 
   gl::GLContext* gl() const;
+
   static gfx::SurfaceFormat ContentTypeToSurfaceFormat(gfxContentType aType);
 
 protected:
   CompositorOGL* mCompositor;
   nsRefPtr<gfxXlibSurface> mSurface;
   RefPtr<gfx::SourceSurface> mSourceSurface;
   GLuint mTexture;
 };