Bug 884061 - Part 3p: Use NS_DECL_THREADSAFE_ISUPPORTS in modules/, r=taras,bsmedberg
authorJoshua Cranmer <Pidgeot18@gmail.com>
Thu, 18 Jul 2013 21:23:44 -0500
changeset 152783 96104885ff185b6a60b4001752da605b6826cec9
parent 152782 f4087583ffc1439115ec1d11dbd44343dfd72a4b
child 152784 14bd6018f287849d5a43f0238cb01e9b1a81e29e
push id382
push userakeybl@mozilla.com
push dateMon, 21 Oct 2013 21:47:13 +0000
treeherdermozilla-release@5f1868ee45cb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstaras, bsmedberg
bugs884061
milestone25.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 884061 - Part 3p: Use NS_DECL_THREADSAFE_ISUPPORTS in modules/, r=taras,bsmedberg
modules/libjar/nsJAR.cpp
modules/libjar/nsJAR.h
modules/libjar/nsJARChannel.cpp
modules/libjar/nsJARChannel.h
modules/libjar/nsJARInputStream.cpp
modules/libjar/nsJARInputStream.h
modules/libjar/nsJARProtocolHandler.cpp
modules/libjar/nsJARProtocolHandler.h
modules/libjar/nsJARURI.cpp
modules/libjar/nsJARURI.h
modules/libjar/nsZipArchive.cpp
modules/libjar/nsZipArchive.h
modules/libjar/zipwriter/src/nsZipDataStream.cpp
modules/libjar/zipwriter/src/nsZipDataStream.h
modules/libpref/public/Preferences.h
modules/libpref/src/Preferences.cpp
modules/libpref/src/nsPrefBranch.cpp
modules/libpref/src/nsPrefBranch.h
--- a/modules/libjar/nsJAR.cpp
+++ b/modules/libjar/nsJAR.cpp
@@ -93,25 +93,25 @@ nsJAR::nsJAR(): mZip(new nsZipArchive())
 {
 }
 
 nsJAR::~nsJAR()
 {
   Close();
 }
 
-NS_IMPL_THREADSAFE_QUERY_INTERFACE1(nsJAR, nsIZipReader)
-NS_IMPL_THREADSAFE_ADDREF(nsJAR)
+NS_IMPL_QUERY_INTERFACE1(nsJAR, nsIZipReader)
+NS_IMPL_ADDREF(nsJAR)
 
 // Custom Release method works with nsZipReaderCache...
 nsrefcnt nsJAR::Release(void) 
 {
   nsrefcnt count; 
   NS_PRECONDITION(0 != mRefCnt, "dup release"); 
-  count = NS_AtomicDecrementRefcnt(mRefCnt); 
+  count = --mRefCnt;
   NS_LOG_RELEASE(this, count, "nsJAR"); 
   if (0 == count) {
     mRefCnt = 1; /* stabilize */ 
     /* enable this to find non-threadsafe destructors: */ 
     /* NS_ASSERT_OWNINGTHREAD(nsJAR); */ 
     delete this;
     return 0; 
   }
@@ -861,17 +861,17 @@ nsresult nsJAR::CalculateDigest(const ch
   if (NS_FAILED(rv)) return rv;
 
   rv = hasher->Update((const uint8_t*) aInBuf, aLen);
   if (NS_FAILED(rv)) return rv;
 
   return hasher->Finish(true, digest);
 }
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(nsJAREnumerator, nsIUTF8StringEnumerator)
+NS_IMPL_ISUPPORTS1(nsJAREnumerator, nsIUTF8StringEnumerator)
   
 //----------------------------------------------
 // nsJAREnumerator::HasMore
 //----------------------------------------------
 NS_IMETHODIMP
 nsJAREnumerator::HasMore(bool* aResult)
 {
     // try to get the next element
@@ -903,17 +903,17 @@ nsJAREnumerator::GetNext(nsACString& aRe
             return NS_ERROR_FAILURE; // no error translation
     }
     aResult.Assign(mName, mNameLen);
     mName = 0; // we just gave this one away
     return NS_OK;
 }
 
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(nsJARItem, nsIZipEntry)
+NS_IMPL_ISUPPORTS1(nsJARItem, nsIZipEntry)
 
 nsJARItem::nsJARItem(nsZipItem* aZipItem)
     : mSize(aZipItem->Size()),
       mRealsize(aZipItem->RealSize()),
       mCrc32(aZipItem->CRC32()),
       mLastModTime(aZipItem->LastModTime()),
       mCompression(aZipItem->Compression()),
       mIsDirectory(aZipItem->IsDirectory()),
@@ -1003,17 +1003,17 @@ nsJARItem::GetLastModifiedTime(PRTime* a
 
     *aLastModTime = mLastModTime;
     return NS_OK;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsIZipReaderCache
 
-NS_IMPL_THREADSAFE_ISUPPORTS3(nsZipReaderCache, nsIZipReaderCache, nsIObserver, nsISupportsWeakReference)
+NS_IMPL_ISUPPORTS3(nsZipReaderCache, nsIZipReaderCache, nsIObserver, nsISupportsWeakReference)
 
 nsZipReaderCache::nsZipReaderCache()
   : mLock("nsZipReaderCache.mLock")
   , mZips(16)
 #ifdef ZIP_CACHE_HIT_RATE
     ,
     mZipCacheLookups(0),
     mZipCacheHits(0),
--- a/modules/libjar/nsJAR.h
+++ b/modules/libjar/nsJAR.h
@@ -61,17 +61,17 @@ class nsJAR : public nsIZipReader
 
   public:
 
     nsJAR();
     virtual ~nsJAR();
     
     NS_DEFINE_STATIC_CID_ACCESSOR( NS_ZIPREADER_CID )
   
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
 
     NS_DECL_NSIZIPREADER
 
     nsresult GetJarPath(nsACString& aResult);
 
     PRIntervalTime GetReleaseTime() {
         return mReleaseTime;
     }
@@ -125,17 +125,17 @@ class nsJAR : public nsIZipReader
  * nsJARItem
  *
  * An individual JAR entry. A set of nsJARItems macthing a
  * supplied pattern are returned in a nsJAREnumerator.
  */
 class nsJARItem : public nsIZipEntry
 {
 public:
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSIZIPENTRY
     
     nsJARItem(nsZipItem* aZipItem);
     virtual ~nsJARItem() {}
 
 private:
     uint32_t     mSize;             /* size in original file */
     uint32_t     mRealsize;         /* inflated size */
@@ -150,17 +150,17 @@ private:
  * nsJAREnumerator
  *
  * Enumerates a list of files in a zip archive 
  * (based on a pattern match in its member nsZipFind).
  */
 class nsJAREnumerator MOZ_FINAL : public nsIUTF8StringEnumerator
 {
 public:
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSIUTF8STRINGENUMERATOR
 
     nsJAREnumerator(nsZipFind *aFind) : mFind(aFind), mName(nullptr) { 
       NS_ASSERTION(mFind, "nsJAREnumerator: Missing zipFind.");
     }
 
 private:
     nsZipFind    *mFind;
@@ -175,17 +175,17 @@ private:
 #if defined(DEBUG_warren) || defined(DEBUG_jband)
 #define ZIP_CACHE_HIT_RATE
 #endif
 
 class nsZipReaderCache : public nsIZipReaderCache, public nsIObserver,
                          public nsSupportsWeakReference
 {
 public:
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIZIPREADERCACHE
   NS_DECL_NSIOBSERVER
 
   nsZipReaderCache();
   virtual ~nsZipReaderCache();
 
   nsresult ReleaseZip(nsJAR* reader);
 
--- a/modules/libjar/nsJARChannel.cpp
+++ b/modules/libjar/nsJARChannel.cpp
@@ -56,17 +56,17 @@ static PRLogModuleInfo *gJarProtocolLog 
 // nsJARInputThunk
 //
 // this class allows us to do some extra work on the stream transport thread.
 //-----------------------------------------------------------------------------
 
 class nsJARInputThunk : public nsIInputStream
 {
 public:
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSIINPUTSTREAM
 
     nsJARInputThunk(nsIZipReader *zipReader,
                     nsIURI* fullJarURI,
                     const nsACString &jarEntry,
                     bool usingJarCache)
         : mUsingJarCache(usingJarCache)
         , mJarReader(zipReader)
@@ -99,17 +99,17 @@ private:
     bool                        mUsingJarCache;
     nsCOMPtr<nsIZipReader>      mJarReader;
     nsCString                   mJarDirSpec;
     nsCOMPtr<nsIInputStream>    mJarStream;
     nsCString                   mJarEntry;
     int64_t                     mContentLength;
 };
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(nsJARInputThunk, nsIInputStream)
+NS_IMPL_ISUPPORTS1(nsJARInputThunk, nsIInputStream)
 
 nsresult
 nsJARInputThunk::Init()
 {
     nsresult rv;
     if (ENTRY_IS_DIRECTORY(mJarEntry)) {
         // A directory stream also needs the Spec of the FullJarURI
         // because is included in the stream data itself.
--- a/modules/libjar/nsJARChannel.h
+++ b/modules/libjar/nsJARChannel.h
@@ -29,17 +29,17 @@ class nsJARInputThunk;
 
 class nsJARChannel : public nsIJARChannel
                    , public nsIDownloadObserver
                    , public nsIStreamListener
                    , public nsIRemoteOpenFileListener
                    , public nsHashPropertyBag
 {
 public:
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSIREQUEST
     NS_DECL_NSICHANNEL
     NS_DECL_NSIJARCHANNEL
     NS_DECL_NSIDOWNLOADOBSERVER
     NS_DECL_NSIREQUESTOBSERVER
     NS_DECL_NSISTREAMLISTENER
     NS_DECL_NSIREMOTEOPENFILELISTENER
 
--- a/modules/libjar/nsJARInputStream.cpp
+++ b/modules/libjar/nsJARInputStream.cpp
@@ -17,17 +17,17 @@
 #if defined(XP_WIN)
 #include <windows.h>
 #endif
 
 /*---------------------------------------------
  *  nsISupports implementation
  *--------------------------------------------*/
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(nsJARInputStream, nsIInputStream)
+NS_IMPL_ISUPPORTS1(nsJARInputStream, nsIInputStream)
 
 /*----------------------------------------------------------
  * nsJARInputStream implementation
  *--------------------------------------------------------*/
 
 nsresult
 nsJARInputStream::InitFile(nsJAR *aJar, nsZipItem *item)
 {
--- a/modules/libjar/nsJARInputStream.h
+++ b/modules/libjar/nsJARInputStream.h
@@ -24,17 +24,17 @@ class nsJARInputStream MOZ_FINAL : publi
         mOutSize(0), mInCrc(0), mOutCrc(0), mCurPos(0),
         mMode(MODE_NOTINITED)
     { 
       memset(&mZs, 0, sizeof(z_stream));
     }
 
     ~nsJARInputStream() { Close(); }
 
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSIINPUTSTREAM
    
     // takes ownership of |fd|, even on failure
     nsresult InitFile(nsJAR *aJar, nsZipItem *item);
 
     nsresult InitDirectory(nsJAR *aJar,
                            const nsACString& aJarDirSpec,
                            const char* aDir);
--- a/modules/libjar/nsJARProtocolHandler.cpp
+++ b/modules/libjar/nsJARProtocolHandler.cpp
@@ -119,17 +119,17 @@ nsJARProtocolHandler::RemoteOpenFileComp
     nsresult status = NS_SUCCEEDED(aStatus) ? NS_ERROR_ALREADY_OPENED : aStatus;
 
     uint32_t count = listeners.Length();
     for (uint32_t index = 0; index < count; index++) {
         listeners[index]->OnRemoteFileOpenComplete(status);
     }
 }
 
-NS_IMPL_THREADSAFE_ISUPPORTS3(nsJARProtocolHandler,
+NS_IMPL_ISUPPORTS3(nsJARProtocolHandler,
                               nsIJARProtocolHandler,
                               nsIProtocolHandler,
                               nsISupportsWeakReference)
 
 nsJARProtocolHandler*
 nsJARProtocolHandler::GetSingleton()
 {
     if (!gJarHandler) {
--- a/modules/libjar/nsJARProtocolHandler.h
+++ b/modules/libjar/nsJARProtocolHandler.h
@@ -22,17 +22,17 @@ template<class E, uint32_t N> class nsAu
 
 class nsJARProtocolHandler : public nsIJARProtocolHandler
                            , public nsSupportsWeakReference
 {
     typedef nsAutoTArray<nsCOMPtr<nsIRemoteOpenFileListener>, 5>
             RemoteFileListenerArray;
 
 public:
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSIPROTOCOLHANDLER
     NS_DECL_NSIJARPROTOCOLHANDLER
 
     // nsJARProtocolHandler methods:
     nsJARProtocolHandler();
     virtual ~nsJARProtocolHandler();
 
     static nsJARProtocolHandler *GetSingleton();
--- a/modules/libjar/nsJARURI.cpp
+++ b/modules/libjar/nsJARURI.cpp
@@ -32,18 +32,18 @@ nsJARURI::nsJARURI()
 {
 }
  
 nsJARURI::~nsJARURI()
 {
 }
 
 // XXX Why is this threadsafe?
-NS_IMPL_THREADSAFE_ADDREF(nsJARURI)
-NS_IMPL_THREADSAFE_RELEASE(nsJARURI)
+NS_IMPL_ADDREF(nsJARURI)
+NS_IMPL_RELEASE(nsJARURI)
 NS_INTERFACE_MAP_BEGIN(nsJARURI)
   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIJARURI)
   NS_INTERFACE_MAP_ENTRY(nsIURI)
   NS_INTERFACE_MAP_ENTRY(nsIURL)
   NS_INTERFACE_MAP_ENTRY(nsIJARURI)
   NS_INTERFACE_MAP_ENTRY(nsISerializable)
   NS_INTERFACE_MAP_ENTRY(nsIClassInfo)
   NS_INTERFACE_MAP_ENTRY(nsINestedURI)
--- a/modules/libjar/nsJARURI.h
+++ b/modules/libjar/nsJARURI.h
@@ -34,17 +34,17 @@
 
 class nsJARURI : public nsIJARURI,
                  public nsISerializable,
                  public nsIClassInfo,
                  public nsINestedURI,
                  public nsIIPCSerializableURI
 {
 public:
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSIURI
     NS_DECL_NSIURL
     NS_DECL_NSIJARURI
     NS_DECL_NSISERIALIZABLE
     NS_DECL_NSICLASSINFO
     NS_DECL_NSINESTEDURI
     NS_DECL_NSIIPCSERIALIZABLEURI
 
--- a/modules/libjar/nsZipArchive.cpp
+++ b/modules/libjar/nsZipArchive.cpp
@@ -158,18 +158,18 @@ nsZipHandle::nsZipHandle()
   : mFileData(nullptr)
   , mLen(0)
   , mMap(nullptr)
   , mRefCnt(0)
 {
   MOZ_COUNT_CTOR(nsZipHandle);
 }
 
-NS_IMPL_THREADSAFE_ADDREF(nsZipHandle)
-NS_IMPL_THREADSAFE_RELEASE(nsZipHandle)
+NS_IMPL_ADDREF(nsZipHandle)
+NS_IMPL_RELEASE(nsZipHandle)
 
 nsresult nsZipHandle::Init(nsIFile *file, nsZipHandle **ret, PRFileDesc **aFd)
 {
   mozilla::AutoFDClose fd;
   int32_t flags = PR_RDONLY;
 #if defined(XP_WIN)
   flags |= nsIFile::OS_READAHEAD;
 #endif
@@ -820,18 +820,18 @@ nsZipArchive::nsZipArchive()
   zipLog.AddRef();
 
   MOZ_COUNT_CTOR(nsZipArchive);
 
   // initialize the table to NULL
   memset(mFiles, 0, sizeof(mFiles));
 }
 
-NS_IMPL_THREADSAFE_ADDREF(nsZipArchive)
-NS_IMPL_THREADSAFE_RELEASE(nsZipArchive)
+NS_IMPL_ADDREF(nsZipArchive)
+NS_IMPL_RELEASE(nsZipArchive)
 
 nsZipArchive::~nsZipArchive()
 {
   CloseArchive();
 
   MOZ_COUNT_DTOR(nsZipArchive);
 
   zipLog.Release();
--- a/modules/libjar/nsZipArchive.h
+++ b/modules/libjar/nsZipArchive.h
@@ -15,16 +15,17 @@
 #define PL_ARENA_CONST_ALIGN_MASK  (sizeof(void*)-1)
 #endif
 #include "plarena.h"
 
 #include "zlib.h"
 #include "zipstruct.h"
 #include "nsAutoPtr.h"
 #include "nsIFile.h"
+#include "nsISupportsImpl.h" // For mozilla::ThreadSafeAutoRefCnt
 #include "mozilla/FileUtils.h"
 #include "mozilla/FileLocation.h"
 
 #if defined(XP_WIN) && defined(_MSC_VER)
 #define MOZ_WIN_MEM_TRY_BEGIN __try {
 #define MOZ_WIN_MEM_TRY_CATCH(cmd) }                                \
   __except(GetExceptionCode()==EXCEPTION_IN_PAGE_ERROR ?            \
            EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH)   \
@@ -199,17 +200,18 @@ public:
   /*
    * Refcounting
    */
   NS_METHOD_(nsrefcnt) AddRef(void);
   NS_METHOD_(nsrefcnt) Release(void);
 
 private:
   //--- private members ---
-  nsrefcnt      mRefCnt; /* ref count */
+  mozilla::ThreadSafeAutoRefCnt mRefCnt; /* ref count */
+  NS_DECL_OWNINGTHREAD
 
   nsZipItem*    mFiles[ZIP_TABSIZE];
   PLArenaPool   mArena;
 
   const char*   mCommentPtr;
   uint16_t      mCommentLen;
 
   // Whether we synthesized the directory entries
@@ -391,14 +393,15 @@ protected:
   mozilla::FileLocation mFile; /* source file if any, for logging */
 
 private:
   nsZipHandle();
   ~nsZipHandle();
 
   PRFileMap *                       mMap;    /* nspr datastructure for mmap */
   nsAutoPtr<nsZipItemPtr<uint8_t> > mBuf;
-  nsrefcnt                          mRefCnt; /* ref count */
+  mozilla::ThreadSafeAutoRefCnt     mRefCnt; /* ref count */
+  NS_DECL_OWNINGTHREAD
 };
 
 nsresult gZlibInit(z_stream *zs);
 
 #endif /* nsZipArchive_h_ */
--- a/modules/libjar/zipwriter/src/nsZipDataStream.cpp
+++ b/modules/libjar/zipwriter/src/nsZipDataStream.cpp
@@ -17,17 +17,17 @@
 
 /**
  * nsZipDataStream handles the writing an entry's into the zip file.
  * It is set up to wither write the data as is, or in the event that compression
  * has been requested to pass it through a stream converter.
  * Currently only the deflate compression method is supported.
  * The CRC checksum for the entry's data is also generated here.
  */
-NS_IMPL_THREADSAFE_ISUPPORTS2(nsZipDataStream, nsIStreamListener,
+NS_IMPL_ISUPPORTS2(nsZipDataStream, nsIStreamListener,
                                                nsIRequestObserver)
 
 nsresult nsZipDataStream::Init(nsZipWriter *aWriter,
                                nsIOutputStream *aStream,
                                nsZipHeader *aHeader,
                                int32_t aCompression)
 {
     mWriter = aWriter;
--- a/modules/libjar/zipwriter/src/nsZipDataStream.h
+++ b/modules/libjar/zipwriter/src/nsZipDataStream.h
@@ -10,17 +10,17 @@
 #include "nsIOutputStream.h"
 #include "nsIStreamListener.h"
 #include "nsAutoPtr.h"
 #include "mozilla/Attributes.h"
 
 class nsZipDataStream MOZ_FINAL : public nsIStreamListener
 {
 public:
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSIREQUESTOBSERVER
     NS_DECL_NSISTREAMLISTENER
 
     nsZipDataStream()
     {
     }
 
     nsresult Init(nsZipWriter *aWriter, nsIOutputStream *aStream,
--- a/modules/libpref/public/Preferences.h
+++ b/modules/libpref/public/Preferences.h
@@ -38,17 +38,17 @@ class PrefSetting;
 class Preferences : public nsIPrefService,
                     public nsIObserver,
                     public nsIPrefBranchInternal,
                     public nsSupportsWeakReference
 {
 public:
   typedef mozilla::dom::PrefSetting PrefSetting;
 
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIPREFSERVICE
   NS_FORWARD_NSIPREFBRANCH(sRootBranch->)
   NS_DECL_NSIOBSERVER
 
   Preferences();
   virtual ~Preferences();
 
   nsresult Init();
--- a/modules/libpref/src/Preferences.cpp
+++ b/modules/libpref/src/Preferences.cpp
@@ -322,18 +322,18 @@ Preferences::~Preferences()
   PREF_Cleanup();
 }
 
 
 /*
  * nsISupports Implementation
  */
 
-NS_IMPL_THREADSAFE_ADDREF(Preferences)
-NS_IMPL_THREADSAFE_RELEASE(Preferences)
+NS_IMPL_ADDREF(Preferences)
+NS_IMPL_RELEASE(Preferences)
 
 NS_INTERFACE_MAP_BEGIN(Preferences)
     NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIPrefService)
     NS_INTERFACE_MAP_ENTRY(nsIPrefService)
     NS_INTERFACE_MAP_ENTRY(nsIObserver)
     NS_INTERFACE_MAP_ENTRY(nsIPrefBranch)
     NS_INTERFACE_MAP_ENTRY(nsIPrefBranch2)
     NS_INTERFACE_MAP_ENTRY(nsIPrefBranchInternal)
--- a/modules/libpref/src/nsPrefBranch.cpp
+++ b/modules/libpref/src/nsPrefBranch.cpp
@@ -94,18 +94,18 @@ nsPrefBranch::~nsPrefBranch()
     observerService->RemoveObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID);
 }
 
 
 /*
  * nsISupports Implementation
  */
 
-NS_IMPL_THREADSAFE_ADDREF(nsPrefBranch)
-NS_IMPL_THREADSAFE_RELEASE(nsPrefBranch)
+NS_IMPL_ADDREF(nsPrefBranch)
+NS_IMPL_RELEASE(nsPrefBranch)
 
 NS_INTERFACE_MAP_BEGIN(nsPrefBranch)
   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIPrefBranch)
   NS_INTERFACE_MAP_ENTRY(nsIPrefBranch)
   NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIPrefBranch2, !mIsDefault)
   NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIPrefBranchInternal, !mIsDefault)
   NS_INTERFACE_MAP_ENTRY(nsIObserver)
   NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
@@ -828,18 +828,18 @@ nsPrefLocalizedString::~nsPrefLocalizedS
 {
 }
 
 
 /*
  * nsISupports Implementation
  */
 
-NS_IMPL_THREADSAFE_ADDREF(nsPrefLocalizedString)
-NS_IMPL_THREADSAFE_RELEASE(nsPrefLocalizedString)
+NS_IMPL_ADDREF(nsPrefLocalizedString)
+NS_IMPL_RELEASE(nsPrefLocalizedString)
 
 NS_INTERFACE_MAP_BEGIN(nsPrefLocalizedString)
     NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIPrefLocalizedString)
     NS_INTERFACE_MAP_ENTRY(nsIPrefLocalizedString)
     NS_INTERFACE_MAP_ENTRY(nsISupportsString)
 NS_INTERFACE_MAP_END
 
 nsresult nsPrefLocalizedString::Init()
@@ -882,17 +882,17 @@ nsPrefLocalizedString::SetDataWithLength
     return SetData(EmptyString());
   return SetData(Substring(aData, aLength));
 }
 
 //----------------------------------------------------------------------------
 // nsRelativeFilePref
 //----------------------------------------------------------------------------
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(nsRelativeFilePref, nsIRelativeFilePref)
+NS_IMPL_ISUPPORTS1(nsRelativeFilePref, nsIRelativeFilePref)
 
 nsRelativeFilePref::nsRelativeFilePref()
 {
 }
 
 nsRelativeFilePref::~nsRelativeFilePref()
 {
 }
--- a/modules/libpref/src/nsPrefBranch.h
+++ b/modules/libpref/src/nsPrefBranch.h
@@ -169,17 +169,17 @@ class PrefCallback : public PLDHashEntry
     }
 };
 
 class nsPrefBranch : public nsIPrefBranchInternal,
                      public nsIObserver,
                      public nsSupportsWeakReference
 {
 public:
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIPREFBRANCH
   NS_DECL_NSIPREFBRANCH2
   NS_DECL_NSIOBSERVER
 
   nsPrefBranch(const char *aPrefRoot, bool aDefaultBranch);
   virtual ~nsPrefBranch();
 
   int32_t GetRootLength() { return mPrefRootLength; }
@@ -222,17 +222,17 @@ private:
 
 class nsPrefLocalizedString : public nsIPrefLocalizedString,
                               public nsISupportsString
 {
 public:
   nsPrefLocalizedString();
   virtual ~nsPrefLocalizedString();
 
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_FORWARD_NSISUPPORTSSTRING(mUnicodeString->)
   NS_FORWARD_NSISUPPORTSPRIMITIVE(mUnicodeString->)
 
   nsresult Init();
 
 private:
   NS_IMETHOD GetData(PRUnichar**);
   NS_IMETHOD SetData(const PRUnichar* aData);
@@ -240,17 +240,17 @@ private:
 
   nsCOMPtr<nsISupportsString> mUnicodeString;
 };
 
 
 class nsRelativeFilePref : public nsIRelativeFilePref
 {
 public:
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIRELATIVEFILEPREF
   
                 nsRelativeFilePref();
   virtual       ~nsRelativeFilePref();
   
 private:
   nsCOMPtr<nsIFile> mFile;
   nsCString mRelativeToKey;