зеркало из https://github.com/mozilla/pjs.git
Bug 526072. Guard super-expensive nsFrameList assertions with #ifdef DEBUG_FRAME_LIST so debug builds don't completely suck. r=bz
This commit is contained in:
Родитель
966ac3a4b2
Коммит
552850c2d6
|
@ -97,7 +97,10 @@ void
|
||||||
nsFrameList::RemoveFrame(nsIFrame* aFrame)
|
nsFrameList::RemoveFrame(nsIFrame* aFrame)
|
||||||
{
|
{
|
||||||
NS_PRECONDITION(aFrame, "null ptr");
|
NS_PRECONDITION(aFrame, "null ptr");
|
||||||
|
#ifdef DEBUG_FRAME_LIST
|
||||||
|
// ContainsFrame is O(N)
|
||||||
NS_PRECONDITION(ContainsFrame(aFrame), "wrong list");
|
NS_PRECONDITION(ContainsFrame(aFrame), "wrong list");
|
||||||
|
#endif
|
||||||
|
|
||||||
nsIFrame* nextFrame = aFrame->GetNextSibling();
|
nsIFrame* nextFrame = aFrame->GetNextSibling();
|
||||||
if (aFrame == mFirstChild) {
|
if (aFrame == mFirstChild) {
|
||||||
|
@ -137,7 +140,9 @@ nsFrameList
|
||||||
nsFrameList::RemoveFramesAfter(nsIFrame* aAfterFrame)
|
nsFrameList::RemoveFramesAfter(nsIFrame* aAfterFrame)
|
||||||
{
|
{
|
||||||
NS_PRECONDITION(NotEmpty(), "illegal operation on empty list");
|
NS_PRECONDITION(NotEmpty(), "illegal operation on empty list");
|
||||||
|
#ifdef DEBUG_FRAME_LIST
|
||||||
NS_PRECONDITION(ContainsFrame(aAfterFrame), "wrong list");
|
NS_PRECONDITION(ContainsFrame(aAfterFrame), "wrong list");
|
||||||
|
#endif
|
||||||
|
|
||||||
nsIFrame* tail = aAfterFrame->GetNextSibling();
|
nsIFrame* tail = aAfterFrame->GetNextSibling();
|
||||||
// if (!tail) return EmptyList(); -- worth optimizing this case?
|
// if (!tail) return EmptyList(); -- worth optimizing this case?
|
||||||
|
@ -193,8 +198,11 @@ nsFrameList::InsertFrames(nsIFrame* aParent, nsIFrame* aPrevSibling,
|
||||||
NS_ASSERTION(!aPrevSibling ||
|
NS_ASSERTION(!aPrevSibling ||
|
||||||
aPrevSibling->GetParent() == aFrameList.FirstChild()->GetParent(),
|
aPrevSibling->GetParent() == aFrameList.FirstChild()->GetParent(),
|
||||||
"prev sibling has different parent");
|
"prev sibling has different parent");
|
||||||
|
#ifdef DEBUG_FRAME_LIST
|
||||||
|
// ContainsFrame is O(N)
|
||||||
NS_ASSERTION(!aPrevSibling || ContainsFrame(aPrevSibling),
|
NS_ASSERTION(!aPrevSibling || ContainsFrame(aPrevSibling),
|
||||||
"prev sibling is not on this list");
|
"prev sibling is not on this list");
|
||||||
|
#endif
|
||||||
|
|
||||||
nsIFrame* firstNewFrame = aFrameList.FirstChild();
|
nsIFrame* firstNewFrame = aFrameList.FirstChild();
|
||||||
nsIFrame* nextSibling;
|
nsIFrame* nextSibling;
|
||||||
|
@ -213,9 +221,7 @@ nsFrameList::InsertFrames(nsIFrame* aParent, nsIFrame* aPrevSibling,
|
||||||
mLastChild = lastNewFrame;
|
mLastChild = lastNewFrame;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
VerifyList();
|
VerifyList();
|
||||||
#endif
|
|
||||||
|
|
||||||
aFrameList.Clear();
|
aFrameList.Clear();
|
||||||
return Slice(*this, firstNewFrame, nextSibling);
|
return Slice(*this, firstNewFrame, nextSibling);
|
||||||
|
@ -604,7 +610,7 @@ nsFrameList::GetNextVisualFor(nsIFrame* aFrame) const
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG_FRAME_LIST
|
||||||
void
|
void
|
||||||
nsFrameList::VerifyList() const
|
nsFrameList::VerifyList() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -45,6 +45,9 @@
|
||||||
|
|
||||||
class nsIFrame;
|
class nsIFrame;
|
||||||
|
|
||||||
|
// Uncomment this to enable expensive frame-list integrity checking
|
||||||
|
// #define DEBUG_FRAME_LIST
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A class for managing a list of frames.
|
* A class for managing a list of frames.
|
||||||
*/
|
*/
|
||||||
|
@ -60,9 +63,7 @@ public:
|
||||||
mFirstChild(aFirstFrame), mLastChild(aLastFrame)
|
mFirstChild(aFirstFrame), mLastChild(aLastFrame)
|
||||||
{
|
{
|
||||||
MOZ_COUNT_CTOR(nsFrameList);
|
MOZ_COUNT_CTOR(nsFrameList);
|
||||||
#ifdef DEBUG
|
|
||||||
VerifyList();
|
VerifyList();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsFrameList(const nsFrameList& aOther) :
|
nsFrameList(const nsFrameList& aOther) :
|
||||||
|
@ -265,9 +266,6 @@ public:
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
void List(FILE* out) const;
|
void List(FILE* out) const;
|
||||||
protected:
|
|
||||||
void VerifyList() const;
|
|
||||||
public:
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static nsresult Init();
|
static nsresult Init();
|
||||||
|
@ -437,6 +435,12 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
#ifdef DEBUG_FRAME_LIST
|
||||||
|
void VerifyList() const;
|
||||||
|
#else
|
||||||
|
void VerifyList() const {}
|
||||||
|
#endif
|
||||||
|
|
||||||
static const nsFrameList* sEmptyList;
|
static const nsFrameList* sEmptyList;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
Загрузка…
Ссылка в новой задаче