Skip to content

Commit

Permalink
Bug 936511 - Add layers.dump to dump layer tree. r=bas,nrc
Browse files Browse the repository at this point in the history
  • Loading branch information
bgirard committed Nov 17, 2013
1 parent 25995e2 commit a176b5d
Show file tree
Hide file tree
Showing 36 changed files with 18 additions and 192 deletions.
2 changes: 0 additions & 2 deletions gfx/layers/Effects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

using namespace mozilla::layers;

#ifdef MOZ_LAYERS_HAVE_LOG
void
TexturedEffect::PrintInfo(nsACString& aTo, const char* aPrefix)
{
Expand Down Expand Up @@ -55,4 +54,3 @@ EffectSolidColor::PrintInfo(nsACString& aTo, const char* aPrefix)
aTo += nsPrintfCString("EffectSolidColor (0x%p) [color=%x]", this, mColor.ToABGR());
}

#endif // MOZ_LAYERS_HAVE_LOG
24 changes: 1 addition & 23 deletions gfx/layers/Effects.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#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
Expand Down Expand Up @@ -44,9 +44,7 @@ struct Effect : public RefCounted<Effect>
EffectTypes mType;

virtual ~Effect() {}
#ifdef MOZ_LAYERS_HAVE_LOG
virtual void PrintInfo(nsACString& aTo, const char* aPrefix) =0;
#endif
};

// Render from a texture
Expand All @@ -63,10 +61,8 @@ struct TexturedEffect : public Effect
, 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;
Expand All @@ -87,9 +83,7 @@ struct EffectMask : public Effect
, mMaskTransform(aMaskTransform)
{}

#ifdef MOZ_LAYERS_HAVE_LOG
virtual void PrintInfo(nsACString& aTo, const char* aPrefix);
#endif

TextureSource* mMaskTexture;
bool mIs3D;
Expand All @@ -105,10 +99,8 @@ struct EffectRenderTarget : public TexturedEffect
, 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;
};
Expand All @@ -122,9 +114,7 @@ struct EffectBGRX : public TexturedEffect
: TexturedEffect(EFFECT_BGRX, aBGRXTexture, aPremultiplied, aFilter)
{}

#ifdef MOZ_LAYERS_HAVE_LOG
virtual const char* Name() { return "EffectBGRX"; }
#endif
};

struct EffectRGBX : public TexturedEffect
Expand All @@ -135,9 +125,7 @@ struct EffectRGBX : public TexturedEffect
: TexturedEffect(EFFECT_RGBX, aRGBXTexture, aPremultiplied, aFilter)
{}

#ifdef MOZ_LAYERS_HAVE_LOG
virtual const char* Name() { return "EffectRGBX"; }
#endif
};

struct EffectBGRA : public TexturedEffect
Expand All @@ -148,9 +136,7 @@ struct EffectBGRA : public TexturedEffect
: TexturedEffect(EFFECT_BGRA, aBGRATexture, aPremultiplied, aFilter)
{}

#ifdef MOZ_LAYERS_HAVE_LOG
virtual const char* Name() { return "EffectBGRA"; }
#endif
};

struct EffectRGBA : public TexturedEffect
Expand All @@ -161,9 +147,7 @@ struct EffectRGBA : public TexturedEffect
: TexturedEffect(EFFECT_RGBA, aRGBATexture, aPremultiplied, aFilter)
{}

#ifdef MOZ_LAYERS_HAVE_LOG
virtual const char* Name() { return "EffectRGBA"; }
#endif
};

struct EffectYCbCr : public TexturedEffect
Expand All @@ -172,9 +156,7 @@ struct EffectYCbCr : public TexturedEffect
: TexturedEffect(EFFECT_YCBCR, aSource, false, aFilter)
{}

#ifdef MOZ_LAYERS_HAVE_LOG
virtual const char* Name() { return "EffectYCbCr"; }
#endif
};

struct EffectComponentAlpha : public TexturedEffect
Expand All @@ -187,9 +169,7 @@ struct EffectComponentAlpha : public TexturedEffect
, mOnWhite(aOnWhite)
{}

#ifdef MOZ_LAYERS_HAVE_LOG
virtual const char* Name() { return "EffectComponentAlpha"; }
#endif

TextureSource* mOnBlack;
TextureSource* mOnWhite;
Expand All @@ -202,9 +182,7 @@ struct EffectSolidColor : public Effect
, mColor(aColor)
{}

#ifdef MOZ_LAYERS_HAVE_LOG
virtual void PrintInfo(nsACString& aTo, const char* aPrefix);
#endif

gfx::Color mColor;
};
Expand Down
56 changes: 0 additions & 56 deletions gfx/layers/Layers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,11 @@ 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 {
Expand Down Expand Up @@ -1131,8 +1129,6 @@ LayerManager::BeginTabSwitch()
mTabSwitchStart = TimeStamp::Now();
}

#ifdef MOZ_LAYERS_HAVE_LOG

static nsACString& PrintInfo(nsACString& aTo, LayerComposite* aLayerComposite);

#ifdef MOZ_DUMP_PAINTING
Expand Down Expand Up @@ -1510,58 +1506,6 @@ PrintInfo(nsACString& aTo, LayerComposite* aLayerComposite)
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
Expand Down
4 changes: 0 additions & 4 deletions gfx/layers/Layers.h
Original file line number Diff line number Diff line change
Expand Up @@ -505,10 +505,6 @@ class LayerManager {
*/
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 "???"; }

/**
Expand Down
4 changes: 0 additions & 4 deletions gfx/layers/LayersTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@
#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
Expand Down
2 changes: 0 additions & 2 deletions gfx/layers/basic/BasicLayers.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,7 @@ class BasicLayerManager :
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;
Expand Down
2 changes: 0 additions & 2 deletions gfx/layers/client/ClientLayerManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,7 @@ class ClientLayerManager : public LayerManager,

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);

Expand Down
2 changes: 0 additions & 2 deletions gfx/layers/composite/CanvasLayerComposite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ CanvasLayerComposite::CleanupResources()
mImageHost = nullptr;
}

#ifdef MOZ_LAYERS_HAVE_LOG
nsACString&
CanvasLayerComposite::PrintInfo(nsACString& aTo, const char* aPrefix)
{
Expand All @@ -133,5 +132,4 @@ CanvasLayerComposite::PrintInfo(nsACString& aTo, const char* aPrefix)
}
return aTo;
}
#endif

2 changes: 0 additions & 2 deletions gfx/layers/composite/CanvasLayerComposite.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,10 @@ class CanvasLayerComposite : public CanvasLayer,

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;
Expand Down
3 changes: 0 additions & 3 deletions gfx/layers/composite/ColorLayerComposite.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#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;
Expand Down Expand Up @@ -49,9 +48,7 @@ class ColorLayerComposite : public ColorLayer,

virtual LayerComposite* AsLayerComposite() MOZ_OVERRIDE { return this; }

#ifdef MOZ_LAYERS_HAVE_LOG
virtual const char* Name() const MOZ_OVERRIDE { return "ColorLayerComposite"; }
#endif
};

} /* layers */
Expand Down
2 changes: 0 additions & 2 deletions gfx/layers/composite/CompositableHost.h
Original file line number Diff line number Diff line change
Expand Up @@ -282,9 +282,7 @@ class CompositableHost : public RefCounted<CompositableHost>
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) {}
Expand Down
5 changes: 0 additions & 5 deletions gfx/layers/composite/ContainerLayerComposite.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#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;
Expand Down Expand Up @@ -53,9 +52,7 @@ class ContainerLayerComposite : public ContainerLayer,
// 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,
Expand Down Expand Up @@ -90,9 +87,7 @@ class RefLayerComposite : public RefLayer,
// 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 */
Expand Down
2 changes: 0 additions & 2 deletions gfx/layers/composite/ContentHost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,6 @@ ContentHostIncremental::TextureUpdateRequest::Execute(ContentHostIncremental* aH
}
}

#ifdef MOZ_LAYERS_HAVE_LOG
void
ContentHostSingleBuffered::PrintInfo(nsACString& aTo, const char* aPrefix)
{
Expand Down Expand Up @@ -763,7 +762,6 @@ ContentHostDoubleBuffered::PrintInfo(nsACString& aTo, const char* aPrefix)
mBackHost->PrintInfo(aTo, prefix.get());
}
}
#endif

#ifdef MOZ_DUMP_PAINTING
void
Expand Down
6 changes: 1 addition & 5 deletions gfx/layers/composite/ContentHost.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#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
Expand Down Expand Up @@ -183,9 +183,7 @@ class ContentHostDoubleBuffered : public ContentHostBase
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
Expand Down Expand Up @@ -220,9 +218,7 @@ class ContentHostSingleBuffered : public ContentHostBase
const TextureInfo& aTextureInfo) MOZ_OVERRIDE;
virtual void DestroyTextures() MOZ_OVERRIDE;

#ifdef MOZ_LAYERS_HAVE_LOG
virtual void PrintInfo(nsACString& aTo, const char* aPrefix);
#endif
};

/**
Expand Down
Loading

0 comments on commit a176b5d

Please sign in to comment.