Bug 944961 - Build rdf in unified mode. r=bsmedberg

--HG--
extra : rebase_source : 02d0dda613da55539f8fdb69ffd8c03e576e5ce9
This commit is contained in:
Chris Peterson 2013-11-30 21:42:59 -08:00
parent a8c349eab5
commit d06e89d099
11 changed files with 57 additions and 55 deletions

View File

@ -4,7 +4,7 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this # 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/. # file, You can obtain one at http://mozilla.org/MPL/2.0/.
SOURCES += [ UNIFIED_SOURCES += [
'nsCompositeDataSource.cpp', 'nsCompositeDataSource.cpp',
'nsContainerEnumerator.cpp', 'nsContainerEnumerator.cpp',
'nsDefaultResourceFactory.cpp', 'nsDefaultResourceFactory.cpp',

View File

@ -49,8 +49,6 @@
PRLogModuleInfo* nsRDFLog = nullptr; PRLogModuleInfo* nsRDFLog = nullptr;
#endif #endif
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// //
// CompositeDataSourceImpl // CompositeDataSourceImpl

View File

@ -36,11 +36,6 @@
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
static NS_DEFINE_CID(kRDFContainerUtilsCID, NS_RDFCONTAINERUTILS_CID);
////////////////////////////////////////////////////////////////////////
class ContainerEnumeratorImpl : public nsISimpleEnumerator { class ContainerEnumeratorImpl : public nsISimpleEnumerator {
private: private:
// pseudo-constants // pseudo-constants
@ -84,6 +79,8 @@ ContainerEnumeratorImpl::Init()
{ {
if (gRefCnt++ == 0) { if (gRefCnt++ == 0) {
nsresult rv; nsresult rv;
NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
nsCOMPtr<nsIRDFService> rdf = do_GetService(kRDFServiceCID); nsCOMPtr<nsIRDFService> rdf = do_GetService(kRDFServiceCID);
NS_ASSERTION(rdf != nullptr, "unable to acquire resource manager"); NS_ASSERTION(rdf != nullptr, "unable to acquire resource manager");
if (! rdf) if (! rdf)
@ -93,6 +90,7 @@ ContainerEnumeratorImpl::Init()
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get resource"); NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get resource");
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
NS_DEFINE_CID(kRDFContainerUtilsCID, NS_RDFCONTAINERUTILS_CID);
rv = CallGetService(kRDFContainerUtilsCID, &gRDFC); rv = CallGetService(kRDFContainerUtilsCID, &gRDFC);
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
} }

View File

@ -69,11 +69,6 @@
#include "rdfIDataSource.h" #include "rdfIDataSource.h"
#include "rdfITripleVisitor.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 // This struct is used as the slot value in the forward and reverse
// arcs hash tables. // arcs hash tables.
// //
@ -365,8 +360,17 @@ public:
#endif #endif
bool mPropagateChanges; bool mPropagateChanges;
private:
#ifdef PR_LOGGING
static PRLogModuleInfo* gLog;
#endif
}; };
#ifdef PR_LOGGING
PRLogModuleInfo* InMemoryDataSource::gLog;
#endif
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// //
// InMemoryAssertionEnumeratorImpl // InMemoryAssertionEnumeratorImpl

View File

@ -45,10 +45,6 @@
#include "nsXPIDLString.h" #include "nsXPIDLString.h"
#include "rdf.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 #define RDF_SEQ_LIST_LIMIT 8
class RDFContainerImpl : public nsIRDFContainer class RDFContainerImpl : public nsIRDFContainer
@ -381,6 +377,7 @@ RDFContainerImpl::Init()
if (gRefCnt++ == 0) { if (gRefCnt++ == 0) {
nsresult rv; nsresult rv;
NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
rv = CallGetService(kRDFServiceCID, &gRDFService); rv = CallGetService(kRDFServiceCID, &gRDFService);
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
NS_ERROR("unable to get RDF service"); NS_ERROR("unable to get RDF service");
@ -391,6 +388,7 @@ RDFContainerImpl::Init()
&kRDF_nextVal); &kRDF_nextVal);
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
NS_DEFINE_CID(kRDFContainerUtilsCID, NS_RDFCONTAINERUTILS_CID);
rv = CallGetService(kRDFContainerUtilsCID, &gRDFContainerUtils); rv = CallGetService(kRDFContainerUtilsCID, &gRDFContainerUtils);
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
NS_ERROR("unable to get RDF container utils service"); NS_ERROR("unable to get RDF container utils service");
@ -688,6 +686,7 @@ RDFContainerImpl::GetNextValue(nsIRDFResource** aResult)
} }
} }
static const char kRDFNameSpaceURI[] = RDF_NAMESPACE_URI;
char buf[sizeof(kRDFNameSpaceURI) + 16]; char buf[sizeof(kRDFNameSpaceURI) + 16];
nsFixedCString nextValStr(buf, sizeof(buf), 0); nsFixedCString nextValStr(buf, sizeof(buf), 0);
nextValStr = kRDFNameSpaceURI; nextValStr = kRDFNameSpaceURI;

View File

@ -23,9 +23,6 @@
#include "rdf.h" #include "rdf.h"
#include "rdfutil.h" #include "rdfutil.h"
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
static const char kRDFNameSpaceURI[] = RDF_NAMESPACE_URI;
class RDFContainerUtilsImpl : public nsIRDFContainerUtils class RDFContainerUtilsImpl : public nsIRDFContainerUtils
{ {
public: public:
@ -57,9 +54,9 @@ private:
static nsIRDFResource* kRDF_Seq; static nsIRDFResource* kRDF_Seq;
static nsIRDFResource* kRDF_Alt; static nsIRDFResource* kRDF_Alt;
static nsIRDFLiteral* kOne; static nsIRDFLiteral* kOne;
static const char kRDFNameSpaceURI[];
}; };
int32_t RDFContainerUtilsImpl::gRefCnt = 0; int32_t RDFContainerUtilsImpl::gRefCnt = 0;
nsIRDFService* RDFContainerUtilsImpl::gRDFService; nsIRDFService* RDFContainerUtilsImpl::gRDFService;
nsIRDFResource* RDFContainerUtilsImpl::kRDF_instanceOf; nsIRDFResource* RDFContainerUtilsImpl::kRDF_instanceOf;
@ -68,6 +65,7 @@ nsIRDFResource* RDFContainerUtilsImpl::kRDF_Bag;
nsIRDFResource* RDFContainerUtilsImpl::kRDF_Seq; nsIRDFResource* RDFContainerUtilsImpl::kRDF_Seq;
nsIRDFResource* RDFContainerUtilsImpl::kRDF_Alt; nsIRDFResource* RDFContainerUtilsImpl::kRDF_Alt;
nsIRDFLiteral* RDFContainerUtilsImpl::kOne; nsIRDFLiteral* RDFContainerUtilsImpl::kOne;
const char RDFContainerUtilsImpl::kRDFNameSpaceURI[] = RDF_NAMESPACE_URI;
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
// nsISupports interface // nsISupports interface
@ -325,6 +323,7 @@ RDFContainerUtilsImpl::RDFContainerUtilsImpl()
if (gRefCnt++ == 0) { if (gRefCnt++ == 0) {
nsresult rv; nsresult rv;
NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
rv = CallGetService(kRDFServiceCID, &gRDFService); rv = CallGetService(kRDFServiceCID, &gRDFService);
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get RDF service"); NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get RDF service");

View File

@ -68,25 +68,6 @@
using namespace mozilla; 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 { enum RDFContentSinkState {
@ -244,6 +225,11 @@ protected:
nsAutoTArray<RDFContextStackElement, 8>* mContextStack; nsAutoTArray<RDFContextStackElement, 8>* mContextStack;
nsIURI* mDocumentURL; nsIURI* mDocumentURL;
private:
#ifdef PR_LOGGING
static PRLogModuleInfo* gLog;
#endif
}; };
int32_t RDFContentSinkImpl::gRefCnt = 0; int32_t RDFContentSinkImpl::gRefCnt = 0;
@ -256,6 +242,10 @@ nsIRDFResource* RDFContentSinkImpl::kRDF_Bag;
nsIRDFResource* RDFContentSinkImpl::kRDF_Seq; nsIRDFResource* RDFContentSinkImpl::kRDF_Seq;
nsIRDFResource* RDFContentSinkImpl::kRDF_nextVal; nsIRDFResource* RDFContentSinkImpl::kRDF_nextVal;
#ifdef PR_LOGGING
PRLogModuleInfo* RDFContentSinkImpl::gLog;
#endif
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
#define RDF_ATOM(name_, value_) nsIAtom* RDFContentSinkImpl::name_; #define RDF_ATOM(name_, value_) nsIAtom* RDFContentSinkImpl::name_;
@ -282,6 +272,7 @@ RDFContentSinkImpl::RDFContentSinkImpl()
mDocumentURL(nullptr) mDocumentURL(nullptr)
{ {
if (gRefCnt++ == 0) { if (gRefCnt++ == 0) {
NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
nsresult rv = CallGetService(kRDFServiceCID, &gRDFService); nsresult rv = CallGetService(kRDFServiceCID, &gRDFService);
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get RDF service"); NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get RDF service");
@ -300,7 +291,7 @@ RDFContentSinkImpl::RDFContentSinkImpl()
&kRDF_nextVal); &kRDF_nextVal);
} }
NS_DEFINE_CID(kRDFContainerUtilsCID, NS_RDFCONTAINERUTILS_CID);
rv = CallGetService(kRDFContainerUtilsCID, &gRDFContainerUtils); rv = CallGetService(kRDFContainerUtilsCID, &gRDFContainerUtils);
NS_RegisterStaticAtoms(rdf_atoms); NS_RegisterStaticAtoms(rdf_atoms);
@ -381,6 +372,12 @@ RDFContentSinkImpl::QueryInterface(REFNSIID iid, void** result)
if (! result) if (! result)
return NS_ERROR_NULL_POINTER; 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; *result = nullptr;
if (iid.Equals(kIRDFContentSinkIID) || if (iid.Equals(kIRDFContentSinkIID) ||
iid.Equals(kIXMLContentSinkIID) || iid.Equals(kIXMLContentSinkIID) ||

View File

@ -70,10 +70,6 @@ static NS_DEFINE_IID(kIRDFIntIID, NS_IRDFINT_IID);
static NS_DEFINE_IID(kIRDFNodeIID, NS_IRDFNODE_IID); static NS_DEFINE_IID(kIRDFNodeIID, NS_IRDFNODE_IID);
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
#ifdef PR_LOGGING
static PRLogModuleInfo* gLog = nullptr;
#endif
class BlobImpl; class BlobImpl;
// These functions are copied from nsprpub/lib/ds/plhash.c, with one // These functions are copied from nsprpub/lib/ds/plhash.c, with one
@ -728,6 +724,10 @@ IntImpl::EqualsInt(nsIRDFInt* intValue, bool* result)
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
// RDFServiceImpl // RDFServiceImpl
#ifdef PR_LOGGING
PRLogModuleInfo* RDFServiceImpl::gLog;
#endif
RDFServiceImpl* RDFServiceImpl*
RDFServiceImpl::gRDFService; RDFServiceImpl::gRDFService;

View File

@ -28,6 +28,7 @@
#include "nsString.h" #include "nsString.h"
struct PLHashTable; struct PLHashTable;
struct PRLogModuleInfo;
class nsIRDFLiteral; class nsIRDFLiteral;
class nsIRDFInt; class nsIRDFInt;
class nsIRDFDate; class nsIRDFDate;
@ -36,6 +37,10 @@ class BlobImpl;
class RDFServiceImpl : public nsIRDFService, class RDFServiceImpl : public nsIRDFService,
public nsSupportsWeakReference public nsSupportsWeakReference
{ {
#ifdef PR_LOGGING
static PRLogModuleInfo* gLog;
#endif
protected: protected:
PLHashTable* mNamedDataSources; PLHashTable* mNamedDataSources;
PLDHashTable mResources; PLDHashTable mResources;

View File

@ -97,15 +97,6 @@
#include "rdfIDataSource.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 // RDFXMLDataSourceImpl
@ -141,6 +132,10 @@ protected:
static int32_t gRefCnt; static int32_t gRefCnt;
static nsIRDFService* gRDFService; static nsIRDFService* gRDFService;
#ifdef PR_LOGGING
static PRLogModuleInfo* gLog;
#endif
nsresult Init(); nsresult Init();
RDFXMLDataSourceImpl(void); RDFXMLDataSourceImpl(void);
virtual ~RDFXMLDataSourceImpl(void); virtual ~RDFXMLDataSourceImpl(void);
@ -363,6 +358,10 @@ protected:
int32_t RDFXMLDataSourceImpl::gRefCnt = 0; int32_t RDFXMLDataSourceImpl::gRefCnt = 0;
nsIRDFService* RDFXMLDataSourceImpl::gRDFService; nsIRDFService* RDFXMLDataSourceImpl::gRDFService;
#ifdef PR_LOGGING
PRLogModuleInfo* RDFXMLDataSourceImpl::gLog;
#endif
static const char kFileURIPrefix[] = "file:"; static const char kFileURIPrefix[] = "file:";
static const char kResourceURIPrefix[] = "resource:"; static const char kResourceURIPrefix[] = "resource:";
@ -410,10 +409,12 @@ nsresult
RDFXMLDataSourceImpl::Init() RDFXMLDataSourceImpl::Init()
{ {
nsresult rv; nsresult rv;
NS_DEFINE_CID(kRDFInMemoryDataSourceCID, NS_RDFINMEMORYDATASOURCE_CID);
mInner = do_CreateInstance(kRDFInMemoryDataSourceCID, &rv); mInner = do_CreateInstance(kRDFInMemoryDataSourceCID, &rv);
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
if (gRefCnt++ == 0) { if (gRefCnt++ == 0) {
NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
rv = CallGetService(kRDFServiceCID, &gRDFService); rv = CallGetService(kRDFServiceCID, &gRDFService);
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get RDF service"); NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get RDF service");
@ -742,6 +743,7 @@ RDFXMLDataSourceImpl::rdfXMLFlush(nsIURI *aURI)
// we are, we're screwed: it's too late to serialize because // we are, we're screwed: it's too late to serialize because
// many of the services that we'll need to acquire to properly // many of the services that we'll need to acquire to properly
// write the file will be unaquirable. // write the file will be unaquirable.
NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
nsCOMPtr<nsIRDFService> dummy = do_GetService(kRDFServiceCID, &rv); nsCOMPtr<nsIRDFService> dummy = do_GetService(kRDFServiceCID, &rv);
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
NS_WARNING("unable to Flush() dirty datasource during XPCOM shutdown"); NS_WARNING("unable to Flush() dirty datasource during XPCOM shutdown");

View File

@ -4,7 +4,7 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this # 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/. # file, You can obtain one at http://mozilla.org/MPL/2.0/.
SOURCES += [ UNIFIED_SOURCES += [
'nsFileSystemDataSource.cpp', 'nsFileSystemDataSource.cpp',
'nsLocalStore.cpp', 'nsLocalStore.cpp',
] ]