bug 943023 - unify some of toolkit/components/ and rdf/ r=ehsan
☠☠ backed out by d8de1b834f47 ☠ ☠
authorTrevor Saunders <trev.saunders@gmail.com>
Mon, 25 Nov 2013 14:28:06 -0500
changeset 157439 d84bce4e8f2c739d7f1baba03cb2bd0338e4db9f
parent 157438 ca137ceb2877232c148f08907698fb94df7bb6a3
child 157440 12d272165d32354a972558b8c51538dcb73278b8
push id36716
push usertrev.saunders@gmail.com
push dateMon, 25 Nov 2013 23:01:10 +0000
treeherdermozilla-inbound@d84bce4e8f2c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs943023
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 943023 - unify some of toolkit/components/ and rdf/ r=ehsan
rdf/base/src/moz.build
rdf/base/src/nsCompositeDataSource.cpp
rdf/base/src/nsContainerEnumerator.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
toolkit/components/alerts/moz.build
toolkit/components/autocomplete/moz.build
toolkit/components/mediasniffer/moz.build
toolkit/components/mediasniffer/nsMediaSniffer.h
toolkit/components/protobuf/moz.build
toolkit/components/url-classifier/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,26 +74,26 @@ ContainerEnumeratorImpl::ContainerEnumer
 {
 }
 
 nsresult
 ContainerEnumeratorImpl::Init()
 {
     if (gRefCnt++ == 0) {
         nsresult rv;
-        nsCOMPtr<nsIRDFService> rdf = do_GetService(kRDFServiceCID);
+        nsCOMPtr<nsIRDFService> rdf = do_GetService(NS_RDFSERVICE_CID);
         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;
 
-        rv = CallGetService(kRDFContainerUtilsCID, &gRDFC);
+        rv = CallGetService(NS_RDFCONTAINERUTILS_CID, &gRDFC);
         if (NS_FAILED(rv)) return rv;
     }
 
     return NS_OK;
 }
 
 
 ContainerEnumeratorImpl::~ContainerEnumeratorImpl()
--- a/rdf/base/src/nsRDFContainer.cpp
+++ b/rdf/base/src/nsRDFContainer.cpp
@@ -42,17 +42,16 @@
 #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
@@ -683,19 +682,19 @@ RDFContainerImpl::GetNextValue(nsIRDFRes
             if (*p < '0' || *p > '9')
                 break;
 
             nextVal *= 10;
             nextVal += *p - '0';
         }
     }
 
-    char buf[sizeof(kRDFNameSpaceURI) + 16];
+    char buf[sizeof(RDF_NAMESPACE_URI) + 16];
     nsFixedCString nextValStr(buf, sizeof(buf), 0);
-    nextValStr = kRDFNameSpaceURI;
+    nextValStr = RDF_NAMESPACE_URI;
     nextValStr.Append("_");
     nextValStr.AppendInt(nextVal, 10);
 
     rv = gRDFService->GetResource(nextValStr, aResult);
     if (NS_FAILED(rv)) return rv;
 
     // Now increment the RDF:nextVal property.
     rv = mDataSource->Unassert(mContainer, kRDF_nextVal, nextValLiteral);
--- a/rdf/base/src/nsRDFContainerUtils.cpp
+++ b/rdf/base/src/nsRDFContainerUtils.cpp
@@ -18,17 +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
 
@@ -320,17 +319,17 @@ RDFContainerUtilsImpl::MakeAlt(nsIRDFDat
 ////////////////////////////////////////////////////////////////////////
 
 
 RDFContainerUtilsImpl::RDFContainerUtilsImpl()
 {
     if (gRefCnt++ == 0) {
         nsresult rv;
 
-        rv = CallGetService(kRDFServiceCID, &gRDFService);
+        rv = CallGetService(NS_RDFSERVICE_CID, &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);
             gRDFService->GetResource(NS_LITERAL_CSTRING(RDF_NAMESPACE_URI "Bag"),
--- a/rdf/base/src/nsRDFContentSink.cpp
+++ b/rdf/base/src/nsRDFContentSink.cpp
@@ -69,23 +69,19 @@
 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
 
 ///////////////////////////////////////////////////////////////////////
 
@@ -277,17 +273,17 @@ RDFContentSinkImpl::RDFContentSinkImpl()
       mTextLength(0),
       mTextSize(0),
       mState(eRDFContentSinkState_InProlog),
       mParseMode(eRDFContentSinkParseMode_Literal),
       mContextStack(nullptr),
       mDocumentURL(nullptr)
 {
     if (gRefCnt++ == 0) {
-        nsresult rv = CallGetService(kRDFServiceCID, &gRDFService);
+        nsresult rv = CallGetService(NS_RDFSERVICE_CID, &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);
             rv = gRDFService->GetResource(NS_LITERAL_CSTRING(RDF_NAMESPACE_URI "Alt"),
@@ -296,17 +292,17 @@ RDFContentSinkImpl::RDFContentSinkImpl()
                                           &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);
         }
 
 
-        rv = CallGetService(kRDFContainerUtilsCID, &gRDFContainerUtils);
+        rv = CallGetService(NS_RDFCONTAINERUTILS_CID, &gRDFContainerUtils);
 
         NS_RegisterStaticAtoms(rdf_atoms);
     }
 
 #ifdef PR_LOGGING
     if (! gLog)
         gLog = PR_NewLogModule("nsRDFContentSink");
 #endif
@@ -380,17 +376,17 @@ RDFContentSinkImpl::QueryInterface(REFNS
     NS_PRECONDITION(result, "null ptr");
     if (! result)
         return NS_ERROR_NULL_POINTER;
 
     *result = nullptr;
     if (iid.Equals(kIRDFContentSinkIID) ||
         iid.Equals(kIXMLContentSinkIID) ||
         iid.Equals(kIContentSinkIID) ||
-        iid.Equals(kISupportsIID)) {
+        iid.Equals(NS_GET_IID(nsISupports))) {
         *result = static_cast<nsIXMLContentSink*>(this);
         AddRef();
         return NS_OK;
     }
     else if (iid.Equals(kIExpatSinkIID)) {
       *result = static_cast<nsIExpatSink*>(this);
        AddRef();
        return NS_OK;
--- a/rdf/base/src/nsRDFXMLDataSource.cpp
+++ b/rdf/base/src/nsRDFXMLDataSource.cpp
@@ -95,17 +95,16 @@
 #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
@@ -409,17 +408,17 @@ RDFXMLDataSourceImpl::RDFXMLDataSourceIm
 nsresult
 RDFXMLDataSourceImpl::Init()
 {
     nsresult rv;
     mInner = do_CreateInstance(kRDFInMemoryDataSourceCID, &rv);
     if (NS_FAILED(rv)) return rv;
 
     if (gRefCnt++ == 0) {
-        rv = CallGetService(kRDFServiceCID, &gRDFService);
+        rv = CallGetService(NS_RDFSERVICE_CID, &gRDFService);
 
         NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get RDF service");
         if (NS_FAILED(rv)) return rv;
     }
 
     return NS_OK;
 }
 
--- 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'
--- a/toolkit/components/alerts/moz.build
+++ b/toolkit/components/alerts/moz.build
@@ -7,16 +7,16 @@
 TEST_DIRS += ['test']
 
 XPIDL_SOURCES += [
     'nsIAlertsService.idl',
 ]
 
 XPIDL_MODULE = 'alerts'
 
-SOURCES += [
+UNIFIED_SOURCES += [
     'nsAlertsService.cpp',
     'nsXULAlerts.cpp',
 ]
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
 FINAL_LIBRARY = 'toolkitcomps'
--- a/toolkit/components/autocomplete/moz.build
+++ b/toolkit/components/autocomplete/moz.build
@@ -12,16 +12,16 @@ XPIDL_SOURCES += [
     'nsIAutoCompletePopup.idl',
     'nsIAutoCompleteResult.idl',
     'nsIAutoCompleteSearch.idl',
     'nsIAutoCompleteSimpleResult.idl',
 ]
 
 XPIDL_MODULE = 'autocomplete'
 
-SOURCES += [
+UNIFIED_SOURCES += [
     'nsAutoCompleteController.cpp',
     'nsAutoCompleteSimpleResult.cpp',
 ]
 
 FAIL_ON_WARNINGS = True
 
 FINAL_LIBRARY = 'xul'
--- a/toolkit/components/mediasniffer/moz.build
+++ b/toolkit/components/mediasniffer/moz.build
@@ -5,18 +5,15 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 TEST_DIRS += ['test']
 
 EXPORTS += [
     'nsMediaSniffer.h',
 ]
 
-SOURCES += [
+UNIFIED_SOURCES += [
+    'mp3sniff.c',
     'nsMediaSniffer.cpp',
     'nsMediaSnifferModule.cpp',
 ]
 
-SOURCES += [
-    'mp3sniff.c',
-]
-
 FINAL_LIBRARY = 'xul'
--- a/toolkit/components/mediasniffer/nsMediaSniffer.h
+++ b/toolkit/components/mediasniffer/nsMediaSniffer.h
@@ -1,14 +1,16 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim:set ts=2 sw=2 sts=2 tw=80 et cindent: */
 /* 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/. */
 
+#ifndef nsMediaSniffer_h
+#define nsMediaSniffer_h
 
 #include "nsIModule.h"
 #include "nsIFactory.h"
 
 #include "nsIComponentManager.h"
 #include "nsIComponentRegistrar.h"
 #include "nsIContentSniffer.h"
 #include "mozilla/Attributes.h"
@@ -35,8 +37,10 @@ class nsMediaSniffer MOZ_FINAL : public 
     const uint8_t* mMask;
     const uint8_t* mPattern;
     const uint32_t mLength;
     const char* mContentType;
   };
 
   static nsMediaSnifferEntry sSnifferEntries[];
 };
+
+#endif
--- a/toolkit/components/protobuf/moz.build
+++ b/toolkit/components/protobuf/moz.build
@@ -25,17 +25,17 @@ EXPORTS.protobuf.google.protobuf.io += [
     'google/protobuf/io/coded_stream.h',
     'google/protobuf/io/coded_stream_inl.h',
     'google/protobuf/io/zero_copy_stream.h',
     'google/protobuf/io/zero_copy_stream_impl.h',
     'google/protobuf/io/zero_copy_stream_impl_lite.h',
     'google/protobuf/package_info.h',
 ]
 
-SOURCES += [
+UNIFIED_SOURCES += [
     'google/protobuf/extension_set.cc',
     'google/protobuf/generated_message_util.cc',
     'google/protobuf/io/coded_stream.cc',
     'google/protobuf/io/zero_copy_stream.cc',
     'google/protobuf/io/zero_copy_stream_impl_lite.cc',
     'google/protobuf/message_lite.cc',
     'google/protobuf/repeated_field.cc',
     'google/protobuf/stubs/common.cc',
--- a/toolkit/components/url-classifier/moz.build
+++ b/toolkit/components/url-classifier/moz.build
@@ -12,30 +12,34 @@ XPIDL_SOURCES += [
     'nsIUrlClassifierPrefixSet.idl',
     'nsIUrlClassifierStreamUpdater.idl',
     'nsIUrlClassifierUtils.idl',
     'nsIUrlListManager.idl',
 ]
 
 XPIDL_MODULE = 'url-classifier'
 
-SOURCES += [
+UNIFIED_SOURCES += [
     'ChunkSet.cpp',
     'Classifier.cpp',
-    'HashStore.cpp',
     'LookupCache.cpp',
     'nsCheckSummedOutputStream.cpp',
     'nsUrlClassifierDBService.cpp',
     'nsUrlClassifierPrefixSet.cpp',
     'nsUrlClassifierProxies.cpp',
     'nsUrlClassifierStreamUpdater.cpp',
     'nsUrlClassifierUtils.cpp',
     'ProtocolParser.cpp',
 ]
 
+# contains variables that conflict with LookupCache.cpp
+SOURCES += [
+    'HashStore.cpp',
+]
+
 EXTRA_COMPONENTS += [
     'nsURLClassifier.manifest',
     'nsUrlClassifierHashCompleter.js',
 ]
 
 # Same as JS components that are run through the pre-processor.
 EXTRA_PP_COMPONENTS += [
     'nsUrlClassifierLib.js',