mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 15:52:07 +00:00
Bug 1163192 - Part 2: Wrap expensive calls in PR_LOG_TEST. r=froydnj
Check that logging is enabled before performing potentially expensive operations.
This commit is contained in:
parent
698f689e80
commit
17c9cb1b3e
@ -157,27 +157,29 @@ txStylesheet::findTemplate(const txXPathNode& aNode,
|
||||
}
|
||||
}
|
||||
|
||||
nsAutoString mode, nodeName;
|
||||
if (aMode.mLocalName) {
|
||||
aMode.mLocalName->ToString(mode);
|
||||
}
|
||||
txXPathNodeUtils::getNodeName(aNode, nodeName);
|
||||
if (matchTemplate) {
|
||||
nsAutoString matchAttr;
|
||||
if (PR_LOG_TEST(txLog::xslt, PR_LOG_DEBUG)) {
|
||||
nsAutoString mode, nodeName;
|
||||
if (aMode.mLocalName) {
|
||||
aMode.mLocalName->ToString(mode);
|
||||
}
|
||||
txXPathNodeUtils::getNodeName(aNode, nodeName);
|
||||
if (matchTemplate) {
|
||||
nsAutoString matchAttr;
|
||||
#ifdef TX_TO_STRING
|
||||
match->toString(matchAttr);
|
||||
match->toString(matchAttr);
|
||||
#endif
|
||||
PR_LOG(txLog::xslt, PR_LOG_DEBUG,
|
||||
("MatchTemplate, Pattern %s, Mode %s, Node %s\n",
|
||||
NS_LossyConvertUTF16toASCII(matchAttr).get(),
|
||||
NS_LossyConvertUTF16toASCII(mode).get(),
|
||||
NS_LossyConvertUTF16toASCII(nodeName).get()));
|
||||
}
|
||||
else {
|
||||
PR_LOG(txLog::xslt, PR_LOG_DEBUG,
|
||||
("No match, Node %s, Mode %s\n",
|
||||
NS_LossyConvertUTF16toASCII(nodeName).get(),
|
||||
NS_LossyConvertUTF16toASCII(mode).get()));
|
||||
PR_LOG(txLog::xslt, PR_LOG_DEBUG,
|
||||
("MatchTemplate, Pattern %s, Mode %s, Node %s\n",
|
||||
NS_LossyConvertUTF16toASCII(matchAttr).get(),
|
||||
NS_LossyConvertUTF16toASCII(mode).get(),
|
||||
NS_LossyConvertUTF16toASCII(nodeName).get()));
|
||||
}
|
||||
else {
|
||||
PR_LOG(txLog::xslt, PR_LOG_DEBUG,
|
||||
("No match, Node %s, Mode %s\n",
|
||||
NS_LossyConvertUTF16toASCII(nodeName).get(),
|
||||
NS_LossyConvertUTF16toASCII(mode).get()));
|
||||
}
|
||||
}
|
||||
|
||||
if (!matchTemplate) {
|
||||
|
Loading…
Reference in New Issue
Block a user