Bug 1809505 - Extract counter list dumping. r=jwatt
This was useful for debugging. Differential Revision: https://phabricator.services.mozilla.com/D238538
This commit is contained in:
@@ -333,6 +333,27 @@ bool nsCounterList::SetScopeByWalkingBackwardThroughList(
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(DEBUG) || defined(MOZ_LAYOUT_DEBUGGER)
|
||||||
|
void nsCounterList::Dump() {
|
||||||
|
int32_t i = 0;
|
||||||
|
for (auto* node = First(); node; node = Next(node)) {
|
||||||
|
const char* types[] = {"RESET", "INCREMENT", "SET", "USE"};
|
||||||
|
printf(
|
||||||
|
" Node #%d @%p frame=%p index=%d type=%s valAfter=%d\n"
|
||||||
|
" scope-start=%p scope-prev=%p",
|
||||||
|
i++, (void*)node, (void*)node->mPseudoFrame, node->mContentIndex,
|
||||||
|
types[node->mType], node->mValueAfter, (void*)node->mScopeStart,
|
||||||
|
(void*)node->mScopePrev);
|
||||||
|
if (node->mType == nsCounterNode::USE) {
|
||||||
|
nsAutoString text;
|
||||||
|
node->UseNode()->GetText(text);
|
||||||
|
printf(" text=%s", NS_ConvertUTF16toUTF8(text).get());
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void nsCounterList::RecalcAll() {
|
void nsCounterList::RecalcAll() {
|
||||||
AutoRestore<bool> restoreRecalculatingAll(mRecalculatingAll);
|
AutoRestore<bool> restoreRecalculatingAll(mRecalculatingAll);
|
||||||
mRecalculatingAll = true;
|
mRecalculatingAll = true;
|
||||||
@@ -535,22 +556,7 @@ void nsCounterManager::Dump() const {
|
|||||||
printf("Counter named \"%s\":\n", nsAtomCString(entry.GetKey()).get());
|
printf("Counter named \"%s\":\n", nsAtomCString(entry.GetKey()).get());
|
||||||
|
|
||||||
nsCounterList* list = entry.GetWeak();
|
nsCounterList* list = entry.GetWeak();
|
||||||
int32_t i = 0;
|
list->Dump();
|
||||||
for (nsCounterNode* node = list->First(); node; node = list->Next(node)) {
|
|
||||||
const char* types[] = {"RESET", "INCREMENT", "SET", "USE"};
|
|
||||||
printf(
|
|
||||||
" Node #%d @%p frame=%p index=%d type=%s valAfter=%d\n"
|
|
||||||
" scope-start=%p scope-prev=%p",
|
|
||||||
i++, (void*)node, (void*)node->mPseudoFrame, node->mContentIndex,
|
|
||||||
types[node->mType], node->mValueAfter, (void*)node->mScopeStart,
|
|
||||||
(void*)node->mScopePrev);
|
|
||||||
if (node->mType == nsCounterNode::USE) {
|
|
||||||
nsAutoString text;
|
|
||||||
node->UseNode()->GetText(text);
|
|
||||||
printf(" text=%s", NS_ConvertUTF16toUTF8(text).get());
|
|
||||||
}
|
|
||||||
printf("\n");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
printf("\n\n");
|
printf("\n\n");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -219,6 +219,10 @@ class nsCounterList : public nsGenConList {
|
|||||||
MOZ_ASSERT(aScope);
|
MOZ_ASSERT(aScope);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(DEBUG) || defined(MOZ_LAYOUT_DEBUGGER)
|
||||||
|
void Dump();
|
||||||
|
#endif
|
||||||
|
|
||||||
// Return the first node for aFrame on this list, or nullptr.
|
// Return the first node for aFrame on this list, or nullptr.
|
||||||
nsCounterNode* GetFirstNodeFor(nsIFrame* aFrame) const {
|
nsCounterNode* GetFirstNodeFor(nsIFrame* aFrame) const {
|
||||||
return static_cast<nsCounterNode*>(nsGenConList::GetFirstNodeFor(aFrame));
|
return static_cast<nsCounterNode*>(nsGenConList::GetFirstNodeFor(aFrame));
|
||||||
|
|||||||
Reference in New Issue
Block a user