Bug 1104266 - Avoid needless temporary nsACString. r=mattwoodrow

This commit is contained in:
Kartikaya Gupta 2014-11-25 08:45:19 -05:00
parent 9bc95683df
commit d7b95978c4
5 changed files with 33 additions and 34 deletions

View File

@ -1949,11 +1949,13 @@ nsDisplaySolidColor::Paint(nsDisplayListBuilder* aBuilder,
#ifdef MOZ_DUMP_PAINTING
void
nsDisplaySolidColor::WriteDebugInfo(nsACString& aTo)
nsDisplaySolidColor::WriteDebugInfo(std::stringstream& aStream)
{
aTo += nsPrintfCString(" (rgba %d,%d,%d,%d)",
NS_GET_R(mColor), NS_GET_G(mColor),
NS_GET_B(mColor), NS_GET_A(mColor));
aStream << " (rgba "
<< (int)NS_GET_R(mColor) << ","
<< (int)NS_GET_G(mColor) << ","
<< (int)NS_GET_B(mColor) << ","
<< (int)NS_GET_A(mColor) << ")";
}
#endif
@ -2663,9 +2665,9 @@ nsDisplayThemedBackground::~nsDisplayThemedBackground()
#ifdef MOZ_DUMP_PAINTING
void
nsDisplayThemedBackground::WriteDebugInfo(nsACString& aTo)
nsDisplayThemedBackground::WriteDebugInfo(std::stringstream& aStream)
{
aTo += nsPrintfCString(" (themed, appearance:%d)", mAppearance);
aStream << " (themed, appearance:" << (int)mAppearance << ")";
}
#endif
@ -2868,11 +2870,10 @@ nsDisplayBackgroundColor::HitTest(nsDisplayListBuilder* aBuilder,
#ifdef MOZ_DUMP_PAINTING
void
nsDisplayBackgroundColor::WriteDebugInfo(nsACString& aTo)
nsDisplayBackgroundColor::WriteDebugInfo(std::stringstream& aStream)
{
aTo += nsPrintfCString(" (rgba %f,%f,%f,%f)",
mColor.r, mColor.g,
mColor.b, mColor.a);
aStream << " (rgba " << mColor.r << "," << mColor.g << ","
<< mColor.b << "," << mColor.a << ")";
}
#endif
@ -3678,9 +3679,9 @@ bool nsDisplayOpacity::TryMerge(nsDisplayListBuilder* aBuilder, nsDisplayItem* a
#ifdef MOZ_DUMP_PAINTING
void
nsDisplayOpacity::WriteDebugInfo(nsACString& aTo)
nsDisplayOpacity::WriteDebugInfo(std::stringstream& aStream)
{
aTo += nsPrintfCString(" (opacity %f)", mOpacity);
aStream << " (opacity " << mOpacity << ")";
}
#endif
@ -4443,10 +4444,10 @@ nsDisplayScrollLayer::GetScrollLayerCount()
#ifdef MOZ_DUMP_PAINTING
void
nsDisplayScrollLayer::WriteDebugInfo(nsACString& aTo)
nsDisplayScrollLayer::WriteDebugInfo(std::stringstream& aStream)
{
aTo += nsPrintfCString(" (scrollframe %p scrolledframe %p)",
mScrollFrame, mScrolledFrame);
aStream << " (scrollframe " << mScrollFrame
<< " scrolledFrame " << mScrolledFrame << ")";
}
#endif
@ -5631,11 +5632,9 @@ bool nsDisplayTransform::UntransformVisibleRect(nsDisplayListBuilder* aBuilder,
#ifdef MOZ_DUMP_PAINTING
void
nsDisplayTransform::WriteDebugInfo(nsACString& aTo)
nsDisplayTransform::WriteDebugInfo(std::stringstream& aStream)
{
std::stringstream ss;
AppendToString(ss, GetTransform());
aTo += ss.str().c_str();
AppendToString(aStream, GetTransform());
}
#endif

View File

@ -1345,7 +1345,7 @@ public:
*/
virtual const char* Name() = 0;
virtual void WriteDebugInfo(nsACString& aTo) {}
virtual void WriteDebugInfo(std::stringstream& aStream) {}
#endif
nsDisplayItem* GetAbove() { return mAbove; }
@ -2165,7 +2165,7 @@ public:
}
#ifdef MOZ_DUMP_PAINTING
virtual void WriteDebugInfo(nsACString& aTo) MOZ_OVERRIDE;
virtual void WriteDebugInfo(std::stringstream& aStream) MOZ_OVERRIDE;
#endif
NS_DISPLAY_DECL_NAME("SolidColor", TYPE_SOLID_COLOR)
@ -2326,7 +2326,7 @@ public:
nsRegion* aInvalidRegion) MOZ_OVERRIDE;
#ifdef MOZ_DUMP_PAINTING
virtual void WriteDebugInfo(nsACString& aTo) MOZ_OVERRIDE;
virtual void WriteDebugInfo(std::stringstream& aStream) MOZ_OVERRIDE;
#endif
protected:
nsRect GetBoundsInternal();
@ -2389,7 +2389,7 @@ public:
NS_DISPLAY_DECL_NAME("BackgroundColor", TYPE_BACKGROUND_COLOR)
#ifdef MOZ_DUMP_PAINTING
virtual void WriteDebugInfo(nsACString& aTo) MOZ_OVERRIDE;
virtual void WriteDebugInfo(std::stringstream& aStream) MOZ_OVERRIDE;
#endif
protected:
@ -2834,7 +2834,7 @@ public:
bool NeedsActiveLayer(nsDisplayListBuilder* aBuilder);
NS_DISPLAY_DECL_NAME("Opacity", TYPE_OPACITY)
#ifdef MOZ_DUMP_PAINTING
virtual void WriteDebugInfo(nsACString& aTo) MOZ_OVERRIDE;
virtual void WriteDebugInfo(std::stringstream& aStream) MOZ_OVERRIDE;
#endif
bool CanUseAsyncAnimations(nsDisplayListBuilder* aBuilder) MOZ_OVERRIDE;
@ -3132,7 +3132,7 @@ public:
virtual nsIFrame* GetScrolledFrame() { return mScrolledFrame; }
#ifdef MOZ_DUMP_PAINTING
virtual void WriteDebugInfo(nsACString& aTo) MOZ_OVERRIDE;
virtual void WriteDebugInfo(std::stringstream& aStream) MOZ_OVERRIDE;
#endif
bool IsDisplayPortOpaque() { return mDisplayPortContentsOpaque; }
@ -3543,7 +3543,7 @@ public:
bool ShouldPrerender(nsDisplayListBuilder* aBuilder);
#ifdef MOZ_DUMP_PAINTING
virtual void WriteDebugInfo(nsACString& aTo) MOZ_OVERRIDE;
virtual void WriteDebugInfo(std::stringstream& aStream) MOZ_OVERRIDE;
#endif
private:

View File

@ -191,9 +191,7 @@ PrintDisplayItemTo(nsDisplayListBuilder* aBuilder, nsDisplayItem* aItem,
}
// Display item specific debug info
nsCString itemStr;
aItem->WriteDebugInfo(itemStr);
aStream << itemStr.get();
aItem->WriteDebugInfo(aStream);
if (aDumpHtml && aItem->Painted()) {
aStream << "</a>";

View File

@ -286,11 +286,13 @@ nsDisplayCanvasBackgroundColor::Paint(nsDisplayListBuilder* aBuilder,
#ifdef MOZ_DUMP_PAINTING
void
nsDisplayCanvasBackgroundColor::WriteDebugInfo(nsACString& aTo)
nsDisplayCanvasBackgroundColor::WriteDebugInfo(std::stringstream& aStream)
{
aTo += nsPrintfCString(" (rgba %d,%d,%d,%d)",
NS_GET_R(mColor), NS_GET_G(mColor),
NS_GET_B(mColor), NS_GET_A(mColor));
aStream << " (rgba "
<< (int)NS_GET_R(mColor) << ","
<< (int)NS_GET_G(mColor) << ","
<< (int)NS_GET_B(mColor) << ","
<< (int)NS_GET_A(mColor) << ")";
}
#endif

View File

@ -214,7 +214,7 @@ public:
NS_DISPLAY_DECL_NAME("CanvasBackgroundColor", TYPE_CANVAS_BACKGROUND_COLOR)
#ifdef MOZ_DUMP_PAINTING
virtual void WriteDebugInfo(nsACString& aTo) MOZ_OVERRIDE;
virtual void WriteDebugInfo(std::stringstream& aStream) MOZ_OVERRIDE;
#endif
private: