From 9cafa40bbee750ab6e4963be7e4081935ee1543c Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Thu, 19 Sep 2013 15:31:21 -0400 Subject: [PATCH] Bug 918105 - Minimize the #includes in xpcom/ds; r=bsmedberg --- modules/libjar/nsJARProtocolHandler.cpp | 1 + xpcom/ds/TimeStamp.h | 7 +++---- xpcom/ds/TimeStamp_darwin.cpp | 4 +--- xpcom/ds/TimeStamp_posix.cpp | 1 + xpcom/ds/nsArray.cpp | 3 ++- xpcom/ds/nsAtomTable.cpp | 7 +------ xpcom/ds/nsAtomTable.h | 3 +-- xpcom/ds/nsCRT.cpp | 4 +--- xpcom/ds/nsCRT.h | 1 - xpcom/ds/nsHashPropertyBag.cpp | 1 - xpcom/ds/nsHashPropertyBag.h | 3 --- xpcom/ds/nsHashtable.cpp | 5 ++--- xpcom/ds/nsHashtable.h | 12 ++---------- xpcom/ds/nsINIParserImpl.cpp | 2 -- xpcom/ds/nsObserverService.cpp | 6 ------ xpcom/ds/nsPersistentProperties.cpp | 8 -------- xpcom/ds/nsPersistentProperties.h | 5 ++--- xpcom/ds/nsProperties.cpp | 2 -- xpcom/ds/nsProperties.h | 2 -- xpcom/ds/nsStaticNameTable.cpp | 3 --- xpcom/ds/nsStaticNameTable.h | 2 +- xpcom/ds/nsStringEnumerator.cpp | 4 +--- xpcom/ds/nsStringEnumerator.h | 5 +++-- xpcom/ds/nsSupportsArray.cpp | 1 - xpcom/ds/nsSupportsPrimitives.cpp | 5 ----- xpcom/ds/nsSupportsPrimitives.h | 3 +-- xpcom/ds/nsVariant.cpp | 7 +++++-- xpcom/ds/nsVariant.h | 1 - 28 files changed, 28 insertions(+), 80 deletions(-) diff --git a/modules/libjar/nsJARProtocolHandler.cpp b/modules/libjar/nsJARProtocolHandler.cpp index 30750029c31..c47620c112c 100644 --- a/modules/libjar/nsJARProtocolHandler.cpp +++ b/modules/libjar/nsJARProtocolHandler.cpp @@ -21,6 +21,7 @@ #include "nsIHashable.h" #include "nsThreadUtils.h" #include "nsXULAppAPI.h" +#include "nsTArray.h" static NS_DEFINE_CID(kZipReaderCacheCID, NS_ZIPREADERCACHE_CID); diff --git a/xpcom/ds/TimeStamp.h b/xpcom/ds/TimeStamp.h index 0fa9d454d92..854d091ea5e 100644 --- a/xpcom/ds/TimeStamp.h +++ b/xpcom/ds/TimeStamp.h @@ -7,11 +7,10 @@ #ifndef mozilla_TimeStamp_h #define mozilla_TimeStamp_h +#include #include "mozilla/Assertions.h" #include "mozilla/Attributes.h" - -#include "prinrval.h" -#include "nsDebug.h" +#include "nscore.h" namespace IPC { template struct ParamTraits; @@ -261,7 +260,7 @@ public: TimeDuration operator-(const TimeStamp& aOther) const { MOZ_ASSERT(!IsNull(), "Cannot compute with a null value"); MOZ_ASSERT(!aOther.IsNull(), "Cannot compute with aOther null value"); - PR_STATIC_ASSERT(-INT64_MAX > INT64_MIN); + static_assert(-INT64_MAX > INT64_MIN, "int64_t sanity check"); int64_t ticks = int64_t(mValue - aOther.mValue); // Check for overflow. if (mValue > aOther.mValue) { diff --git a/xpcom/ds/TimeStamp_darwin.cpp b/xpcom/ds/TimeStamp_darwin.cpp index b2bd1f68629..4a32b04aa92 100644 --- a/xpcom/ds/TimeStamp_darwin.cpp +++ b/xpcom/ds/TimeStamp_darwin.cpp @@ -17,14 +17,12 @@ // of storing the time value in nanoseconds. #include -#include #include #include #include #include "mozilla/TimeStamp.h" -#include "nsCRT.h" -#include "prprf.h" +#include "nsDebug.h" // Estimate of the smallest duration of time we can measure. static uint64_t sResolution; diff --git a/xpcom/ds/TimeStamp_posix.cpp b/xpcom/ds/TimeStamp_posix.cpp index c3af5922772..3c42c70bcfb 100644 --- a/xpcom/ds/TimeStamp_posix.cpp +++ b/xpcom/ds/TimeStamp_posix.cpp @@ -50,6 +50,7 @@ #include "nsCRT.h" #include "prprf.h" #include "prthread.h" +#include "nsDebug.h" // Estimate of the smallest duration of time we can measure. static uint64_t sResolution; diff --git a/xpcom/ds/nsArray.cpp b/xpcom/ds/nsArray.cpp index 164bef3cea2..193e0476e61 100644 --- a/xpcom/ds/nsArray.cpp +++ b/xpcom/ds/nsArray.cpp @@ -5,7 +5,8 @@ #include "nsArray.h" #include "nsArrayEnumerator.h" -#include "nsWeakReference.h" +#include "nsIWeakReference.h" +#include "nsIWeakReferenceUtils.h" #include "nsThreadUtils.h" // used by IndexOf() diff --git a/xpcom/ds/nsAtomTable.cpp b/xpcom/ds/nsAtomTable.cpp index e21086ac450..e16ed88e995 100644 --- a/xpcom/ds/nsAtomTable.cpp +++ b/xpcom/ds/nsAtomTable.cpp @@ -11,9 +11,7 @@ #include "nsAtomTable.h" #include "nsStaticAtom.h" -#include "nsString.h" -#include "nsReadableUtils.h" -#include "nsUTF8Utils.h" +#include "nsStringGlue.h" #include "nsCRT.h" #include "pldhash.h" #include "prenv.h" @@ -23,9 +21,6 @@ #include "nsAutoPtr.h" #include "nsUnicharUtils.h" -#define PL_ARENA_CONST_ALIGN_MASK 3 -#include "plarena.h" - using namespace mozilla; /** diff --git a/xpcom/ds/nsAtomTable.h b/xpcom/ds/nsAtomTable.h index 0f9244cffbb..4b79c42a688 100644 --- a/xpcom/ds/nsAtomTable.h +++ b/xpcom/ds/nsAtomTable.h @@ -7,8 +7,7 @@ #define nsAtomTable_h__ #include "mozilla/MemoryReporting.h" -#include -#include "nscore.h" +#include void NS_PurgeAtomTable(); diff --git a/xpcom/ds/nsCRT.cpp b/xpcom/ds/nsCRT.cpp index 07557fdeb73..f7cf48cd3cc 100644 --- a/xpcom/ds/nsCRT.cpp +++ b/xpcom/ds/nsCRT.cpp @@ -20,9 +20,7 @@ #include "nsCRT.h" -#include "nsIServiceManager.h" -#include "nsCharTraits.h" -#include "nsUTF8Utils.h" +#include "nsDebug.h" //---------------------------------------------------------------------- diff --git a/xpcom/ds/nsCRT.h b/xpcom/ds/nsCRT.h index 4f8bea17acc..d49806d603f 100644 --- a/xpcom/ds/nsCRT.h +++ b/xpcom/ds/nsCRT.h @@ -6,7 +6,6 @@ #define nsCRT_h___ #include -#include #include #include "plstr.h" #include "nscore.h" diff --git a/xpcom/ds/nsHashPropertyBag.cpp b/xpcom/ds/nsHashPropertyBag.cpp index 80eb5ddb057..29ea0c8c3eb 100644 --- a/xpcom/ds/nsHashPropertyBag.cpp +++ b/xpcom/ds/nsHashPropertyBag.cpp @@ -7,7 +7,6 @@ #include "nsHashPropertyBag.h" #include "nsArray.h" #include "nsArrayEnumerator.h" -#include "nsComponentManagerUtils.h" #include "nsIVariant.h" #include "nsIProperty.h" #include "nsVariant.h" diff --git a/xpcom/ds/nsHashPropertyBag.h b/xpcom/ds/nsHashPropertyBag.h index 1a2941efcf5..71c396a50bd 100644 --- a/xpcom/ds/nsHashPropertyBag.h +++ b/xpcom/ds/nsHashPropertyBag.h @@ -6,9 +6,6 @@ #ifndef nsHashPropertyBag_h___ #define nsHashPropertyBag_h___ -#include "nsCOMPtr.h" -#include "nsCOMArray.h" - #include "nsIVariant.h" #include "nsIWritablePropertyBag.h" #include "nsIWritablePropertyBag2.h" diff --git a/xpcom/ds/nsHashtable.cpp b/xpcom/ds/nsHashtable.cpp index ca1becb7dd7..afe581bc5c0 100644 --- a/xpcom/ds/nsHashtable.cpp +++ b/xpcom/ds/nsHashtable.cpp @@ -15,13 +15,12 @@ */ #include -#include "pratom.h" #include "prlog.h" +#include "prlock.h" #include "nsHashtable.h" -#include "nsReadableUtils.h" #include "nsIObjectInputStream.h" #include "nsIObjectOutputStream.h" -#include "nsCRT.h" +#include "nsCRTGlue.h" #include "mozilla/HashFunctions.h" using namespace mozilla; diff --git a/xpcom/ds/nsHashtable.h b/xpcom/ds/nsHashtable.h index f88f93ce286..d1b0ccb71a9 100644 --- a/xpcom/ds/nsHashtable.h +++ b/xpcom/ds/nsHashtable.h @@ -23,15 +23,13 @@ #include "pldhash.h" #include "nscore.h" -#include "nsString.h" -#include "nsISupportsBase.h" +#include "nsISupports.h" #include "nsTraceRefcnt.h" +#include "nsStringFwd.h" class nsIObjectInputStream; class nsIObjectOutputStream; -class nsHashtable; -class nsStringKey; struct PRLock; class nsHashKey { @@ -157,8 +155,6 @@ class nsObjectHashtable : public nsHashtable { //////////////////////////////////////////////////////////////////////////////// // nsSupportsHashtable: an nsHashtable where the elements are nsISupports* -class nsISupports; - class nsSupportsHashtable : private nsHashtable { @@ -194,8 +190,6 @@ class nsSupportsHashtable //////////////////////////////////////////////////////////////////////////////// // nsISupportsKey: Where keys are nsISupports objects that get refcounted. -#include "nsISupports.h" - class nsISupportsKey : public nsHashKey { protected: nsISupports* mKey; @@ -301,8 +295,6 @@ class nsVoidKey : public nsHashKey { void* GetValue() { return mKey; } }; -#include "nsString.h" - // for null-terminated c-strings class nsCStringKey : public nsHashKey { public: diff --git a/xpcom/ds/nsINIParserImpl.cpp b/xpcom/ds/nsINIParserImpl.cpp index 76981a42437..1e442143637 100644 --- a/xpcom/ds/nsINIParserImpl.cpp +++ b/xpcom/ds/nsINIParserImpl.cpp @@ -4,8 +4,6 @@ #include "nsINIParserImpl.h" -#include "nsIFile.h" - #include "nsINIParser.h" #include "nsStringEnumerator.h" #include "nsTArray.h" diff --git a/xpcom/ds/nsObserverService.cpp b/xpcom/ds/nsObserverService.cpp index f03de844a59..6edc1e31135 100644 --- a/xpcom/ds/nsObserverService.cpp +++ b/xpcom/ds/nsObserverService.cpp @@ -5,17 +5,11 @@ #include "prlog.h" #include "nsAutoPtr.h" -#include "nsIFactory.h" -#include "nsIServiceManager.h" -#include "nsIComponentManager.h" #include "nsIObserverService.h" #include "nsIObserver.h" -#include "nsISimpleEnumerator.h" #include "nsObserverService.h" #include "nsObserverList.h" -#include "nsHashtable.h" #include "nsThreadUtils.h" -#include "nsIWeakReference.h" #include "nsEnumeratorUtils.h" #include "nsIMemoryReporter.h" #include "mozilla/net/NeckoCommon.h" diff --git a/xpcom/ds/nsPersistentProperties.cpp b/xpcom/ds/nsPersistentProperties.cpp index db5e6dcbe43..0b9b2606b64 100644 --- a/xpcom/ds/nsPersistentProperties.cpp +++ b/xpcom/ds/nsPersistentProperties.cpp @@ -6,20 +6,12 @@ #include "nsArrayEnumerator.h" #include "nsID.h" #include "nsCOMArray.h" -#include "nsCRT.h" -#include "nsReadableUtils.h" -#include "nsIInputStream.h" #include "nsUnicharInputStream.h" -#include "pratom.h" -#include "nsEnumeratorUtils.h" -#include "nsReadableUtils.h" #include "nsPrintfCString.h" -#include "nsDependentString.h" #define PL_ARENA_CONST_ALIGN_MASK 3 #include "nsPersistentProperties.h" #include "nsIProperties.h" -#include "nsProperties.h" struct PropertyTableEntry : public PLDHashEntryHdr { diff --git a/xpcom/ds/nsPersistentProperties.h b/xpcom/ds/nsPersistentProperties.h index 668d653ed31..71a621d6c99 100644 --- a/xpcom/ds/nsPersistentProperties.h +++ b/xpcom/ds/nsPersistentProperties.h @@ -9,12 +9,11 @@ #include "nsIPersistentProperties2.h" #include "pldhash.h" #include "plarena.h" -#include "nsString.h" +#include "nsStringGlue.h" #include "nsCOMPtr.h" #include "mozilla/Attributes.h" -#include "nsIUnicharInputStream.h" - +class nsIUnicharInputStream; class nsPersistentProperties MOZ_FINAL : public nsIPersistentProperties { diff --git a/xpcom/ds/nsProperties.cpp b/xpcom/ds/nsProperties.cpp index 0ab910cd899..27d1f28779e 100644 --- a/xpcom/ds/nsProperties.cpp +++ b/xpcom/ds/nsProperties.cpp @@ -4,8 +4,6 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "nsProperties.h" -#include "nsString.h" -#include "nsCRT.h" //////////////////////////////////////////////////////////////////////////////// diff --git a/xpcom/ds/nsProperties.h b/xpcom/ds/nsProperties.h index 771ad1138ea..d28be3ac34c 100644 --- a/xpcom/ds/nsProperties.h +++ b/xpcom/ds/nsProperties.h @@ -20,8 +20,6 @@ {0x93, 0xb6, 0x00, 0x10, 0x4b, 0xa0, 0xfd, 0x40} \ } -class nsIUnicharInputStream; - typedef nsInterfaceHashtable nsProperties_HashBase; diff --git a/xpcom/ds/nsStaticNameTable.cpp b/xpcom/ds/nsStaticNameTable.cpp index 33c4fbe2f0a..fdd0a4d70d1 100644 --- a/xpcom/ds/nsStaticNameTable.cpp +++ b/xpcom/ds/nsStaticNameTable.cpp @@ -9,9 +9,6 @@ #include "nsCRT.h" #include "nscore.h" -#include "nsString.h" -#include "nsReadableUtils.h" -#include "prbit.h" #include "mozilla/HashFunctions.h" #include "nsTraceRefcnt.h" diff --git a/xpcom/ds/nsStaticNameTable.h b/xpcom/ds/nsStaticNameTable.h index 6616c770e6b..081c55618fe 100644 --- a/xpcom/ds/nsStaticNameTable.h +++ b/xpcom/ds/nsStaticNameTable.h @@ -10,7 +10,7 @@ #define nsStaticNameTable_h___ #include "pldhash.h" -#include "nsString.h" +#include "nsStringGlue.h" /* This class supports case insensitive lookup. * diff --git a/xpcom/ds/nsStringEnumerator.cpp b/xpcom/ds/nsStringEnumerator.cpp index e840de4a9ba..c71bd5cebbe 100644 --- a/xpcom/ds/nsStringEnumerator.cpp +++ b/xpcom/ds/nsStringEnumerator.cpp @@ -5,12 +5,10 @@ #include "nsStringEnumerator.h" -#include "nsCRT.h" -#include "nsString.h" -#include "nsReadableUtils.h" #include "nsISimpleEnumerator.h" #include "nsSupportsPrimitives.h" #include "mozilla/Attributes.h" +#include "nsTArray.h" // // nsStringEnumerator diff --git a/xpcom/ds/nsStringEnumerator.h b/xpcom/ds/nsStringEnumerator.h index 3aeb6dcacbf..5c322d4972b 100644 --- a/xpcom/ds/nsStringEnumerator.h +++ b/xpcom/ds/nsStringEnumerator.h @@ -4,8 +4,9 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "nsIStringEnumerator.h" -#include "nsString.h" -#include "nsTArray.h" +#include "nsStringFwd.h" + +template class nsTArray; // nsIStringEnumerator/nsIUTF8StringEnumerator implementations // diff --git a/xpcom/ds/nsSupportsArray.cpp b/xpcom/ds/nsSupportsArray.cpp index 3a174d417e5..d692ab49ae5 100644 --- a/xpcom/ds/nsSupportsArray.cpp +++ b/xpcom/ds/nsSupportsArray.cpp @@ -7,7 +7,6 @@ #include "prbit.h" #include "nsSupportsArray.h" #include "nsSupportsArrayEnumerator.h" -#include "nsAString.h" #include "nsIObjectInputStream.h" #include "nsIObjectOutputStream.h" diff --git a/xpcom/ds/nsSupportsPrimitives.cpp b/xpcom/ds/nsSupportsPrimitives.cpp index eca65e9ffcd..a5c4f1d6146 100644 --- a/xpcom/ds/nsSupportsPrimitives.cpp +++ b/xpcom/ds/nsSupportsPrimitives.cpp @@ -4,13 +4,8 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "nsSupportsPrimitives.h" -#include "nsCRT.h" #include "nsMemory.h" #include "prprf.h" -#include "nsIInterfaceInfoManager.h" -#include "nsDependentString.h" -#include "nsReadableUtils.h" -#include "nsPromiseFlatString.h" /***************************************************************************/ diff --git a/xpcom/ds/nsSupportsPrimitives.h b/xpcom/ds/nsSupportsPrimitives.h index e9f16769242..72da261fee9 100644 --- a/xpcom/ds/nsSupportsPrimitives.h +++ b/xpcom/ds/nsSupportsPrimitives.h @@ -10,8 +10,7 @@ #include "nsISupportsPrimitives.h" #include "nsCOMPtr.h" -#include "nsString.h" -#include "nsDependentString.h" +#include "nsStringGlue.h" class nsSupportsIDImpl MOZ_FINAL : public nsISupportsID { diff --git a/xpcom/ds/nsVariant.cpp b/xpcom/ds/nsVariant.cpp index 32bb467dc45..20052026b28 100644 --- a/xpcom/ds/nsVariant.cpp +++ b/xpcom/ds/nsVariant.cpp @@ -7,12 +7,15 @@ /* The long avoided variant support for xpcom. */ #include "nsVariant.h" -#include "nsString.h" #include "prprf.h" #include "prdtoa.h" #include -#include "nsCRT.h" #include "nsCycleCollectionParticipant.h" +#include "xpt_struct.h" +#include "nsReadableUtils.h" +#include "nsMemory.h" +#include "nsStringGlue.h" +#include "nsCRTGlue.h" /***************************************************************************/ // Helpers for static convert functions... diff --git a/xpcom/ds/nsVariant.h b/xpcom/ds/nsVariant.h index 181a543c35d..c4c13a4519a 100644 --- a/xpcom/ds/nsVariant.h +++ b/xpcom/ds/nsVariant.h @@ -11,7 +11,6 @@ #include "nsIVariant.h" #include "nsStringFwd.h" -#include "xpt_struct.h" #include "mozilla/Attributes.h" class nsCycleCollectionTraversalCallback;