Bug 944961 - Build rdf in unified mode. r=bsmedberg
authorChris Peterson <cpeterson@mozilla.com>
Sat, 30 Nov 2013 21:42:59 -0800
changeset 174790 42ebb2419d34455979a1d8246e1378569af5d925
parent 174789 ca8e76cd1b16a972a61dea41b4d53f3d616ace93
child 174791 77116d8569628db3c5c287bd11b90781230374d8
push id445
push userffxbld
push dateMon, 10 Mar 2014 22:05:19 +0000
treeherdermozilla-release@dc38b741b04e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbsmedberg
bugs944961
milestone28.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 944961 - Build rdf in unified mode. r=bsmedberg
rdf/base/src/moz.build
rdf/base/src/nsCompositeDataSource.cpp
rdf/base/src/nsContainerEnumerator.cpp
rdf/base/src/nsInMemoryDataSource.cpp
rdf/base/src/nsRDFContainer.cpp
rdf/base/src/nsRDFContainerUtils.cpp
rdf/base/src/nsRDFContentSink.cpp
rdf/base/src/nsRDFXMLDataSource.cpp
rdf/datasource/src/moz.build
--- a/rdf/base/src/moz.build
+++ b/rdf/base/src/moz.build
@@ -1,15 +1,15 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-SOURCES += [
+UNIFIED_SOURCES += [
     'nsCompositeDataSource.cpp',
     'nsContainerEnumerator.cpp',
     'nsDefaultResourceFactory.cpp',
     'nsInMemoryDataSource.cpp',
     'nsNameSpaceMap.cpp',
     'nsRDFContainer.cpp',
     'nsRDFContainerUtils.cpp',
     'nsRDFContentSink.cpp',
--- a/rdf/base/src/nsCompositeDataSource.cpp
+++ b/rdf/base/src/nsCompositeDataSource.cpp
@@ -44,18 +44,16 @@
 
 #ifdef DEBUG
 #include "prlog.h"
 #include "prprf.h"
 #include <stdio.h>
 PRLogModuleInfo* nsRDFLog = nullptr;
 #endif
 
-static NS_DEFINE_IID(kISupportsIID,           NS_ISUPPORTS_IID);
-
 //----------------------------------------------------------------------
 //
 // CompositeDataSourceImpl
 //
 
 class CompositeEnumeratorImpl;
 class CompositeArcsInOutEnumeratorImpl;
 class CompositeAssertionEnumeratorImpl;
--- a/rdf/base/src/nsContainerEnumerator.cpp
+++ b/rdf/base/src/nsContainerEnumerator.cpp
@@ -31,21 +31,16 @@
 #include "nsString.h"
 #include "nsXPIDLString.h"
 #include "prlog.h"
 #include "rdf.h"
 #include "rdfutil.h"
 
 ////////////////////////////////////////////////////////////////////////
 
-static NS_DEFINE_CID(kRDFServiceCID,        NS_RDFSERVICE_CID);
-static NS_DEFINE_CID(kRDFContainerUtilsCID, NS_RDFCONTAINERUTILS_CID);
-
-////////////////////////////////////////////////////////////////////////
-
 class ContainerEnumeratorImpl : public nsISimpleEnumerator {
 private:
     // pseudo-constants
     static nsrefcnt              gRefCnt;
     static nsIRDFResource*       kRDF_nextVal;
     static nsIRDFContainerUtils* gRDFC;
 
     nsCOMPtr<nsIRDFDataSource>      mDataSource;
@@ -79,25 +74,28 @@ ContainerEnumeratorImpl::ContainerEnumer
 {
 }
 
 nsresult
 ContainerEnumeratorImpl::Init()
 {
     if (gRefCnt++ == 0) {
         nsresult rv;
+
+        NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
         nsCOMPtr<nsIRDFService> rdf = do_GetService(kRDFServiceCID);
         NS_ASSERTION(rdf != nullptr, "unable to acquire resource manager");
         if (! rdf)
             return NS_ERROR_FAILURE;
 
         rv = rdf->GetResource(NS_LITERAL_CSTRING(RDF_NAMESPACE_URI "nextVal"), &kRDF_nextVal);
         NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get resource");
         if (NS_FAILED(rv)) return rv;
 
+        NS_DEFINE_CID(kRDFContainerUtilsCID, NS_RDFCONTAINERUTILS_CID);
         rv = CallGetService(kRDFContainerUtilsCID, &gRDFC);
         if (NS_FAILED(rv)) return rv;
     }
 
     return NS_OK;
 }
 
 
--- a/rdf/base/src/nsInMemoryDataSource.cpp
+++ b/rdf/base/src/nsInMemoryDataSource.cpp
@@ -64,21 +64,16 @@
 #include "pldhash.h"
 #include "plstr.h"
 #include "prlog.h"
 #include "rdf.h"
 
 #include "rdfIDataSource.h"
 #include "rdfITripleVisitor.h"
 
-#ifdef PR_LOGGING
-static PRLogModuleInfo* gLog = nullptr;
-#endif
-
-
 // This struct is used as the slot value in the forward and reverse
 // arcs hash tables.
 //
 // Assertion objects are reference counted, because each Assertion's
 // ownership is shared between the datasource and any enumerators that
 // are currently iterating over the datasource.
 //
 class Assertion
@@ -360,18 +355,27 @@ public:
     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
  */
--- a/rdf/base/src/nsRDFContainer.cpp
+++ b/rdf/base/src/nsRDFContainer.cpp
@@ -40,20 +40,16 @@
 #include "nsIRDFPropagatableDataSource.h"
 #include "nsIRDFService.h"
 #include "nsIServiceManager.h"
 #include "nsRDFCID.h"
 #include "nsString.h"
 #include "nsXPIDLString.h"
 #include "rdf.h"
 
-static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
-static NS_DEFINE_CID(kRDFContainerUtilsCID, NS_RDFCONTAINERUTILS_CID);
-static const char kRDFNameSpaceURI[] = RDF_NAMESPACE_URI;
-
 #define RDF_SEQ_LIST_LIMIT   8
 
 class RDFContainerImpl : public nsIRDFContainer
 {
 public:
 
     // nsISupports interface
     NS_DECL_ISUPPORTS
@@ -376,26 +372,28 @@ RDFContainerImpl::RDFContainerImpl()
 
 
 nsresult
 RDFContainerImpl::Init()
 {
     if (gRefCnt++ == 0) {
         nsresult rv;
 
+        NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
         rv = CallGetService(kRDFServiceCID, &gRDFService);
         if (NS_FAILED(rv)) {
             NS_ERROR("unable to get RDF service");
             return rv;
         }
 
         rv = gRDFService->GetResource(NS_LITERAL_CSTRING(RDF_NAMESPACE_URI "nextVal"),
                                       &kRDF_nextVal);
         if (NS_FAILED(rv)) return rv;
 
+        NS_DEFINE_CID(kRDFContainerUtilsCID, NS_RDFCONTAINERUTILS_CID);
         rv = CallGetService(kRDFContainerUtilsCID, &gRDFContainerUtils);
         if (NS_FAILED(rv)) {
             NS_ERROR("unable to get RDF container utils service");
             return rv;
         }
     }
 
     return NS_OK;
@@ -683,16 +681,17 @@ RDFContainerImpl::GetNextValue(nsIRDFRes
             if (*p < '0' || *p > '9')
                 break;
 
             nextVal *= 10;
             nextVal += *p - '0';
         }
     }
 
+    static const char kRDFNameSpaceURI[] = RDF_NAMESPACE_URI;
     char buf[sizeof(kRDFNameSpaceURI) + 16];
     nsFixedCString nextValStr(buf, sizeof(buf), 0);
     nextValStr = kRDFNameSpaceURI;
     nextValStr.Append("_");
     nextValStr.AppendInt(nextVal, 10);
 
     rv = gRDFService->GetResource(nextValStr, aResult);
     if (NS_FAILED(rv)) return rv;
--- a/rdf/base/src/nsRDFContainerUtils.cpp
+++ b/rdf/base/src/nsRDFContainerUtils.cpp
@@ -18,19 +18,16 @@
 #include "nsRDFCID.h"
 #include "nsString.h"
 #include "nsXPIDLString.h"
 #include "plstr.h"
 #include "prprf.h"
 #include "rdf.h"
 #include "rdfutil.h"
 
-static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
-static const char kRDFNameSpaceURI[] = RDF_NAMESPACE_URI;
-
 class RDFContainerUtilsImpl : public nsIRDFContainerUtils
 {
 public:
     // nsISupports interface
     NS_DECL_ISUPPORTS
 
     // nsIRDFContainerUtils interface
     NS_DECL_NSIRDFCONTAINERUTILS
@@ -52,27 +49,28 @@ private:
     static int32_t gRefCnt;
     static nsIRDFService* gRDFService;
     static nsIRDFResource* kRDF_instanceOf;
     static nsIRDFResource* kRDF_nextVal;
     static nsIRDFResource* kRDF_Bag;
     static nsIRDFResource* kRDF_Seq;
     static nsIRDFResource* kRDF_Alt;
     static nsIRDFLiteral* kOne;
+    static const char kRDFNameSpaceURI[];
 };
 
-
 int32_t         RDFContainerUtilsImpl::gRefCnt = 0;
 nsIRDFService*  RDFContainerUtilsImpl::gRDFService;
 nsIRDFResource* RDFContainerUtilsImpl::kRDF_instanceOf;
 nsIRDFResource* RDFContainerUtilsImpl::kRDF_nextVal;
 nsIRDFResource* RDFContainerUtilsImpl::kRDF_Bag;
 nsIRDFResource* RDFContainerUtilsImpl::kRDF_Seq;
 nsIRDFResource* RDFContainerUtilsImpl::kRDF_Alt;
 nsIRDFLiteral*  RDFContainerUtilsImpl::kOne;
+const char      RDFContainerUtilsImpl::kRDFNameSpaceURI[] = RDF_NAMESPACE_URI;
 
 ////////////////////////////////////////////////////////////////////////
 // nsISupports interface
 
 NS_IMPL_ISUPPORTS1(RDFContainerUtilsImpl, nsIRDFContainerUtils)
 
 ////////////////////////////////////////////////////////////////////////
 // nsIRDFContainerUtils interface
@@ -320,16 +318,17 @@ RDFContainerUtilsImpl::MakeAlt(nsIRDFDat
 ////////////////////////////////////////////////////////////////////////
 
 
 RDFContainerUtilsImpl::RDFContainerUtilsImpl()
 {
     if (gRefCnt++ == 0) {
         nsresult rv;
 
+        NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
         rv = CallGetService(kRDFServiceCID, &gRDFService);
 
         NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get RDF service");
         if (NS_SUCCEEDED(rv)) {
             gRDFService->GetResource(NS_LITERAL_CSTRING(RDF_NAMESPACE_URI "instanceOf"),
                                      &kRDF_instanceOf);
             gRDFService->GetResource(NS_LITERAL_CSTRING(RDF_NAMESPACE_URI "nextVal"),
                                      &kRDF_nextVal);
--- a/rdf/base/src/nsRDFContentSink.cpp
+++ b/rdf/base/src/nsRDFContentSink.cpp
@@ -63,35 +63,16 @@
 #include "nsCRT.h"
 #include "nsIAtom.h"
 #include "nsStaticAtom.h"
 #include "nsIScriptError.h"
 #include "nsIDTD.h"
 
 using namespace mozilla;
 
-////////////////////////////////////////////////////////////////////////
-// XPCOM IIDs
-
-static NS_DEFINE_IID(kIContentSinkIID,         NS_ICONTENT_SINK_IID); // XXX grr...
-static NS_DEFINE_IID(kIExpatSinkIID,           NS_IEXPATSINK_IID);
-static NS_DEFINE_IID(kIRDFServiceIID,          NS_IRDFSERVICE_IID);
-static NS_DEFINE_IID(kISupportsIID,            NS_ISUPPORTS_IID);
-static NS_DEFINE_IID(kIXMLContentSinkIID,      NS_IXMLCONTENT_SINK_IID);
-static NS_DEFINE_IID(kIRDFContentSinkIID,      NS_IRDFCONTENTSINK_IID);
-
-static NS_DEFINE_CID(kRDFServiceCID,            NS_RDFSERVICE_CID);
-static NS_DEFINE_CID(kRDFContainerUtilsCID,     NS_RDFCONTAINERUTILS_CID);
-
-////////////////////////////////////////////////////////////////////////
-
-#ifdef PR_LOGGING
-static PRLogModuleInfo* gLog;
-#endif
-
 ///////////////////////////////////////////////////////////////////////
 
 enum RDFContentSinkState {
     eRDFContentSinkState_InProlog,
     eRDFContentSinkState_InDocumentElement,
     eRDFContentSinkState_InDescriptionElement,
     eRDFContentSinkState_InContainerElement,
     eRDFContentSinkState_InPropertyElement,
@@ -239,28 +220,37 @@ protected:
         nsCOMPtr<nsIRDFResource> mResource;
         RDFContentSinkState      mState;
         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_)
 #include "nsRDFContentSinkAtomList.h"
@@ -277,16 +267,17 @@ RDFContentSinkImpl::RDFContentSinkImpl()
       mTextLength(0),
       mTextSize(0),
       mState(eRDFContentSinkState_InProlog),
       mParseMode(eRDFContentSinkParseMode_Literal),
       mContextStack(nullptr),
       mDocumentURL(nullptr)
 {
     if (gRefCnt++ == 0) {
+        NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
         nsresult rv = CallGetService(kRDFServiceCID, &gRDFService);
 
         NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get RDF service");
         if (NS_SUCCEEDED(rv)) {
             rv = gRDFService->GetResource(NS_LITERAL_CSTRING(RDF_NAMESPACE_URI "type"),
                                           &kRDF_type);
             rv = gRDFService->GetResource(NS_LITERAL_CSTRING(RDF_NAMESPACE_URI "instanceOf"),
                                           &kRDF_instanceOf);
@@ -295,17 +286,17 @@ RDFContentSinkImpl::RDFContentSinkImpl()
             rv = gRDFService->GetResource(NS_LITERAL_CSTRING(RDF_NAMESPACE_URI "Bag"),
                                           &kRDF_Bag);
             rv = gRDFService->GetResource(NS_LITERAL_CSTRING(RDF_NAMESPACE_URI "Seq"),
                                           &kRDF_Seq);
             rv = gRDFService->GetResource(NS_LITERAL_CSTRING(RDF_NAMESPACE_URI "nextVal"),
                                           &kRDF_nextVal);
         }
 
-
+        NS_DEFINE_CID(kRDFContainerUtilsCID, NS_RDFCONTAINERUTILS_CID);
         rv = CallGetService(kRDFContainerUtilsCID, &gRDFContainerUtils);
 
         NS_RegisterStaticAtoms(rdf_atoms);
     }
 
 #ifdef PR_LOGGING
     if (! gLog)
         gLog = PR_NewLogModule("nsRDFContentSink");
@@ -376,16 +367,22 @@ NS_IMPL_RELEASE(RDFContentSinkImpl)
 
 NS_IMETHODIMP
 RDFContentSinkImpl::QueryInterface(REFNSIID iid, void** result)
 {
     NS_PRECONDITION(result, "null ptr");
     if (! result)
         return NS_ERROR_NULL_POINTER;
 
+    NS_DEFINE_IID(kIContentSinkIID,    NS_ICONTENT_SINK_IID);
+    NS_DEFINE_IID(kIExpatSinkIID,      NS_IEXPATSINK_IID);
+    NS_DEFINE_IID(kISupportsIID,       NS_ISUPPORTS_IID);
+    NS_DEFINE_IID(kIXMLContentSinkIID, NS_IXMLCONTENT_SINK_IID);
+    NS_DEFINE_IID(kIRDFContentSinkIID, NS_IRDFCONTENTSINK_IID);
+
     *result = nullptr;
     if (iid.Equals(kIRDFContentSinkIID) ||
         iid.Equals(kIXMLContentSinkIID) ||
         iid.Equals(kIContentSinkIID) ||
         iid.Equals(kISupportsIID)) {
         *result = static_cast<nsIXMLContentSink*>(this);
         AddRef();
         return NS_OK;
--- a/rdf/base/src/nsRDFXMLDataSource.cpp
+++ b/rdf/base/src/nsRDFXMLDataSource.cpp
@@ -93,25 +93,16 @@
 #include "nsIScriptSecurityManager.h"
 #include "nsIChannelEventSink.h"
 #include "nsIAsyncVerifyRedirectCallback.h"
 #include "nsNetUtil.h"
 
 #include "rdfIDataSource.h"
 
 //----------------------------------------------------------------------
-
-static NS_DEFINE_CID(kRDFInMemoryDataSourceCID, NS_RDFINMEMORYDATASOURCE_CID);
-static NS_DEFINE_CID(kRDFServiceCID,            NS_RDFSERVICE_CID);
-
-#ifdef PR_LOGGING
-static PRLogModuleInfo* gLog;
-#endif
-
-//----------------------------------------------------------------------
 //
 // RDFXMLDataSourceImpl
 //
 
 class RDFXMLDataSourceImpl : public nsIRDFDataSource,
                              public nsIRDFRemoteDataSource,
                              public nsIRDFXMLSink,
                              public nsIRDFXMLSource,
@@ -136,16 +127,20 @@ 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);
 
@@ -358,16 +353,20 @@ 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
 NS_NewRDFXMLDataSource(nsIRDFDataSource** aResult)
@@ -405,20 +404,22 @@ RDFXMLDataSourceImpl::RDFXMLDataSourceIm
 #endif
 }
 
 
 nsresult
 RDFXMLDataSourceImpl::Init()
 {
     nsresult rv;
+    NS_DEFINE_CID(kRDFInMemoryDataSourceCID, NS_RDFINMEMORYDATASOURCE_CID);
     mInner = do_CreateInstance(kRDFInMemoryDataSourceCID, &rv);
     if (NS_FAILED(rv)) return rv;
 
     if (gRefCnt++ == 0) {
+        NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
         rv = CallGetService(kRDFServiceCID, &gRDFService);
 
         NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get RDF service");
         if (NS_FAILED(rv)) return rv;
     }
 
     return NS_OK;
 }
@@ -737,16 +738,17 @@ RDFXMLDataSourceImpl::rdfXMLFlush(nsIURI
 
     nsresult rv;
 
     {
         // Quick and dirty check to see if we're in XPCOM shutdown. If
         // we are, we're screwed: it's too late to serialize because
         // many of the services that we'll need to acquire to properly
         // write the file will be unaquirable.
+        NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
         nsCOMPtr<nsIRDFService> dummy = do_GetService(kRDFServiceCID, &rv);
         if (NS_FAILED(rv)) {
             NS_WARNING("unable to Flush() dirty datasource during XPCOM shutdown");
             return rv;
         }
     }
 
     // Is it a file? If so, we can write to it. Some day, it'd be nice
--- a/rdf/datasource/src/moz.build
+++ b/rdf/datasource/src/moz.build
@@ -1,12 +1,12 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-SOURCES += [
+UNIFIED_SOURCES += [
     'nsFileSystemDataSource.cpp',
     'nsLocalStore.cpp',
 ]
 
 FINAL_LIBRARY = 'rdf'