Bug 1162740 - Part 1: Remove instances of #ifdef PR_LOGGING in rdf. r=froydnj
authorEric Rahm <erahm@mozilla.com>
Fri, 08 May 2015 09:33:17 -0700
changeset 274402 53086148c9aa5947e41cb4796edcadeaae7b4bc2
parent 274401 fefdeb41a9be81723c6a35dcd683e4ad25f0dd82
child 274403 885382fbe6533631abf604e6b5a0c456b4e1a569
push id863
push userraliiev@mozilla.com
push dateMon, 03 Aug 2015 13:22:43 +0000
treeherdermozilla-release@f6321b14228d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1162740
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 1162740 - Part 1: Remove instances of #ifdef PR_LOGGING in rdf. r=froydnj PR_LOGGING is now always defined, we can remove #ifdefs checking for it.
rdf/base/nsCompositeDataSource.cpp
rdf/base/nsInMemoryDataSource.cpp
rdf/base/nsRDFContentSink.cpp
rdf/base/nsRDFService.cpp
rdf/base/nsRDFXMLDataSource.cpp
--- a/rdf/base/nsCompositeDataSource.cpp
+++ b/rdf/base/nsCompositeDataSource.cpp
@@ -37,22 +37,20 @@
 #include "nsCOMArray.h"
 #include "nsArrayEnumerator.h"
 #include "nsXPIDLString.h"
 #include "rdf.h"
 #include "nsCycleCollectionParticipant.h"
 
 #include "nsEnumeratorUtils.h"
 
-#ifdef PR_LOGGING
 #include "prlog.h"
 #include "prprf.h"
 #include <stdio.h>
 PRLogModuleInfo* nsRDFLog = nullptr;
-#endif
 
 //----------------------------------------------------------------------
 //
 // CompositeDataSourceImpl
 //
 
 class CompositeEnumeratorImpl;
 class CompositeArcsInOutEnumeratorImpl;
@@ -487,20 +485,18 @@ NS_NewRDFCompositeDataSource(nsIRDFCompo
 }
 
 
 CompositeDataSourceImpl::CompositeDataSourceImpl(void)
 	: mAllowNegativeAssertions(true),
 	  mCoalesceDuplicateArcs(true),
       mUpdateBatchNest(0)
 {
-#ifdef PR_LOGGING
     if (nsRDFLog == nullptr) 
         nsRDFLog = PR_NewLogModule("RDF");
-#endif
 }
 
 //----------------------------------------------------------------------
 //
 // nsISupports interface
 //
 
 NS_IMPL_CYCLE_COLLECTION_CLASS(CompositeDataSourceImpl)
--- a/rdf/base/nsInMemoryDataSource.cpp
+++ b/rdf/base/nsInMemoryDataSource.cpp
@@ -354,36 +354,30 @@ public:
                 entry->mAssertions = as;
             }
         }
         else {
             PL_DHashTableRemove(&mReverseArcs, v);
         }
     }
 
-#ifdef PR_LOGGING
     void
     LogOperation(const char* aOperation,
                  nsIRDFResource* asource,
                  nsIRDFResource* aProperty,
                  nsIRDFNode* aTarget,
                  bool aTruthValue = true);
-#endif
 
     bool    mPropagateChanges;
 
 private:
-#ifdef PR_LOGGING
     static PRLogModuleInfo* gLog;
-#endif
 };
 
-#ifdef PR_LOGGING
 PRLogModuleInfo* InMemoryDataSource::gLog;
-#endif
 
 //----------------------------------------------------------------------
 //
 // InMemoryAssertionEnumeratorImpl
 //
 
 /**
  * InMemoryAssertionEnumeratorImpl
@@ -785,20 +779,18 @@ InMemoryDataSource::InMemoryDataSource(n
 
 
 nsresult
 InMemoryDataSource::Init()
 {
     PL_DHashTableInit(&mForwardArcs, PL_DHashGetStubOps(), sizeof(Entry));
     PL_DHashTableInit(&mReverseArcs, PL_DHashGetStubOps(), sizeof(Entry));
 
-#ifdef PR_LOGGING
     if (! gLog)
         gLog = PR_NewLogModule("InMemoryDataSource");
-#endif
 
     return NS_OK;
 }
 
 
 InMemoryDataSource::~InMemoryDataSource()
 {
 #ifdef DEBUG_REFS
@@ -861,17 +853,16 @@ NS_INTERFACE_MAP_BEGIN_AGGREGATED(InMemo
     NS_INTERFACE_MAP_ENTRY(nsIRDFPropagatableDataSource)
     NS_INTERFACE_MAP_ENTRY(nsIRDFPurgeableDataSource)
     NS_INTERFACE_MAP_ENTRY(rdfIDataSource)
 NS_INTERFACE_MAP_END
 
 ////////////////////////////////////////////////////////////////////////
 
 
-#ifdef PR_LOGGING
 void
 InMemoryDataSource::LogOperation(const char* aOperation,
                                  nsIRDFResource* aSource,
                                  nsIRDFResource* aProperty,
                                  nsIRDFNode* aTarget,
                                  bool aTruthValue)
 {
     if (! PR_LOG_TEST(gLog, PR_LOG_NOTICE))
@@ -910,17 +901,16 @@ InMemoryDataSource::LogOperation(const c
 
         free(valueCStr);
     }
     else {
         PR_LogPrint
            ("  -->(unknown-type)\n");
     }
 }
-#endif
 
 
 NS_IMETHODIMP
 InMemoryDataSource::GetURI(char* *uri)
 {
     NS_PRECONDITION(uri != nullptr, "null ptr");
     if (! uri)
         return NS_ERROR_NULL_POINTER;
@@ -1120,19 +1110,17 @@ InMemoryDataSource::GetTargets(nsIRDFRes
 
 
 nsresult
 InMemoryDataSource::LockedAssert(nsIRDFResource* aSource,
                                  nsIRDFResource* aProperty,
                                  nsIRDFNode* aTarget,
                                  bool aTruthValue)
 {
-#ifdef PR_LOGGING
     LogOperation("ASSERT", aSource, aProperty, aTarget, aTruthValue);
-#endif
 
     Assertion* next = GetForwardArcs(aSource);
     Assertion* prev = next;
     Assertion* as = nullptr;
 
     bool    haveHash = (next) ? next->mHashEntry : false;
     if (haveHash) {
         PLDHashEntryHdr* hdr =
@@ -1260,19 +1248,17 @@ InMemoryDataSource::Assert(nsIRDFResourc
 }
 
 
 nsresult
 InMemoryDataSource::LockedUnassert(nsIRDFResource* aSource,
                                    nsIRDFResource* aProperty,
                                    nsIRDFNode* aTarget)
 {
-#ifdef PR_LOGGING
     LogOperation("UNASSERT", aSource, aProperty, aTarget);
-#endif
 
     Assertion* next = GetForwardArcs(aSource);
     Assertion* prev = next;
     Assertion* root = next;
     Assertion* as = nullptr;
 
     bool    haveHash = (next) ? next->mHashEntry : false;
     if (haveHash) {
@@ -1806,19 +1792,17 @@ InMemoryDataSource::Mark(nsIRDFResource*
         while (val) {
             if ((val->u.as.mTarget == aTarget) &&
                 (aTruthValue == (val->u.as.mTruthValue))) {
 
                 // found it! so mark it.
                 as->Mark();
                 *aDidMark = true;
 
-#ifdef PR_LOGGING
                 LogOperation("MARK", aSource, aProperty, aTarget, aTruthValue);
-#endif
 
                 return NS_OK;
             }
             val = val->mNext;
         }
     }
     else for (; as != nullptr; as = as->mNext) {
         // check target first as its most unique
@@ -1830,19 +1814,17 @@ InMemoryDataSource::Mark(nsIRDFResource*
 
         if (aTruthValue != (as->u.as.mTruthValue))
             continue;
 
         // found it! so mark it.
         as->Mark();
         *aDidMark = true;
 
-#ifdef PR_LOGGING
         LogOperation("MARK", aSource, aProperty, aTarget, aTruthValue);
-#endif
 
         return NS_OK;
     }
 
     // If we get here, we couldn't find the assertion
     *aDidMark = false;
     return NS_OK;
 }
@@ -1859,19 +1841,17 @@ InMemoryDataSource::Sweep()
     SweepInfo info = { nullptr, &mReverseArcs };
 
     // Remove all the assertions, but don't notify anyone.
     PL_DHashTableEnumerate(&mForwardArcs, SweepForwardArcsEntries, &info);
 
     // Now do the notification.
     Assertion* as = info.mUnassertList;
     while (as) {
-#ifdef PR_LOGGING
         LogOperation("SWEEP", as->mSource, as->u.as.mProperty, as->u.as.mTarget, as->u.as.mTruthValue);
-#endif
         if (!(as->mHashEntry))
         {
             for (int32_t i = int32_t(mNumObservers) - 1; mPropagateChanges && i >= 0; --i) {
                 nsIRDFObserver* obs = mObservers[i];
                 // XXXbz other loops over mObservers null-check |obs| here!
                 obs->OnUnassert(this, as->mSource, as->u.as.mProperty, as->u.as.mTarget);
                 // XXX ignore return value?
             }
--- a/rdf/base/nsRDFContentSink.cpp
+++ b/rdf/base/nsRDFContentSink.cpp
@@ -221,34 +221,30 @@ protected:
         RDFContentSinkParseMode  mParseMode;
     };
 
     nsAutoTArray<RDFContextStackElement, 8>* mContextStack;
 
     nsIURI*      mDocumentURL;
 
 private:
-#ifdef PR_LOGGING
     static PRLogModuleInfo* gLog;
-#endif
 };
 
 int32_t         RDFContentSinkImpl::gRefCnt = 0;
 nsIRDFService*  RDFContentSinkImpl::gRDFService;
 nsIRDFContainerUtils* RDFContentSinkImpl::gRDFContainerUtils;
 nsIRDFResource* RDFContentSinkImpl::kRDF_type;
 nsIRDFResource* RDFContentSinkImpl::kRDF_instanceOf;
 nsIRDFResource* RDFContentSinkImpl::kRDF_Alt;
 nsIRDFResource* RDFContentSinkImpl::kRDF_Bag;
 nsIRDFResource* RDFContentSinkImpl::kRDF_Seq;
 nsIRDFResource* RDFContentSinkImpl::kRDF_nextVal;
 
-#ifdef PR_LOGGING
 PRLogModuleInfo* RDFContentSinkImpl::gLog;
-#endif
 
 ////////////////////////////////////////////////////////////////////////
 
 #define RDF_ATOM(name_, value_) nsIAtom* RDFContentSinkImpl::name_;
 #include "nsRDFContentSinkAtomList.h"
 #undef RDF_ATOM
 
 #define RDF_ATOM(name_, value_) NS_STATIC_ATOM_BUFFER(name_##_buffer, value_)
@@ -291,20 +287,18 @@ RDFContentSinkImpl::RDFContentSinkImpl()
         }
 
         NS_DEFINE_CID(kRDFContainerUtilsCID, NS_RDFCONTAINERUTILS_CID);
         rv = CallGetService(kRDFContainerUtilsCID, &gRDFContainerUtils);
 
         NS_RegisterStaticAtoms(rdf_atoms);
     }
 
-#ifdef PR_LOGGING
     if (! gLog)
         gLog = PR_NewLogModule("nsRDFContentSink");
-#endif
 }
 
 
 RDFContentSinkImpl::~RDFContentSinkImpl()
 {
 #ifdef DEBUG_REFS
     --gInstanceCount;
     fprintf(stdout, "%d - RDF: RDFContentSinkImpl\n", gInstanceCount);
@@ -321,27 +315,25 @@ RDFContentSinkImpl::~RDFContentSinkImpl(
         // pop all the elements off the stack and release them.
         int32_t i = mContextStack->Length();
         while (0 < i--) {
             nsIRDFResource* resource = nullptr;
             RDFContentSinkState state;
             RDFContentSinkParseMode parseMode;
             PopContext(resource, state, parseMode);
 
-#ifdef PR_LOGGING
             // print some fairly useless debugging info
             // XXX we should save line numbers on the context stack: this'd
             // be about 1000x more helpful.
             if (resource) {
                 nsXPIDLCString uri;
                 resource->GetValue(getter_Copies(uri));
                 PR_LOG(gLog, PR_LOG_NOTICE,
                        ("rdfxml:   uri=%s", (const char*) uri));
             }
-#endif
 
             NS_IF_RELEASE(resource);
         }
 
         delete mContextStack;
     }
     free(mText);
 
@@ -441,28 +433,26 @@ RDFContentSinkImpl::HandleStartElement(c
 NS_IMETHODIMP 
 RDFContentSinkImpl::HandleEndElement(const char16_t *aName)
 {
   FlushText();
 
   nsIRDFResource* resource;
   if (NS_FAILED(PopContext(resource, mState, mParseMode))) {
       // XXX parser didn't catch unmatched tags?
-#ifdef PR_LOGGING
       if (PR_LOG_TEST(gLog, PR_LOG_WARNING)) {
           nsAutoString tagStr(aName);
           char* tagCStr = ToNewCString(tagStr);
 
           PR_LogPrint
                  ("rdfxml: extra close tag '%s' at line %d",
                   tagCStr, 0/*XXX fix me */);
 
           free(tagCStr);
       }
-#endif
 
       return NS_ERROR_UNEXPECTED; // XXX
   }
 
   // If we've just popped a member or property element, _now_ is the
   // time to add that element to the graph.
   switch (mState) {
     case eRDFContentSinkState_InMemberElement: 
--- a/rdf/base/nsRDFService.cpp
+++ b/rdf/base/nsRDFService.cpp
@@ -65,19 +65,17 @@ static NS_DEFINE_CID(kRDFXMLDataSourceCI
 static NS_DEFINE_CID(kRDFDefaultResourceCID,  NS_RDFDEFAULTRESOURCE_CID);
 
 static NS_DEFINE_IID(kIRDFLiteralIID,         NS_IRDFLITERAL_IID);
 static NS_DEFINE_IID(kIRDFDateIID,         NS_IRDFDATE_IID);
 static NS_DEFINE_IID(kIRDFIntIID,         NS_IRDFINT_IID);
 static NS_DEFINE_IID(kIRDFNodeIID,            NS_IRDFNODE_IID);
 static NS_DEFINE_IID(kISupportsIID,           NS_ISUPPORTS_IID);
 
-#ifdef PR_LOGGING
 static PRLogModuleInfo* gLog = nullptr;
-#endif
 
 class BlobImpl;
 
 // These functions are copied from nsprpub/lib/ds/plhash.c, with one
 // change to free the key in DataSourceFreeEntry.
 // XXX sigh, why were DefaultAllocTable et. al. declared static, anyway?
 
 static void *
@@ -750,20 +748,18 @@ RDFServiceImpl::Init()
     PL_DHashTableInit(&mDates, &gDateTableOps, sizeof(DateHashEntry));
 
     PL_DHashTableInit(&mBlobs, &gBlobTableOps, sizeof(BlobHashEntry));
 
     mDefaultResourceFactory = do_GetClassObject(kRDFDefaultResourceCID, &rv);
     NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get default resource factory");
     if (NS_FAILED(rv)) return rv;
 
-#ifdef PR_LOGGING
     if (! gLog)
         gLog = PR_NewLogModule("nsRDFService");
-#endif
 
     return NS_OK;
 }
 
 
 RDFServiceImpl::~RDFServiceImpl()
 {
     if (mNamedDataSources) {
--- a/rdf/base/nsRDFXMLDataSource.cpp
+++ b/rdf/base/nsRDFXMLDataSource.cpp
@@ -129,19 +129,17 @@ protected:
     nsCOMPtr<nsIURI>    mURL;
     nsCOMPtr<nsIStreamListener> mListener;
     nsNameSpaceMap      mNameSpaces;
 
     // pseudo-constants
     static int32_t gRefCnt;
     static nsIRDFService* gRDFService;
 
-#ifdef PR_LOGGING
     static PRLogModuleInfo* gLog;
-#endif
 
     nsresult Init();
     RDFXMLDataSourceImpl(void);
     virtual ~RDFXMLDataSourceImpl(void);
     nsresult rdfXMLFlush(nsIURI *aURI);
 
     friend nsresult
     NS_NewRDFXMLDataSource(nsIRDFDataSource** aResult);
@@ -355,19 +353,17 @@ public:
 protected:
     nsresult
     BlockingParse(nsIURI* aURL, nsIStreamListener* aConsumer);
 };
 
 int32_t         RDFXMLDataSourceImpl::gRefCnt = 0;
 nsIRDFService*  RDFXMLDataSourceImpl::gRDFService;
 
-#ifdef PR_LOGGING
 PRLogModuleInfo* RDFXMLDataSourceImpl::gLog;
-#endif
 
 static const char kFileURIPrefix[] = "file:";
 static const char kResourceURIPrefix[] = "resource:";
 
 
 //----------------------------------------------------------------------
 
 nsresult
@@ -395,20 +391,18 @@ NS_NewRDFXMLDataSource(nsIRDFDataSource*
 }
 
 
 RDFXMLDataSourceImpl::RDFXMLDataSourceImpl(void)
     : mIsWritable(true),
       mIsDirty(false),
       mLoadState(eLoadState_Unloaded)
 {
-#ifdef PR_LOGGING
     if (! gLog)
         gLog = PR_NewLogModule("nsRDFXMLDataSource");
-#endif
 }
 
 
 nsresult
 RDFXMLDataSourceImpl::Init()
 {
     nsresult rv;
     NS_DEFINE_CID(kRDFInMemoryDataSourceCID, NS_RDFINMEMORYDATASOURCE_CID);
@@ -828,22 +822,20 @@ RDFXMLDataSourceImpl::Flush(void)
     if (!mIsWritable || !mIsDirty)
         return NS_OK;
 
     // while it is not fatal if mURL is not set,
     // indicate failure since we can't flush back to an unknown origin
     if (! mURL)
         return NS_ERROR_NOT_INITIALIZED;
 
-#ifdef PR_LOGGING
     nsAutoCString spec;
     mURL->GetSpec(spec);
     PR_LOG(gLog, PR_LOG_NOTICE,
            ("rdfxml[%p] flush(%s)", this, spec.get()));
-#endif
 
     nsresult rv;
     if (NS_SUCCEEDED(rv = rdfXMLFlush(mURL)))
     {
       mIsDirty = false;
     }
     return rv;
 }
@@ -908,24 +900,22 @@ RDFXMLDataSourceImpl::AsyncOnChannelRedi
 
     cb->OnRedirectVerifyCallback(NS_OK);
     return NS_OK;
 }
 
 NS_IMETHODIMP
 RDFXMLDataSourceImpl::Refresh(bool aBlocking)
 {
-#ifdef PR_LOGGING
     nsAutoCString spec;
     if (mURL) {
         mURL->GetSpec(spec);
     }
     PR_LOG(gLog, PR_LOG_NOTICE,
            ("rdfxml[%p] refresh(%s) %sblocking", this, spec.get(), (aBlocking ? "" : "non")));
-#endif
     
     // If an asynchronous load is already pending, then just let it do
     // the honors.
     if (IsLoading()) {
         PR_LOG(gLog, PR_LOG_NOTICE,
                ("rdfxml[%p] refresh(%s) a load was pending", this, spec.get()));
 
         if (aBlocking) {
@@ -972,24 +962,22 @@ RDFXMLDataSourceImpl::Refresh(bool aBloc
     }
 
     return NS_OK;
 }
 
 NS_IMETHODIMP
 RDFXMLDataSourceImpl::BeginLoad(void)
 {
-#ifdef PR_LOGGING
     nsAutoCString spec;
     if (mURL) {
         mURL->GetSpec(spec);
     }
     PR_LOG(gLog, PR_LOG_NOTICE,
            ("rdfxml[%p] begin-load(%s)", this, spec.get()));
-#endif
     
     mLoadState = eLoadState_Loading;
     for (int32_t i = mObservers.Count() - 1; i >= 0; --i) {
         // Make sure to hold a strong reference to the observer so
         // that it doesn't go away in this call if it removes itself
         // as an observer
         nsCOMPtr<nsIRDFXMLSinkObserver> obs = mObservers[i];
 
@@ -998,24 +986,22 @@ RDFXMLDataSourceImpl::BeginLoad(void)
         }
     }
     return NS_OK;
 }
 
 NS_IMETHODIMP
 RDFXMLDataSourceImpl::Interrupt(void)
 {
-#ifdef PR_LOGGING
     nsAutoCString spec;
     if (mURL) {
         mURL->GetSpec(spec);
     }
     PR_LOG(gLog, PR_LOG_NOTICE,
            ("rdfxml[%p] interrupt(%s)", this, spec.get()));
-#endif
     
     for (int32_t i = mObservers.Count() - 1; i >= 0; --i) {
         // Make sure to hold a strong reference to the observer so
         // that it doesn't go away in this call if it removes itself
         // as an observer
         nsCOMPtr<nsIRDFXMLSinkObserver> obs = mObservers[i];
 
         if (obs) {
@@ -1023,24 +1009,22 @@ RDFXMLDataSourceImpl::Interrupt(void)
         }
     }
     return NS_OK;
 }
 
 NS_IMETHODIMP
 RDFXMLDataSourceImpl::Resume(void)
 {
-#ifdef PR_LOGGING
     nsAutoCString spec;
     if (mURL) {
         mURL->GetSpec(spec);
     }
     PR_LOG(gLog, PR_LOG_NOTICE,
            ("rdfxml[%p] resume(%s)", this, spec.get()));
-#endif
     
     for (int32_t i = mObservers.Count() - 1; i >= 0; --i) {
         // Make sure to hold a strong reference to the observer so
         // that it doesn't go away in this call if it removes itself
         // as an observer
         nsCOMPtr<nsIRDFXMLSinkObserver> obs = mObservers[i];
 
         if (obs) {
@@ -1048,24 +1032,22 @@ RDFXMLDataSourceImpl::Resume(void)
         }
     }
     return NS_OK;
 }
 
 NS_IMETHODIMP
 RDFXMLDataSourceImpl::EndLoad(void)
 {
-#ifdef PR_LOGGING
     nsAutoCString spec;
     if (mURL) {
         mURL->GetSpec(spec);
     }
     PR_LOG(gLog, PR_LOG_NOTICE,
            ("rdfxml[%p] end-load(%s)", this, spec.get()));
-#endif
     
     mLoadState = eLoadState_Loaded;
 
     // Clear out any unmarked assertions from the datasource.
     nsCOMPtr<nsIRDFPurgeableDataSource> gcable = do_QueryInterface(mInner);
     if (gcable) {
         gcable->Sweep();
     }