Bug 1163194 - Part 2: Wrap expensive calls in PR_LOG_TEST. r=froydnj
authorEric Rahm <erahm@mozilla.com>
Mon, 11 May 2015 13:58:14 -0700
changeset 243299 3026a0345003b62c61371988cb92e48d536ba8f1
parent 243298 49ac06aeb3a8c4b4d63ea0c7d9e2c29e04524313
child 243300 0f061c5d85bee655242a9ea9c55ac0cd3aed5b3e
push id59642
push usererahm@mozilla.com
push dateMon, 11 May 2015 20:58:29 +0000
treeherdermozilla-inbound@3026a0345003 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1163194
milestone40.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1163194 - Part 2: Wrap expensive calls in PR_LOG_TEST. r=froydnj Check that logging is enabled before performing potentially expensive operations.
dom/xul/templates/nsXULTemplateQueryProcessorRDF.cpp
--- a/dom/xul/templates/nsXULTemplateQueryProcessorRDF.cpp
+++ b/dom/xul/templates/nsXULTemplateQueryProcessorRDF.cpp
@@ -1256,35 +1256,33 @@ nsXULTemplateQueryProcessorRDF::CompileE
 
 nsresult
 nsXULTemplateQueryProcessorRDF::CompileQueryChild(nsIAtom* aTag,
                                                   nsRDFQuery* aQuery,
                                                   nsIContent* aCondition,
                                                   TestNode* aParentNode,
                                                   TestNode** aResult)
 {
-    nsresult rv;
+    nsresult rv = NS_OK;
 
     if (aTag == nsGkAtoms::triple) {
         rv = CompileTripleCondition(aQuery, aCondition, aParentNode, aResult);
     }
     else if (aTag == nsGkAtoms::member) {
         rv = CompileMemberCondition(aQuery, aCondition, aParentNode, aResult);
     }
-    else {
+    else if (PR_LOG_TEST(gXULTemplateLog, PR_LOG_ALWAYS)) {
         nsAutoString tagstr;
         aTag->ToString(tagstr);
 
         nsAutoCString tagstrC;
         tagstrC.AssignWithConversion(tagstr);
         PR_LOG(gXULTemplateLog, PR_LOG_ALWAYS,
                ("xultemplate[%p] unrecognized condition test <%s>",
                 this, tagstrC.get()));
-
-        rv = NS_OK;
     }
 
     return rv;
 }
 
 nsresult
 nsXULTemplateQueryProcessorRDF::ParseLiteral(const nsString& aParseType, 
                                              const nsString& aValue,