Bug 936511 - Add layers.dump to dump layer tree. r=bas,nrc
authorBenoit Girard <b56girard@gmail.com>
Sun, 17 Nov 2013 16:47:40 -0500
changeset 155113 92f737230338676fc3f3f502ff13d5c21590b050
parent 155112 b4bb0aebdaada2a21dd34feaf3a39eab36cadbd4
child 155114 e5c12bfd295973777d2bcd9bafcf3094e0eb3abb
push id36241
push userb56girard@gmail.com
push dateMon, 18 Nov 2013 01:01:58 +0000
treeherdermozilla-inbound@92f737230338 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbas, nrc
bugs936511
milestone28.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 936511 - Add layers.dump to dump layer tree. r=bas,nrc
gfx/layers/Effects.cpp
gfx/layers/Effects.h
gfx/layers/Layers.cpp
gfx/layers/Layers.h
gfx/layers/LayersTypes.h
gfx/layers/basic/BasicLayers.h
gfx/layers/client/ClientLayerManager.h
gfx/layers/composite/CanvasLayerComposite.cpp
gfx/layers/composite/CanvasLayerComposite.h
gfx/layers/composite/ColorLayerComposite.h
gfx/layers/composite/CompositableHost.h
gfx/layers/composite/ContainerLayerComposite.h
gfx/layers/composite/ContentHost.cpp
gfx/layers/composite/ContentHost.h
gfx/layers/composite/ImageHost.cpp
gfx/layers/composite/ImageHost.h
gfx/layers/composite/ImageLayerComposite.cpp
gfx/layers/composite/ImageLayerComposite.h
gfx/layers/composite/LayerManagerComposite.cpp
gfx/layers/composite/LayerManagerComposite.h
gfx/layers/composite/TextureHost.cpp
gfx/layers/composite/TextureHost.h
gfx/layers/composite/ThebesLayerComposite.cpp
gfx/layers/composite/ThebesLayerComposite.h
gfx/layers/composite/TiledContentHost.cpp
gfx/layers/composite/TiledContentHost.h
gfx/layers/d3d10/LayerManagerD3D10.h
gfx/layers/d3d11/TextureD3D11.h
gfx/layers/d3d9/LayerManagerD3D9.h
gfx/layers/d3d9/TextureD3D9.h
gfx/layers/opengl/GrallocTextureHost.h
gfx/layers/opengl/LayerManagerOGL.h
gfx/layers/opengl/TextureHostOGL.h
gfx/thebes/gfxPlatform.cpp
gfx/thebes/gfxPlatform.h
modules/libpref/src/init/all.js
--- a/gfx/layers/Effects.cpp
+++ b/gfx/layers/Effects.cpp
@@ -6,17 +6,16 @@
 #include "Effects.h"
 #include "LayersLogging.h"              // for AppendToString
 #include "nsAString.h"
 #include "nsPrintfCString.h"            // for nsPrintfCString
 #include "nsString.h"                   // for nsAutoCString
 
 using namespace mozilla::layers;
 
-#ifdef MOZ_LAYERS_HAVE_LOG
 void
 TexturedEffect::PrintInfo(nsACString& aTo, const char* aPrefix)
 {
   aTo += aPrefix;
   aTo += nsPrintfCString("%s (0x%p)", Name(), this);
   AppendToString(aTo, mTextureCoords, " [texture-coords=", "]");
 
   if (mPremultiplied) {
@@ -50,9 +49,8 @@ EffectRenderTarget::PrintInfo(nsACString
 
 void
 EffectSolidColor::PrintInfo(nsACString& aTo, const char* aPrefix)
 {
   aTo += aPrefix;
   aTo += nsPrintfCString("EffectSolidColor (0x%p) [color=%x]", this, mColor.ToABGR());
 }
 
-#endif // MOZ_LAYERS_HAVE_LOG
--- a/gfx/layers/Effects.h
+++ b/gfx/layers/Effects.h
@@ -8,17 +8,17 @@
 
 #include "mozilla/Assertions.h"         // for MOZ_ASSERT, etc
 #include "mozilla/RefPtr.h"             // for RefPtr, TemporaryRef, etc
 #include "mozilla/gfx/Matrix.h"         // for Matrix4x4
 #include "mozilla/gfx/Point.h"          // for IntSize
 #include "mozilla/gfx/Rect.h"           // for Rect
 #include "mozilla/gfx/Types.h"          // for Filter, etc
 #include "mozilla/layers/CompositorTypes.h"  // for EffectTypes, etc
-#include "mozilla/layers/LayersTypes.h"  // for MOZ_LAYERS_HAVE_LOG
+#include "mozilla/layers/LayersTypes.h"
 #include "mozilla/layers/TextureHost.h"  // for CompositingRenderTarget, etc
 #include "mozilla/mozalloc.h"           // for operator delete, etc
 #include "nscore.h"                     // for nsACString
 
 namespace mozilla {
 namespace layers {
 
 /**
@@ -39,39 +39,35 @@ namespace layers {
 
 struct Effect : public RefCounted<Effect>
 {
   Effect(EffectTypes aType) : mType(aType) {}
 
   EffectTypes mType;
 
   virtual ~Effect() {}
-#ifdef MOZ_LAYERS_HAVE_LOG
   virtual void PrintInfo(nsACString& aTo, const char* aPrefix) =0;
-#endif
 };
 
 // Render from a texture
 struct TexturedEffect : public Effect
 {
   TexturedEffect(EffectTypes aType,
                  TextureSource *aTexture,
                  bool aPremultiplied,
                  gfx::Filter aFilter)
      : Effect(aType)
      , mTextureCoords(0, 0, 1.0f, 1.0f)
      , mTexture(aTexture)
      , mPremultiplied(aPremultiplied)
      , mFilter(aFilter)
   {}
 
-#ifdef MOZ_LAYERS_HAVE_LOG
   virtual const char* Name() = 0;
   virtual void PrintInfo(nsACString& aTo, const char* aPrefix);
-#endif
 
   gfx::Rect mTextureCoords;
   TextureSource* mTexture;
   bool mPremultiplied;
   gfx::Filter mFilter;;
 };
 
 // Support an alpha mask.
@@ -82,134 +78,116 @@ struct EffectMask : public Effect
              const gfx::Matrix4x4 &aMaskTransform)
     : Effect(EFFECT_MASK)
     , mMaskTexture(aMaskTexture)
     , mIs3D(false)
     , mSize(aSize)
     , mMaskTransform(aMaskTransform)
   {}
 
-#ifdef MOZ_LAYERS_HAVE_LOG
   virtual void PrintInfo(nsACString& aTo, const char* aPrefix);
-#endif
 
   TextureSource* mMaskTexture;
   bool mIs3D;
   gfx::IntSize mSize;
   gfx::Matrix4x4 mMaskTransform;
 };
 
 // Render to a render target rather than the screen.
 struct EffectRenderTarget : public TexturedEffect
 {
   EffectRenderTarget(CompositingRenderTarget *aRenderTarget)
     : TexturedEffect(EFFECT_RENDER_TARGET, aRenderTarget, true, gfx::FILTER_LINEAR)
     , mRenderTarget(aRenderTarget)
   {}
 
-#ifdef MOZ_LAYERS_HAVE_LOG
   virtual const char* Name() { return "EffectRenderTarget"; }
   virtual void PrintInfo(nsACString& aTo, const char* aPrefix);
-#endif
 
   RefPtr<CompositingRenderTarget> mRenderTarget;
 };
 
 struct EffectBGRX : public TexturedEffect
 {
   EffectBGRX(TextureSource *aBGRXTexture,
              bool aPremultiplied,
              gfx::Filter aFilter,
              bool aFlipped = false)
     : TexturedEffect(EFFECT_BGRX, aBGRXTexture, aPremultiplied, aFilter)
   {}
 
-#ifdef MOZ_LAYERS_HAVE_LOG
   virtual const char* Name() { return "EffectBGRX"; }
-#endif
 };
 
 struct EffectRGBX : public TexturedEffect
 {
   EffectRGBX(TextureSource *aRGBXTexture,
              bool aPremultiplied,
              gfx::Filter aFilter)
     : TexturedEffect(EFFECT_RGBX, aRGBXTexture, aPremultiplied, aFilter)
   {}
 
-#ifdef MOZ_LAYERS_HAVE_LOG
   virtual const char* Name() { return "EffectRGBX"; }
-#endif
 };
 
 struct EffectBGRA : public TexturedEffect
 {
   EffectBGRA(TextureSource *aBGRATexture,
              bool aPremultiplied,
              gfx::Filter aFilter)
     : TexturedEffect(EFFECT_BGRA, aBGRATexture, aPremultiplied, aFilter)
   {}
 
-#ifdef MOZ_LAYERS_HAVE_LOG
   virtual const char* Name() { return "EffectBGRA"; }
-#endif
 };
 
 struct EffectRGBA : public TexturedEffect
 {
   EffectRGBA(TextureSource *aRGBATexture,
              bool aPremultiplied,
              gfx::Filter aFilter)
     : TexturedEffect(EFFECT_RGBA, aRGBATexture, aPremultiplied, aFilter)
   {}
 
-#ifdef MOZ_LAYERS_HAVE_LOG
   virtual const char* Name() { return "EffectRGBA"; }
-#endif
 };
 
 struct EffectYCbCr : public TexturedEffect
 {
   EffectYCbCr(TextureSource *aSource, gfx::Filter aFilter)
     : TexturedEffect(EFFECT_YCBCR, aSource, false, aFilter)
   {}
 
-#ifdef MOZ_LAYERS_HAVE_LOG
   virtual const char* Name() { return "EffectYCbCr"; }
-#endif
 };
 
 struct EffectComponentAlpha : public TexturedEffect
 {
   EffectComponentAlpha(TextureSource *aOnBlack,
                        TextureSource *aOnWhite,
                        gfx::Filter aFilter)
     : TexturedEffect(EFFECT_COMPONENT_ALPHA, nullptr, false, aFilter)
     , mOnBlack(aOnBlack)
     , mOnWhite(aOnWhite)
   {}
 
-#ifdef MOZ_LAYERS_HAVE_LOG
   virtual const char* Name() { return "EffectComponentAlpha"; }
-#endif
 
   TextureSource* mOnBlack;
   TextureSource* mOnWhite;
 };
 
 struct EffectSolidColor : public Effect
 {
   EffectSolidColor(const gfx::Color &aColor)
     : Effect(EFFECT_SOLID_COLOR)
     , mColor(aColor)
   {}
 
-#ifdef MOZ_LAYERS_HAVE_LOG
   virtual void PrintInfo(nsACString& aTo, const char* aPrefix);
-#endif
 
   gfx::Color mColor;
 };
 
 struct EffectChain
 {
   RefPtr<Effect> mPrimaryEffect;
   RefPtr<Effect> mSecondaryEffects[EFFECT_MAX_SECONDARY];
--- a/gfx/layers/Layers.cpp
+++ b/gfx/layers/Layers.cpp
@@ -37,23 +37,21 @@ using namespace mozilla::gfx;
 
 typedef FrameMetrics::ViewID ViewID;
 const ViewID FrameMetrics::NULL_SCROLL_ID = 0;
 const ViewID FrameMetrics::ROOT_SCROLL_ID = 1;
 const ViewID FrameMetrics::START_SCROLL_ID = 2;
 
 uint8_t gLayerManagerLayerBuilder;
 
-#ifdef MOZ_LAYERS_HAVE_LOG
 FILE*
 FILEOrDefault(FILE* aFile)
 {
   return aFile ? aFile : stderr;
 }
-#endif // MOZ_LAYERS_HAVE_LOG
 
 namespace mozilla {
 namespace layers {
 
 //--------------------------------------------------
 // LayerManager
 Layer*
 LayerManager::GetPrimaryScrollableLayer()
@@ -1126,18 +1124,16 @@ LayerManager::StopFrameTimeRecording(uin
 }
 
 void
 LayerManager::BeginTabSwitch()
 {
   mTabSwitchStart = TimeStamp::Now();
 }
 
-#ifdef MOZ_LAYERS_HAVE_LOG
-
 static nsACString& PrintInfo(nsACString& aTo, LayerComposite* aLayerComposite);
 
 #ifdef MOZ_DUMP_PAINTING
 template <typename T>
 void WriteSnapshotLinkToDumpFile(T* aObj, FILE* aFile)
 {
   if (!aObj) {
     return;
@@ -1505,64 +1501,12 @@ PrintInfo(nsACString& aTo, LayerComposit
     AppendToString(aTo, aLayerComposite->GetShadowTransform(), " [shadow-transform=", "]");
   }
   if (!aLayerComposite->GetShadowVisibleRegion().IsEmpty()) {
     AppendToString(aTo, aLayerComposite->GetShadowVisibleRegion(), " [shadow-visible=", "]");
   }
   return aTo;
 }
 
-#else  // !MOZ_LAYERS_HAVE_LOG
-
-void Layer::Dump(FILE* aFile, const char* aPrefix, bool aDumpHtml) {}
-void Layer::DumpSelf(FILE* aFile, const char* aPrefix) {}
-void Layer::Log(const char* aPrefix) {}
-void Layer::LogSelf(const char* aPrefix) {}
-nsACString&
-Layer::PrintInfo(nsACString& aTo, const char* aPrefix)
-{ return aTo; }
-
-nsACString&
-ThebesLayer::PrintInfo(nsACString& aTo, const char* aPrefix)
-{ return aTo; }
-
-nsACString&
-ContainerLayer::PrintInfo(nsACString& aTo, const char* aPrefix)
-{ return aTo; }
-
-nsACString&
-ColorLayer::PrintInfo(nsACString& aTo, const char* aPrefix)
-{ return aTo; }
-
-nsACString&
-CanvasLayer::PrintInfo(nsACString& aTo, const char* aPrefix)
-{ return aTo; }
-
-nsACString&
-ImageLayer::PrintInfo(nsACString& aTo, const char* aPrefix)
-{ return aTo; }
-
-nsACString&
-RefLayer::PrintInfo(nsACString& aTo, const char* aPrefix)
-{ return aTo; }
-
-nsACString&
-ReadbackLayer::PrintInfo(nsACString& aTo, const char* aPrefix)
-{ return aTo; }
-
-void LayerManager::Dump(FILE* aFile, const char* aPrefix, bool aDumpHtml) {}
-void LayerManager::DumpSelf(FILE* aFile, const char* aPrefix) {}
-void LayerManager::Log(const char* aPrefix) {}
-void LayerManager::LogSelf(const char* aPrefix) {}
-
-nsACString&
-LayerManager::PrintInfo(nsACString& aTo, const char* aPrefix)
-{ return aTo; }
-
-/*static*/ void LayerManager::InitLog() {}
-/*static*/ bool LayerManager::IsLogEnabled() { return false; }
-
-#endif // MOZ_LAYERS_HAVE_LOG
-
 PRLogModuleInfo* LayerManager::sLog;
 
 } // namespace layers
 } // namespace mozilla
--- a/gfx/layers/Layers.h
+++ b/gfx/layers/Layers.h
@@ -500,20 +500,16 @@ public:
   virtual void FlushRendering() { }
 
   /**
    * Checks if we need to invalidate the OS widget to trigger
    * painting when updating this layer manager.
    */
   virtual bool NeedsWidgetInvalidation() { return true; }
 
-  // We always declare the following logging symbols, because it's
-  // extremely tricky to conditionally declare them.  However, for
-  // ifndef MOZ_LAYERS_HAVE_LOG builds, they only have trivial
-  // definitions in Layers.cpp.
   virtual const char* Name() const { return "???"; }
 
   /**
    * Dump information about this layer manager and its managed tree to
    * aFile, which defaults to stderr.
    */
   void Dump(FILE* aFile=nullptr, const char* aPrefix="", bool aDumpHtml=false);
   /**
--- a/gfx/layers/LayersTypes.h
+++ b/gfx/layers/LayersTypes.h
@@ -4,20 +4,16 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef GFX_LAYERSTYPES_H
 #define GFX_LAYERSTYPES_H
 
 #include <stdint.h>                     // for uint32_t
 #include "nsPoint.h"                    // for nsIntPoint
 
-// Debugging define.
-// To dump a layer tree call LayerManager::Dump()
-// #define MOZ_LAYERS_HAVE_LOG
-
 #ifdef MOZ_WIDGET_GONK
 #include <ui/GraphicBuffer.h>
 #endif
 #if defined(DEBUG) || defined(PR_LOGGING)
 #  include <stdio.h>            // FILE
 #  include "prlog.h"            // for PR_LOG
 #  ifndef MOZ_LAYERS_HAVE_LOG
 #    define MOZ_LAYERS_HAVE_LOG
--- a/gfx/layers/basic/BasicLayers.h
+++ b/gfx/layers/basic/BasicLayers.h
@@ -120,19 +120,17 @@ public:
   bool InForward() { return mPhase == PHASE_FORWARD; }
 #endif
   bool InTransaction() { return mPhase != PHASE_NONE; }
 
   gfxContext* GetTarget() { return mTarget; }
   void SetTarget(gfxContext* aTarget) { mUsingDefaultTarget = false; mTarget = aTarget; }
   bool IsRetained() { return mWidget != nullptr; }
 
-#ifdef MOZ_LAYERS_HAVE_LOG
   virtual const char* Name() const { return "Basic"; }
-#endif // MOZ_LAYERS_HAVE_LOG
 
   // Clear the cached contents of this layer tree.
   virtual void ClearCachedResources(Layer* aSubtree = nullptr) MOZ_OVERRIDE;
 
   void SetTransactionIncomplete() { mTransactionIncomplete = true; }
   bool IsTransactionIncomplete() { return mTransactionIncomplete; }
 
   already_AddRefed<gfxContext> PushGroupForLayer(gfxContext* aContext, Layer* aLayer,
--- a/gfx/layers/client/ClientLayerManager.h
+++ b/gfx/layers/client/ClientLayerManager.h
@@ -55,19 +55,17 @@ public:
   virtual void BeginTransaction();
   virtual bool EndEmptyTransaction(EndTransactionFlags aFlags = END_DEFAULT);
   virtual void EndTransaction(DrawThebesLayerCallback aCallback,
                               void* aCallbackData,
                               EndTransactionFlags aFlags = END_DEFAULT);
 
   virtual LayersBackend GetBackendType() { return LAYERS_CLIENT; }
   virtual void GetBackendName(nsAString& name);
-#ifdef MOZ_LAYERS_HAVE_LOG
   virtual const char* Name() const { return "Client"; }
-#endif // MOZ_LAYERS_HAVE_LOG
 
   virtual void SetRoot(Layer* aLayer);
 
   virtual void Mutated(Layer* aLayer);
 
   virtual already_AddRefed<ThebesLayer> CreateThebesLayer();
   virtual already_AddRefed<ContainerLayer> CreateContainerLayer();
   virtual already_AddRefed<ImageLayer> CreateImageLayer();
--- a/gfx/layers/composite/CanvasLayerComposite.cpp
+++ b/gfx/layers/composite/CanvasLayerComposite.cpp
@@ -115,23 +115,21 @@ void
 CanvasLayerComposite::CleanupResources()
 {
   if (mImageHost) {
     mImageHost->Detach(this);
   }
   mImageHost = nullptr;
 }
 
-#ifdef MOZ_LAYERS_HAVE_LOG
 nsACString&
 CanvasLayerComposite::PrintInfo(nsACString& aTo, const char* aPrefix)
 {
   CanvasLayer::PrintInfo(aTo, aPrefix);
   aTo += "\n";
   if (mImageHost && mImageHost->IsAttached()) {
     nsAutoCString pfx(aPrefix);
     pfx += "  ";
     mImageHost->PrintInfo(aTo, pfx.get());
   }
   return aTo;
 }
-#endif
 
--- a/gfx/layers/composite/CanvasLayerComposite.h
+++ b/gfx/layers/composite/CanvasLayerComposite.h
@@ -53,22 +53,20 @@ public:
   virtual void CleanupResources() MOZ_OVERRIDE;
 
   CompositableHost* GetCompositableHost() MOZ_OVERRIDE;
 
   virtual LayerComposite* AsLayerComposite() MOZ_OVERRIDE { return this; }
 
   void SetBounds(nsIntRect aBounds) { mBounds = aBounds; }
 
-#ifdef MOZ_LAYERS_HAVE_LOG
   virtual const char* Name() const MOZ_OVERRIDE { return "CanvasLayerComposite"; }
 
 protected:
   virtual nsACString& PrintInfo(nsACString& aTo, const char* aPrefix) MOZ_OVERRIDE;
-#endif
 
 private:
   RefPtr<CompositableHost> mImageHost;
 };
 
 } /* layers */
 } /* mozilla */
 #endif /* GFX_CanvasLayerComposite_H */
--- a/gfx/layers/composite/ColorLayerComposite.h
+++ b/gfx/layers/composite/ColorLayerComposite.h
@@ -4,17 +4,16 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef GFX_ColorLayerComposite_H
 #define GFX_ColorLayerComposite_H
 
 #include "Layers.h"                     // for ColorLayer, etc
 #include "mozilla/Attributes.h"         // for MOZ_OVERRIDE
 #include "mozilla/layers/LayerManagerComposite.h"  // for LayerComposite, etc
-#include "mozilla/layers/LayersTypes.h"  // for MOZ_LAYERS_HAVE_LOG
 #include "nsTraceRefcnt.h"              // for MOZ_COUNT_CTOR, etc
 
 struct nsIntPoint;
 struct nsIntRect;
 
 namespace mozilla {
 namespace layers {
 
@@ -44,16 +43,14 @@ public:
 
   virtual void RenderLayer(const nsIntRect& aClipRect) MOZ_OVERRIDE;
   virtual void CleanupResources() MOZ_OVERRIDE {};
 
   CompositableHost* GetCompositableHost() MOZ_OVERRIDE { return nullptr; }
 
   virtual LayerComposite* AsLayerComposite() MOZ_OVERRIDE { return this; }
 
-#ifdef MOZ_LAYERS_HAVE_LOG
   virtual const char* Name() const MOZ_OVERRIDE { return "ColorLayerComposite"; }
-#endif
 };
 
 } /* layers */
 } /* mozilla */
 #endif /* GFX_ColorLayerComposite_H */
--- a/gfx/layers/composite/CompositableHost.h
+++ b/gfx/layers/composite/CompositableHost.h
@@ -277,19 +277,17 @@ public:
                     const char* aPrefix="",
                     bool aDumpHtml=false) { }
   static void DumpDeprecatedTextureHost(FILE* aFile, DeprecatedTextureHost* aTexture);
   static void DumpTextureHost(FILE* aFile, TextureHost* aTexture);
 
   virtual already_AddRefed<gfxImageSurface> GetAsSurface() { return nullptr; }
 #endif
 
-#ifdef MOZ_LAYERS_HAVE_LOG
   virtual void PrintInfo(nsACString& aTo, const char* aPrefix) { }
-#endif
 
   void AddTextureHost(TextureHost* aTexture);
   virtual void UseTextureHost(TextureHost* aTexture) {}
   virtual void RemoveTextureHost(uint64_t aTextureID);
   TextureHost* GetTextureHost(uint64_t aTextureID);
 
 protected:
   TextureInfo mTextureInfo;
--- a/gfx/layers/composite/ContainerLayerComposite.h
+++ b/gfx/layers/composite/ContainerLayerComposite.h
@@ -4,17 +4,16 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef GFX_ContainerLayerComposite_H
 #define GFX_ContainerLayerComposite_H
 
 #include "Layers.h"                     // for Layer (ptr only), etc
 #include "mozilla/Attributes.h"         // for MOZ_OVERRIDE
 #include "mozilla/layers/LayerManagerComposite.h"
-#include "mozilla/layers/LayersTypes.h"  // for MOZ_LAYERS_HAVE_LOG
 
 class gfx3DMatrix;
 struct nsIntPoint;
 struct nsIntRect;
 
 namespace mozilla {
 namespace layers {
 
@@ -48,19 +47,17 @@ public:
 
   virtual void CleanupResources() MOZ_OVERRIDE;
 
   virtual LayerComposite* AsLayerComposite() MOZ_OVERRIDE { return this; }
 
   // container layers don't use a compositable
   CompositableHost* GetCompositableHost() MOZ_OVERRIDE { return nullptr; }
 
-#ifdef MOZ_LAYERS_HAVE_LOG
   virtual const char* Name() const MOZ_OVERRIDE { return "ContainerLayerComposite"; }
-#endif
 };
 
 class RefLayerComposite : public RefLayer,
                           public LayerComposite
 {
   template<class ContainerT>
   friend void ContainerRender(ContainerT* aContainer,
                               LayerManagerComposite* aManager,
@@ -85,17 +82,15 @@ public:
 
   virtual void CleanupResources() MOZ_OVERRIDE;
 
   virtual LayerComposite* AsLayerComposite() MOZ_OVERRIDE { return this; }
 
   // ref layers don't use a compositable
   CompositableHost* GetCompositableHost() MOZ_OVERRIDE { return nullptr; }
 
-#ifdef MOZ_LAYERS_HAVE_LOG
   virtual const char* Name() const MOZ_OVERRIDE { return "RefLayerComposite"; }
-#endif
 };
 
 } /* layers */
 } /* mozilla */
 
 #endif /* GFX_ContainerLayerComposite_H */
--- a/gfx/layers/composite/ContentHost.cpp
+++ b/gfx/layers/composite/ContentHost.cpp
@@ -711,17 +711,16 @@ ContentHostIncremental::TextureUpdateReq
 
   if (mTextureId == TextureFront) {
     aHost->mDeprecatedTextureHost->Update(mDescriptor, &mUpdated, &offset);
   } else {
     aHost->mDeprecatedTextureHostOnWhite->Update(mDescriptor, &mUpdated, &offset);
   }
 }
 
-#ifdef MOZ_LAYERS_HAVE_LOG
 void
 ContentHostSingleBuffered::PrintInfo(nsACString& aTo, const char* aPrefix)
 {
   aTo += aPrefix;
   aTo += nsPrintfCString("ContentHostSingleBuffered (0x%p)", this);
 
   AppendToString(aTo, mBufferRect, " [buffer-rect=", "]");
   AppendToString(aTo, mBufferRotation, " [buffer-rotation=", "]");
@@ -758,17 +757,16 @@ ContentHostDoubleBuffered::PrintInfo(nsA
     mDeprecatedTextureHost->PrintInfo(aTo, prefix.get());
   }
 
   if (mBackHost) {
     aTo += "\n";
     mBackHost->PrintInfo(aTo, prefix.get());
   }
 }
-#endif
 
 #ifdef MOZ_DUMP_PAINTING
 void
 ContentHostDoubleBuffered::Dump(FILE* aFile,
                                 const char* aPrefix,
                                 bool aDumpHtml)
 {
   ContentHostBase::Dump(aFile, aPrefix, aDumpHtml);
--- a/gfx/layers/composite/ContentHost.h
+++ b/gfx/layers/composite/ContentHost.h
@@ -15,17 +15,17 @@
 #include "mozilla/RefPtr.h"             // for RefPtr
 #include "mozilla/gfx/BasePoint.h"      // for BasePoint
 #include "mozilla/gfx/Point.h"          // for Point
 #include "mozilla/gfx/Rect.h"           // for Rect
 #include "mozilla/gfx/Types.h"          // for Filter
 #include "mozilla/layers/CompositorTypes.h"  // for TextureInfo, etc
 #include "mozilla/layers/ISurfaceAllocator.h"  // for ISurfaceAllocator
 #include "mozilla/layers/LayersSurfaces.h"  // for SurfaceDescriptor
-#include "mozilla/layers/LayersTypes.h"  // for MOZ_LAYERS_HAVE_LOG, etc
+#include "mozilla/layers/LayersTypes.h"  // for etc
 #include "mozilla/layers/TextureHost.h"  // for DeprecatedTextureHost
 #include "mozilla/mozalloc.h"           // for operator delete
 #include "nsAutoPtr.h"                  // for nsAutoPtr
 #include "nsCOMPtr.h"                   // for already_AddRefed
 #include "nsDebug.h"                    // for NS_RUNTIMEABORT
 #include "nsPoint.h"                    // for nsIntPoint
 #include "nsRect.h"                     // for nsIntRect
 #include "nsRegion.h"                   // for nsIntRegion
@@ -178,19 +178,17 @@ public:
   virtual void DestroyTextures() MOZ_OVERRIDE;
 
 #ifdef MOZ_DUMP_PAINTING
   virtual void Dump(FILE* aFile=nullptr,
                     const char* aPrefix="",
                     bool aDumpHtml=false) MOZ_OVERRIDE;
 #endif
 
-#ifdef MOZ_LAYERS_HAVE_LOG
   virtual void PrintInfo(nsACString& aTo, const char* aPrefix);
-#endif
 protected:
   nsIntRegion mValidRegionForNextBackBuffer;
   // Texture host for the back buffer. We never read or write this buffer. We
   // only swap it with the front buffer (mDeprecatedTextureHost) when we are told by the
   // content thread.
   RefPtr<DeprecatedTextureHost> mBackHost;
   RefPtr<DeprecatedTextureHost> mBackHostOnWhite;
 };
@@ -215,19 +213,17 @@ public:
                             nsIntRegion* aUpdatedRegionBack);
 
   virtual void EnsureDeprecatedTextureHost(TextureIdentifier aTextureId,
                                  const SurfaceDescriptor& aSurface,
                                  ISurfaceAllocator* aAllocator,
                                  const TextureInfo& aTextureInfo) MOZ_OVERRIDE;
   virtual void DestroyTextures() MOZ_OVERRIDE;
 
-#ifdef MOZ_LAYERS_HAVE_LOG
   virtual void PrintInfo(nsACString& aTo, const char* aPrefix);
-#endif
 };
 
 /**
  * Maintains a host-side only texture, and gets provided with
  * surfaces that only cover the changed pixels during an update.
  *
  * Takes ownership of the passed in update surfaces, and must
  * free them once texture upload is complete.
--- a/gfx/layers/composite/ImageHost.cpp
+++ b/gfx/layers/composite/ImageHost.cpp
@@ -146,34 +146,31 @@ ImageHost::Composite(EffectChain& aEffec
                               aOpacity, aTransform);
     GetCompositor()->DrawDiagnostics(DIAGNOSTIC_IMAGE,
                                      rect, aClipRect,
                                      aTransform);
   }
   mFrontBuffer->Unlock();
 }
 
-#ifdef MOZ_LAYERS_HAVE_LOG
 void
 ImageHost::PrintInfo(nsACString& aTo, const char* aPrefix)
 {
   aTo += aPrefix;
   aTo += nsPrintfCString("ImageHost (0x%p)", this);
 
   AppendToString(aTo, mPictureRect, " [picture-rect=", "]");
 
   if (mFrontBuffer) {
     nsAutoCString pfx(aPrefix);
     pfx += "  ";
     aTo += "\n";
     mFrontBuffer->PrintInfo(aTo, pfx.get());
   }
 }
-#endif
-
 
 #ifdef MOZ_DUMP_PAINTING
 void
 ImageHost::Dump(FILE* aFile,
                 const char* aPrefix,
                 bool aDumpHtml)
 {
   if (!aFile) {
@@ -330,33 +327,31 @@ DeprecatedImageHostSingle::Composite(Eff
                               aOpacity, aTransform);
     GetCompositor()->DrawDiagnostics(DIAGNOSTIC_IMAGE,
                                      rect, aClipRect, aTransform);
   }
 
   mDeprecatedTextureHost->Unlock();
 }
 
-#ifdef MOZ_LAYERS_HAVE_LOG
 void
 DeprecatedImageHostSingle::PrintInfo(nsACString& aTo, const char* aPrefix)
 {
   aTo += aPrefix;
   aTo += nsPrintfCString("DeprecatedImageHostSingle (0x%p)", this);
 
   AppendToString(aTo, mPictureRect, " [picture-rect=", "]");
 
   if (mDeprecatedTextureHost) {
     nsAutoCString pfx(aPrefix);
     pfx += "  ";
     aTo += "\n";
     mDeprecatedTextureHost->PrintInfo(aTo, pfx.get());
   }
 }
-#endif
 
 bool
 DeprecatedImageHostBuffered::Update(const SurfaceDescriptor& aImage,
                                     SurfaceDescriptor* aResult) {
   if (!GetDeprecatedTextureHost()) {
     *aResult = aImage;
     return false;
   }
--- a/gfx/layers/composite/ImageHost.h
+++ b/gfx/layers/composite/ImageHost.h
@@ -63,19 +63,17 @@ public:
   virtual void SetPictureRect(const nsIntRect& aPictureRect) MOZ_OVERRIDE
   {
     mPictureRect = aPictureRect;
     mHasPictureRect = true;
   }
 
   virtual LayerRenderState GetRenderState() MOZ_OVERRIDE;
 
-#ifdef MOZ_LAYERS_HAVE_LOG
   virtual void PrintInfo(nsACString& aTo, const char* aPrefix);
-#endif
 
 #ifdef MOZ_DUMP_PAINTING
   virtual void Dump(FILE* aFile=NULL,
                     const char* aPrefix="",
                     bool aDumpHtml=false) MOZ_OVERRIDE;
 
   virtual already_AddRefed<gfxImageSurface> GetAsSurface() MOZ_OVERRIDE;
 #endif
@@ -125,19 +123,17 @@ public:
     mPictureRect = aPictureRect;
     mHasPictureRect = true;
   }
 
   virtual LayerRenderState GetRenderState() MOZ_OVERRIDE;
 
   virtual void SetCompositor(Compositor* aCompositor) MOZ_OVERRIDE;
 
-#ifdef MOZ_LAYERS_HAVE_LOG
   virtual void PrintInfo(nsACString& aTo, const char* aPrefix);
-#endif
 
 #ifdef MOZ_DUMP_PAINTING
   virtual void Dump(FILE* aFile=nullptr,
                     const char* aPrefix="",
                     bool aDumpHtml=false) MOZ_OVERRIDE;
 
   virtual already_AddRefed<gfxImageSurface> GetAsSurface() MOZ_OVERRIDE;
 #endif
--- a/gfx/layers/composite/ImageLayerComposite.cpp
+++ b/gfx/layers/composite/ImageLayerComposite.cpp
@@ -153,25 +153,23 @@ void
 ImageLayerComposite::CleanupResources()
 {
   if (mImageHost) {
     mImageHost->Detach(this);
   }
   mImageHost = nullptr;
 }
 
-#ifdef MOZ_LAYERS_HAVE_LOG
 nsACString&
 ImageLayerComposite::PrintInfo(nsACString& aTo, const char* aPrefix)
 {
   ImageLayer::PrintInfo(aTo, aPrefix);
   aTo += "\n";
   if (mImageHost && mImageHost->IsAttached()) {
     nsAutoCString pfx(aPrefix);
     pfx += "  ";
     mImageHost->PrintInfo(aTo, pfx.get());
   }
   return aTo;
 }
-#endif
 
 } /* layers */
 } /* mozilla */
--- a/gfx/layers/composite/ImageLayerComposite.h
+++ b/gfx/layers/composite/ImageLayerComposite.h
@@ -49,22 +49,20 @@ public:
   virtual void ComputeEffectiveTransforms(const gfx3DMatrix& aTransformToSurface) MOZ_OVERRIDE;
 
   virtual void CleanupResources() MOZ_OVERRIDE;
 
   CompositableHost* GetCompositableHost() MOZ_OVERRIDE;
 
   virtual LayerComposite* AsLayerComposite() MOZ_OVERRIDE { return this; }
 
-#ifdef MOZ_LAYERS_HAVE_LOG
   virtual const char* Name() const { return "ImageLayerComposite"; }
 
 protected:
   virtual nsACString& PrintInfo(nsACString& aTo, const char* aPrefix) MOZ_OVERRIDE;
-#endif
 
 private:
   RefPtr<CompositableHost> mImageHost;
 };
 
 } /* layers */
 } /* mozilla */
 
--- a/gfx/layers/composite/LayerManagerComposite.cpp
+++ b/gfx/layers/composite/LayerManagerComposite.cpp
@@ -32,17 +32,17 @@
 #include "mozilla/gfx/2D.h"             // for DrawTarget
 #include "mozilla/gfx/Matrix.h"         // for Matrix4x4
 #include "mozilla/gfx/Point.h"          // for IntSize, Point
 #include "mozilla/gfx/Rect.h"           // for Rect
 #include "mozilla/gfx/Types.h"          // for Color, SurfaceFormat
 #include "mozilla/layers/Compositor.h"  // for Compositor
 #include "mozilla/layers/CompositorTypes.h"
 #include "mozilla/layers/Effects.h"     // for Effect, EffectChain, etc
-#include "mozilla/layers/LayersTypes.h"  // for MOZ_LAYERS_HAVE_LOG, etc
+#include "mozilla/layers/LayersTypes.h"  // for etc
 #include "ipc/ShadowLayerUtils.h"
 #include "mozilla/mozalloc.h"           // for operator new, etc
 #include "nsAutoPtr.h"                  // for nsRefPtr
 #include "nsCOMPtr.h"                   // for already_AddRefed
 #include "nsDebug.h"                    // for NS_WARNING, NS_RUNTIMEABORT, etc
 #include "nsISupportsImpl.h"            // for Layer::AddRef, etc
 #include "nsIWidget.h"                  // for nsIWidget
 #include "nsPoint.h"                    // for nsIntPoint
@@ -313,16 +313,20 @@ void
 LayerManagerComposite::Render()
 {
   PROFILER_LABEL("LayerManagerComposite", "Render");
   if (mDestroyed) {
     NS_WARNING("Call on destroyed layer manager");
     return;
   }
 
+  if (gfxPlatform::GetPrefLayersDump()) {
+    this->Dump();
+  }
+
   if (mComposer2D && mComposer2D->TryRender(mRoot, mWorldMatrix)) {
     mCompositor->EndFrameForExternalComposition(mWorldMatrix);
     return;
   }
 
   {
     PROFILER_LABEL("LayerManagerComposite", "PreRender");
     if (!mCompositor->GetWidget()->PreRender(this)) {
--- a/gfx/layers/composite/LayerManagerComposite.h
+++ b/gfx/layers/composite/LayerManagerComposite.h
@@ -153,19 +153,17 @@ public:
 
 
   DrawThebesLayerCallback GetThebesLayerCallback() const
   { return mThebesLayerCallback; }
 
   void* GetThebesLayerCallbackData() const
   { return mThebesLayerCallbackData; }
 
-#ifdef MOZ_LAYERS_HAVE_LOG
   virtual const char* Name() const MOZ_OVERRIDE { return ""; }
-#endif // MOZ_LAYERS_HAVE_LOG
 
   enum WorldTransforPolicy {
     ApplyWorldTransform,
     DontApplyWorldTransform
   };
 
   /**
    * Setup World transform matrix.
--- a/gfx/layers/composite/TextureHost.cpp
+++ b/gfx/layers/composite/TextureHost.cpp
@@ -157,30 +157,26 @@ TextureHost::TextureHost(uint64_t aID,
     , mNextTexture(nullptr)
     , mFlags(aFlags)
 {}
 
 TextureHost::~TextureHost()
 {
 }
 
-#ifdef MOZ_LAYERS_HAVE_LOG
-
 void
 TextureHost::PrintInfo(nsACString& aTo, const char* aPrefix)
 {
   aTo += aPrefix;
   aTo += nsPrintfCString("%s (0x%p)", Name(), this);
   AppendToString(aTo, GetSize(), " [size=", "]");
   AppendToString(aTo, GetFormat(), " [format=", "]");
   AppendToString(aTo, mFlags, " [flags=", "]");
 }
 
-#endif
-
 void
 TextureSource::SetCompositableBackendSpecificData(CompositableBackendSpecificData* aBackendData)
 {
     mCompositableBackendData = aBackendData;
 }
 
 TextureSource::TextureSource()
 {
@@ -241,28 +237,25 @@ DeprecatedTextureHost::SwapTextures(cons
   // GrallocDeprecatedTextureHostOGL which overrides SetBuffer to make it
   // register the TextureHost with the GrallocBufferActor.
   // The reason why this SetBuffer calls is needed here is that just above we
   // overwrote *mBuffer in place, so we need to tell the new mBuffer about this
   // TextureHost.
   SetBuffer(mBuffer, mDeAllocator);
 }
 
-#ifdef MOZ_LAYERS_HAVE_LOG
-
 void
 DeprecatedTextureHost::PrintInfo(nsACString& aTo, const char* aPrefix)
 {
   aTo += aPrefix;
   aTo += nsPrintfCString("%s (0x%p)", Name(), this);
   AppendToString(aTo, GetSize(), " [size=", "]");
   AppendToString(aTo, GetFormat(), " [format=", "]");
   AppendToString(aTo, mFlags, " [flags=", "]");
 }
-#endif // MOZ_LAYERS_HAVE_LOG
 
 
 
 
 
 
 
 BufferTextureHost::BufferTextureHost(uint64_t aID,
--- a/gfx/layers/composite/TextureHost.h
+++ b/gfx/layers/composite/TextureHost.h
@@ -379,20 +379,18 @@ public:
   {
     // 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 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<CompositableBackendSpecificData> mCompositableBackendData;
 };
 
@@ -475,19 +473,17 @@ public:
                    TextureFlags aFlags);
 
   ~ShmemTextureHost();
 
   virtual void DeallocateSharedData() MOZ_OVERRIDE;
 
   virtual uint8_t* GetBuffer() MOZ_OVERRIDE;
 
-#ifdef MOZ_LAYERS_HAVE_LOG
   virtual const char *Name() MOZ_OVERRIDE { return "ShmemTextureHost"; }
-#endif
 
 protected:
   mozilla::ipc::Shmem* mShmem;
   ISurfaceAllocator* mDeallocator;
 };
 
 /**
  * TextureHost that wraps raw memory.
@@ -504,19 +500,17 @@ public:
                     TextureFlags aFlags);
 
   ~MemoryTextureHost();
 
   virtual void DeallocateSharedData() MOZ_OVERRIDE;
 
   virtual uint8_t* GetBuffer() MOZ_OVERRIDE;
 
-#ifdef MOZ_LAYERS_HAVE_LOG
   virtual const char *Name() MOZ_OVERRIDE { return "MemoryTextureHost"; }
-#endif
 
 protected:
   uint8_t* mBuffer;
 };
 
 
 /**
  * XXX - This class is deprectaed, will be removed soon.
@@ -659,20 +653,18 @@ public:
 
   virtual LayerRenderState GetRenderState()
   {
     return LayerRenderState();
   }
 
   virtual already_AddRefed<gfxImageSurface> GetAsSurface() = 0;
 
-#ifdef MOZ_LAYERS_HAVE_LOG
   virtual const char *Name() = 0;
   virtual void PrintInfo(nsACString& aTo, const char* aPrefix);
-#endif
 
   /**
    * TEMPORARY.
    *
    * Ensure that a buffer of the given size/type has been allocated so that
    * we can update it using Update and/or CopyTo.
    */
   virtual void EnsureBuffer(const nsIntSize& aSize, gfxContentType aType)
--- a/gfx/layers/composite/ThebesLayerComposite.cpp
+++ b/gfx/layers/composite/ThebesLayerComposite.cpp
@@ -184,25 +184,23 @@ ThebesLayerComposite::GetEffectiveResolu
     const FrameMetrics& metrics = parent->GetFrameMetrics();
     resolution.width *= metrics.mResolution.scale;
     resolution.height *= metrics.mResolution.scale;
   }
 
   return resolution;
 }
 
-#ifdef MOZ_LAYERS_HAVE_LOG
 nsACString&
 ThebesLayerComposite::PrintInfo(nsACString& aTo, const char* aPrefix)
 {
   ThebesLayer::PrintInfo(aTo, aPrefix);
   aTo += "\n";
   if (mBuffer && mBuffer->IsAttached()) {
     nsAutoCString pfx(aPrefix);
     pfx += "  ";
     mBuffer->PrintInfo(aTo, pfx.get());
   }
   return aTo;
 }
-#endif
 
 } /* layers */
 } /* mozilla */
--- a/gfx/layers/composite/ThebesLayerComposite.h
+++ b/gfx/layers/composite/ThebesLayerComposite.h
@@ -74,19 +74,17 @@ public:
     mValidRegion = aRegion;
     Mutated();
   }
 
   MOZ_LAYER_DECL_NAME("ThebesLayerComposite", TYPE_SHADOW)
 
 protected:
 
-#ifdef MOZ_LAYERS_HAVE_LOG
   virtual nsACString& PrintInfo(nsACString& aTo, const char* aPrefix) MOZ_OVERRIDE;
-#endif
 
 private:
   gfxSize GetEffectiveResolution();
 
   RefPtr<ContentHost> mBuffer;
   bool mRequiresTiledProperties;
 };
 
--- a/gfx/layers/composite/TiledContentHost.cpp
+++ b/gfx/layers/composite/TiledContentHost.cpp
@@ -301,25 +301,23 @@ TiledTexture::Validate(gfxReusableSurfac
                                                   nullptr);
     mDeprecatedTextureHost->SetCompositor(aCompositor);
     flags |= TEXTURE_NEW_TILE;
   }
 
   mDeprecatedTextureHost->Update(aReusableSurface, flags, gfx::IntSize(aSize, aSize));
 }
 
-#ifdef MOZ_LAYERS_HAVE_LOG
 void
 TiledContentHost::PrintInfo(nsACString& aTo, const char* aPrefix)
 {
   aTo += aPrefix;
   aTo += nsPrintfCString("TiledContentHost (0x%p)", this);
 
 }
-#endif
 
 #ifdef MOZ_DUMP_PAINTING
 void
 TiledContentHost::Dump(FILE* aFile,
                        const char* aPrefix,
                        bool aDumpHtml)
 {
   if (!aFile) {
--- a/gfx/layers/composite/TiledContentHost.h
+++ b/gfx/layers/composite/TiledContentHost.h
@@ -240,19 +240,17 @@ public:
                       AttachFlags aFlags = NO_FLAGS) MOZ_OVERRIDE;
 
 #ifdef MOZ_DUMP_PAINTING
   virtual void Dump(FILE* aFile=nullptr,
                     const char* aPrefix="",
                     bool aDumpHtml=false) MOZ_OVERRIDE;
 #endif
 
-#ifdef MOZ_LAYERS_HAVE_LOG
   virtual void PrintInfo(nsACString& aTo, const char* aPrefix);
-#endif
 
 private:
   void ProcessUploadQueue(nsIntRegion* aNewValidRegion,
                           TiledLayerProperties* aLayerProperties);
   void ProcessLowPrecisionUploadQueue();
 
   void RenderLayerBuffer(TiledLayerBufferComposite& aLayerBuffer,
                          const nsIntRegion& aValidRegion,
--- a/gfx/layers/d3d10/LayerManagerD3D10.h
+++ b/gfx/layers/d3d10/LayerManagerD3D10.h
@@ -118,19 +118,17 @@ public:
 
   virtual TemporaryRef<mozilla::gfx::DrawTarget>
     CreateDrawTarget(const mozilla::gfx::IntSize &aSize,
                      mozilla::gfx::SurfaceFormat aFormat);
 
   virtual LayersBackend GetBackendType() { return LAYERS_D3D10; }
   virtual void GetBackendName(nsAString& name) { name.AssignLiteral("Direct3D 10"); }
 
-#ifdef MOZ_LAYERS_HAVE_LOG
   virtual const char* Name() const { return "D3D10"; }
-#endif // MOZ_LAYERS_HAVE_LOG
 
   // Public helpers
 
   ID3D10Device1 *device() const { return mDevice; }
 
   ID3D10Effect *effect() const { return mEffect; }
   IDXGISwapChain *SwapChain() const
   {
--- a/gfx/layers/d3d11/TextureD3D11.h
+++ b/gfx/layers/d3d11/TextureD3D11.h
@@ -144,22 +144,20 @@ public:
 
   virtual bool Lock() MOZ_OVERRIDE { return true; }
 
   virtual already_AddRefed<gfxImageSurface> GetAsSurface() MOZ_OVERRIDE
   {
     return nullptr; // TODO: cf bug 872568
   }
 
-#ifdef MOZ_LAYERS_HAVE_LOG
   virtual const char* Name() MOZ_OVERRIDE
   {
     return "DeprecatedTextureHostShmemD3D11";
   }
-#endif
 
   virtual void BeginTileIteration() MOZ_OVERRIDE
   {
     mIterating = true;
     mCurrentTile = 0;
   }
   virtual void EndTileIteration() MOZ_OVERRIDE
   {
@@ -209,19 +207,17 @@ public:
   virtual bool Lock() MOZ_OVERRIDE;
   virtual void Unlock() MOZ_OVERRIDE;
 
   virtual already_AddRefed<gfxImageSurface> GetAsSurface() MOZ_OVERRIDE
   {
     return nullptr; // TODO: cf bug 872568
   }
 
-#ifdef MOZ_LAYERS_HAVE_LOG
   virtual const char* Name() { return "DeprecatedTextureHostDXGID3D11"; }
-#endif
 
 protected:
   virtual void UpdateImpl(const SurfaceDescriptor& aSurface,
                           nsIntRegion* aRegion,
                           nsIntPoint* aOffset = nullptr) MOZ_OVERRIDE;
 private:
   void LockTexture();
   void ReleaseTexture();
@@ -247,22 +243,20 @@ public:
 
   virtual bool IsYCbCrSource() const MOZ_OVERRIDE { return true; }
 
   virtual already_AddRefed<gfxImageSurface> GetAsSurface() MOZ_OVERRIDE
   {
     return nullptr; // TODO: cf bug 872568
   }
 
-#ifdef MOZ_LAYERS_HAVE_LOG
   virtual const char* Name() MOZ_OVERRIDE
   {
     return "TextureImageDeprecatedTextureHostD3D11";
   }
-#endif
 
 protected:
   virtual void UpdateImpl(const SurfaceDescriptor& aSurface,
                           nsIntRegion* aRegion,
                           nsIntPoint* aOffset = nullptr) MOZ_OVERRIDE;
 
 private:
   RefPtr<ID3D11Device> mDevice;
--- a/gfx/layers/d3d9/LayerManagerD3D9.h
+++ b/gfx/layers/d3d9/LayerManagerD3D9.h
@@ -124,19 +124,17 @@ public:
    */ 
   Nv3DVUtils *GetNv3DVUtils() { return mDeviceManager ? mDeviceManager->GetNv3DVUtils() : nullptr; } 
 
   static void OnDeviceManagerDestroy(DeviceManagerD3D9 *aDeviceManager) {
     if(aDeviceManager == mDefaultDeviceManager)
       mDefaultDeviceManager = nullptr;
   }
 
-#ifdef MOZ_LAYERS_HAVE_LOG
   virtual const char* Name() const { return "D3D9"; }
-#endif // MOZ_LAYERS_HAVE_LOG
 
   void ReportFailure(const nsACString &aMsg, HRESULT aCode);
 
   bool CompositingDisabled() { return mCompositingDisabled; }
   void SetCompositingDisabled(bool aCompositingDisabled) { mCompositingDisabled = aCompositingDisabled; }
 
 private:
   /* Default device manager instance */
--- a/gfx/layers/d3d9/TextureD3D9.h
+++ b/gfx/layers/d3d9/TextureD3D9.h
@@ -143,32 +143,28 @@ protected:
   std::vector< RefPtr<IDirect3DTexture9> > mTileTextures;
   uint32_t mCurrentTile;
   bool mIterating;
 };
 
 class DeprecatedTextureHostShmemD3D9 : public DeprecatedTextureHostD3D9
 {
 public:
-#ifdef MOZ_LAYERS_HAVE_LOG
   virtual const char* Name() { return "DeprecatedTextureHostShmemD3D9"; }
-#endif
 
 protected:
   virtual void UpdateImpl(const SurfaceDescriptor& aSurface,
                           nsIntRegion* aRegion,
                           nsIntPoint *aOffset = nullptr) MOZ_OVERRIDE;
 };
 
 class DeprecatedTextureHostSystemMemD3D9 : public DeprecatedTextureHostD3D9
 {
 public:
-#ifdef MOZ_LAYERS_HAVE_LOG
   virtual const char* Name() { return "DeprecatedTextureHostSystemMemD3D9"; }
-#endif
 
 protected:
   virtual void UpdateImpl(const SurfaceDescriptor& aSurface,
                           nsIntRegion* aRegion,
                           nsIntPoint *aOffset = nullptr) MOZ_OVERRIDE;
 };
 
 class DeprecatedTextureHostYCbCrD3D9 : public DeprecatedTextureHost
@@ -189,38 +185,34 @@ public:
 
   virtual bool IsYCbCrSource() const MOZ_OVERRIDE { return true; }
 
   virtual already_AddRefed<gfxImageSurface> GetAsSurface() MOZ_OVERRIDE
   {
     return nullptr; // TODO: cf bug 872568
   }
 
-#ifdef MOZ_LAYERS_HAVE_LOG
   virtual const char* Name() MOZ_OVERRIDE
   {
     return "TextureImageDeprecatedTextureHostD3D11";
   }
-#endif
 
 protected:
   virtual void UpdateImpl(const SurfaceDescriptor& aSurface,
                           nsIntRegion* aRegion,
                           nsIntPoint* aOffset = nullptr) MOZ_OVERRIDE;
 
 private:
   RefPtr<IDirect3DDevice9> mDevice;
 };
 
 class DeprecatedTextureHostDIB : public DeprecatedTextureHostD3D9
 {
 public:
-#ifdef MOZ_LAYERS_HAVE_LOG
   virtual const char* Name() { return "DeprecatedTextureHostDIB"; }
-#endif
   virtual void SetBuffer(SurfaceDescriptor* aBuffer, ISurfaceAllocator* aAllocator) MOZ_OVERRIDE
   {
     MOZ_ASSERT(aBuffer->type() == SurfaceDescriptor::TSurfaceDescriptorDIB);
     // We are responsible for keeping the surface alive. But the client will have AddRefed it
     // for transport to the host. So we don't need to AddRef here.
     mSurface = dont_AddRef(reinterpret_cast<gfxWindowsSurface*>(aBuffer->get_SurfaceDescriptorDIB().surface()));
     DeprecatedTextureHost::SetBuffer(aBuffer, aAllocator);
   }
--- a/gfx/layers/opengl/GrallocTextureHost.h
+++ b/gfx/layers/opengl/GrallocTextureHost.h
@@ -105,19 +105,17 @@ public:
   }
 
   virtual already_AddRefed<gfxImageSurface> GetAsSurface() 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:
   GrallocBufferActor* mGrallocActor;
   RefPtr<GrallocTextureSourceOGL> mTextureSource;
   gfx::IntSize mSize; // See comment in textureClientOGL.h
 };
 
 } // namespace layers
--- a/gfx/layers/opengl/LayerManagerOGL.h
+++ b/gfx/layers/opengl/LayerManagerOGL.h
@@ -259,19 +259,17 @@ public:
   // |aTexSize| is the actual size of the texture, as it can be larger
   // than the rectangle given by |aTexCoordRect|.
   void BindAndDrawQuadWithTextureRect(ShaderProgramOGL *aProg,
                                       const nsIntRect& aTexCoordRect,
                                       const nsIntSize& aTexSize,
                                       GLenum aWrapMode = LOCAL_GL_REPEAT,
                                       bool aFlipped = false);
 
-#ifdef MOZ_LAYERS_HAVE_LOG
   virtual const char* Name() const { return "OGL"; }
-#endif // MOZ_LAYERS_HAVE_LOG
 
   const nsIntSize& GetWidgetSize() {
     return mWidgetSize;
   }
 
   enum WorldTransforPolicy {
     ApplyWorldTransform,
     DontApplyWorldTransform
--- a/gfx/layers/opengl/TextureHostOGL.h
+++ b/gfx/layers/opengl/TextureHostOGL.h
@@ -17,17 +17,16 @@
 #include "mozilla/GfxMessageUtils.h"    // for gfxContentType
 #include "mozilla/Assertions.h"         // for MOZ_ASSERT, etc
 #include "mozilla/Attributes.h"         // for MOZ_OVERRIDE
 #include "mozilla/RefPtr.h"             // for RefPtr
 #include "mozilla/gfx/Point.h"          // for IntSize, IntPoint
 #include "mozilla/gfx/Types.h"          // for SurfaceFormat, etc
 #include "mozilla/layers/CompositorTypes.h"  // for TextureFlags
 #include "mozilla/layers/LayersSurfaces.h"  // for SurfaceDescriptor
-#include "mozilla/layers/LayersTypes.h"  // for MOZ_LAYERS_HAVE_LOG
 #include "mozilla/layers/TextureHost.h"  // for DeprecatedTextureHost, etc
 #include "mozilla/mozalloc.h"           // for operator delete, etc
 #include "nsAutoPtr.h"                  // for nsRefPtr
 #include "nsCOMPtr.h"                   // for already_AddRefed
 #include "nsDebug.h"                    // for NS_WARNING
 #include "nsISupportsImpl.h"            // for TextureImage::Release, etc
 #include "nsTraceRefcnt.h"              // for MOZ_COUNT_CTOR, etc
 #include "LayerManagerOGLProgram.h"     // for ShaderProgramType, etc
@@ -333,19 +332,17 @@ public:
   {
     return nullptr; // XXX - implement this (for MOZ_DUMP_PAINTING)
   }
 
   gl::GLContext* gl() const;
 
   virtual gfx::IntSize GetSize() const MOZ_OVERRIDE { return mSize; }
 
-#ifdef MOZ_LAYERS_HAVE_LOG
   virtual const char* Name() { return "SharedTextureHostOGL"; }
-#endif
 
 protected:
   gfx::IntSize mSize;
   CompositorOGL* mCompositor;
   gl::SharedTextureHandle mSharedHandle;
   gl::SharedTextureShareType mShareType;
 
   RefPtr<SharedTextureSourceOGL> mTextureSource;
@@ -437,19 +434,17 @@ public:
 
   gl::GLContext* gl() const;
 
   virtual gfx::IntSize GetSize() const MOZ_OVERRIDE {
     return gfx::IntSize(mSurface->GetDevicePixelWidth(),
                         mSurface->GetDevicePixelHeight());
   }
 
-#ifdef MOZ_LAYERS_HAVE_LOG
   virtual const char* Name() { return "MacIOSurfaceTextureHostOGL"; }
-#endif
 
 protected:
   CompositorOGL* mCompositor;
   RefPtr<MacIOSurfaceTextureSourceOGL> mTextureSource;
   RefPtr<MacIOSurface> mSurface;
 };
 #endif
 
@@ -569,19 +564,17 @@ public:
     return mTexture->NextTile();
   }
 
   virtual gfx::SurfaceFormat GetFormat() const MOZ_OVERRIDE
   {
     return DeprecatedTextureHost::GetFormat();
   }
 
-#ifdef MOZ_LAYERS_HAVE_LOG
   virtual const char* Name() { return "TextureImageDeprecatedTextureHostOGL"; }
-#endif
 
 protected:
   nsRefPtr<gl::TextureImage> mTexture;
   gl::GLContext* mGL;
   bool mIterating;
 };
 
 /**
@@ -681,19 +674,17 @@ public:
       NS_WARNING("YCbCrDeprecatedTextureHost::GetSize called but no data has been set yet");
       return gfx::IntSize(0,0);
     }
     return mYTexture->GetSize();
   }
 
   virtual already_AddRefed<gfxImageSurface> GetAsSurface() MOZ_OVERRIDE;
 
-#ifdef MOZ_LAYERS_HAVE_LOG
   virtual const char* Name() { return "YCbCrDeprecatedTextureHostOGL"; }
-#endif
 
 private:
   RefPtr<Channel> mYTexture;
   RefPtr<Channel> mCbTexture;
   RefPtr<Channel> mCrTexture;
   gl::GLContext* mGL;
 };
 
@@ -773,19 +764,17 @@ public:
              GFX_CONTENT_COLOR_ALPHA :
              GFX_CONTENT_COLOR;
   }
 
   virtual gfx3DMatrix GetTextureTransform() MOZ_OVERRIDE;
 
   virtual already_AddRefed<gfxImageSurface> GetAsSurface() MOZ_OVERRIDE;
 
-#ifdef MOZ_LAYERS_HAVE_LOG
   virtual const char* Name() { return "SharedDeprecatedTextureHostOGL"; }
-#endif
 
 protected:
   void DeleteTextures();
 
   gfx::IntSize mSize;
   nsRefPtr<gl::GLContext> mGL;
   GLuint mTextureHandle;
   GLenum mWrapMode;
@@ -854,19 +843,17 @@ public:
   ContentType GetContentType() {
     return (mFormat == gfx::FORMAT_B8G8R8A8) ?
              GFX_CONTENT_COLOR_ALPHA :
              GFX_CONTENT_COLOR;
   }
 
   virtual already_AddRefed<gfxImageSurface> GetAsSurface() MOZ_OVERRIDE;
 
-#ifdef MOZ_LAYERS_HAVE_LOG
   virtual const char* Name() { return "SurfaceStreamHostOGL"; }
-#endif
 
   SurfaceStreamHostOGL()
     : mGL(nullptr)
     , mTextureHandle(0)
     , mTextureTarget(LOCAL_GL_TEXTURE_2D)
     , mUploadTexture(0)
     , mWrapMode(LOCAL_GL_CLAMP_TO_EDGE)
     , mStream(nullptr)
@@ -918,19 +905,17 @@ public:
   }
 
   virtual void SwapTexturesImpl(const SurfaceDescriptor& aImage,
                                 nsIntRegion* aRegion = nullptr)
   { MOZ_ASSERT(false, "Tiles should not use this path"); }
 
   virtual already_AddRefed<gfxImageSurface> GetAsSurface() MOZ_OVERRIDE;
 
-#ifdef MOZ_LAYERS_HAVE_LOG
   virtual const char* Name() { return "TiledDeprecatedTextureHostOGL"; }
-#endif
 
 protected:
   void DeleteTextures();
 
   virtual uint64_t GetIdentifier() const MOZ_OVERRIDE {
     return static_cast<uint64_t>(mTextureHandle);
   }
 
@@ -988,19 +973,17 @@ public:
   {
     return mTextureTarget;
   }
 
   bool IsValid() const MOZ_OVERRIDE;
 
   virtual already_AddRefed<gfxImageSurface> GetAsSurface() MOZ_OVERRIDE;
 
-#ifdef MOZ_LAYERS_HAVE_LOG
   virtual const char* Name() { return "GrallocDeprecatedTextureHostOGL"; }
-#endif
 
   void BindTexture(GLenum aTextureUnit) MOZ_OVERRIDE;
   void UnbindTexture() MOZ_OVERRIDE {}
 
   virtual TextureSourceOGL* AsSourceOGL() MOZ_OVERRIDE
   {
     return this;
   }
--- a/gfx/thebes/gfxPlatform.cpp
+++ b/gfx/thebes/gfxPlatform.cpp
@@ -2025,16 +2025,17 @@ gfxPlatform::GetOrientationSyncMillis() 
  */
 static bool sPrefLayersOffMainThreadCompositionEnabled = false;
 static bool sPrefLayersOffMainThreadCompositionTestingEnabled = false;
 static bool sPrefLayersOffMainThreadCompositionForceEnabled = false;
 static bool sPrefLayersAccelerationForceEnabled = false;
 static bool sPrefLayersAccelerationDisabled = false;
 static bool sPrefLayersPreferOpenGL = false;
 static bool sPrefLayersPreferD3D9 = false;
+static bool sPrefLayersDump = false;
 static bool sLayersSupportsD3D9 = false;
 static int  sPrefLayoutFrameRate = -1;
 static bool sBufferRotationEnabled = false;
 static bool sComponentAlphaEnabled = true;
 static bool sPrefBrowserTabsRemote = false;
 
 static bool sLayersAccelerationPrefsInitialized = false;
 
@@ -2045,16 +2046,17 @@ InitLayersAccelerationPrefs()
   {
     sPrefLayersOffMainThreadCompositionEnabled = Preferences::GetBool("layers.offmainthreadcomposition.enabled", false);
     sPrefLayersOffMainThreadCompositionTestingEnabled = Preferences::GetBool("layers.offmainthreadcomposition.testing.enabled", false);
     sPrefLayersOffMainThreadCompositionForceEnabled = Preferences::GetBool("layers.offmainthreadcomposition.force-enabled", false);
     sPrefLayersAccelerationForceEnabled = Preferences::GetBool("layers.acceleration.force-enabled", false);
     sPrefLayersAccelerationDisabled = Preferences::GetBool("layers.acceleration.disabled", false);
     sPrefLayersPreferOpenGL = Preferences::GetBool("layers.prefer-opengl", false);
     sPrefLayersPreferD3D9 = Preferences::GetBool("layers.prefer-d3d9", false);
+    sPrefLayersDump = Preferences::GetBool("layers.dump", false);
     sPrefLayoutFrameRate = Preferences::GetInt("layout.frame_rate", -1);
     sBufferRotationEnabled = Preferences::GetBool("layers.bufferrotation.enabled", true);
     sComponentAlphaEnabled = Preferences::GetBool("layers.componentalpha.enabled", true);
     sPrefBrowserTabsRemote = Preferences::GetBool("browser.tabs.remote", false);
 
 #ifdef XP_WIN
     if (sPrefLayersAccelerationForceEnabled) {
       sLayersSupportsD3D9 = true;
@@ -2137,16 +2139,23 @@ gfxPlatform::CanUseDirect3D9()
 int
 gfxPlatform::GetPrefLayoutFrameRate()
 {
   InitLayersAccelerationPrefs();
   return sPrefLayoutFrameRate;
 }
 
 bool
+gfxPlatform::GetPrefLayersDump()
+{
+  InitLayersAccelerationPrefs();
+  return sPrefLayersDump;
+}
+
+bool
 gfxPlatform::BufferRotationEnabled()
 {
   MutexAutoLock autoLock(*gGfxPlatformPrefsLock);
 
   InitLayersAccelerationPrefs();
   return sBufferRotationEnabled;
 }
 
--- a/gfx/thebes/gfxPlatform.h
+++ b/gfx/thebes/gfxPlatform.h
@@ -498,16 +498,17 @@ public:
     static bool GetPrefLayersOffMainThreadCompositionEnabled();
     static bool GetPrefLayersOffMainThreadCompositionForceEnabled();
     static bool GetPrefLayersAccelerationForceEnabled();
     static bool GetPrefLayersAccelerationDisabled();
     static bool GetPrefLayersPreferOpenGL();
     static bool GetPrefLayersPreferD3D9();
     static bool CanUseDirect3D9();
     static int  GetPrefLayoutFrameRate();
+    static bool GetPrefLayersDump();
 
     static bool OffMainThreadCompositionRequired();
 
     /**
      * Is it possible to use buffer rotation
      */
     static bool BufferRotationEnabled();
     static void DisableBufferRotation();
--- a/modules/libpref/src/init/all.js
+++ b/modules/libpref/src/init/all.js
@@ -4193,16 +4193,17 @@ pref("layers.acceleration.disabled", fal
 // means a startup crash for everyone.
 pref("layers.acceleration.force-enabled", true);
 #else
 pref("layers.acceleration.force-enabled", false);
 #endif
 
 pref("layers.acceleration.draw-fps", false);
 
+pref("layers.dump", false);
 pref("layers.draw-borders", false);
 pref("layers.draw-tile-borders", false);
 pref("layers.draw-bigimage-borders", false);
 pref("layers.frame-counter", false);
 // Max number of layers per container. See Overwrite in mobile prefs.
 pref("layers.max-active", -1);
 
 // Set the default values, and then override per-platform as needed