Bug 884061 - Part 3q: Use NS_DECL_THREADSAFE_ISUPPORTS in netwerk/, r=macmanus
authorJoshua Cranmer <Pidgeot18@gmail.com>
Thu, 18 Jul 2013 21:24:13 -0500
changeset 147194 14bd6018f287849d5a43f0238cb01e9b1a81e29e
parent 147193 96104885ff185b6a60b4001752da605b6826cec9
child 147195 3bd71784e8a01a6acbb827a21189e2252cef3c74
push id4085
push userbbajaj@mozilla.com
push dateMon, 05 Aug 2013 20:29:25 +0000
treeherdermozilla-aurora@ede8780a15bc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmacmanus
bugs884061
milestone25.0a1
Bug 884061 - Part 3q: Use NS_DECL_THREADSAFE_ISUPPORTS in netwerk/, r=macmanus
netwerk/base/public/nsAsyncRedirectVerifyHelper.h
netwerk/base/src/BackgroundFileSaver.cpp
netwerk/base/src/BackgroundFileSaver.h
netwerk/base/src/Dashboard.cpp
netwerk/base/src/Dashboard.h
netwerk/base/src/EventTokenBucket.cpp
netwerk/base/src/EventTokenBucket.h
netwerk/base/src/ProxyAutoConfig.cpp
netwerk/base/src/Tickler.cpp
netwerk/base/src/Tickler.h
netwerk/base/src/nsAsyncRedirectVerifyHelper.cpp
netwerk/base/src/nsAsyncStreamCopier.cpp
netwerk/base/src/nsAsyncStreamCopier.h
netwerk/base/src/nsBaseContentStream.cpp
netwerk/base/src/nsBaseContentStream.h
netwerk/base/src/nsBufferedStreams.cpp
netwerk/base/src/nsBufferedStreams.h
netwerk/base/src/nsDNSPrefetch.cpp
netwerk/base/src/nsDNSPrefetch.h
netwerk/base/src/nsDirectoryIndexStream.cpp
netwerk/base/src/nsDirectoryIndexStream.h
netwerk/base/src/nsFileStreams.cpp
netwerk/base/src/nsFileStreams.h
netwerk/base/src/nsIOService.cpp
netwerk/base/src/nsIOService.h
netwerk/base/src/nsIOThreadPool.cpp
netwerk/base/src/nsInputStreamPump.cpp
netwerk/base/src/nsInputStreamPump.h
netwerk/base/src/nsLoadGroup.cpp
netwerk/base/src/nsMIMEInputStream.cpp
netwerk/base/src/nsPACMan.cpp
netwerk/base/src/nsPACMan.h
netwerk/base/src/nsPreloadedStream.cpp
netwerk/base/src/nsPreloadedStream.h
netwerk/base/src/nsProtocolProxyService.cpp
netwerk/base/src/nsProxyInfo.cpp
netwerk/base/src/nsProxyInfo.h
netwerk/base/src/nsRequestObserverProxy.cpp
netwerk/base/src/nsRequestObserverProxy.h
netwerk/base/src/nsServerSocket.cpp
netwerk/base/src/nsServerSocket.h
netwerk/base/src/nsSocketTransport2.cpp
netwerk/base/src/nsSocketTransport2.h
netwerk/base/src/nsSocketTransportService2.cpp
netwerk/base/src/nsSocketTransportService2.h
netwerk/base/src/nsStreamListenerTee.cpp
netwerk/base/src/nsStreamListenerTee.h
netwerk/base/src/nsStreamTransportService.cpp
netwerk/base/src/nsStreamTransportService.h
netwerk/base/src/nsTemporaryFileInputStream.cpp
netwerk/base/src/nsTemporaryFileInputStream.h
netwerk/base/src/nsTransportUtils.cpp
netwerk/base/src/nsUDPServerSocket.cpp
netwerk/base/src/nsUDPServerSocket.h
netwerk/base/src/nsURLParsers.cpp
netwerk/base/src/nsURLParsers.h
netwerk/cache/nsCacheEntryDescriptor.cpp
netwerk/cache/nsCacheEntryDescriptor.h
netwerk/cache/nsCacheService.cpp
netwerk/cache/nsCacheService.h
netwerk/cache/nsDiskCacheBinding.cpp
netwerk/cache/nsDiskCacheBinding.h
netwerk/cache/nsDiskCacheDeviceSQL.cpp
netwerk/cache/nsDiskCacheDeviceSQL.h
netwerk/cache/nsDiskCacheStreams.cpp
netwerk/cache/nsDiskCacheStreams.h
netwerk/dns/nsDNSService2.cpp
netwerk/dns/nsDNSService2.h
netwerk/dns/nsIDNService.cpp
netwerk/dns/nsIDNService.h
netwerk/ipc/RemoteOpenFileChild.cpp
netwerk/ipc/RemoteOpenFileChild.h
netwerk/protocol/device/AndroidCaptureProvider.cpp
netwerk/protocol/device/AndroidCaptureProvider.h
netwerk/protocol/device/nsDeviceProtocolHandler.cpp
netwerk/protocol/device/nsDeviceProtocolHandler.h
netwerk/protocol/file/nsFileProtocolHandler.cpp
netwerk/protocol/file/nsFileProtocolHandler.h
netwerk/protocol/ftp/nsFTPChannel.cpp
netwerk/protocol/ftp/nsFtpProtocolHandler.cpp
netwerk/protocol/ftp/nsFtpProtocolHandler.h
netwerk/protocol/http/NullHttpTransaction.cpp
netwerk/protocol/http/NullHttpTransaction.h
netwerk/protocol/http/SpdyPush3.cpp
netwerk/protocol/http/SpdyPush3.h
netwerk/protocol/http/SpdySession2.cpp
netwerk/protocol/http/SpdySession2.h
netwerk/protocol/http/SpdySession3.cpp
netwerk/protocol/http/SpdySession3.h
netwerk/protocol/http/nsHttpActivityDistributor.cpp
netwerk/protocol/http/nsHttpActivityDistributor.h
netwerk/protocol/http/nsHttpConnection.cpp
netwerk/protocol/http/nsHttpConnection.h
netwerk/protocol/http/nsHttpConnectionInfo.h
netwerk/protocol/http/nsHttpConnectionMgr.cpp
netwerk/protocol/http/nsHttpConnectionMgr.h
netwerk/protocol/http/nsHttpHandler.cpp
netwerk/protocol/http/nsHttpHandler.h
netwerk/protocol/http/nsHttpPipeline.cpp
netwerk/protocol/http/nsHttpPipeline.h
netwerk/protocol/http/nsHttpTransaction.cpp
netwerk/protocol/http/nsHttpTransaction.h
netwerk/protocol/res/nsResProtocolHandler.cpp
netwerk/protocol/res/nsResProtocolHandler.h
netwerk/protocol/websocket/WebSocketChannel.cpp
netwerk/protocol/websocket/WebSocketChannel.h
netwerk/protocol/websocket/WebSocketChannelParent.cpp
netwerk/protocol/websocket/WebSocketChannelParent.h
netwerk/protocol/wyciwyg/nsWyciwygChannel.cpp
netwerk/protocol/wyciwyg/nsWyciwygChannel.h
netwerk/sctp/datachannel/DataChannel.cpp
netwerk/sctp/datachannel/DataChannel.h
netwerk/socket/nsSOCKSIOLayer.cpp
netwerk/socket/nsSOCKSSocketProvider.cpp
netwerk/socket/nsSOCKSSocketProvider.h
netwerk/socket/nsSocketProviderService.cpp
netwerk/socket/nsSocketProviderService.h
netwerk/socket/nsUDPSocketProvider.cpp
netwerk/socket/nsUDPSocketProvider.h
netwerk/streamconv/converters/nsHTTPCompressConv.cpp
netwerk/streamconv/converters/nsHTTPCompressConv.h
netwerk/system/win32/nsNotifyAddrListener.cpp
netwerk/system/win32/nsNotifyAddrListener.h
netwerk/test/TestCallbacks.cpp
netwerk/test/TestCommon.h
netwerk/test/TestDNS.cpp
netwerk/test/TestHttp.cpp
netwerk/test/TestIOThreads.cpp
netwerk/test/TestPageLoad.cpp
netwerk/test/TestProtocols.cpp
netwerk/test/TestServ.cpp
netwerk/test/TestSocketTransport.cpp
netwerk/test/TestStreamTransport.cpp
netwerk/test/TestUDPServerSocket.cpp
netwerk/wifi/nsWifiAccessPoint.cpp
netwerk/wifi/nsWifiAccessPoint.h
netwerk/wifi/nsWifiMonitor.cpp
netwerk/wifi/nsWifiMonitor.h
--- a/netwerk/base/public/nsAsyncRedirectVerifyHelper.h
+++ b/netwerk/base/public/nsAsyncRedirectVerifyHelper.h
@@ -21,17 +21,17 @@ class nsIChannel;
 /**
  * This class simplifies call of OnChannelRedirect of IOService and
  * the sink bound with the channel being redirected while the result of
  * redirect decision is returned through the callback.
  */
 class nsAsyncRedirectVerifyHelper MOZ_FINAL : public nsIRunnable,
                                               public nsIAsyncVerifyRedirectCallback
 {
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSIRUNNABLE
     NS_DECL_NSIASYNCVERIFYREDIRECTCALLBACK
 
 public:
     nsAsyncRedirectVerifyHelper();
 
     /*
      * Calls AsyncOnChannelRedirect() on the given sink with the given
--- a/netwerk/base/src/BackgroundFileSaver.cpp
+++ b/netwerk/base/src/BackgroundFileSaver.cpp
@@ -703,21 +703,21 @@ BackgroundFileSaver::NotifySaveComplete(
   }
 
   return NS_OK;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 //// BackgroundFileSaverOutputStream
 
-NS_IMPL_THREADSAFE_ISUPPORTS4(BackgroundFileSaverOutputStream,
-                              nsIBackgroundFileSaver,
-                              nsIOutputStream,
-                              nsIAsyncOutputStream,
-                              nsIOutputStreamCallback)
+NS_IMPL_ISUPPORTS4(BackgroundFileSaverOutputStream,
+                   nsIBackgroundFileSaver,
+                   nsIOutputStream,
+                   nsIAsyncOutputStream,
+                   nsIOutputStreamCallback)
 
 BackgroundFileSaverOutputStream::BackgroundFileSaverOutputStream()
 : BackgroundFileSaver()
 , mAsyncWaitCallback(nullptr)
 {
 }
 
 BackgroundFileSaverOutputStream::~BackgroundFileSaverOutputStream()
@@ -806,20 +806,20 @@ BackgroundFileSaverOutputStream::OnOutpu
   asyncWaitCallback.swap(mAsyncWaitCallback);
 
   return asyncWaitCallback->OnOutputStreamReady(this);
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 //// BackgroundFileSaverStreamListener
 
-NS_IMPL_THREADSAFE_ISUPPORTS3(BackgroundFileSaverStreamListener,
-                              nsIBackgroundFileSaver,
-                              nsIRequestObserver,
-                              nsIStreamListener)
+NS_IMPL_ISUPPORTS3(BackgroundFileSaverStreamListener,
+                   nsIBackgroundFileSaver,
+                   nsIRequestObserver,
+                   nsIStreamListener)
 
 BackgroundFileSaverStreamListener::BackgroundFileSaverStreamListener()
 : BackgroundFileSaver()
 , mSuspensionLock("BackgroundFileSaverStreamListener.mSuspensionLock")
 , mReceivedTooMuchData(false)
 , mRequest(nullptr)
 , mRequestSuspended(false)
 {
@@ -970,18 +970,18 @@ BackgroundFileSaverStreamListener::Notif
     }
   }
 
   return NS_OK;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 //// DigestOutputStream
-NS_IMPL_THREADSAFE_ISUPPORTS1(DigestOutputStream,
-                              nsIOutputStream)
+NS_IMPL_ISUPPORTS1(DigestOutputStream,
+                   nsIOutputStream)
 
 DigestOutputStream::DigestOutputStream(nsIOutputStream* aStream,
                                        PK11Context* aContext) :
   mOutputStream(aStream)
   , mDigestContext(aContext)
 {
   MOZ_ASSERT(mDigestContext, "Can't have null digest context");
   MOZ_ASSERT(mOutputStream, "Can't have null output stream");
--- a/netwerk/base/src/BackgroundFileSaver.h
+++ b/netwerk/base/src/BackgroundFileSaver.h
@@ -266,17 +266,17 @@ private:
 ////////////////////////////////////////////////////////////////////////////////
 //// BackgroundFileSaverOutputStream
 
 class BackgroundFileSaverOutputStream : public BackgroundFileSaver
                                       , public nsIAsyncOutputStream
                                       , public nsIOutputStreamCallback
 {
 public:
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIOUTPUTSTREAM
   NS_DECL_NSIASYNCOUTPUTSTREAM
   NS_DECL_NSIOUTPUTSTREAMCALLBACK
 
   BackgroundFileSaverOutputStream();
 
 protected:
   virtual bool HasInfiniteBuffer() MOZ_OVERRIDE;
@@ -294,17 +294,17 @@ private:
 ////////////////////////////////////////////////////////////////////////////////
 //// BackgroundFileSaverStreamListener. This class is instantiated by
 // nsExternalHelperAppService, DownloadCore.jsm, and possibly others.
 
 class BackgroundFileSaverStreamListener : public BackgroundFileSaver
                                         , public nsIStreamListener
 {
 public:
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIREQUESTOBSERVER
   NS_DECL_NSISTREAMLISTENER
 
   BackgroundFileSaverStreamListener();
 
 protected:
   virtual bool HasInfiniteBuffer() MOZ_OVERRIDE;
   virtual nsAsyncCopyProgressFun GetProgressCallback() MOZ_OVERRIDE;
@@ -346,17 +346,17 @@ private:
 
 // A wrapper around nsIOutputStream, so that we can compute hashes on the
 // stream without copying and without polluting pristine NSS code with XPCOM
 // interfaces.
 class DigestOutputStream : public nsNSSShutDownObject,
                            public nsIOutputStream
 {
 public:
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIOUTPUTSTREAM
   // Constructor. Neither parameter may be null. The caller owns both.
   DigestOutputStream(nsIOutputStream* outputStream, PK11Context* aContext);
   ~DigestOutputStream();
 
   // We don't own any NSS objects here, so no need to clean up
   void virtualDestroyNSSReference() { }
 
--- a/netwerk/base/src/Dashboard.cpp
+++ b/netwerk/base/src/Dashboard.cpp
@@ -8,17 +8,17 @@
 #include "mozilla/net/HttpInfo.h"
 #include "mozilla/dom/NetDashboardBinding.h"
 #include "jsapi.h"
 
 using mozilla::AutoSafeJSContext;
 namespace mozilla {
 namespace net {
 
-NS_IMPL_THREADSAFE_ISUPPORTS2(Dashboard, nsIDashboard, nsIDashboardEventNotifier)
+NS_IMPL_ISUPPORTS2(Dashboard, nsIDashboard, nsIDashboardEventNotifier)
 using mozilla::dom::Sequence;
 
 Dashboard::Dashboard()
 {
     mEnableLogging = false;
 }
 
 Dashboard::~Dashboard()
--- a/netwerk/base/src/Dashboard.h
+++ b/netwerk/base/src/Dashboard.h
@@ -19,17 +19,17 @@
 namespace mozilla {
 namespace net {
 
 class Dashboard:
     public nsIDashboard,
     public nsIDashboardEventNotifier
 {
 public:
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSIDASHBOARD
     NS_DECL_NSIDASHBOARDEVENTNOTIFIER
 
     Dashboard();
 private:
     virtual ~Dashboard();
 
     void GetSocketsDispatch();
--- a/netwerk/base/src/EventTokenBucket.cpp
+++ b/netwerk/base/src/EventTokenBucket.cpp
@@ -21,29 +21,29 @@ namespace net {
 
 ////////////////////////////////////////////
 // EventTokenBucketCancelable
 ////////////////////////////////////////////
 
 class TokenBucketCancelable : public nsICancelable
 {
 public:
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSICANCELABLE
 
   TokenBucketCancelable(class ATokenBucketEvent *event);
   virtual ~TokenBucketCancelable() {}
   void Fire();
 
 private:
   friend class EventTokenBucket;
   ATokenBucketEvent *mEvent;
 };
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(TokenBucketCancelable, nsICancelable)
+NS_IMPL_ISUPPORTS1(TokenBucketCancelable, nsICancelable)
 
 TokenBucketCancelable::TokenBucketCancelable(ATokenBucketEvent *event)
   : mEvent(event)
 {
 }
 
 NS_IMETHODIMP
 TokenBucketCancelable::Cancel(nsresult reason)
@@ -63,17 +63,17 @@ TokenBucketCancelable::Fire()
   mEvent = nullptr;
   event->OnTokenBucketAdmitted();
 }
 
 ////////////////////////////////////////////
 // EventTokenBucket
 ////////////////////////////////////////////
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(EventTokenBucket, nsITimerCallback)
+NS_IMPL_ISUPPORTS1(EventTokenBucket, nsITimerCallback)
 
 // by default 1hz with no burst
 EventTokenBucket::EventTokenBucket(uint32_t eventsPerSecond,
                                    uint32_t burstSize)
   : mUnitCost(kUsecPerSec)
   , mMaxCredit(kUsecPerSec)
   , mCredit(kUsecPerSec)
   , mPaused(false)
--- a/netwerk/base/src/EventTokenBucket.h
+++ b/netwerk/base/src/EventTokenBucket.h
@@ -64,17 +64,17 @@ public:
   virtual void OnTokenBucketAdmitted() = 0;
 };
 
 class TokenBucketCancelable;
 
 class EventTokenBucket : public nsITimerCallback
 {
 public:
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSITIMERCALLBACK
 
   // This should be constructed on the main thread
   EventTokenBucket(uint32_t eventsPerSecond, uint32_t burstSize);
   virtual ~EventTokenBucket();
 
   // These public methods are all meant to be called from the socket thread
   void ClearCredits();
--- a/netwerk/base/src/ProxyAutoConfig.cpp
+++ b/netwerk/base/src/ProxyAutoConfig.cpp
@@ -244,17 +244,17 @@ static const char *sPacUtils =
 // or reset.
 static ProxyAutoConfig *sRunning = nullptr;
 
 // The PACResolver is used for dnsResolve()
 class PACResolver MOZ_FINAL : public nsIDNSListener
                             , public nsITimerCallback
 {
 public:
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
 
   PACResolver()
     : mStatus(NS_ERROR_FAILURE)
   {
   }
 
   // nsIDNSListener
   NS_IMETHODIMP OnLookupComplete(nsICancelable *request,
@@ -281,17 +281,17 @@ public:
     return NS_OK;
   }
 
   nsresult                mStatus;
   nsCOMPtr<nsICancelable> mRequest;
   nsCOMPtr<nsIDNSRecord>  mResponse;
   nsCOMPtr<nsITimer>      mTimer;
 };
-NS_IMPL_THREADSAFE_ISUPPORTS2(PACResolver, nsIDNSListener, nsITimerCallback)
+NS_IMPL_ISUPPORTS2(PACResolver, nsIDNSListener, nsITimerCallback)
 
 static
 void PACLogToConsole(nsString &aMessage)
 {
   nsCOMPtr<nsIConsoleService> consoleService =
     do_GetService(NS_CONSOLESERVICE_CONTRACTID);
   if (!consoleService)
     return;
--- a/netwerk/base/src/Tickler.cpp
+++ b/netwerk/base/src/Tickler.cpp
@@ -12,17 +12,17 @@
 
 #ifdef MOZ_USE_WIFI_TICKLER
 
 #include "AndroidBridge.h"
 
 namespace mozilla {
 namespace net {
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(Tickler, nsISupportsWeakReference)
+NS_IMPL_ISUPPORTS1(Tickler, nsISupportsWeakReference)
 
 Tickler::Tickler()
     : mLock("Tickler::mLock")
     , mActive(false)
     , mCanceled(false)
     , mEnabled(false)
     , mDelay(16)
     , mDuration(TimeDuration::FromMilliseconds(400))
@@ -185,17 +185,17 @@ void Tickler::StopTickler()
   MOZ_ASSERT(mActive);
 
   mTimer->Cancel();
   mActive = false;
 }
 
 class TicklerTimer MOZ_FINAL : public nsITimerCallback
 {
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSITIMERCALLBACK
 
   TicklerTimer(Tickler *aTickler)
   {
     mTickler = do_GetWeakReference(aTickler);
   }
 
   ~TicklerTimer() {};
@@ -224,17 +224,17 @@ void Tickler::SetIPV4Address(uint32_t ad
 }
 
 // argument should be in network byte order
 void Tickler::SetIPV4Port(uint16_t port)
 {
   mAddr.inet.port = port;
 }
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(TicklerTimer, nsITimerCallback)
+NS_IMPL_ISUPPORTS1(TicklerTimer, nsITimerCallback)
 
 NS_IMETHODIMP TicklerTimer::Notify(nsITimer *timer)
 {
   nsRefPtr<Tickler> tickler = do_QueryReferent(mTickler);
   if (!tickler)
     return NS_ERROR_FAILURE;
   MutexAutoLock lock(tickler->mLock);
 
@@ -258,14 +258,14 @@ NS_IMETHODIMP TicklerTimer::Notify(nsITi
 
 } // namespace mozilla::net
 } // namespace mozilla
 
 #else // not defined MOZ_USE_WIFI_TICKLER
 
 namespace mozilla {
 namespace net {
-NS_IMPL_THREADSAFE_ISUPPORTS0(Tickler)
+NS_IMPL_ISUPPORTS0(Tickler)
 } // namespace mozilla::net
 } // namespace mozilla
 
 #endif // defined MOZ_USE_WIFI_TICKLER
 
--- a/netwerk/base/src/Tickler.h
+++ b/netwerk/base/src/Tickler.h
@@ -45,17 +45,17 @@ namespace net {
 #define MOZ_USE_WIFI_TICKLER
 #endif
 
 #ifdef MOZ_USE_WIFI_TICKLER
 
 class Tickler MOZ_FINAL : public nsSupportsWeakReference
 {
 public:
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
 
   // These methods are main thread only
   Tickler();
   ~Tickler();
   void Cancel();
   nsresult Init();
   void SetIPV4Address(uint32_t address);
   void SetIPV4Port(uint16_t port);
@@ -92,17 +92,17 @@ private:
   void StopTickler();
 };
 
 #else // not defined MOZ_USE_WIFI_TICKLER
 
 class Tickler MOZ_FINAL : public nsISupports
 {
 public:
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
 
   Tickler() { }
   ~Tickler() { }
   nsresult Init() { return NS_ERROR_NOT_IMPLEMENTED; }
   void Cancel() { }
   void SetIPV4Address(uint32_t) { };
   void SetIPV4Port(uint16_t) { }
   void Tickle() { }
--- a/netwerk/base/src/nsAsyncRedirectVerifyHelper.cpp
+++ b/netwerk/base/src/nsAsyncRedirectVerifyHelper.cpp
@@ -26,19 +26,19 @@ GetRedirectLog()
         sLog = PR_NewLogModule("nsRedirect");
     return sLog;
 }
 #define LOG(args) PR_LOG(GetRedirectLog(), PR_LOG_DEBUG, args)
 #else
 #define LOG(args)
 #endif
 
-NS_IMPL_THREADSAFE_ISUPPORTS2(nsAsyncRedirectVerifyHelper,
-                              nsIAsyncVerifyRedirectCallback,
-                              nsIRunnable)
+NS_IMPL_ISUPPORTS2(nsAsyncRedirectVerifyHelper,
+                   nsIAsyncVerifyRedirectCallback,
+                   nsIRunnable)
 
 class nsAsyncVerifyRedirectCallbackEvent : public nsRunnable {
 public:
     nsAsyncVerifyRedirectCallbackEvent(nsIAsyncVerifyRedirectCallback *cb,
                                        nsresult result)
         : mCallback(cb), mResult(result) {
     }
 
--- a/netwerk/base/src/nsAsyncStreamCopier.cpp
+++ b/netwerk/base/src/nsAsyncStreamCopier.cpp
@@ -83,17 +83,17 @@ nsAsyncStreamCopier::OnAsyncCopyComplete
     nsAsyncStreamCopier *self = (nsAsyncStreamCopier *) closure;
     self->Complete(status);
     NS_RELEASE(self); // addref'd in AsyncCopy
 }
 
 //-----------------------------------------------------------------------------
 // nsISupports
 
-NS_IMPL_THREADSAFE_ISUPPORTS2(nsAsyncStreamCopier,
+NS_IMPL_ISUPPORTS2(nsAsyncStreamCopier,
                               nsIRequest,
                               nsIAsyncStreamCopier)
 
 //-----------------------------------------------------------------------------
 // nsIRequest
 
 NS_IMETHODIMP
 nsAsyncStreamCopier::GetName(nsACString &name)
--- a/netwerk/base/src/nsAsyncStreamCopier.h
+++ b/netwerk/base/src/nsAsyncStreamCopier.h
@@ -13,17 +13,17 @@
 #include "nsStreamUtils.h"
 #include "nsCOMPtr.h"
 
 //-----------------------------------------------------------------------------
 
 class nsAsyncStreamCopier : public nsIAsyncStreamCopier
 {
 public:
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSIREQUEST
     NS_DECL_NSIASYNCSTREAMCOPIER
 
     nsAsyncStreamCopier();
     virtual ~nsAsyncStreamCopier();
 
     //-------------------------------------------------------------------------
     // these methods may be called on any thread
--- a/netwerk/base/src/nsBaseContentStream.cpp
+++ b/netwerk/base/src/nsBaseContentStream.cpp
@@ -27,18 +27,18 @@ nsBaseContentStream::DispatchCallback(bo
   mCallbackTarget = nullptr;
 
   callback->OnInputStreamReady(this);
 }
 
 //-----------------------------------------------------------------------------
 // nsBaseContentStream::nsISupports
 
-NS_IMPL_THREADSAFE_ADDREF(nsBaseContentStream)
-NS_IMPL_THREADSAFE_RELEASE(nsBaseContentStream)
+NS_IMPL_ADDREF(nsBaseContentStream)
+NS_IMPL_RELEASE(nsBaseContentStream)
 
 // We only support nsIAsyncInputStream when we are in non-blocking mode.
 NS_INTERFACE_MAP_BEGIN(nsBaseContentStream)
   NS_INTERFACE_MAP_ENTRY(nsIInputStream)
   NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIAsyncInputStream, mNonBlocking)
   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIInputStream)
 NS_INTERFACE_MAP_END_THREADSAFE
 
--- a/netwerk/base/src/nsBaseContentStream.h
+++ b/netwerk/base/src/nsBaseContentStream.h
@@ -31,17 +31,17 @@
 // base stream's CloseWithStatus (and Close) method will ensure that any
 // pending callback is dispatched.  It is the responsibility of the subclass
 // to ensure that the pending callback is dispatched when it wants to have its
 // ReadSegments method called again.
 
 class nsBaseContentStream : public nsIAsyncInputStream
 {
 public: 
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIINPUTSTREAM
   NS_DECL_NSIASYNCINPUTSTREAM
 
   nsBaseContentStream(bool nonBlocking)
     : mStatus(NS_OK)
     , mNonBlocking(nonBlocking) {
   }
 
--- a/netwerk/base/src/nsBufferedStreams.cpp
+++ b/netwerk/base/src/nsBufferedStreams.cpp
@@ -56,17 +56,17 @@ nsBufferedStream::nsBufferedStream()
 {
 }
 
 nsBufferedStream::~nsBufferedStream()
 {
     Close();
 }
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(nsBufferedStream, nsISeekableStream)
+NS_IMPL_ISUPPORTS1(nsBufferedStream, nsISeekableStream)
 
 nsresult
 nsBufferedStream::Init(nsISupports* stream, uint32_t bufferSize)
 {
     NS_ASSERTION(stream, "need to supply a stream");
     NS_ASSERTION(mStream == nullptr, "already inited");
     mStream = stream;
     NS_IF_ADDREF(mStream);
--- a/netwerk/base/src/nsBufferedStreams.h
+++ b/netwerk/base/src/nsBufferedStreams.h
@@ -15,17 +15,17 @@
 #include "nsCOMPtr.h"
 #include "nsIIPCSerializableInputStream.h"
 
 ////////////////////////////////////////////////////////////////////////////////
 
 class nsBufferedStream : public nsISeekableStream
 {
 public:
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSISEEKABLESTREAM
 
     nsBufferedStream();
     virtual ~nsBufferedStream();
 
     nsresult Close();
 
 protected:
--- a/netwerk/base/src/nsDNSPrefetch.cpp
+++ b/netwerk/base/src/nsDNSPrefetch.cpp
@@ -74,17 +74,17 @@ nsDNSPrefetch::PrefetchMedium()
 
 nsresult
 nsDNSPrefetch::PrefetchHigh()
 {
     return Prefetch(0);
 }
 
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(nsDNSPrefetch, nsIDNSListener)
+NS_IMPL_ISUPPORTS1(nsDNSPrefetch, nsIDNSListener)
 
 NS_IMETHODIMP
 nsDNSPrefetch::OnLookupComplete(nsICancelable *request,
                                 nsIDNSRecord  *rec,
                                 nsresult       status)
 {
     if (mStoreTiming)
         mEndTimestamp = mozilla::TimeStamp::Now();
--- a/netwerk/base/src/nsDNSPrefetch.h
+++ b/netwerk/base/src/nsDNSPrefetch.h
@@ -14,17 +14,17 @@
 #include "nsIDNSListener.h"
 
 class nsIURI;
 class nsIDNSService;
 
 class nsDNSPrefetch MOZ_FINAL : public nsIDNSListener
 {
 public:
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSIDNSLISTENER
   
     nsDNSPrefetch(nsIURI *aURI, bool storeTiming);
     bool TimingsValid() const {
         return !mStartTimestamp.IsNull() && !mEndTimestamp.IsNull();
     }
     // Only use the two timings if TimingsValid() returns true
     const mozilla::TimeStamp& StartTimestamp() const { return mStartTimestamp; }
--- a/netwerk/base/src/nsDirectoryIndexStream.cpp
+++ b/netwerk/base/src/nsDirectoryIndexStream.cpp
@@ -183,17 +183,17 @@ nsDirectoryIndexStream::Create(nsIFile* 
         return rv;
     }
 
     *aResult = result;
     NS_ADDREF(*aResult);
     return NS_OK;
 }
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(nsDirectoryIndexStream, nsIInputStream)
+NS_IMPL_ISUPPORTS1(nsDirectoryIndexStream, nsIInputStream)
 
 // The below routines are proxied to the UI thread!
 NS_IMETHODIMP
 nsDirectoryIndexStream::Close()
 {
     mStatus = NS_BASE_STREAM_CLOSED;
     return NS_OK;
 }
--- a/netwerk/base/src/nsDirectoryIndexStream.h
+++ b/netwerk/base/src/nsDirectoryIndexStream.h
@@ -35,16 +35,16 @@ private:
 public:
     /**
      * aDir will only be used on the calling thread.
      */ 
     static nsresult
     Create(nsIFile* aDir, nsIInputStream** aStreamResult);
 
     // nsISupportsInterface
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
 
     // nsIInputStream interface
     NS_DECL_NSIINPUTSTREAM
 };
 
 #endif // nsDirectoryIndexStream_h__
 
--- a/netwerk/base/src/nsFileStreams.cpp
+++ b/netwerk/base/src/nsFileStreams.cpp
@@ -46,19 +46,19 @@ nsFileStreamBase::nsFileStreamBase()
 {
 }
 
 nsFileStreamBase::~nsFileStreamBase()
 {
     Close();
 }
 
-NS_IMPL_THREADSAFE_ISUPPORTS2(nsFileStreamBase,
-                              nsISeekableStream,
-                              nsIFileMetadata)
+NS_IMPL_ISUPPORTS2(nsFileStreamBase,
+                   nsISeekableStream,
+                   nsIFileMetadata)
 
 NS_IMETHODIMP
 nsFileStreamBase::Seek(int32_t whence, int64_t offset)
 {
     nsresult rv = DoPendingOpen();
     NS_ENSURE_SUCCESS(rv, rv);
 
     if (mFD == nullptr)
--- a/netwerk/base/src/nsFileStreams.h
+++ b/netwerk/base/src/nsFileStreams.h
@@ -24,17 +24,17 @@
 
 
 ////////////////////////////////////////////////////////////////////////////////
 
 class nsFileStreamBase : public nsISeekableStream,
                          public nsIFileMetadata
 {
 public:
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSISEEKABLESTREAM
     NS_DECL_NSIFILEMETADATA
 
     nsFileStreamBase();
     virtual ~nsFileStreamBase();
 
 protected:
     nsresult Close();
--- a/netwerk/base/src/nsIOService.cpp
+++ b/netwerk/base/src/nsIOService.cpp
@@ -296,23 +296,23 @@ nsIOService::GetInstance() {
             return nullptr;
         }
         return gIOService;
     }
     NS_ADDREF(gIOService);
     return gIOService;
 }
 
-NS_IMPL_THREADSAFE_ISUPPORTS6(nsIOService,
-                              nsIIOService,
-                              nsIIOService2,
-                              nsINetUtil,
-                              nsISpeculativeConnect,
-                              nsIObserver,
-                              nsISupportsWeakReference)
+NS_IMPL_ISUPPORTS6(nsIOService,
+                   nsIIOService,
+                   nsIIOService2,
+                   nsINetUtil,
+                   nsISpeculativeConnect,
+                   nsIObserver,
+                   nsISupportsWeakReference)
 
 ////////////////////////////////////////////////////////////////////////////////
 
 nsresult
 nsIOService::AsyncOnChannelRedirect(nsIChannel* oldChan, nsIChannel* newChan,
                                     uint32_t flags,
                                     nsAsyncRedirectVerifyHelper *helper)
 {
--- a/netwerk/base/src/nsIOService.h
+++ b/netwerk/base/src/nsIOService.h
@@ -43,17 +43,17 @@ class nsIPrefBranch;
 
 class nsIOService MOZ_FINAL : public nsIIOService2
                             , public nsIObserver
                             , public nsINetUtil
                             , public nsISpeculativeConnect
                             , public nsSupportsWeakReference
 {
 public:
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSIIOSERVICE
     NS_DECL_NSIIOSERVICE2
     NS_DECL_NSIOBSERVER
     NS_DECL_NSINETUTIL
     NS_DECL_NSISPECULATIVECONNECT
 
     // Gets the singleton instance of the IO Service, creating it as needed
     // Returns nullptr on out of memory or failure to initialize.
--- a/netwerk/base/src/nsIOThreadPool.cpp
+++ b/netwerk/base/src/nsIOThreadPool.cpp
@@ -38,17 +38,17 @@ static PRLogModuleInfo *gIOThreadPoolLog
 // more than THREAD_IDLE_TIMEOUT.  the thread pool shuts down when it receives
 // the "xpcom-shutdown-threads" event.
 //-----------------------------------------------------------------------------
 
 class nsIOThreadPool : public nsIEventTarget
                      , public nsIObserver
 {
 public:
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSIEVENTTARGET
     NS_DECL_NSIOBSERVER
 
     nsresult Init();
     void     Shutdown();
 
 private:
     virtual ~nsIOThreadPool();
@@ -61,17 +61,17 @@ private:
     PRCondVar *mExitThreadCV;   // notified when a thread exits
     uint32_t   mNumThreads;     // number of active + idle threads
     uint32_t   mNumIdleThreads; // number of idle threads
     PRCList    mEventQ;         // queue of PLEvent structs
     bool       mShutdown;       // set to true if shutting down
     nsThreadPoolNaming mNaming; // thread name numbering
 };
 
-NS_IMPL_THREADSAFE_ISUPPORTS2(nsIOThreadPool, nsIEventTarget, nsIObserver)
+NS_IMPL_ISUPPORTS2(nsIOThreadPool, nsIEventTarget, nsIObserver)
 
 nsresult
 nsIOThreadPool::Init()
 {
 #if defined(PR_LOGGING)
     if (!gIOThreadPoolLog)
         gIOThreadPoolLog = PR_NewLogModule("nsIOThreadPool");
 #endif
--- a/netwerk/base/src/nsInputStreamPump.cpp
+++ b/netwerk/base/src/nsInputStreamPump.cpp
@@ -150,21 +150,21 @@ nsInputStreamPump::EnsureWaiting()
 
 //-----------------------------------------------------------------------------
 // nsInputStreamPump::nsISupports
 //-----------------------------------------------------------------------------
 
 // although this class can only be accessed from one thread at a time, we do
 // allow its ownership to move from thread to thread, assuming the consumer
 // understands the limitations of this.
-NS_IMPL_THREADSAFE_ISUPPORTS4(nsInputStreamPump,
-                              nsIRequest,
-                              nsIThreadRetargetableRequest,
-                              nsIInputStreamCallback,
-                              nsIInputStreamPump)
+NS_IMPL_ISUPPORTS4(nsInputStreamPump,
+                   nsIRequest,
+                   nsIThreadRetargetableRequest,
+                   nsIInputStreamCallback,
+                   nsIInputStreamPump)
 
 //-----------------------------------------------------------------------------
 // nsInputStreamPump::nsIRequest
 //-----------------------------------------------------------------------------
 
 NS_IMETHODIMP
 nsInputStreamPump::GetName(nsACString &result)
 {
--- a/netwerk/base/src/nsInputStreamPump.h
+++ b/netwerk/base/src/nsInputStreamPump.h
@@ -19,17 +19,17 @@
 #include "nsCOMPtr.h"
 #include "mozilla/Attributes.h"
 
 class nsInputStreamPump MOZ_FINAL : public nsIInputStreamPump
                                   , public nsIInputStreamCallback
                                   , public nsIThreadRetargetableRequest
 {
 public:
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSIREQUEST
     NS_DECL_NSIINPUTSTREAMPUMP
     NS_DECL_NSIINPUTSTREAMCALLBACK
     NS_DECL_NSITHREADRETARGETABLEREQUEST
 
     nsInputStreamPump(); 
     ~nsInputStreamPump();
 
--- a/netwerk/base/src/nsLoadGroup.cpp
+++ b/netwerk/base/src/nsLoadGroup.cpp
@@ -1043,26 +1043,26 @@ nsresult nsLoadGroup::MergeLoadFlags(nsI
     return rv;
 }
 
 // nsLoadGroupConnectionInfo
 
 class nsLoadGroupConnectionInfo MOZ_FINAL : public nsILoadGroupConnectionInfo
 {
 public:
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSILOADGROUPCONNECTIONINFO
 
     nsLoadGroupConnectionInfo();
 private:
     int32_t       mBlockingTransactionCount; // signed for PR_ATOMIC_*
     nsAutoPtr<mozilla::net::SpdyPushCache3> mSpdyCache3;
 };
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(nsLoadGroupConnectionInfo, nsILoadGroupConnectionInfo)
+NS_IMPL_ISUPPORTS1(nsLoadGroupConnectionInfo, nsILoadGroupConnectionInfo)
 
 nsLoadGroupConnectionInfo::nsLoadGroupConnectionInfo()
     : mBlockingTransactionCount(0)
 {
 }
 
 NS_IMETHODIMP
 nsLoadGroupConnectionInfo::GetBlockingTransactionCount(uint32_t *aBlockingTransactionCount)
--- a/netwerk/base/src/nsMIMEInputStream.cpp
+++ b/netwerk/base/src/nsMIMEInputStream.cpp
@@ -27,17 +27,17 @@ using namespace mozilla::ipc;
 class nsMIMEInputStream : public nsIMIMEInputStream,
                           public nsISeekableStream,
                           public nsIIPCSerializableInputStream
 {
 public:
     nsMIMEInputStream();
     virtual ~nsMIMEInputStream();
 
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSIINPUTSTREAM
     NS_DECL_NSIMIMEINPUTSTREAM
     NS_DECL_NSISEEKABLESTREAM
     NS_DECL_NSIIPCSERIALIZABLEINPUTSTREAM
 
     NS_METHOD Init();
 
 private:
@@ -60,18 +60,18 @@ private:
     nsCOMPtr<nsIStringInputStream> mCLStream;
     
     nsCOMPtr<nsIInputStream> mData;
     nsCOMPtr<nsIMultiplexInputStream> mStream;
     bool mAddContentLength;
     bool mStartedReading;
 };
 
-NS_IMPL_THREADSAFE_ADDREF(nsMIMEInputStream)
-NS_IMPL_THREADSAFE_RELEASE(nsMIMEInputStream)
+NS_IMPL_ADDREF(nsMIMEInputStream)
+NS_IMPL_RELEASE(nsMIMEInputStream)
 
 NS_IMPL_CLASSINFO(nsMIMEInputStream, NULL, nsIClassInfo::THREADSAFE,
                   NS_MIMEINPUTSTREAM_CID)
 
 NS_IMPL_QUERY_INTERFACE4_CI(nsMIMEInputStream,
                             nsIMIMEInputStream,
                             nsIInputStream,
                             nsISeekableStream,
--- a/netwerk/base/src/nsPACMan.cpp
+++ b/netwerk/base/src/nsPACMan.cpp
@@ -557,18 +557,18 @@ nsPACMan::ProcessPending()
     nsresult status = mPAC.GetProxyForURI(query->mSpec, query->mHost, pacString);
     query->Complete(status, pacString);
   }
 
   mInProgress = false;
   return true;
 }
 
-NS_IMPL_THREADSAFE_ISUPPORTS3(nsPACMan, nsIStreamLoaderObserver,
-                              nsIInterfaceRequestor, nsIChannelEventSink)
+NS_IMPL_ISUPPORTS3(nsPACMan, nsIStreamLoaderObserver,
+                   nsIInterfaceRequestor, nsIChannelEventSink)
 
 NS_IMETHODIMP
 nsPACMan::OnStreamComplete(nsIStreamLoader *loader,
                            nsISupports *context,
                            nsresult status,
                            uint32_t dataLen,
                            const uint8_t *data)
 {
--- a/netwerk/base/src/nsPACMan.h
+++ b/netwerk/base/src/nsPACMan.h
@@ -78,17 +78,17 @@ private:
  * defined on this class are intended to be called on the main thread only.
  */
 
 class nsPACMan MOZ_FINAL : public nsIStreamLoaderObserver
                          , public nsIInterfaceRequestor
                          , public nsIChannelEventSink
 {
 public:
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
 
   nsPACMan();
 
   /**
    * This method may be called to shutdown the PAC manager.  Any async queries
    * that have not yet completed will either finish normally or be canceled by
    * the time this method returns.
    */
--- a/netwerk/base/src/nsPreloadedStream.cpp
+++ b/netwerk/base/src/nsPreloadedStream.cpp
@@ -8,19 +8,19 @@
 
 #include "nsThreadUtils.h"
 #include "nsAlgorithm.h"
 #include <algorithm>
    
 namespace mozilla {
 namespace net {
 
-NS_IMPL_THREADSAFE_ISUPPORTS2(nsPreloadedStream,
-                              nsIInputStream,
-                              nsIAsyncInputStream)
+NS_IMPL_ISUPPORTS2(nsPreloadedStream,
+                   nsIInputStream,
+                   nsIAsyncInputStream)
 
 nsPreloadedStream::nsPreloadedStream(nsIAsyncInputStream *aStream,
                                      const char *data, uint32_t datalen)
     : mStream(aStream),
       mOffset(0),
       mLen(datalen)
 {
     mBuf = (char *) moz_xmalloc(datalen);
--- a/netwerk/base/src/nsPreloadedStream.h
+++ b/netwerk/base/src/nsPreloadedStream.h
@@ -25,17 +25,17 @@
 #include "mozilla/Attributes.h"
 
 namespace mozilla {
 namespace net {
 
 class nsPreloadedStream MOZ_FINAL : public nsIAsyncInputStream
 {
  public:
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSIINPUTSTREAM
     NS_DECL_NSIASYNCINPUTSTREAM
 
     nsPreloadedStream(nsIAsyncInputStream *aStream, 
                       const char *data, uint32_t datalen);
 private:
     ~nsPreloadedStream();
 
--- a/netwerk/base/src/nsProtocolProxyService.cpp
+++ b/netwerk/base/src/nsProtocolProxyService.cpp
@@ -71,17 +71,17 @@ struct nsProtocolInfo {
 // The nsPACManCallback portion of this implementation should be run
 // on the main thread - so call nsPACMan::AsyncGetProxyForURI() with
 // a true mainThreadResponse parameter.
 class nsAsyncResolveRequest MOZ_FINAL : public nsIRunnable
                                       , public nsPACManCallback
                                       , public nsICancelable
 {
 public:
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
 
     nsAsyncResolveRequest(nsProtocolProxyService *pps, nsIURI *uri,
                           uint32_t aResolveFlags,
                           nsIProtocolProxyCallback *callback)
         : mStatus(NS_OK)
         , mDispatched(false)
         , mResolveFlags(aResolveFlags)
         , mPPS(pps)
@@ -268,17 +268,17 @@ private:
 
     nsProtocolProxyService            *mPPS;
     nsCOMPtr<nsIProtocolProxyService>  mXPComPPS;
     nsCOMPtr<nsIURI>                   mURI;
     nsCOMPtr<nsIProtocolProxyCallback> mCallback;
     nsCOMPtr<nsIProxyInfo>             mProxyInfo;
 };
 
-NS_IMPL_THREADSAFE_ISUPPORTS2(nsAsyncResolveRequest, nsICancelable, nsIRunnable)
+NS_IMPL_ISUPPORTS2(nsAsyncResolveRequest, nsICancelable, nsIRunnable)
 
 //----------------------------------------------------------------------------
 
 #define IS_ASCII_SPACE(_c) ((_c) == ' ' || (_c) == '\t')
 
 //
 // apply mask to address (zeros out excluded bits).
 //
@@ -967,17 +967,17 @@ nsProtocolProxyService::ReloadPAC()
 // When sync interface is removed this can go away too
 // The nsPACManCallback portion of this implementation should be run
 // off the main thread, because it uses a condvar for signaling and
 // the main thread is blocking on that condvar -
 //  so call nsPACMan::AsyncGetProxyForURI() with
 // a false mainThreadResponse parameter.
 class nsAsyncBridgeRequest MOZ_FINAL  : public nsPACManCallback
 {
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
 
      nsAsyncBridgeRequest()
         : mMutex("nsDeprecatedCallback")
         , mCondVar(mMutex, "nsDeprecatedCallback")
         , mCompleted(false)
     {
     }
 
@@ -1007,17 +1007,17 @@ private:
     Mutex    mMutex;
     CondVar  mCondVar;
 
     nsresult  mStatus;
     nsCString mPACString;
     nsCString mPACURL;
     bool      mCompleted;
 };
-NS_IMPL_THREADSAFE_ISUPPORTS1(nsAsyncBridgeRequest, nsPACManCallback)
+NS_IMPL_ISUPPORTS1(nsAsyncBridgeRequest, nsPACManCallback)
 
 // nsIProtocolProxyService2
 NS_IMETHODIMP
 nsProtocolProxyService::DeprecatedBlockingResolve(nsIURI *aURI,
                                                   uint32_t aFlags,
                                                   nsIProxyInfo **retval)
 {
     NS_ENSURE_ARG_POINTER(aURI);
--- a/netwerk/base/src/nsProxyInfo.cpp
+++ b/netwerk/base/src/nsProxyInfo.cpp
@@ -3,17 +3,17 @@
 /* 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/. */
 
 #include "nsProxyInfo.h"
 #include "nsCOMPtr.h"
 
 // Yes, we support QI to nsProxyInfo
-NS_IMPL_THREADSAFE_ISUPPORTS2(nsProxyInfo, nsProxyInfo, nsIProxyInfo) 
+NS_IMPL_ISUPPORTS2(nsProxyInfo, nsProxyInfo, nsIProxyInfo) 
 
 using namespace mozilla;
 
 NS_IMETHODIMP
 nsProxyInfo::GetHost(nsACString &result)
 {
   result = mHost;
   return NS_OK;
--- a/netwerk/base/src/nsProxyInfo.h
+++ b/netwerk/base/src/nsProxyInfo.h
@@ -22,17 +22,17 @@
 
 // This class is exposed to other classes inside Necko for fast access
 // to the nsIProxyInfo attributes.
 class nsProxyInfo MOZ_FINAL : public nsIProxyInfo
 {
 public:
   NS_DECLARE_STATIC_IID_ACCESSOR(NS_PROXYINFO_IID)
 
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIPROXYINFO
 
   // Cheap accessors for use within Necko
   const nsCString &Host()  { return mHost; }
   int32_t          Port()  { return mPort; }
   const char      *Type()  { return mType; }
   uint32_t         Flags() { return mFlags; }
 
--- a/netwerk/base/src/nsRequestObserverProxy.cpp
+++ b/netwerk/base/src/nsRequestObserverProxy.cpp
@@ -110,19 +110,19 @@ public:
         return NS_OK;
     }
 };
 
 //-----------------------------------------------------------------------------
 // nsRequestObserverProxy::nsISupports implementation...
 //-----------------------------------------------------------------------------
 
-NS_IMPL_THREADSAFE_ISUPPORTS2(nsRequestObserverProxy,
-                              nsIRequestObserver,
-                              nsIRequestObserverProxy)
+NS_IMPL_ISUPPORTS2(nsRequestObserverProxy,
+                   nsIRequestObserver,
+                   nsIRequestObserverProxy)
 
 //-----------------------------------------------------------------------------
 // nsRequestObserverProxy::nsIRequestObserver implementation...
 //-----------------------------------------------------------------------------
 
 NS_IMETHODIMP 
 nsRequestObserverProxy::OnStartRequest(nsIRequest *request,
                                        nsISupports *context)
--- a/netwerk/base/src/nsRequestObserverProxy.h
+++ b/netwerk/base/src/nsRequestObserverProxy.h
@@ -13,17 +13,17 @@
 #include "nsCOMPtr.h"
 #include "nsProxyRelease.h"
 
 class nsARequestObserverEvent;
 
 class nsRequestObserverProxy MOZ_FINAL : public nsIRequestObserverProxy
 {
 public:
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSIREQUESTOBSERVER
     NS_DECL_NSIREQUESTOBSERVERPROXY
 
     nsRequestObserverProxy() {}
 
     nsIRequestObserver *Observer() { return mObserver; }
 
     nsresult FireEvent(nsARequestObserverEvent *);
--- a/netwerk/base/src/nsServerSocket.cpp
+++ b/netwerk/base/src/nsServerSocket.cpp
@@ -239,17 +239,17 @@ nsServerSocket::KeepWhenOffline(bool *aK
 {
   *aKeepWhenOffline = mKeepWhenOffline;
 }
 
 //-----------------------------------------------------------------------------
 // nsServerSocket::nsISupports
 //-----------------------------------------------------------------------------
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(nsServerSocket, nsIServerSocket)
+NS_IMPL_ISUPPORTS1(nsServerSocket, nsIServerSocket)
 
 
 //-----------------------------------------------------------------------------
 // nsServerSocket::nsIServerSocket
 //-----------------------------------------------------------------------------
 
 NS_IMETHODIMP
 nsServerSocket::Init(int32_t aPort, bool aLoopbackOnly, int32_t aBackLog)
@@ -359,17 +359,17 @@ namespace {
 class ServerSocketListenerProxy MOZ_FINAL : public nsIServerSocketListener
 {
 public:
   ServerSocketListenerProxy(nsIServerSocketListener* aListener)
     : mListener(new nsMainThreadPtrHolder<nsIServerSocketListener>(aListener))
     , mTargetThread(do_GetCurrentThread())
   { }
 
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSISERVERSOCKETLISTENER
 
   class OnSocketAcceptedRunnable : public nsRunnable
   {
   public:
     OnSocketAcceptedRunnable(const nsMainThreadPtrHandle<nsIServerSocketListener>& aListener,
                              nsIServerSocket* aServ,
                              nsISocketTransport* aTransport)
@@ -405,18 +405,18 @@ public:
     nsresult mStatus;
   };
 
 private:
   nsMainThreadPtrHandle<nsIServerSocketListener> mListener;
   nsCOMPtr<nsIEventTarget> mTargetThread;
 };
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(ServerSocketListenerProxy,
-                              nsIServerSocketListener)
+NS_IMPL_ISUPPORTS1(ServerSocketListenerProxy,
+                   nsIServerSocketListener)
 
 NS_IMETHODIMP
 ServerSocketListenerProxy::OnSocketAccepted(nsIServerSocket* aServ,
                                             nsISocketTransport* aTransport)
 {
   nsRefPtr<OnSocketAcceptedRunnable> r =
     new OnSocketAcceptedRunnable(mListener, aServ, aTransport);
   return mTargetThread->Dispatch(r, NS_DISPATCH_NORMAL);
--- a/netwerk/base/src/nsServerSocket.h
+++ b/netwerk/base/src/nsServerSocket.h
@@ -11,17 +11,17 @@
 #include "mozilla/Mutex.h"
 
 //-----------------------------------------------------------------------------
 
 class nsServerSocket : public nsASocketHandler
                      , public nsIServerSocket
 {
 public:
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSISERVERSOCKET
 
   // nsASocketHandler methods:
   virtual void OnSocketReady(PRFileDesc *fd, int16_t outFlags);
   virtual void OnSocketDetached(PRFileDesc *fd);
   virtual void IsLocal(bool *aIsLocal);
   virtual void KeepWhenOffline(bool *aKeepWhenOffline);
 
--- a/netwerk/base/src/nsSocketTransport2.cpp
+++ b/netwerk/base/src/nsSocketTransport2.cpp
@@ -230,24 +230,24 @@ nsSocketInputStream::OnSocketReady(nsres
 
 NS_IMPL_QUERY_INTERFACE2(nsSocketInputStream,
                          nsIInputStream,
                          nsIAsyncInputStream)
 
 NS_IMETHODIMP_(nsrefcnt)
 nsSocketInputStream::AddRef()
 {
-    NS_AtomicIncrementRefcnt(mReaderRefCnt);
+    ++mReaderRefCnt;
     return mTransport->AddRef();
 }
 
 NS_IMETHODIMP_(nsrefcnt)
 nsSocketInputStream::Release()
 {
-    if (NS_AtomicDecrementRefcnt(mReaderRefCnt) == 0)
+    if (--mReaderRefCnt == 0)
         Close();
     return mTransport->Release();
 }
 
 NS_IMETHODIMP
 nsSocketInputStream::Close()
 {
     return CloseWithStatus(NS_BASE_STREAM_CLOSED);
@@ -493,24 +493,24 @@ nsSocketOutputStream::OnSocketReady(nsre
 
 NS_IMPL_QUERY_INTERFACE2(nsSocketOutputStream,
                          nsIOutputStream,
                          nsIAsyncOutputStream)
 
 NS_IMETHODIMP_(nsrefcnt)
 nsSocketOutputStream::AddRef()
 {
-    NS_AtomicIncrementRefcnt(mWriterRefCnt);
+    ++mWriterRefCnt;
     return mTransport->AddRef();
 }
 
 NS_IMETHODIMP_(nsrefcnt)
 nsSocketOutputStream::Release()
 {
-    if (NS_AtomicDecrementRefcnt(mWriterRefCnt) == 0)
+    if (--mWriterRefCnt == 0)
         Close();
     return mTransport->Release();
 }
 
 NS_IMETHODIMP
 nsSocketOutputStream::Close()
 {
     return CloseWithStatus(NS_BASE_STREAM_CLOSED);
@@ -1727,21 +1727,21 @@ nsSocketTransport::IsLocal(bool *aIsLoca
         MutexAutoLock lock(mLock);
         *aIsLocal = IsLoopBackAddress(&mNetAddr);
     }
 }
 
 //-----------------------------------------------------------------------------
 // xpcom api
 
-NS_IMPL_THREADSAFE_ISUPPORTS4(nsSocketTransport,
-                              nsISocketTransport,
-                              nsITransport,
-                              nsIDNSListener,
-                              nsIClassInfo)
+NS_IMPL_ISUPPORTS4(nsSocketTransport,
+                   nsISocketTransport,
+                   nsITransport,
+                   nsIDNSListener,
+                   nsIClassInfo)
 NS_IMPL_CI_INTERFACE_GETTER3(nsSocketTransport,
                              nsISocketTransport,
                              nsITransport,
                              nsIDNSListener)
 
 NS_IMETHODIMP
 nsSocketTransport::OpenInputStream(uint32_t flags,
                                    uint32_t segsize,
--- a/netwerk/base/src/nsSocketTransport2.h
+++ b/netwerk/base/src/nsSocketTransport2.h
@@ -52,17 +52,17 @@ public:
     nsresult Condition()    { return mCondition; }
     uint64_t ByteCount()    { return mByteCount; }
 
     // called by the socket transport on the socket thread...
     void OnSocketReady(nsresult condition);
 
 private:
     nsSocketTransport               *mTransport;
-    nsrefcnt                         mReaderRefCnt;
+    mozilla::ThreadSafeAutoRefCnt    mReaderRefCnt;
 
     // access to these is protected by mTransport->mLock
     nsresult                         mCondition;
     nsCOMPtr<nsIInputStreamCallback> mCallback;
     uint32_t                         mCallbackFlags;
     uint64_t                         mByteCount;
 };
 
@@ -86,17 +86,17 @@ public:
     void OnSocketReady(nsresult condition); 
 
 private:
     static NS_METHOD WriteFromSegments(nsIInputStream *, void *,
                                        const char *, uint32_t offset,
                                        uint32_t count, uint32_t *countRead);
 
     nsSocketTransport                *mTransport;
-    nsrefcnt                          mWriterRefCnt;
+    mozilla::ThreadSafeAutoRefCnt     mWriterRefCnt;
 
     // access to these is protected by mTransport->mLock
     nsresult                          mCondition;
     nsCOMPtr<nsIOutputStreamCallback> mCallback;
     uint32_t                          mCallbackFlags;
     uint64_t                          mByteCount;
 };
 
@@ -105,17 +105,17 @@ private:
 class nsSocketTransport : public nsASocketHandler
                         , public nsISocketTransport
                         , public nsIDNSListener
                         , public nsIClassInfo
 {
     typedef mozilla::Mutex Mutex;
 
 public:
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSITRANSPORT
     NS_DECL_NSISOCKETTRANSPORT
     NS_DECL_NSIDNSLISTENER
     NS_DECL_NSICLASSINFO
 
     nsSocketTransport();
 
     // this method instructs the socket transport to open a socket of the
--- a/netwerk/base/src/nsSocketTransportService2.cpp
+++ b/netwerk/base/src/nsSocketTransportService2.cpp
@@ -396,23 +396,23 @@ nsSocketTransportService::Poll(bool wait
 
     *interval = PR_IntervalToSeconds(passedInterval);
     return rv;
 }
 
 //-----------------------------------------------------------------------------
 // xpcom api
 
-NS_IMPL_THREADSAFE_ISUPPORTS6(nsSocketTransportService,
-                              nsISocketTransportService,
-                              nsIEventTarget,
-                              nsIThreadObserver,
-                              nsIRunnable,
-                              nsPISocketTransportService,
-                              nsIObserver)
+NS_IMPL_ISUPPORTS6(nsSocketTransportService,
+                   nsISocketTransportService,
+                   nsIEventTarget,
+                   nsIThreadObserver,
+                   nsIRunnable,
+                   nsPISocketTransportService,
+                   nsIObserver)
 
 // called from main thread only
 NS_IMETHODIMP
 nsSocketTransportService::Init()
 {
     if (!NS_IsMainThread()) {
         NS_ERROR("wrong thread");
         return NS_ERROR_UNEXPECTED;
--- a/netwerk/base/src/nsSocketTransportService2.h
+++ b/netwerk/base/src/nsSocketTransportService2.h
@@ -42,17 +42,17 @@ class nsSocketTransportService : public 
                                , public nsIEventTarget
                                , public nsIThreadObserver
                                , public nsIRunnable
                                , public nsIObserver
 {
     typedef mozilla::Mutex Mutex;
 
 public:
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSPISOCKETTRANSPORTSERVICE
     NS_DECL_NSISOCKETTRANSPORTSERVICE
     NS_DECL_NSIEVENTTARGET
     NS_DECL_NSITHREADOBSERVER
     NS_DECL_NSIRUNNABLE
     NS_DECL_NSIOBSERVER 
 
     nsSocketTransportService();
--- a/netwerk/base/src/nsStreamListenerTee.cpp
+++ b/netwerk/base/src/nsStreamListenerTee.cpp
@@ -1,20 +1,20 @@
 /* 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/. */
 
 #include "nsStreamListenerTee.h"
 #include "nsProxyRelease.h"
 
-NS_IMPL_THREADSAFE_ISUPPORTS4(nsStreamListenerTee,
-                              nsIStreamListener,
-                              nsIRequestObserver,
-                              nsIStreamListenerTee,
-                              nsIThreadRetargetableStreamListener)
+NS_IMPL_ISUPPORTS4(nsStreamListenerTee,
+                   nsIStreamListener,
+                   nsIRequestObserver,
+                   nsIStreamListenerTee,
+                   nsIThreadRetargetableStreamListener)
 
 NS_IMETHODIMP
 nsStreamListenerTee::OnStartRequest(nsIRequest *request,
                                     nsISupports *context)
 {
     NS_ENSURE_TRUE(mListener, NS_ERROR_NOT_INITIALIZED);
     nsresult rv1 = mListener->OnStartRequest(request, context);
     nsresult rv2 = NS_OK;
--- a/netwerk/base/src/nsStreamListenerTee.h
+++ b/netwerk/base/src/nsStreamListenerTee.h
@@ -11,17 +11,17 @@
 #include "nsIOutputStream.h"
 #include "nsCOMPtr.h"
 #include "nsIEventTarget.h"
 
 class nsStreamListenerTee : public nsIStreamListenerTee
                           , public nsIThreadRetargetableStreamListener
 {
 public:
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSIREQUESTOBSERVER
     NS_DECL_NSISTREAMLISTENER
     NS_DECL_NSITHREADRETARGETABLESTREAMLISTENER
     NS_DECL_NSISTREAMLISTENERTEE
 
     nsStreamListenerTee() { }
     virtual ~nsStreamListenerTee() { }
 
--- a/netwerk/base/src/nsStreamTransportService.cpp
+++ b/netwerk/base/src/nsStreamTransportService.cpp
@@ -27,17 +27,17 @@
 // allows the transport to support seeking, range-limiting, progress reporting,
 // and close-when-done semantics while utilizing NS_AsyncCopy.
 //-----------------------------------------------------------------------------
 
 class nsInputStreamTransport : public nsITransport
                              , public nsIInputStream
 {
 public:
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSITRANSPORT
     NS_DECL_NSIINPUTSTREAM
 
     nsInputStreamTransport(nsIInputStream *source,
                            uint64_t offset,
                            uint64_t limit,
                            bool closeWhenDone)
         : mSource(source)
@@ -65,19 +65,19 @@ private:
     bool                            mCloseWhenDone;
     bool                            mFirstTime;
 
     // this variable serves as a lock to prevent the state of the transport
     // from being modified once the copy is in progress.
     bool                            mInProgress;
 };
 
-NS_IMPL_THREADSAFE_ISUPPORTS2(nsInputStreamTransport,
-                              nsITransport,
-                              nsIInputStream)
+NS_IMPL_ISUPPORTS2(nsInputStreamTransport,
+                   nsITransport,
+                   nsIInputStream)
 
 /** nsITransport **/
 
 NS_IMETHODIMP
 nsInputStreamTransport::OpenInputStream(uint32_t flags,
                                         uint32_t segsize,
                                         uint32_t segcount,
                                         nsIInputStream **result)
@@ -227,17 +227,17 @@ nsInputStreamTransport::IsNonBlocking(bo
 // allows the transport to support seeking, range-limiting, progress reporting,
 // and close-when-done semantics while utilizing NS_AsyncCopy.
 //-----------------------------------------------------------------------------
 
 class nsOutputStreamTransport : public nsITransport
                               , public nsIOutputStream
 {
 public:
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSITRANSPORT
     NS_DECL_NSIOUTPUTSTREAM
 
     nsOutputStreamTransport(nsIOutputStream *sink,
                             uint64_t offset,
                             uint64_t limit,
                             bool closeWhenDone)
         : mSink(sink)
@@ -265,19 +265,19 @@ private:
     bool                            mCloseWhenDone;
     bool                            mFirstTime;
 
     // this variable serves as a lock to prevent the state of the transport
     // from being modified once the copy is in progress.
     bool                            mInProgress;
 };
 
-NS_IMPL_THREADSAFE_ISUPPORTS2(nsOutputStreamTransport,
-                              nsITransport,
-                              nsIOutputStream)
+NS_IMPL_ISUPPORTS2(nsOutputStreamTransport,
+                   nsITransport,
+                   nsIOutputStream)
 
 /** nsITransport **/
 
 NS_IMETHODIMP
 nsOutputStreamTransport::OpenInputStream(uint32_t flags,
                                          uint32_t segsize,
                                          uint32_t segcount,
                                          nsIInputStream **result)
@@ -449,20 +449,20 @@ nsStreamTransportService::Init()
 
     nsCOMPtr<nsIObserverService> obsSvc =
         mozilla::services::GetObserverService();
     if (obsSvc)
         obsSvc->AddObserver(this, "xpcom-shutdown-threads", false);
     return NS_OK;
 }
 
-NS_IMPL_THREADSAFE_ISUPPORTS3(nsStreamTransportService,
-                              nsIStreamTransportService,
-                              nsIEventTarget,
-                              nsIObserver)
+NS_IMPL_ISUPPORTS3(nsStreamTransportService,
+                   nsIStreamTransportService,
+                   nsIEventTarget,
+                   nsIObserver)
 
 NS_IMETHODIMP
 nsStreamTransportService::Dispatch(nsIRunnable *task, uint32_t flags)
 {
     NS_ENSURE_TRUE(mPool, NS_ERROR_NOT_INITIALIZED);
     return mPool->Dispatch(task, flags);
 }
 
--- a/netwerk/base/src/nsStreamTransportService.h
+++ b/netwerk/base/src/nsStreamTransportService.h
@@ -9,17 +9,17 @@
 #include "nsCOMPtr.h"
 #include "mozilla/Attributes.h"
 
 class nsStreamTransportService MOZ_FINAL : public nsIStreamTransportService
                                          , public nsIEventTarget
                                          , public nsIObserver
 {
 public:
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSISTREAMTRANSPORTSERVICE
     NS_DECL_NSIEVENTTARGET
     NS_DECL_NSIOBSERVER
 
     nsresult Init();
 
     nsStreamTransportService() {}
 
--- a/netwerk/base/src/nsTemporaryFileInputStream.cpp
+++ b/netwerk/base/src/nsTemporaryFileInputStream.cpp
@@ -1,17 +1,17 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /* 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/. */
 
 #include "nsTemporaryFileInputStream.h"
 #include "nsStreamUtils.h"
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(nsTemporaryFileInputStream, nsIInputStream)
+NS_IMPL_ISUPPORTS1(nsTemporaryFileInputStream, nsIInputStream)
 
 nsTemporaryFileInputStream::nsTemporaryFileInputStream(FileDescOwner* aFileDescOwner, uint64_t aStartPos, uint64_t aEndPos)
   : mFileDescOwner(aFileDescOwner),
     mStartPos(aStartPos),
     mEndPos(aEndPos),
     mClosed(false)
 { 
   NS_ASSERTION(aStartPos <= aEndPos, "StartPos should less equal than EndPos!");
--- a/netwerk/base/src/nsTemporaryFileInputStream.h
+++ b/netwerk/base/src/nsTemporaryFileInputStream.h
@@ -34,17 +34,17 @@ public:
     PRFileDesc* mFD;
     mozilla::Mutex mMutex;
   };
 
   nsTemporaryFileInputStream(FileDescOwner* aFileDescOwner, uint64_t aStartPos, uint64_t aEndPos);
 
   virtual ~nsTemporaryFileInputStream() { }
 
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIINPUTSTREAM
 
 private:
   nsRefPtr<FileDescOwner> mFileDescOwner;
   uint64_t mStartPos;
   uint64_t mEndPos;
   bool mClosed;
 };
--- a/netwerk/base/src/nsTransportUtils.cpp
+++ b/netwerk/base/src/nsTransportUtils.cpp
@@ -14,17 +14,17 @@ using namespace mozilla;
 
 //-----------------------------------------------------------------------------
 
 class nsTransportStatusEvent;
 
 class nsTransportEventSinkProxy : public nsITransportEventSink
 {
 public:
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSITRANSPORTEVENTSINK
 
     nsTransportEventSinkProxy(nsITransportEventSink *sink,
                               nsIEventTarget *target,
                               bool coalesceAll)
         : mSink(sink)
         , mTarget(target)
         , mLock("nsTransportEventSinkProxy.mLock")
@@ -84,17 +84,17 @@ public:
 
     // parameters to OnTransportStatus
     nsCOMPtr<nsITransport> mTransport;
     nsresult               mStatus;
     uint64_t               mProgress;
     uint64_t               mProgressMax;
 };
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(nsTransportEventSinkProxy, nsITransportEventSink)
+NS_IMPL_ISUPPORTS1(nsTransportEventSinkProxy, nsITransportEventSink)
 
 NS_IMETHODIMP
 nsTransportEventSinkProxy::OnTransportStatus(nsITransport *transport,
                                              nsresult status,
                                              uint64_t progress,
                                              uint64_t progressMax)
 {
     nsresult rv = NS_OK;
--- a/netwerk/base/src/nsUDPServerSocket.cpp
+++ b/netwerk/base/src/nsUDPServerSocket.cpp
@@ -38,17 +38,17 @@ PostEvent(nsUDPServerSocket *s, nsUDPSer
     return NS_ERROR_FAILURE;
 
   return gSocketTransportService->Dispatch(ev, NS_DISPATCH_NORMAL);
 }
 
 //-----------------------------------------------------------------------------
 // nsUPDOutputStream impl
 //-----------------------------------------------------------------------------
-NS_IMPL_THREADSAFE_ISUPPORTS1(nsUDPOutputStream, nsIOutputStream)
+NS_IMPL_ISUPPORTS1(nsUDPOutputStream, nsIOutputStream)
 
 nsUDPOutputStream::nsUDPOutputStream(nsUDPServerSocket* aServer,
                                      PRFileDesc* aFD,
                                      PRNetAddr& aPrClientAddr)
   : mServer(aServer)
   , mFD(aFD)
   , mPrClientAddr(aPrClientAddr)
   , mIsClosed(false)
@@ -112,17 +112,17 @@ NS_IMETHODIMP nsUDPOutputStream::IsNonBl
 {
   *_retval = true;
   return NS_OK;
 }
 
 //-----------------------------------------------------------------------------
 // nsUPDMessage impl
 //-----------------------------------------------------------------------------
-NS_IMPL_THREADSAFE_ISUPPORTS1(nsUDPMessage, nsIUDPMessage)
+NS_IMPL_ISUPPORTS1(nsUDPMessage, nsIUDPMessage)
 
 nsUDPMessage::nsUDPMessage(PRNetAddr* aAddr,
              nsIOutputStream* aOutputStream,
              const nsACString& aData)
   : mOutputStream(aOutputStream)
   , mData(aData)
 {
   memcpy(&mAddr, aAddr, sizeof(NetAddr));
@@ -378,17 +378,17 @@ nsUDPServerSocket::IsLocal(bool *aIsLoca
   // If bound to loopback, this server socket only accepts local connections.
   *aIsLocal = mAddr.raw.family == nsINetAddr::FAMILY_LOCAL;
 }
 
 //-----------------------------------------------------------------------------
 // nsServerSocket::nsISupports
 //-----------------------------------------------------------------------------
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(nsUDPServerSocket, nsIUDPServerSocket)
+NS_IMPL_ISUPPORTS1(nsUDPServerSocket, nsIUDPServerSocket)
 
 
 //-----------------------------------------------------------------------------
 // nsServerSocket::nsIServerSocket
 //-----------------------------------------------------------------------------
 
 NS_IMETHODIMP
 nsUDPServerSocket::Init(int32_t aPort, bool aLoopbackOnly)
@@ -512,17 +512,17 @@ namespace {
 class ServerSocketListenerProxy MOZ_FINAL : public nsIUDPServerSocketListener
 {
 public:
   ServerSocketListenerProxy(nsIUDPServerSocketListener* aListener)
     : mListener(new nsMainThreadPtrHolder<nsIUDPServerSocketListener>(aListener))
     , mTargetThread(do_GetCurrentThread())
   { }
 
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIUDPSERVERSOCKETLISTENER
 
   class OnPacketReceivedRunnable : public nsRunnable
   {
   public:
     OnPacketReceivedRunnable(const nsMainThreadPtrHandle<nsIUDPServerSocketListener>& aListener,
                      nsIUDPServerSocket* aServ,
                      nsIUDPMessage* aMessage)
@@ -558,18 +558,18 @@ public:
     nsresult mStatus;
   };
 
 private:
   nsMainThreadPtrHandle<nsIUDPServerSocketListener> mListener;
   nsCOMPtr<nsIEventTarget> mTargetThread;
 };
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(ServerSocketListenerProxy,
-                              nsIUDPServerSocketListener)
+NS_IMPL_ISUPPORTS1(ServerSocketListenerProxy,
+                   nsIUDPServerSocketListener)
 
 NS_IMETHODIMP
 ServerSocketListenerProxy::OnPacketReceived(nsIUDPServerSocket* aServ,
                                             nsIUDPMessage* aMessage)
 {
   nsRefPtr<OnPacketReceivedRunnable> r =
     new OnPacketReceivedRunnable(mListener, aServ, aMessage);
   return mTargetThread->Dispatch(r, NS_DISPATCH_NORMAL);
--- a/netwerk/base/src/nsUDPServerSocket.h
+++ b/netwerk/base/src/nsUDPServerSocket.h
@@ -12,17 +12,17 @@
 #include "nsIOutputStream.h"
 
 //-----------------------------------------------------------------------------
 
 class nsUDPServerSocket : public nsASocketHandler
                         , public nsIUDPServerSocket
 {
 public:
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIUDPSERVERSOCKET
 
   // nsASocketHandler methods:
   virtual void OnSocketReady(PRFileDesc* fd, int16_t outFlags);
   virtual void OnSocketDetached(PRFileDesc* fd);
   virtual void IsLocal(bool* aIsLocal);
 
   uint64_t ByteCountSent() { return mByteWriteCount; }
@@ -56,17 +56,17 @@ private:
   uint64_t   mByteWriteCount;
 };
 
 //-----------------------------------------------------------------------------
 
 class nsUDPMessage : public nsIUDPMessage
 {
 public:
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIUDPMESSAGE
 
   nsUDPMessage(PRNetAddr* aAddr,
                nsIOutputStream* aOutputStream,
                const nsACString& aData);
 
 private:
   virtual ~nsUDPMessage();
@@ -77,17 +77,17 @@ private:
 };
 
 
 //-----------------------------------------------------------------------------
 
 class nsUDPOutputStream : public nsIOutputStream
 {
 public:
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIOUTPUTSTREAM
 
   nsUDPOutputStream(nsUDPServerSocket* aServer,
                     PRFileDesc* aFD,
                     PRNetAddr& aPrClientAddr);
   virtual ~nsUDPOutputStream();
 
 private:
--- a/netwerk/base/src/nsURLParsers.cpp
+++ b/netwerk/base/src/nsURLParsers.cpp
@@ -27,21 +27,18 @@ CountConsecutiveSlashes(const char *str,
     while (len-- && *p++ == '/') ++count;
     return count;
 }
 
 //----------------------------------------------------------------------------
 // nsBaseURLParser implementation
 //----------------------------------------------------------------------------
 
-// The URL parser service does not have any internal state; however, it can
-// be called from multiple threads, so we must use a threadsafe AddRef and
-// Release implementation.
-NS_IMPL_THREADSAFE_ISUPPORTS1(nsAuthURLParser, nsIURLParser)
-NS_IMPL_THREADSAFE_ISUPPORTS1(nsNoAuthURLParser, nsIURLParser)
+NS_IMPL_ISUPPORTS1(nsAuthURLParser, nsIURLParser)
+NS_IMPL_ISUPPORTS1(nsNoAuthURLParser, nsIURLParser)
 
 #define SET_RESULT(component, pos, len) \
     PR_BEGIN_MACRO \
         if (component ## Pos) \
            *component ## Pos = uint32_t(pos); \
         if (component ## Len) \
            *component ## Len = int32_t(len); \
     PR_END_MACRO
--- a/netwerk/base/src/nsURLParsers.h
+++ b/netwerk/base/src/nsURLParsers.h
@@ -38,17 +38,17 @@ protected:
 //
 // XXX except in this case:
 //     file://foo/bar.txt     (the authority "foo"  is ignored)
 //----------------------------------------------------------------------------
 
 class nsNoAuthURLParser MOZ_FINAL : public nsBaseURLParser
 {
 public:
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
 
 #if defined(XP_WIN) || defined(XP_OS2)
     NS_IMETHOD ParseFilePath(const char *, int32_t,
                              uint32_t *, int32_t *,
                              uint32_t *, int32_t *,
                              uint32_t *, int32_t *);
 #endif
 
@@ -70,17 +70,17 @@ public:
 //     http:/www.foo.com/bar.html
 //     http://www.foo.com/bar.html    (treated equivalently)
 //     http:///www.foo.com/bar.html
 //----------------------------------------------------------------------------
 
 class nsAuthURLParser : public nsBaseURLParser
 {
 public:
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
 
     virtual ~nsAuthURLParser() {}
 
     NS_IMETHOD ParseAuthority(const char *auth, int32_t authLen,
                               uint32_t *usernamePos, int32_t *usernameLen,
                               uint32_t *passwordPos, int32_t *passwordLen,
                               uint32_t *hostnamePos, int32_t *hostnameLen,
                               int32_t *port);
--- a/netwerk/cache/nsCacheEntryDescriptor.cpp
+++ b/netwerk/cache/nsCacheEntryDescriptor.cpp
@@ -65,19 +65,19 @@ public:
 
 private:
     nsCOMPtr<nsCacheEntryDescriptor> mDescriptor;
     nsICacheListener                *mListener;
     nsCOMPtr<nsIThread>              mThread;
 };
 
 
-NS_IMPL_THREADSAFE_ISUPPORTS2(nsCacheEntryDescriptor,
-                              nsICacheEntryDescriptor,
-                              nsICacheEntryInfo)
+NS_IMPL_ISUPPORTS2(nsCacheEntryDescriptor,
+                   nsICacheEntryDescriptor,
+                   nsICacheEntryInfo)
 
 nsCacheEntryDescriptor::nsCacheEntryDescriptor(nsCacheEntry * entry,
                                                nsCacheAccessMode accessGranted)
     : mCacheEntry(entry),
       mAccessGranted(accessGranted),
       mOutputWrapper(nullptr),
       mLock("nsCacheEntryDescriptor.mLock"),
       mAsyncDoomPending(false),
@@ -649,17 +649,17 @@ nsCacheEntryDescriptor::VisitMetaData(ns
 }
 
 
 /******************************************************************************
  * nsCacheInputStream - a wrapper for nsIInputStream keeps the cache entry
  *                      open while referenced.
  ******************************************************************************/
 
-NS_IMPL_THREADSAFE_ADDREF(nsCacheEntryDescriptor::nsInputStreamWrapper)
+NS_IMPL_ADDREF(nsCacheEntryDescriptor::nsInputStreamWrapper)
 NS_IMETHODIMP_(nsrefcnt)
 nsCacheEntryDescriptor::nsInputStreamWrapper::Release()
 {
     // Holding a reference to descriptor ensures that cache service won't go
     // away. Do not grab cache service lock if there is no descriptor.
     nsRefPtr<nsCacheEntryDescriptor> desc;
 
     {
@@ -667,17 +667,17 @@ nsCacheEntryDescriptor::nsInputStreamWra
         desc = mDescriptor;
     }
 
     if (desc)
         nsCacheService::Lock(LOCK_TELEM(NSINPUTSTREAMWRAPPER_RELEASE));
 
     nsrefcnt count;
     NS_PRECONDITION(0 != mRefCnt, "dup release");
-    count = NS_AtomicDecrementRefcnt(mRefCnt);
+    count = --mRefCnt;
     NS_LOG_RELEASE(this, count, "nsCacheEntryDescriptor::nsInputStreamWrapper");
 
     if (0 == count) {
         // don't use desc here since mDescriptor might be already nulled out
         if (mDescriptor) {
             NS_ASSERTION(mDescriptor->mInputWrappers.IndexOf(this) != -1,
                          "Wrapper not found in array!");
             mDescriptor->mInputWrappers.RemoveElement(this);
@@ -841,17 +841,17 @@ nsInputStreamWrapper::IsNonBlocking(bool
     return NS_OK;
 }
 
 
 /******************************************************************************
  * nsDecompressInputStreamWrapper - an input stream wrapper that decompresses
  ******************************************************************************/
 
-NS_IMPL_THREADSAFE_ADDREF(nsCacheEntryDescriptor::nsDecompressInputStreamWrapper)
+NS_IMPL_ADDREF(nsCacheEntryDescriptor::nsDecompressInputStreamWrapper)
 NS_IMETHODIMP_(nsrefcnt)
 nsCacheEntryDescriptor::nsDecompressInputStreamWrapper::Release()
 {
     // Holding a reference to descriptor ensures that cache service won't go
     // away. Do not grab cache service lock if there is no descriptor.
     nsRefPtr<nsCacheEntryDescriptor> desc;
 
     {
@@ -860,17 +860,17 @@ nsCacheEntryDescriptor::nsDecompressInpu
     }
 
     if (desc)
         nsCacheService::Lock(LOCK_TELEM(
                              NSDECOMPRESSINPUTSTREAMWRAPPER_RELEASE));
 
     nsrefcnt count;
     NS_PRECONDITION(0 != mRefCnt, "dup release");
-    count = NS_AtomicDecrementRefcnt(mRefCnt);
+    count = --mRefCnt;
     NS_LOG_RELEASE(this, count,
                    "nsCacheEntryDescriptor::nsDecompressInputStreamWrapper");
 
     if (0 == count) {
         // don't use desc here since mDescriptor might be already nulled out
         if (mDescriptor) {
             NS_ASSERTION(mDescriptor->mInputWrappers.IndexOf(this) != -1,
                          "Wrapper not found in array!");
@@ -1031,17 +1031,17 @@ nsDecompressInputStreamWrapper::EndZstre
 
 
 /******************************************************************************
  * nsOutputStreamWrapper - a wrapper for nsIOutputstream to track the amount of
  *                         data written to a cache entry.
  *                       - also keeps the cache entry open while referenced.
  ******************************************************************************/
 
-NS_IMPL_THREADSAFE_ADDREF(nsCacheEntryDescriptor::nsOutputStreamWrapper)
+NS_IMPL_ADDREF(nsCacheEntryDescriptor::nsOutputStreamWrapper)
 NS_IMETHODIMP_(nsrefcnt)
 nsCacheEntryDescriptor::nsOutputStreamWrapper::Release()
 {
     // Holding a reference to descriptor ensures that cache service won't go
     // away. Do not grab cache service lock if there is no descriptor.
     nsRefPtr<nsCacheEntryDescriptor> desc;
 
     {
@@ -1049,17 +1049,17 @@ nsCacheEntryDescriptor::nsOutputStreamWr
         desc = mDescriptor;
     }
 
     if (desc)
         nsCacheService::Lock(LOCK_TELEM(NSOUTPUTSTREAMWRAPPER_RELEASE));
 
     nsrefcnt count;
     NS_PRECONDITION(0 != mRefCnt, "dup release");
-    count = NS_AtomicDecrementRefcnt(mRefCnt);
+    count = --mRefCnt;
     NS_LOG_RELEASE(this, count,
                    "nsCacheEntryDescriptor::nsOutputStreamWrapper");
 
     if (0 == count) {
         // don't use desc here since mDescriptor might be already nulled out
         if (mDescriptor)
             mDescriptor->mOutputWrapper = nullptr;
 
@@ -1261,17 +1261,17 @@ nsOutputStreamWrapper::IsNonBlocking(boo
 }
 
 
 /******************************************************************************
  * nsCompressOutputStreamWrapper - an output stream wrapper that compresses
  *   data before it is written
  ******************************************************************************/
 
-NS_IMPL_THREADSAFE_ADDREF(nsCacheEntryDescriptor::nsCompressOutputStreamWrapper)
+NS_IMPL_ADDREF(nsCacheEntryDescriptor::nsCompressOutputStreamWrapper)
 NS_IMETHODIMP_(nsrefcnt)
 nsCacheEntryDescriptor::nsCompressOutputStreamWrapper::Release()
 {
     // Holding a reference to descriptor ensures that cache service won't go
     // away. Do not grab cache service lock if there is no descriptor.
     nsRefPtr<nsCacheEntryDescriptor> desc;
 
     {
@@ -1279,17 +1279,17 @@ nsCacheEntryDescriptor::nsCompressOutput
         desc = mDescriptor;
     }
 
     if (desc)
         nsCacheService::Lock(LOCK_TELEM(NSCOMPRESSOUTPUTSTREAMWRAPPER_RELEASE));
 
     nsrefcnt count;
     NS_PRECONDITION(0 != mRefCnt, "dup release");
-    count = NS_AtomicDecrementRefcnt(mRefCnt);
+    count = --mRefCnt;
     NS_LOG_RELEASE(this, count,
                    "nsCacheEntryDescriptor::nsCompressOutputStreamWrapper");
 
     if (0 == count) {
         // don't use desc here since mDescriptor might be already nulled out
         if (mDescriptor)
             mDescriptor->mOutputWrapper = nullptr;
 
--- a/netwerk/cache/nsCacheEntryDescriptor.h
+++ b/netwerk/cache/nsCacheEntryDescriptor.h
@@ -20,17 +20,17 @@
 /******************************************************************************
 * nsCacheEntryDescriptor
 *******************************************************************************/
 class nsCacheEntryDescriptor :
     public PRCList,
     public nsICacheEntryDescriptor
 {
 public:
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSICACHEENTRYDESCRIPTOR
     NS_DECL_NSICACHEENTRYINFO
 
     friend class nsAsyncDoomEvent;
     friend class nsCacheService;
 
     nsCacheEntryDescriptor(nsCacheEntry * entry, nsCacheAccessMode  mode);
     virtual ~nsCacheEntryDescriptor();
@@ -77,17 +77,17 @@ private:
 
      private:
          nsCacheEntryDescriptor    * mDescriptor;
          nsCOMPtr<nsIInputStream>    mInput;
          uint32_t                    mStartOffset;
          bool                        mInitialized;
          mozilla::Mutex              mLock;
      public:
-         NS_DECL_ISUPPORTS
+         NS_DECL_THREADSAFE_ISUPPORTS
          NS_DECL_NSIINPUTSTREAM
 
          nsInputStreamWrapper(nsCacheEntryDescriptor * desc, uint32_t off)
              : mDescriptor(desc)
              , mStartOffset(off)
              , mInitialized(false)
              , mLock("nsInputStreamWrapper.mLock")
          {
@@ -110,17 +110,17 @@ private:
      class nsDecompressInputStreamWrapper : public nsInputStreamWrapper {
      private:
          unsigned char* mReadBuffer;
          uint32_t mReadBufferLen;
          z_stream mZstream;
          bool mStreamInitialized;
          bool mStreamEnded;
      public:
-         NS_DECL_ISUPPORTS
+         NS_DECL_THREADSAFE_ISUPPORTS
 
          nsDecompressInputStreamWrapper(nsCacheEntryDescriptor * desc,
                                       uint32_t off)
           : nsInputStreamWrapper(desc, off)
           , mReadBuffer(0)
           , mReadBufferLen(0)
           , mStreamInitialized(false)
           , mStreamEnded(false)
@@ -149,17 +149,17 @@ private:
 
      protected:
          nsCacheEntryDescriptor *    mDescriptor;
          nsCOMPtr<nsIOutputStream>   mOutput;
          uint32_t                    mStartOffset;
          bool                        mInitialized;
          mozilla::Mutex              mLock;
      public:
-         NS_DECL_ISUPPORTS
+         NS_DECL_THREADSAFE_ISUPPORTS
          NS_DECL_NSIOUTPUTSTREAM
 
          nsOutputStreamWrapper(nsCacheEntryDescriptor * desc, uint32_t off)
              : mDescriptor(desc)
              , mStartOffset(off)
              , mInitialized(false)
              , mLock("nsOutputStreamWrapper.mLock")
          {
@@ -189,17 +189,17 @@ private:
      private:
          unsigned char* mWriteBuffer;
          uint32_t mWriteBufferLen;
          z_stream mZstream;
          bool mStreamInitialized;
          bool mStreamEnded;
          uint32_t mUncompressedCount;
      public:
-         NS_DECL_ISUPPORTS
+         NS_DECL_THREADSAFE_ISUPPORTS
 
          nsCompressOutputStreamWrapper(nsCacheEntryDescriptor * desc, 
                                        uint32_t off)
           : nsOutputStreamWrapper(desc, off)
           , mWriteBuffer(0)
           , mWriteBufferLen(0)
           , mStreamInitialized(false)
           , mStreamEnded(false)
--- a/netwerk/cache/nsCacheService.cpp
+++ b/netwerk/cache/nsCacheService.cpp
@@ -116,17 +116,17 @@ const int32_t MAX_CACHE_SIZE = 350 * 102
 const int32_t OLD_MAX_CACHE_SIZE = 1024 * 1024; //   1 GB
 #endif
 // Default cache size was 50 MB for many years until FF 4:
 const int32_t PRE_GECKO_2_0_DEFAULT_CACHE_SIZE = 50 * 1024;
 
 class nsCacheProfilePrefObserver : public nsIObserver
 {
 public:
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSIOBSERVER
 
     nsCacheProfilePrefObserver()
         : mHaveProfile(false)
         , mDiskCacheEnabled(false)
         , mDiskCacheCapacity(0)
         , mDiskCacheMaxEntrySize(-1) // -1 means "no limit"
         , mSmartSizeEnabled(false)
@@ -196,34 +196,34 @@ private:
     int32_t                 mMemoryCacheMaxEntrySize; // in kilobytes
 
     int32_t                 mCacheCompressionLevel;
 
     bool                    mSanitizeOnShutdown;
     bool                    mClearCacheOnShutdown;
 };
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(nsCacheProfilePrefObserver, nsIObserver)
+NS_IMPL_ISUPPORTS1(nsCacheProfilePrefObserver, nsIObserver)
 
 class nsSetDiskSmartSizeCallback MOZ_FINAL : public nsITimerCallback
 {
 public:
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
 
     NS_IMETHOD Notify(nsITimer* aTimer) {
         if (nsCacheService::gService) {
             nsCacheServiceAutoLock autoLock(LOCK_TELEM(NSSETDISKSMARTSIZECALLBACK_NOTIFY));
             nsCacheService::gService->SetDiskSmartSize_Locked();
             nsCacheService::gService->mSmartSizeTimer = nullptr;
         }
         return NS_OK;
     }
 };
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(nsSetDiskSmartSizeCallback, nsITimerCallback)
+NS_IMPL_ISUPPORTS1(nsSetDiskSmartSizeCallback, nsITimerCallback)
 
 // Runnable sent to main thread after the cache IO thread calculates available
 // disk space, so that there is no race in setting mDiskCacheCapacity.
 class nsSetSmartSizeEvent: public nsRunnable 
 {
 public:
     nsSetSmartSizeEvent(int32_t smartSize)
         : mSmartSize(smartSize) {}
@@ -1067,17 +1067,17 @@ private:
     nsCOMPtr<nsIThread>   mThread;
 };
 
 /******************************************************************************
  * nsCacheService
  *****************************************************************************/
 nsCacheService *   nsCacheService::gService = nullptr;
 
-NS_IMPL_THREADSAFE_ISUPPORTS2(nsCacheService, nsICacheService, nsICacheServiceInternal)
+NS_IMPL_ISUPPORTS2(nsCacheService, nsICacheService, nsICacheServiceInternal)
 
 nsCacheService::nsCacheService()
     : mObserver(nullptr),
       mLock("nsCacheService.mLock"),
       mCondVar(mLock, "nsCacheService.mCondVar"),
       mTimeStampLock("nsCacheService.mTimeStampLock"),
       mInitialized(false),
       mClearingEntries(false),
--- a/netwerk/cache/nsCacheService.h
+++ b/netwerk/cache/nsCacheService.h
@@ -59,17 +59,17 @@ private:
 
 /******************************************************************************
  *  nsCacheService
  ******************************************************************************/
 
 class nsCacheService : public nsICacheServiceInternal
 {
 public:
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSICACHESERVICE
     NS_DECL_NSICACHESERVICEINTERNAL
 
     nsCacheService();
     virtual ~nsCacheService();
 
     // Define a Create method to be used with a factory:
     static nsresult
--- a/netwerk/cache/nsDiskCacheBinding.cpp
+++ b/netwerk/cache/nsDiskCacheBinding.cpp
@@ -65,17 +65,17 @@ GetCacheEntryBinding(nsCacheEntry * entr
     return (nsDiskCacheBinding *) entry->Data();
 }
 
 
 /******************************************************************************
  *  nsDiskCacheBinding
  *****************************************************************************/
 
-NS_IMPL_THREADSAFE_ISUPPORTS0(nsDiskCacheBinding)
+NS_IMPL_ISUPPORTS0(nsDiskCacheBinding)
 
 nsDiskCacheBinding::nsDiskCacheBinding(nsCacheEntry* entry, nsDiskCacheRecord * record)
     :   mCacheEntry(entry)
     ,   mStreamIO(nullptr)
     ,   mDeactivateEvent(nullptr)
 {
     NS_ASSERTION(record->ValidRecord(), "bad record");
     PR_INIT_CLIST(this);
--- a/netwerk/cache/nsDiskCacheBinding.h
+++ b/netwerk/cache/nsDiskCacheBinding.h
@@ -27,17 +27,17 @@
  *  linked by the PRCList.
  *
  *****************************************************************************/
 
 class nsDiskCacheDeviceDeactivateEntryEvent;
 
 class nsDiskCacheBinding : public nsISupports, public PRCList {
 public:
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
 
     nsDiskCacheBinding(nsCacheEntry* entry, nsDiskCacheRecord * record);
     virtual ~nsDiskCacheBinding();
 
     nsresult EnsureStreamIO();
     bool     IsActive() { return mCacheEntry != nullptr;}
 
 // XXX make friends
--- a/netwerk/cache/nsDiskCacheDeviceSQL.cpp
+++ b/netwerk/cache/nsDiskCacheDeviceSQL.cpp
@@ -145,17 +145,17 @@ DCacheHash(const char * key)
   // initval 0x7416f295 was chosen randomly
   return (uint64_t(nsDiskCache::Hash(key, 0)) << 32) | nsDiskCache::Hash(key, 0x7416f295);
 }
 
 /******************************************************************************
  * nsOfflineCacheEvictionFunction
  */
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(nsOfflineCacheEvictionFunction, mozIStorageFunction)
+NS_IMPL_ISUPPORTS1(nsOfflineCacheEvictionFunction, mozIStorageFunction)
 
 // helper function for directly exposing the same data file binding
 // path algorithm used in nsOfflineCacheBinding::Create
 static nsresult
 GetCacheDataFile(nsIFile *cacheDir, const char *key,
                  int generation, nsCOMPtr<nsIFile> &file)
 {
   cacheDir->Clone(getter_AddRefs(file));
@@ -342,33 +342,33 @@ nsOfflineCacheDeviceInfo::GetMaximumSize
 
 /******************************************************************************
  * nsOfflineCacheBinding
  */
 
 class nsOfflineCacheBinding MOZ_FINAL : public nsISupports
 {
 public:
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
 
   static nsOfflineCacheBinding *
       Create(nsIFile *cacheDir, const nsCString *key, int generation);
 
   enum { FLAG_NEW_ENTRY = 1 };
 
   nsCOMPtr<nsIFile> mDataFile;
   int               mGeneration;
   int		    mFlags;
 
   bool IsNewEntry() { return mFlags & FLAG_NEW_ENTRY; }
   void MarkNewEntry() { mFlags |= FLAG_NEW_ENTRY; }
   void ClearNewEntry() { mFlags &= ~FLAG_NEW_ENTRY; }
 };
 
-NS_IMPL_THREADSAFE_ISUPPORTS0(nsOfflineCacheBinding)
+NS_IMPL_ISUPPORTS0(nsOfflineCacheBinding)
 
 nsOfflineCacheBinding *
 nsOfflineCacheBinding::Create(nsIFile *cacheDir,
                               const nsCString *fullKey,
                               int generation)
 {
   nsCOMPtr<nsIFile> file;
   cacheDir->Clone(getter_AddRefs(file));
@@ -870,17 +870,17 @@ private:
 };
 
 
 
 /******************************************************************************
  * nsOfflineCacheDevice
  */
 
-NS_IMPL_THREADSAFE_ISUPPORTS0(nsOfflineCacheDevice)
+NS_IMPL_ISUPPORTS0(nsOfflineCacheDevice)
 
 nsOfflineCacheDevice::nsOfflineCacheDevice()
   : mDB(nullptr)
   , mCacheCapacity(0)
   , mDeltaCounter(0)
   , mAutoShutdown(false)
 {
 }
--- a/netwerk/cache/nsDiskCacheDeviceSQL.h
+++ b/netwerk/cache/nsDiskCacheDeviceSQL.h
@@ -36,17 +36,17 @@ public:
 private:
   uint32_t mItemType;
   nsCString mNamespaceSpec;
   nsCString mData;
 };
 
 class nsOfflineCacheEvictionFunction MOZ_FINAL : public mozIStorageFunction {
 public:
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_MOZISTORAGEFUNCTION
 
   nsOfflineCacheEvictionFunction(nsOfflineCacheDevice *device)
     : mDevice(device)
   {}
 
   void Reset() { mItems.Clear(); }
   void Apply();
@@ -58,17 +58,17 @@ private:
 };
 
 class nsOfflineCacheDevice : public nsCacheDevice
                            , public nsISupports
 {
 public:
   nsOfflineCacheDevice();
 
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
 
   /**
    * nsCacheDevice methods
    */
 
   virtual nsresult        Init();
   nsresult                InitWithSqlite(mozIStorageService * ss);
   virtual nsresult        Shutdown();
--- a/netwerk/cache/nsDiskCacheStreams.cpp
+++ b/netwerk/cache/nsDiskCacheStreams.cpp
@@ -39,30 +39,30 @@ public:
 
     nsDiskCacheInputStream( nsDiskCacheStreamIO * parent,
                             PRFileDesc *          fileDesc,
                             const char *          buffer,
                             uint32_t              endOfStream);
 
     virtual ~nsDiskCacheInputStream();
     
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSIINPUTSTREAM
 
 private:
     nsDiskCacheStreamIO *           mStreamIO;  // backpointer to parent
     PRFileDesc *                    mFD;
     const char *                    mBuffer;
     uint32_t                        mStreamEnd;
     uint32_t                        mPos;       // stream position
     bool                            mClosed;
 };
 
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(nsDiskCacheInputStream, nsIInputStream)
+NS_IMPL_ISUPPORTS1(nsDiskCacheInputStream, nsIInputStream)
 
 
 nsDiskCacheInputStream::nsDiskCacheInputStream( nsDiskCacheStreamIO * parent,
                                                 PRFileDesc *          fileDesc,
                                                 const char *          buffer,
                                                 uint32_t              endOfStream)
     : mStreamIO(parent)
     , mFD(fileDesc)
@@ -185,17 +185,17 @@ nsDiskCacheInputStream::IsNonBlocking(bo
 }
 
 
 
 
 /******************************************************************************
  *  nsDiskCacheStreamIO
  *****************************************************************************/
-NS_IMPL_THREADSAFE_ISUPPORTS1(nsDiskCacheStreamIO, nsIOutputStream)
+NS_IMPL_ISUPPORTS1(nsDiskCacheStreamIO, nsIOutputStream)
 
 nsDiskCacheStreamIO::nsDiskCacheStreamIO(nsDiskCacheBinding *   binding)
     : mBinding(binding)
     , mInStreamCount(0)
     , mFD(nullptr)
     , mStreamEnd(0)
     , mBufSize(0)
     , mBuffer(nullptr)
--- a/netwerk/cache/nsDiskCacheStreams.h
+++ b/netwerk/cache/nsDiskCacheStreams.h
@@ -21,17 +21,17 @@
 class nsDiskCacheInputStream;
 class nsDiskCacheDevice;
 
 class nsDiskCacheStreamIO : public nsIOutputStream {
 public:
              nsDiskCacheStreamIO(nsDiskCacheBinding *   binding);
     virtual ~nsDiskCacheStreamIO();
     
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSIOUTPUTSTREAM
 
     nsresult    GetInputStream(uint32_t offset, nsIInputStream ** inputStream);
     nsresult    GetOutputStream(uint32_t offset, nsIOutputStream ** outputStream);
 
     nsresult    ClearBinding();
     
     void        IncrementInputStreamCount() { mInStreamCount++; }
--- a/netwerk/dns/nsDNSService2.cpp
+++ b/netwerk/dns/nsDNSService2.cpp
@@ -44,17 +44,17 @@ static const char kPrefDisableIPv6[]    
 static const char kPrefDisablePrefetch[]    = "network.dns.disablePrefetch";
 static const char kPrefDnsLocalDomains[]    = "network.dns.localDomains";
 
 //-----------------------------------------------------------------------------
 
 class nsDNSRecord : public nsIDNSRecord
 {
 public:
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSIDNSRECORD
 
     nsDNSRecord(nsHostRecord *hostRecord)
         : mHostRecord(hostRecord)
         , mIter(nullptr)
         , mIterGenCnt(-1)
         , mDone(false) {}
 
@@ -64,17 +64,17 @@ private:
     nsRefPtr<nsHostRecord>  mHostRecord;
     NetAddrElement         *mIter;
     int                     mIterGenCnt; // the generation count of
                                          // mHostRecord->addr_info when we
                                          // start iterating
     bool                    mDone;
 };
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(nsDNSRecord, nsIDNSRecord)
+NS_IMPL_ISUPPORTS1(nsDNSRecord, nsIDNSRecord)
 
 NS_IMETHODIMP
 nsDNSRecord::GetCanonicalName(nsACString &result)
 {
     // this method should only be called if we have a CNAME
     NS_ENSURE_TRUE(mHostRecord->flags & nsHostResolver::RES_CANON_NAME,
                    NS_ERROR_NOT_AVAILABLE);
 
@@ -241,17 +241,17 @@ nsDNSRecord::ReportUnusable(uint16_t aPo
 }
 
 //-----------------------------------------------------------------------------
 
 class nsDNSAsyncRequest MOZ_FINAL : public nsResolveHostCallback
                                   , public nsICancelable
 {
 public:
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSICANCELABLE
 
     nsDNSAsyncRequest(nsHostResolver   *res,
                       const nsACString &host,
                       nsIDNSListener   *listener,
                       uint16_t          flags,
                       uint16_t          af)
         : mResolver(res)
@@ -301,17 +301,17 @@ nsDNSAsyncRequest::OnLookupComplete(nsHo
 }
 
 bool
 nsDNSAsyncRequest::EqualsAsyncListener(nsIDNSListener *aListener)
 {
     return (aListener == mListener);
 }
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(nsDNSAsyncRequest, nsICancelable)
+NS_IMPL_ISUPPORTS1(nsDNSAsyncRequest, nsICancelable)
 
 NS_IMETHODIMP
 nsDNSAsyncRequest::Cancel(nsresult reason)
 {
     NS_ENSURE_ARG(NS_FAILED(reason));
     mResolver->DetachCallback(mHost.get(), mFlags, mAF, this, reason);
     return NS_OK;
 }
@@ -367,17 +367,17 @@ nsDNSService::nsDNSService()
     , mOffline(false)
 {
 }
 
 nsDNSService::~nsDNSService()
 {
 }
 
-NS_IMPL_THREADSAFE_ISUPPORTS3(nsDNSService, nsIDNSService, nsPIDNSService,
+NS_IMPL_ISUPPORTS3(nsDNSService, nsIDNSService, nsPIDNSService,
                               nsIObserver)
 
 NS_IMETHODIMP
 nsDNSService::Init()
 {
     if (mResolver)
         return NS_OK;
     NS_ENSURE_TRUE(!mResolver, NS_ERROR_ALREADY_INITIALIZED);
@@ -527,17 +527,17 @@ public:
     // Sometimes aListener is a main-thread only object like XPCWrappedJS, and
     // sometimes it's a threadsafe object like nsSOCKSSocketInfo. Use a main-
     // thread pointer holder, but disable strict enforcement of thread invariants.
     // The AddRef implementation of XPCWrappedJS will assert if we go wrong here.
     : mListener(new nsMainThreadPtrHolder<nsIDNSListener>(aListener, false))
     , mTargetThread(aTargetThread)
   { }
 
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIDNSLISTENER
 
   class OnLookupCompleteRunnable : public nsRunnable
   {
   public:
     OnLookupCompleteRunnable(const nsMainThreadPtrHandle<nsIDNSListener>& aListener,
                              nsICancelable* aRequest,
                              nsIDNSRecord* aRecord,
@@ -557,17 +557,17 @@ public:
     nsresult mStatus;
   };
 
 private:
   nsMainThreadPtrHandle<nsIDNSListener> mListener;
   nsCOMPtr<nsIEventTarget> mTargetThread;
 };
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(DNSListenerProxy, nsIDNSListener)
+NS_IMPL_ISUPPORTS1(DNSListenerProxy, nsIDNSListener)
 
 NS_IMETHODIMP
 DNSListenerProxy::OnLookupComplete(nsICancelable* aRequest,
                                    nsIDNSRecord* aRecord,
                                    nsresult aStatus)
 {
   nsRefPtr<OnLookupCompleteRunnable> r =
     new OnLookupCompleteRunnable(mListener, aRequest, aRecord, aStatus);
--- a/netwerk/dns/nsDNSService2.h
+++ b/netwerk/dns/nsDNSService2.h
@@ -15,17 +15,17 @@
 #include "nsHashKeys.h"
 #include "mozilla/Mutex.h"
 #include "mozilla/Attributes.h"
 
 class nsDNSService MOZ_FINAL : public nsPIDNSService
                              , public nsIObserver
 {
 public:
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSPIDNSSERVICE
     NS_DECL_NSIDNSSERVICE
     NS_DECL_NSIOBSERVER
 
     nsDNSService();
     ~nsDNSService();
 
 private:
--- a/netwerk/dns/nsIDNService.cpp
+++ b/netwerk/dns/nsIDNService.cpp
@@ -41,20 +41,20 @@ inline bool isOnlySafeChars(const nsAFla
           in.FindCharInSet(blacklist) == kNotFound);
 }
 
 //-----------------------------------------------------------------------------
 // nsIDNService
 //-----------------------------------------------------------------------------
 
 /* Implementation file */
-NS_IMPL_THREADSAFE_ISUPPORTS3(nsIDNService,
-                              nsIIDNService,
-                              nsIObserver,
-                              nsISupportsWeakReference)
+NS_IMPL_ISUPPORTS3(nsIDNService,
+                   nsIIDNService,
+                   nsIObserver,
+                   nsISupportsWeakReference)
 
 nsresult nsIDNService::Init()
 {
   nsCOMPtr<nsIPrefService> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID));
   if (prefs)
     prefs->GetBranch(NS_NET_PREF_IDNWHITELIST, getter_AddRefs(mIDNWhitelistPrefBranch));
 
   nsCOMPtr<nsIPrefBranch> prefInternal(do_QueryInterface(prefs));
--- a/netwerk/dns/nsIDNService.h
+++ b/netwerk/dns/nsIDNService.h
@@ -22,17 +22,17 @@ class nsIPrefBranch;
 
 #define kACEPrefixLen 4 
 
 class nsIDNService : public nsIIDNService,
                      public nsIObserver,
                      public nsSupportsWeakReference
 {
 public:
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIIDNSERVICE
   NS_DECL_NSIOBSERVER
 
   nsIDNService();
   virtual ~nsIDNService();
 
   nsresult Init();
 
--- a/netwerk/ipc/RemoteOpenFileChild.cpp
+++ b/netwerk/ipc/RemoteOpenFileChild.cpp
@@ -57,20 +57,20 @@ private:
     nsCOMPtr<nsIRemoteOpenFileListener> mListener;
     nsresult mRV;
 };
 
 //-----------------------------------------------------------------------------
 // RemoteOpenFileChild
 //-----------------------------------------------------------------------------
 
-NS_IMPL_THREADSAFE_ISUPPORTS3(RemoteOpenFileChild,
-                              nsIFile,
-                              nsIHashable,
-                              nsICachedFileDescriptorListener)
+NS_IMPL_ISUPPORTS3(RemoteOpenFileChild,
+                   nsIFile,
+                   nsIHashable,
+                   nsICachedFileDescriptorListener)
 
 RemoteOpenFileChild::RemoteOpenFileChild(const RemoteOpenFileChild& other)
   : mTabChild(other.mTabChild)
   , mNSPRFileDesc(other.mNSPRFileDesc)
   , mAsyncOpenCalled(other.mAsyncOpenCalled)
   , mNSPROpenCalled(other.mNSPROpenCalled)
 {
   // Note: don't clone mListener or we'll have a refcount leak.
--- a/netwerk/ipc/RemoteOpenFileChild.h
+++ b/netwerk/ipc/RemoteOpenFileChild.h
@@ -54,17 +54,17 @@ public:
   RemoteOpenFileChild()
     : mNSPRFileDesc(nullptr)
     , mAsyncOpenCalled(false)
     , mNSPROpenCalled(false)
   {}
 
   virtual ~RemoteOpenFileChild();
 
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIFILE
   NS_DECL_NSIHASHABLE
 
   // URI must be scheme 'remoteopenfile://': otherwise looks like a file:// uri.
   nsresult Init(nsIURI* aRemoteOpenUri);
 
   // Send message to parent to tell it to open file handle for file.
   // TabChild is required, for IPC security.
--- a/netwerk/protocol/device/AndroidCaptureProvider.cpp
+++ b/netwerk/protocol/device/AndroidCaptureProvider.cpp
@@ -12,17 +12,17 @@
 #include "nsMemory.h"
 #include "RawStructs.h"
 
 // The maximum number of frames we keep in our queue. Don't live in the past.
 #define MAX_FRAMES_QUEUED 10
 
 using namespace mozilla::net;
 
-NS_IMPL_THREADSAFE_ISUPPORTS2(AndroidCameraInputStream, nsIInputStream, nsIAsyncInputStream)
+NS_IMPL_ISUPPORTS2(AndroidCameraInputStream, nsIInputStream, nsIAsyncInputStream)
 
 AndroidCameraInputStream::AndroidCameraInputStream() :
   mWidth(0), mHeight(0), mCamera(0), mHeaderSent(false), mClosed(true), mFrameSize(0),
   mMonitor("AndroidCamera.Monitor")
 {
   mAvailable = sizeof(RawVideoHeader);
   mFrameQueue = new nsDeque();
 }
@@ -250,17 +250,17 @@ NS_IMETHODIMP AndroidCameraInputStream::
   AndroidCameraInputStream::doClose();
   return NS_OK;
 }
 
 /**
  * AndroidCaptureProvider implementation
  */
 
-NS_IMPL_THREADSAFE_ISUPPORTS0(AndroidCaptureProvider)
+NS_IMPL_ISUPPORTS0(AndroidCaptureProvider)
 
 AndroidCaptureProvider* AndroidCaptureProvider::sInstance = NULL;
 
 AndroidCaptureProvider::AndroidCaptureProvider() {
 }
 
 AndroidCaptureProvider::~AndroidCaptureProvider() {
   AndroidCaptureProvider::sInstance = NULL;
--- a/netwerk/protocol/device/AndroidCaptureProvider.h
+++ b/netwerk/protocol/device/AndroidCaptureProvider.h
@@ -16,30 +16,30 @@
 #include "nsDeque.h"
 #include "mozilla/ReentrantMonitor.h"
 
 class AndroidCaptureProvider MOZ_FINAL : public nsDeviceCaptureProvider {
   public:
     AndroidCaptureProvider();
     ~AndroidCaptureProvider();
 
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
 
     nsresult Init(nsACString& aContentType, nsCaptureParams* aParams, nsIInputStream** aStream);
     static AndroidCaptureProvider* sInstance;
 };
 
 class AndroidCameraInputStream MOZ_FINAL : public nsIAsyncInputStream, mozilla::net::CameraStreamImpl::FrameCallback {
   public:
     AndroidCameraInputStream();
     ~AndroidCameraInputStream();
 
     NS_IMETHODIMP Init(nsACString& aContentType, nsCaptureParams* aParams);
 
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSIINPUTSTREAM
     NS_DECL_NSIASYNCINPUTSTREAM
 
     void ReceiveFrame(char* frame, uint32_t length);
 
   protected:
     void NotifyListeners();
     void doClose();
--- a/netwerk/protocol/device/nsDeviceProtocolHandler.cpp
+++ b/netwerk/protocol/device/nsDeviceProtocolHandler.cpp
@@ -7,18 +7,18 @@
 #include "nsDeviceChannel.h"
 #include "nsNetCID.h"
 #include "nsAutoPtr.h"
 #include "nsCOMPtr.h"
 #include "nsSimpleURI.h"
 
 //-----------------------------------------------------------------------------
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(nsDeviceProtocolHandler,
-                              nsIProtocolHandler)
+NS_IMPL_ISUPPORTS1(nsDeviceProtocolHandler,
+                   nsIProtocolHandler)
 
 nsresult
 nsDeviceProtocolHandler::Init(){
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDeviceProtocolHandler::GetScheme(nsACString &aResult)
--- a/netwerk/protocol/device/nsDeviceProtocolHandler.h
+++ b/netwerk/protocol/device/nsDeviceProtocolHandler.h
@@ -12,17 +12,17 @@
 
 // {6b0ffe9e-d114-486b-aeb7-da62e7273ed5}
 #define NS_DEVICEPROTOCOLHANDLER_CID                      \
 { 0x60ffe9e, 0xd114, 0x486b,                              \
     {0xae, 0xb7, 0xda, 0x62, 0xe7, 0x27, 0x3e, 0xd5} }
 
 class nsDeviceProtocolHandler MOZ_FINAL : public nsIProtocolHandler {
 public:
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIPROTOCOLHANDLER
 
   nsDeviceProtocolHandler() {}
   ~nsDeviceProtocolHandler() {}
 
   nsresult Init();
 };
 
--- a/netwerk/protocol/file/nsFileProtocolHandler.cpp
+++ b/netwerk/protocol/file/nsFileProtocolHandler.cpp
@@ -46,20 +46,20 @@ nsFileProtocolHandler::nsFileProtocolHan
 }
 
 nsresult
 nsFileProtocolHandler::Init()
 {
     return NS_OK;
 }
 
-NS_IMPL_THREADSAFE_ISUPPORTS3(nsFileProtocolHandler,
-                              nsIFileProtocolHandler,
-                              nsIProtocolHandler,
-                              nsISupportsWeakReference)
+NS_IMPL_ISUPPORTS3(nsFileProtocolHandler,
+                   nsIFileProtocolHandler,
+                   nsIProtocolHandler,
+                   nsISupportsWeakReference)
 
 //-----------------------------------------------------------------------------
 // nsIProtocolHandler methods:
 
 #if defined(XP_WIN)
 NS_IMETHODIMP
 nsFileProtocolHandler::ReadURLFile(nsIFile* aFile, nsIURI** aURI)
 {
--- a/netwerk/protocol/file/nsFileProtocolHandler.h
+++ b/netwerk/protocol/file/nsFileProtocolHandler.h
@@ -8,17 +8,17 @@
 
 #include "nsIFileProtocolHandler.h"
 #include "nsWeakReference.h"
 
 class nsFileProtocolHandler : public nsIFileProtocolHandler
                             , public nsSupportsWeakReference
 {
 public:
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSIPROTOCOLHANDLER
     NS_DECL_NSIFILEPROTOCOLHANDLER
 
     nsFileProtocolHandler();
     virtual ~nsFileProtocolHandler() {}
 
     nsresult Init();
 };
--- a/netwerk/protocol/ftp/nsFTPChannel.cpp
+++ b/netwerk/protocol/ftp/nsFTPChannel.cpp
@@ -154,17 +154,17 @@ namespace {
 class FTPEventSinkProxy MOZ_FINAL : public nsIFTPEventSink
 {
 public:
     FTPEventSinkProxy(nsIFTPEventSink* aTarget)
         : mTarget(aTarget)
         , mTargetThread(do_GetCurrentThread())
     { }
         
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSIFTPEVENTSINK
 
     class OnFTPControlLogRunnable : public nsRunnable
     {
     public:
         OnFTPControlLogRunnable(nsIFTPEventSink* aTarget,
                                 bool aServer,
                                 const char* aMessage)
@@ -181,17 +181,17 @@ public:
         nsCString mMessage;
     };
 
 private:
     nsCOMPtr<nsIFTPEventSink> mTarget;
     nsCOMPtr<nsIThread> mTargetThread;
 };
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(FTPEventSinkProxy, nsIFTPEventSink)
+NS_IMPL_ISUPPORTS1(FTPEventSinkProxy, nsIFTPEventSink)
 
 NS_IMETHODIMP
 FTPEventSinkProxy::OnFTPControlLog(bool aServer, const char* aMsg)
 {
     nsRefPtr<OnFTPControlLogRunnable> r =
         new OnFTPControlLogRunnable(mTarget, aServer, aMsg);
     return mTargetThread->Dispatch(r, NS_DISPATCH_NORMAL);
 }
--- a/netwerk/protocol/ftp/nsFtpProtocolHandler.cpp
+++ b/netwerk/protocol/ftp/nsFtpProtocolHandler.cpp
@@ -89,21 +89,21 @@ nsFtpProtocolHandler::~nsFtpProtocolHand
 {
     LOG(("FTP:destroying handler @%x\n", this));
 
     NS_ASSERTION(mRootConnectionList.Length() == 0, "why wasn't Observe called?");
 
     gFtpHandler = nullptr;
 }
 
-NS_IMPL_THREADSAFE_ISUPPORTS4(nsFtpProtocolHandler,
-                              nsIProtocolHandler,
-                              nsIProxiedProtocolHandler,
-                              nsIObserver,
-                              nsISupportsWeakReference)
+NS_IMPL_ISUPPORTS4(nsFtpProtocolHandler,
+                   nsIProtocolHandler,
+                   nsIProxiedProtocolHandler,
+                   nsIObserver,
+                   nsISupportsWeakReference)
 
 nsresult
 nsFtpProtocolHandler::Init()
 {
     if (IsNeckoChild())
         NeckoChild::InitNeckoChild();
 
     if (mIdleTimeout == -1) {
--- a/netwerk/protocol/ftp/nsFtpProtocolHandler.h
+++ b/netwerk/protocol/ftp/nsFtpProtocolHandler.h
@@ -23,17 +23,17 @@ class nsIStreamListener;
 
 //-----------------------------------------------------------------------------
 
 class nsFtpProtocolHandler : public nsIProxiedProtocolHandler
                            , public nsIObserver
                            , public nsSupportsWeakReference
 {
 public:
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSIPROTOCOLHANDLER
     NS_DECL_NSIPROXIEDPROTOCOLHANDLER
     NS_DECL_NSIOBSERVER
     
     nsFtpProtocolHandler();
     virtual ~nsFtpProtocolHandler();
     
     nsresult Init();
--- a/netwerk/protocol/http/NullHttpTransaction.cpp
+++ b/netwerk/protocol/http/NullHttpTransaction.cpp
@@ -10,17 +10,17 @@
 #include "nsHttp.h"
 #include "NullHttpTransaction.h"
 #include "nsProxyRelease.h"
 #include "nsHttpHandler.h"
 
 namespace mozilla {
 namespace net {
 
-NS_IMPL_THREADSAFE_ISUPPORTS0(NullHttpTransaction)
+NS_IMPL_ISUPPORTS0(NullHttpTransaction)
 
 NullHttpTransaction::NullHttpTransaction(nsHttpConnectionInfo *ci,
                                          nsIInterfaceRequestor *callbacks,
                                          uint32_t caps)
   : mStatus(NS_OK)
   , mCaps(caps | NS_HTTP_ALLOW_KEEPALIVE)
   , mCallbacks(callbacks)
   , mConnectionInfo(ci)
--- a/netwerk/protocol/http/NullHttpTransaction.h
+++ b/netwerk/protocol/http/NullHttpTransaction.h
@@ -19,17 +19,17 @@
 // tunnels) so that a nsHttpConnection becomes fully established in
 // anticipation of a real transaction needing to use it soon.
 
 namespace mozilla { namespace net {
 
 class NullHttpTransaction MOZ_FINAL : public nsAHttpTransaction
 {
 public:
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSAHTTPTRANSACTION
 
   NullHttpTransaction(nsHttpConnectionInfo *ci,
                       nsIInterfaceRequestor *callbacks,
                       uint32_t caps);
   ~NullHttpTransaction();
 
   nsHttpConnectionInfo *ConnectionInfo() { return mConnectionInfo; }
--- a/netwerk/protocol/http/SpdyPush3.cpp
+++ b/netwerk/protocol/http/SpdyPush3.cpp
@@ -203,17 +203,17 @@ SpdyPushCache3::RemovePushedStream(nsCSt
 }
 
 //////////////////////////////////////////
 // SpdyPush3TransactionBuffer
 // This is the nsAHttpTransction owned by the stream when the pushed
 // stream has not yet been matched with a pull request
 //////////////////////////////////////////
 
-NS_IMPL_THREADSAFE_ISUPPORTS0(SpdyPush3TransactionBuffer)
+NS_IMPL_ISUPPORTS0(SpdyPush3TransactionBuffer)
 
 SpdyPush3TransactionBuffer::SpdyPush3TransactionBuffer()
   : mStatus(NS_OK)
   , mRequestHead(nullptr)
   , mPushStream(nullptr)
   , mIsDone(false)
   , mBufferedHTTP1Size(kDefaultBufferSize)
   , mBufferedHTTP1Used(0)
--- a/netwerk/protocol/http/SpdyPush3.h
+++ b/netwerk/protocol/http/SpdyPush3.h
@@ -68,17 +68,17 @@ private:
   nsresult mStatus;
   bool mPushCompleted; // server push FIN received
   bool mDeferCleanupOnSuccess;
 };
 
 class SpdyPush3TransactionBuffer MOZ_FINAL : public nsAHttpTransaction
 {
 public:
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSAHTTPTRANSACTION
 
   SpdyPush3TransactionBuffer();
   virtual ~SpdyPush3TransactionBuffer();
 
   nsresult GetBufferedData(char *buf, uint32_t count, uint32_t *countWritten);
   void SetPushStream(SpdyPushedStream3 *stream) { mPushStream = stream; }
 
--- a/netwerk/protocol/http/SpdySession2.cpp
+++ b/netwerk/protocol/http/SpdySession2.cpp
@@ -24,18 +24,18 @@ extern PRThread *gSocketThread;
 #endif
 
 namespace mozilla {
 namespace net {
 
 // SpdySession2 has multiple inheritance of things that implement
 // nsISupports, so this magic is taken from nsHttpPipeline that
 // implements some of the same abstract classes.
-NS_IMPL_THREADSAFE_ADDREF(SpdySession2)
-NS_IMPL_THREADSAFE_RELEASE(SpdySession2)
+NS_IMPL_ADDREF(SpdySession2)
+NS_IMPL_RELEASE(SpdySession2)
 NS_INTERFACE_MAP_BEGIN(SpdySession2)
     NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsAHttpConnection)
 NS_INTERFACE_MAP_END
 
 SpdySession2::SpdySession2(nsAHttpTransaction *aHttpTransaction,
                          nsISocketTransport *aSocketTransport,
                          int32_t firstPriority)
   : mSocketTransport(aSocketTransport),
--- a/netwerk/protocol/http/SpdySession2.h
+++ b/netwerk/protocol/http/SpdySession2.h
@@ -26,17 +26,17 @@ namespace mozilla { namespace net {
 class SpdyStream2;
 
 class SpdySession2 MOZ_FINAL : public ASpdySession
                              , public nsAHttpConnection
                              , public nsAHttpSegmentReader
                              , public nsAHttpSegmentWriter
 {
 public:
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSAHTTPTRANSACTION
   NS_DECL_NSAHTTPCONNECTION(mConnection)
   NS_DECL_NSAHTTPSEGMENTREADER
   NS_DECL_NSAHTTPSEGMENTWRITER
 
   SpdySession2(nsAHttpTransaction *, nsISocketTransport *, int32_t);
   ~SpdySession2();
 
--- a/netwerk/protocol/http/SpdySession3.cpp
+++ b/netwerk/protocol/http/SpdySession3.cpp
@@ -27,18 +27,18 @@ extern PRThread *gSocketThread;
 #endif
 
 namespace mozilla {
 namespace net {
 
 // SpdySession3 has multiple inheritance of things that implement
 // nsISupports, so this magic is taken from nsHttpPipeline that
 // implements some of the same abstract classes.
-NS_IMPL_THREADSAFE_ADDREF(SpdySession3)
-NS_IMPL_THREADSAFE_RELEASE(SpdySession3)
+NS_IMPL_ADDREF(SpdySession3)
+NS_IMPL_RELEASE(SpdySession3)
 NS_INTERFACE_MAP_BEGIN(SpdySession3)
     NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsAHttpConnection)
 NS_INTERFACE_MAP_END
 
 SpdySession3::SpdySession3(nsAHttpTransaction *aHttpTransaction,
                          nsISocketTransport *aSocketTransport,
                          int32_t firstPriority)
   : mSocketTransport(aSocketTransport),
--- a/netwerk/protocol/http/SpdySession3.h
+++ b/netwerk/protocol/http/SpdySession3.h
@@ -24,17 +24,17 @@ namespace mozilla { namespace net {
 class SpdyStream3;
 
 class SpdySession3 MOZ_FINAL : public ASpdySession
                              , public nsAHttpConnection
                              , public nsAHttpSegmentReader
                              , public nsAHttpSegmentWriter
 {
 public:
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSAHTTPTRANSACTION
   NS_DECL_NSAHTTPCONNECTION(mConnection)
   NS_DECL_NSAHTTPSEGMENTREADER
   NS_DECL_NSAHTTPSEGMENTWRITER
 
   SpdySession3(nsAHttpTransaction *, nsISocketTransport *, int32_t);
   ~SpdySession3();
 
--- a/netwerk/protocol/http/nsHttpActivityDistributor.cpp
+++ b/netwerk/protocol/http/nsHttpActivityDistributor.cpp
@@ -56,19 +56,19 @@ private:
     uint32_t mActivitySubtype;
     PRTime mTimestamp;
     uint64_t mExtraSizeData;
     nsCString mExtraStringData;
 
     ObserverArray mObservers;
 };
 
-NS_IMPL_THREADSAFE_ISUPPORTS2(nsHttpActivityDistributor,
-                              nsIHttpActivityDistributor,
-                              nsIHttpActivityObserver)
+NS_IMPL_ISUPPORTS2(nsHttpActivityDistributor,
+                   nsIHttpActivityDistributor,
+                   nsIHttpActivityObserver)
 
 nsHttpActivityDistributor::nsHttpActivityDistributor()
     : mLock("nsHttpActivityDistributor.mLock")
 {
 }
 
 nsHttpActivityDistributor::~nsHttpActivityDistributor()
 {
--- a/netwerk/protocol/http/nsHttpActivityDistributor.h
+++ b/netwerk/protocol/http/nsHttpActivityDistributor.h
@@ -10,17 +10,17 @@
 #include "nsProxyRelease.h"
 #include "mozilla/Mutex.h"
 
 
 class nsHttpActivityDistributor : public nsIHttpActivityDistributor
 {
 public:
     typedef nsTArray<nsMainThreadPtrHandle<nsIHttpActivityObserver> > ObserverArray;
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSIHTTPACTIVITYOBSERVER
     NS_DECL_NSIHTTPACTIVITYDISTRIBUTOR
 
     nsHttpActivityDistributor();
     virtual ~nsHttpActivityDistributor();
 
 protected:
     ObserverArray mObservers;
--- a/netwerk/protocol/http/nsHttpConnection.cpp
+++ b/netwerk/protocol/http/nsHttpConnection.cpp
@@ -1509,21 +1509,21 @@ nsHttpConnection::SetupProxyConnect()
 
     return NS_NewCStringInputStream(getter_AddRefs(mProxyConnectStream), buf);
 }
 
 //-----------------------------------------------------------------------------
 // nsHttpConnection::nsISupports
 //-----------------------------------------------------------------------------
 
-NS_IMPL_THREADSAFE_ISUPPORTS4(nsHttpConnection,
-                              nsIInputStreamCallback,
-                              nsIOutputStreamCallback,
-                              nsITransportEventSink,
-                              nsIInterfaceRequestor)
+NS_IMPL_ISUPPORTS4(nsHttpConnection,
+                   nsIInputStreamCallback,
+                   nsIOutputStreamCallback,
+                   nsITransportEventSink,
+                   nsIInterfaceRequestor)
 
 //-----------------------------------------------------------------------------
 // nsHttpConnection::nsIInputStreamCallback
 //-----------------------------------------------------------------------------
 
 // called on the socket transport thread
 NS_IMETHODIMP
 nsHttpConnection::OnInputStreamReady(nsIAsyncInputStream *in)
--- a/netwerk/protocol/http/nsHttpConnection.h
+++ b/netwerk/protocol/http/nsHttpConnection.h
@@ -36,17 +36,17 @@ class nsHttpResponseHead;
 class nsHttpConnection : public nsAHttpSegmentReader
                        , public nsAHttpSegmentWriter
                        , public nsIInputStreamCallback
                        , public nsIOutputStreamCallback
                        , public nsITransportEventSink
                        , public nsIInterfaceRequestor
 {
 public:
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSAHTTPSEGMENTREADER
     NS_DECL_NSAHTTPSEGMENTWRITER
     NS_DECL_NSIINPUTSTREAMCALLBACK
     NS_DECL_NSIOUTPUTSTREAMCALLBACK
     NS_DECL_NSITRANSPORTEVENTSINK
     NS_DECL_NSIINTERFACEREQUESTOR
 
     nsHttpConnection();
--- a/netwerk/protocol/http/nsHttpConnectionInfo.h
+++ b/netwerk/protocol/http/nsHttpConnectionInfo.h
@@ -31,24 +31,24 @@ public:
 
    ~nsHttpConnectionInfo()
     {
         PR_LOG(gHttpLog, 4, ("Destroying nsHttpConnectionInfo @%x\n", this));
     }
 
     nsrefcnt AddRef()
     {
-        nsrefcnt n = NS_AtomicIncrementRefcnt(mRef);
+        nsrefcnt n = ++mRef;
         NS_LOG_ADDREF(this, n, "nsHttpConnectionInfo", sizeof(*this));
         return n;
     }
 
     nsrefcnt Release()
     {
-        nsrefcnt n = NS_AtomicDecrementRefcnt(mRef);
+        nsrefcnt n = --mRef;
         NS_LOG_RELEASE(this, n, "nsHttpConnectionInfo");
         if (n == 0)
             delete this;
         return n;
     }
 
     const nsAFlatCString &HashKey() const { return mHashKey; }
 
@@ -92,17 +92,17 @@ public:
     bool          GetPrivate() const     { return mHashKey.CharAt(3) == 'P'; }
 
     const nsCString &GetHost() { return mHost; }
 
     // Returns true for any kind of proxy (http, socks, etc..)
     bool UsingProxy();
 
 private:
-    nsrefcnt               mRef;
+    mozilla::ThreadSafeAutoRefCnt mRef;
     nsCString              mHashKey;
     nsCString              mHost;
     int32_t                mPort;
     nsCOMPtr<nsProxyInfo>  mProxyInfo;
     bool                   mUsingHttpProxy;
     bool                   mUsingSSL;
     bool                   mUsingConnect;  // if will use CONNECT with http proxy
 };
--- a/netwerk/protocol/http/nsHttpConnectionMgr.cpp
+++ b/netwerk/protocol/http/nsHttpConnectionMgr.cpp
@@ -32,17 +32,17 @@ using namespace mozilla::net;
 // defined by the socket transport service while active
 extern PRThread *gSocketThread;
 
 static NS_DEFINE_CID(kSocketTransportServiceCID, NS_SOCKETTRANSPORTSERVICE_CID);
 
 //-----------------------------------------------------------------------------
 
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(nsHttpConnectionMgr, nsIObserver)
+NS_IMPL_ISUPPORTS1(nsHttpConnectionMgr, nsIObserver)
 
 static void
 InsertTransactionSorted(nsTArray<nsHttpTransaction*> &pendingQ, nsHttpTransaction *trans)
 {
     // insert into queue with smallest valued number first.  search in reverse
     // order under the assumption that many of the existing transactions will
     // have the same priority (usually 0).
 
@@ -2454,17 +2454,17 @@ nsHttpConnectionMgr::TimeoutTickCB(const
 nsHttpConnectionMgr::nsConnectionHandle::~nsConnectionHandle()
 {
     if (mConn) {
         gHttpHandler->ReclaimConnection(mConn);
         NS_RELEASE(mConn);
     }
 }
 
-NS_IMPL_THREADSAFE_ISUPPORTS0(nsHttpConnectionMgr::nsConnectionHandle)
+NS_IMPL_ISUPPORTS0(nsHttpConnectionMgr::nsConnectionHandle)
 
 nsHttpConnectionMgr::nsConnectionEntry *
 nsHttpConnectionMgr::GetOrCreateConnectionEntry(nsHttpConnectionInfo *ci)
 {
     nsConnectionEntry *ent = mCT.Get(ci->HashKey());
     if (ent)
         return ent;
 
@@ -2552,21 +2552,21 @@ nsHttpConnectionMgr::nsConnectionHandle:
 {
     return mConn->PushBack(buf, bufLen);
 }
 
 
 //////////////////////// nsHalfOpenSocket
 
 
-NS_IMPL_THREADSAFE_ISUPPORTS4(nsHttpConnectionMgr::nsHalfOpenSocket,
-                              nsIOutputStreamCallback,
-                              nsITransportEventSink,
-                              nsIInterfaceRequestor,
-                              nsITimerCallback)
+NS_IMPL_ISUPPORTS4(nsHttpConnectionMgr::nsHalfOpenSocket,
+                   nsIOutputStreamCallback,
+                   nsITransportEventSink,
+                   nsIInterfaceRequestor,
+                   nsITimerCallback)
 
 nsHttpConnectionMgr::
 nsHalfOpenSocket::nsHalfOpenSocket(nsConnectionEntry *ent,
                                    nsAHttpTransaction *trans,
                                    uint32_t caps)
     : mEnt(ent),
       mTransaction(trans),
       mCaps(caps),
--- a/netwerk/protocol/http/nsHttpConnectionMgr.h
+++ b/netwerk/protocol/http/nsHttpConnectionMgr.h
@@ -35,17 +35,17 @@ class EventTokenBucket;
 }
 }
 
 //-----------------------------------------------------------------------------
 
 class nsHttpConnectionMgr : public nsIObserver
 {
 public:
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSIOBSERVER
 
     // parameter names
     enum nsParamName {
         MAX_CONNECTIONS,
         MAX_PERSISTENT_CONNECTIONS_PER_HOST,
         MAX_PERSISTENT_CONNECTIONS_PER_PROXY,
         MAX_REQUEST_DELAY,
@@ -385,17 +385,17 @@ private:
     // transaction (or pipeline) owns a reference to this handle.  this extra
     // layer of indirection greatly simplifies consumer code, avoiding the
     // need for consumer code to know when to give the connection back to the
     // connection manager.
     //
     class nsConnectionHandle : public nsAHttpConnection
     {
     public:
-        NS_DECL_ISUPPORTS
+        NS_DECL_THREADSAFE_ISUPPORTS
         NS_DECL_NSAHTTPCONNECTION(mConn)
 
         nsConnectionHandle(nsHttpConnection *conn) { NS_ADDREF(mConn = conn); }
         virtual ~nsConnectionHandle();
 
         nsHttpConnection *mConn;
     };
 
@@ -403,17 +403,17 @@ private:
     // while we wait for it to establish and bind it to a connection
 
     class nsHalfOpenSocket MOZ_FINAL : public nsIOutputStreamCallback,
                                        public nsITransportEventSink,
                                        public nsIInterfaceRequestor,
                                        public nsITimerCallback
     {
     public:
-        NS_DECL_ISUPPORTS
+        NS_DECL_THREADSAFE_ISUPPORTS
         NS_DECL_NSIOUTPUTSTREAMCALLBACK
         NS_DECL_NSITRANSPORTEVENTSINK
         NS_DECL_NSIINTERFACEREQUESTOR
         NS_DECL_NSITIMERCALLBACK
 
         nsHalfOpenSocket(nsConnectionEntry *ent,
                          nsAHttpTransaction *trans,
                          uint32_t caps);
--- a/netwerk/protocol/http/nsHttpHandler.cpp
+++ b/netwerk/protocol/http/nsHttpHandler.cpp
@@ -1497,23 +1497,23 @@ nsHttpHandler::SetAcceptEncodings(const 
     mAcceptEncodings = aAcceptEncodings;
     return NS_OK;
 }
 
 //-----------------------------------------------------------------------------
 // nsHttpHandler::nsISupports
 //-----------------------------------------------------------------------------
 
-NS_IMPL_THREADSAFE_ISUPPORTS6(nsHttpHandler,
-                              nsIHttpProtocolHandler,
-                              nsIProxiedProtocolHandler,
-                              nsIProtocolHandler,
-                              nsIObserver,
-                              nsISupportsWeakReference,
-                              nsISpeculativeConnect)
+NS_IMPL_ISUPPORTS6(nsHttpHandler,
+                   nsIHttpProtocolHandler,
+                   nsIProxiedProtocolHandler,
+                   nsIProtocolHandler,
+                   nsIObserver,
+                   nsISupportsWeakReference,
+                   nsISpeculativeConnect)
 
 //-----------------------------------------------------------------------------
 // nsHttpHandler::nsIProtocolHandler
 //-----------------------------------------------------------------------------
 
 NS_IMETHODIMP
 nsHttpHandler::GetScheme(nsACString &aScheme)
 {
@@ -1934,22 +1934,22 @@ nsHttpHandler::TickleWifi(nsIInterfaceRe
     mWifiTickler->SetIPV4Address(gwAddress);
     mWifiTickler->Tickle();
 }
 
 //-----------------------------------------------------------------------------
 // nsHttpsHandler implementation
 //-----------------------------------------------------------------------------
 
-NS_IMPL_THREADSAFE_ISUPPORTS5(nsHttpsHandler,
-                              nsIHttpProtocolHandler,
-                              nsIProxiedProtocolHandler,
-                              nsIProtocolHandler,
-                              nsISupportsWeakReference,
-                              nsISpeculativeConnect)
+NS_IMPL_ISUPPORTS5(nsHttpsHandler,
+                   nsIHttpProtocolHandler,
+                   nsIProxiedProtocolHandler,
+                   nsIProtocolHandler,
+                   nsISupportsWeakReference,
+                   nsISpeculativeConnect)
 
 nsresult
 nsHttpsHandler::Init()
 {
     nsCOMPtr<nsIProtocolHandler> httpHandler(
             do_GetService(NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "http"));
     MOZ_ASSERT(httpHandler.get() != nullptr);
     return NS_OK;
--- a/netwerk/protocol/http/nsHttpHandler.h
+++ b/netwerk/protocol/http/nsHttpHandler.h
@@ -50,17 +50,17 @@ class Tickler;
 //-----------------------------------------------------------------------------
 
 class nsHttpHandler : public nsIHttpProtocolHandler
                     , public nsIObserver
                     , public nsSupportsWeakReference
                     , public nsISpeculativeConnect
 {
 public:
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSIPROTOCOLHANDLER
     NS_DECL_NSIPROXIEDPROTOCOLHANDLER
     NS_DECL_NSIHTTPPROTOCOLHANDLER
     NS_DECL_NSIOBSERVER
     NS_DECL_NSISPECULATIVECONNECT
 
     nsHttpHandler();
     virtual ~nsHttpHandler();
@@ -490,17 +490,17 @@ extern nsHttpHandler *gHttpHandler;
 class nsHttpsHandler : public nsIHttpProtocolHandler
                      , public nsSupportsWeakReference
                      , public nsISpeculativeConnect
 {
 public:
     // we basically just want to override GetScheme and GetDefaultPort...
     // all other methods should be forwarded to the nsHttpHandler instance.
 
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSIPROTOCOLHANDLER
     NS_FORWARD_NSIPROXIEDPROTOCOLHANDLER (gHttpHandler->)
     NS_FORWARD_NSIHTTPPROTOCOLHANDLER    (gHttpHandler->)
     NS_FORWARD_NSISPECULATIVECONNECT     (gHttpHandler->)
 
     nsHttpsHandler() { }
     virtual ~nsHttpsHandler() { }
 
--- a/netwerk/protocol/http/nsHttpPipeline.cpp
+++ b/netwerk/protocol/http/nsHttpPipeline.cpp
@@ -156,18 +156,18 @@ nsHttpPipeline::QueryPipeline()
 {
     return this;
 }
 
 //-----------------------------------------------------------------------------
 // nsHttpPipeline::nsISupports
 //-----------------------------------------------------------------------------
 
-NS_IMPL_THREADSAFE_ADDREF(nsHttpPipeline)
-NS_IMPL_THREADSAFE_RELEASE(nsHttpPipeline)
+NS_IMPL_ADDREF(nsHttpPipeline)
+NS_IMPL_RELEASE(nsHttpPipeline)
 
 // multiple inheritance fun :-)
 NS_INTERFACE_MAP_BEGIN(nsHttpPipeline)
     NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsAHttpConnection)
 NS_INTERFACE_MAP_END
 
 
 //-----------------------------------------------------------------------------
--- a/netwerk/protocol/http/nsHttpPipeline.h
+++ b/netwerk/protocol/http/nsHttpPipeline.h
@@ -14,17 +14,17 @@
 #include "nsTArray.h"
 #include "nsCOMPtr.h"
 
 class nsHttpPipeline : public nsAHttpConnection
                      , public nsAHttpTransaction
                      , public nsAHttpSegmentReader
 {
 public:
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSAHTTPCONNECTION(mConnection)
     NS_DECL_NSAHTTPTRANSACTION
     NS_DECL_NSAHTTPSEGMENTREADER
 
     nsHttpPipeline();
     virtual ~nsHttpPipeline();
 
 private:
--- a/netwerk/protocol/http/nsHttpTransaction.cpp
+++ b/netwerk/protocol/http/nsHttpTransaction.cpp
@@ -1676,38 +1676,38 @@ nsHttpTransaction::CancelPacing(nsresult
         mTokenBucketCancel = nullptr;
     }
 }
 
 //-----------------------------------------------------------------------------
 // nsHttpTransaction::nsISupports
 //-----------------------------------------------------------------------------
 
-NS_IMPL_THREADSAFE_ADDREF(nsHttpTransaction)
+NS_IMPL_ADDREF(nsHttpTransaction)
 
 NS_IMETHODIMP_(nsrefcnt)
 nsHttpTransaction::Release()
 {
     nsrefcnt count;
     NS_PRECONDITION(0 != mRefCnt, "dup release");
-    count = NS_AtomicDecrementRefcnt(mRefCnt);
+    count = --mRefCnt;
     NS_LOG_RELEASE(this, count, "nsHttpTransaction");
     if (0 == count) {
         mRefCnt = 1; /* stablize */
         // it is essential that the transaction be destroyed on the consumer
         // thread (we could be holding the last reference to our consumer).
         DeleteSelfOnConsumerThread();
         return 0;
     }
     return count;
 }
 
-NS_IMPL_THREADSAFE_QUERY_INTERFACE2(nsHttpTransaction,
-                                    nsIInputStreamCallback,
-                                    nsIOutputStreamCallback)
+NS_IMPL_QUERY_INTERFACE2(nsHttpTransaction,
+                         nsIInputStreamCallback,
+                         nsIOutputStreamCallback)
 
 //-----------------------------------------------------------------------------
 // nsHttpTransaction::nsIInputStreamCallback
 //-----------------------------------------------------------------------------
 
 // called on the socket thread
 NS_IMETHODIMP
 nsHttpTransaction::OnInputStreamReady(nsIAsyncInputStream *out)
--- a/netwerk/protocol/http/nsHttpTransaction.h
+++ b/netwerk/protocol/http/nsHttpTransaction.h
@@ -37,17 +37,17 @@ class UpdateSecurityCallbacks;
 //-----------------------------------------------------------------------------
 
 class nsHttpTransaction : public nsAHttpTransaction
                         , public mozilla::net::ATokenBucketEvent
                         , public nsIInputStreamCallback
                         , public nsIOutputStreamCallback
 {
 public:
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSAHTTPTRANSACTION
     NS_DECL_NSIINPUTSTREAMCALLBACK
     NS_DECL_NSIOUTPUTSTREAMCALLBACK
 
     nsHttpTransaction();
     virtual ~nsHttpTransaction();
 
     //
--- a/netwerk/protocol/res/nsResProtocolHandler.cpp
+++ b/netwerk/protocol/res/nsResProtocolHandler.cpp
@@ -194,20 +194,20 @@ nsResProtocolHandler::CollectSubstitutio
 {
     mSubstitutions.EnumerateRead(&EnumerateSubstitution, &aResources);
 }
 
 //----------------------------------------------------------------------------
 // nsResProtocolHandler::nsISupports
 //----------------------------------------------------------------------------
 
-NS_IMPL_THREADSAFE_ISUPPORTS3(nsResProtocolHandler,
-                              nsIResProtocolHandler,
-                              nsIProtocolHandler,
-                              nsISupportsWeakReference)
+NS_IMPL_ISUPPORTS3(nsResProtocolHandler,
+                   nsIResProtocolHandler,
+                   nsIProtocolHandler,
+                   nsISupportsWeakReference)
 
 //----------------------------------------------------------------------------
 // nsResProtocolHandler::nsIProtocolHandler
 //----------------------------------------------------------------------------
 
 NS_IMETHODIMP
 nsResProtocolHandler::GetScheme(nsACString &result)
 {
--- a/netwerk/protocol/res/nsResProtocolHandler.h
+++ b/netwerk/protocol/res/nsResProtocolHandler.h
@@ -22,17 +22,17 @@ public:
     virtual nsStandardURL* StartClone();
     virtual nsresult EnsureFile();
     NS_IMETHOD GetClassIDNoAlloc(nsCID *aCID);
 };
 
 class nsResProtocolHandler : public nsIResProtocolHandler, public nsSupportsWeakReference
 {
 public:
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSIPROTOCOLHANDLER
     NS_DECL_NSIRESPROTOCOLHANDLER
 
     nsResProtocolHandler();
     virtual ~nsResProtocolHandler();
 
     nsresult Init();
 
--- a/netwerk/protocol/websocket/WebSocketChannel.cpp
+++ b/netwerk/protocol/websocket/WebSocketChannel.cpp
@@ -52,28 +52,28 @@
 
 extern PRThread *gSocketThread;
 
 using namespace mozilla;
 
 namespace mozilla {
 namespace net {
 
-NS_IMPL_THREADSAFE_ISUPPORTS11(WebSocketChannel,
-                               nsIWebSocketChannel,
-                               nsIHttpUpgradeListener,
-                               nsIRequestObserver,
-                               nsIStreamListener,
-                               nsIProtocolHandler,
-                               nsIInputStreamCallback,
-                               nsIOutputStreamCallback,
-                               nsITimerCallback,
-                               nsIDNSListener,
-                               nsIInterfaceRequestor,
-                               nsIChannelEventSink)
+NS_IMPL_ISUPPORTS11(WebSocketChannel,
+                    nsIWebSocketChannel,
+                    nsIHttpUpgradeListener,
+                    nsIRequestObserver,
+                    nsIStreamListener,
+                    nsIProtocolHandler,
+                    nsIInputStreamCallback,
+                    nsIOutputStreamCallback,
+                    nsITimerCallback,
+                    nsIDNSListener,
+                    nsIInterfaceRequestor,
+                    nsIChannelEventSink)
 
 // We implement RFC 6455, which uses Sec-WebSocket-Version: 13 on the wire.
 #define SEC_WEBSOCKET_VERSION "13"
 
 /*
  * About SSL unsigned certificates
  *
  * wss will not work to a host using an unsigned certificate unless there
@@ -485,17 +485,17 @@ static nsWSAdmissionManager *sWebSocketA
 
 //-----------------------------------------------------------------------------
 // CallOnMessageAvailable
 //-----------------------------------------------------------------------------
 
 class CallOnMessageAvailable MOZ_FINAL : public nsIRunnable
 {
 public:
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
 
   CallOnMessageAvailable(WebSocketChannel *aChannel,
                          nsCString        &aData,
                          int32_t           aLen)
     : mChannel(aChannel),
       mData(aData),
       mLen(aLen) {}
 
@@ -510,26 +510,26 @@ public:
 
 private:
   ~CallOnMessageAvailable() {}
 
   nsRefPtr<WebSocketChannel>        mChannel;
   nsCString                         mData;
   int32_t                           mLen;
 };
-NS_IMPL_THREADSAFE_ISUPPORTS1(CallOnMessageAvailable, nsIRunnable)
+NS_IMPL_ISUPPORTS1(CallOnMessageAvailable, nsIRunnable)
 
 //-----------------------------------------------------------------------------
 // CallOnStop
 //-----------------------------------------------------------------------------
 
 class CallOnStop MOZ_FINAL : public nsIRunnable
 {
 public:
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
 
   CallOnStop(WebSocketChannel *aChannel,
              nsresult          aReason)
     : mChannel(aChannel),
       mReason(aReason) {}
 
   NS_IMETHOD Run()
   {
@@ -546,26 +546,26 @@ public:
   }
 
 private:
   ~CallOnStop() {}
 
   nsRefPtr<WebSocketChannel>        mChannel;
   nsresult                          mReason;
 };
-NS_IMPL_THREADSAFE_ISUPPORTS1(CallOnStop, nsIRunnable)
+NS_IMPL_ISUPPORTS1(CallOnStop, nsIRunnable)
 
 //-----------------------------------------------------------------------------
 // CallOnServerClose
 //-----------------------------------------------------------------------------
 
 class CallOnServerClose MOZ_FINAL : public nsIRunnable
 {
 public:
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
 
   CallOnServerClose(WebSocketChannel *aChannel,
                     uint16_t          aCode,
                     nsCString        &aReason)
     : mChannel(aChannel),
       mCode(aCode),
       mReason(aReason) {}
 
@@ -577,26 +577,26 @@ public:
 
 private:
   ~CallOnServerClose() {}
 
   nsRefPtr<WebSocketChannel>        mChannel;
   uint16_t                          mCode;
   nsCString                         mReason;
 };
-NS_IMPL_THREADSAFE_ISUPPORTS1(CallOnServerClose, nsIRunnable)
+NS_IMPL_ISUPPORTS1(CallOnServerClose, nsIRunnable)
 
 //-----------------------------------------------------------------------------
 // CallAcknowledge
 //-----------------------------------------------------------------------------
 
 class CallAcknowledge MOZ_FINAL : public nsIRunnable
 {
 public:
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
 
   CallAcknowledge(WebSocketChannel *aChannel,
                   uint32_t          aSize)
     : mChannel(aChannel),
       mSize(aSize) {}
 
   NS_IMETHOD Run()
   {
@@ -606,26 +606,26 @@ public:
   }
 
 private:
   ~CallAcknowledge() {}
 
   nsRefPtr<WebSocketChannel>        mChannel;
   uint32_t                          mSize;
 };
-NS_IMPL_THREADSAFE_ISUPPORTS1(CallAcknowledge, nsIRunnable)
+NS_IMPL_ISUPPORTS1(CallAcknowledge, nsIRunnable)
 
 //-----------------------------------------------------------------------------
 // CallOnTransportAvailable
 //-----------------------------------------------------------------------------
 
 class CallOnTransportAvailable MOZ_FINAL : public nsIRunnable
 {
 public:
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
 
   CallOnTransportAvailable(WebSocketChannel *aChannel,
                            nsISocketTransport *aTransport,
                            nsIAsyncInputStream *aSocketIn,
                            nsIAsyncOutputStream *aSocketOut)
     : mChannel(aChannel),
       mTransport(aTransport),
       mSocketIn(aSocketIn),
@@ -640,17 +640,17 @@ public:
 private:
   ~CallOnTransportAvailable() {}
 
   nsRefPtr<WebSocketChannel>     mChannel;
   nsCOMPtr<nsISocketTransport>   mTransport;
   nsCOMPtr<nsIAsyncInputStream>  mSocketIn;
   nsCOMPtr<nsIAsyncOutputStream> mSocketOut;
 };
-NS_IMPL_THREADSAFE_ISUPPORTS1(CallOnTransportAvailable, nsIRunnable)
+NS_IMPL_ISUPPORTS1(CallOnTransportAvailable, nsIRunnable)
 
 //-----------------------------------------------------------------------------
 // OutboundMessage
 //-----------------------------------------------------------------------------
 
 enum WsMsgType {
   kMsgTypeString = 0,
   kMsgTypeBinaryString,
@@ -759,34 +759,34 @@ private:
 
 //-----------------------------------------------------------------------------
 // OutboundEnqueuer
 //-----------------------------------------------------------------------------
 
 class OutboundEnqueuer MOZ_FINAL : public nsIRunnable
 {
 public:
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
 
   OutboundEnqueuer(WebSocketChannel *aChannel, OutboundMessage *aMsg)
     : mChannel(aChannel), mMessage(aMsg) {}
 
   NS_IMETHOD Run()
   {
     mChannel->EnqueueOutgoingMessage(mChannel->mOutgoingMessages, mMessage);
     return NS_OK;
   }
 
 private:
   ~OutboundEnqueuer() {}
 
   nsRefPtr<WebSocketChannel>  mChannel;
   OutboundMessage            *mMessage;
 };
-NS_IMPL_THREADSAFE_ISUPPORTS1(OutboundEnqueuer, nsIRunnable)
+NS_IMPL_ISUPPORTS1(OutboundEnqueuer, nsIRunnable)
 
 //-----------------------------------------------------------------------------
 // nsWSCompression
 //
 // similar to nsDeflateConverter except for the mandatory FLUSH calls
 // required by websocket and the absence of the deflate termination
 // block which is appropriate because it would create data bytes after
 // sending the websockets CLOSE message.
--- a/netwerk/protocol/websocket/WebSocketChannel.h
+++ b/netwerk/protocol/websocket/WebSocketChannel.h
@@ -57,17 +57,17 @@ class WebSocketChannel : public BaseWebS
                          public nsIInputStreamCallback,
                          public nsIOutputStreamCallback,
                          public nsITimerCallback,
                          public nsIDNSListener,
                          public nsIInterfaceRequestor,
                          public nsIChannelEventSink
 {
 public:
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIHTTPUPGRADELISTENER
   NS_DECL_NSIREQUESTOBSERVER
   NS_DECL_NSISTREAMLISTENER
   NS_DECL_NSIINPUTSTREAMCALLBACK
   NS_DECL_NSIOUTPUTSTREAMCALLBACK
   NS_DECL_NSITIMERCALLBACK
   NS_DECL_NSIDNSLISTENER
   NS_DECL_NSIINTERFACEREQUESTOR
--- a/netwerk/protocol/websocket/WebSocketChannelParent.cpp
+++ b/netwerk/protocol/websocket/WebSocketChannelParent.cpp
@@ -10,17 +10,17 @@
 #include "mozilla/ipc/InputStreamUtils.h"
 #include "mozilla/ipc/URIUtils.h"
 
 using namespace mozilla::ipc;
 
 namespace mozilla {
 namespace net {
 
-NS_IMPL_THREADSAFE_ISUPPORTS2(WebSocketChannelParent,
+NS_IMPL_ISUPPORTS2(WebSocketChannelParent,
                               nsIWebSocketListener,
                               nsIInterfaceRequestor)
 
 WebSocketChannelParent::WebSocketChannelParent(nsIAuthPromptProvider* aAuthProvider,
                                                nsILoadContext* aLoadContext,
                                                PBOverrideStatus aOverrideStatus)
   : mAuthProvider(aAuthProvider)
   , mLoadContext(aLoadContext)
--- a/netwerk/protocol/websocket/WebSocketChannelParent.h
+++ b/netwerk/protocol/websocket/WebSocketChannelParent.h
@@ -21,17 +21,17 @@ class nsIAuthPromptProvider;
 namespace mozilla {
 namespace net {
 
 class WebSocketChannelParent : public PWebSocketParent,
                                public nsIWebSocketListener,
                                public nsIInterfaceRequestor
 {
  public:
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIWEBSOCKETLISTENER
   NS_DECL_NSIINTERFACEREQUESTOR
 
   WebSocketChannelParent(nsIAuthPromptProvider* aAuthProvider,
                          nsILoadContext* aLoadContext,
                          PBOverrideStatus aOverrideStatus);
 
  private:
--- a/netwerk/protocol/wyciwyg/nsWyciwygChannel.cpp
+++ b/netwerk/protocol/wyciwyg/nsWyciwygChannel.cpp
@@ -90,24 +90,24 @@ nsWyciwygChannel::nsWyciwygChannel()
     mInBrowser(false)
 {
 }
 
 nsWyciwygChannel::~nsWyciwygChannel() 
 {
 }
 
-NS_IMPL_THREADSAFE_ISUPPORTS7(nsWyciwygChannel,
-                              nsIChannel,
-                              nsIRequest,
-                              nsIStreamListener,
-                              nsIRequestObserver,
-                              nsICacheListener,
-                              nsIWyciwygChannel,
-                              nsIPrivateBrowsingChannel)
+NS_IMPL_ISUPPORTS7(nsWyciwygChannel,
+                   nsIChannel,
+                   nsIRequest,
+                   nsIStreamListener,
+                   nsIRequestObserver,
+                   nsICacheListener,
+                   nsIWyciwygChannel,
+                   nsIPrivateBrowsingChannel)
 
 nsresult
 nsWyciwygChannel::Init(nsIURI* uri)
 {
   NS_ENSURE_ARG_POINTER(uri);
 
   nsresult rv;
 
--- a/netwerk/protocol/wyciwyg/nsWyciwygChannel.h
+++ b/netwerk/protocol/wyciwyg/nsWyciwygChannel.h
@@ -33,17 +33,17 @@ extern PRLogModuleInfo * gWyciwygLog;
 //-----------------------------------------------------------------------------
 
 class nsWyciwygChannel: public nsIWyciwygChannel,
                         public nsIStreamListener,
                         public nsICacheListener,
                         public mozilla::net::PrivateBrowsingChannel<nsWyciwygChannel>
 {
 public:
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSIREQUEST
     NS_DECL_NSICHANNEL
     NS_DECL_NSIWYCIWYGCHANNEL
     NS_DECL_NSIREQUESTOBSERVER
     NS_DECL_NSISTREAMLISTENER
     NS_DECL_NSICACHELISTENER
 
     friend class nsWyciwygSetCharsetandSourceEvent;
--- a/netwerk/sctp/datachannel/DataChannel.cpp
+++ b/netwerk/sctp/datachannel/DataChannel.cpp
@@ -267,18 +267,18 @@ void DataChannelConnection::DestroyOnSTS
   if (aSocket && aSocket != aMasterSocket)
     usrsctp_close(aSocket);
   if (aMasterSocket)
     usrsctp_close(aMasterSocket);
 
   disconnect_all();
 }
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(DataChannelConnection,
-                              nsITimerCallback)
+NS_IMPL_ISUPPORTS1(DataChannelConnection,
+                   nsITimerCallback)
 
 bool
 DataChannelConnection::Init(unsigned short aPort, uint16_t aNumStreams, bool aUsingDtls)
 {
   struct sctp_initmsg initmsg;
   struct sctp_udpencaps encaps;
   struct sctp_assoc_value av;
   struct sctp_event event;
--- a/netwerk/sctp/datachannel/DataChannel.h
+++ b/netwerk/sctp/datachannel/DataChannel.h
@@ -116,17 +116,17 @@ public:
 
 // One per PeerConnection
 class DataChannelConnection: public nsITimerCallback
 #ifdef SCTP_DTLS_SUPPORTED
                              , public sigslot::has_slots<>
 #endif
 {
 public:
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSITIMERCALLBACK
 
   class DataConnectionListener : public SupportsWeakPtr<DataConnectionListener>
   {
   public:
     virtual ~DataConnectionListener() {}
 
     // Called when a the connection is open
--- a/netwerk/socket/nsSOCKSIOLayer.cpp
+++ b/netwerk/socket/nsSOCKSIOLayer.cpp
@@ -61,17 +61,17 @@ class nsSOCKSSocketInfo : public nsISOCK
     // in case of SOCKS4 as well as SOCKS5
     static const uint32_t BUFFER_SIZE = 262;
     static const uint32_t MAX_HOSTNAME_LEN = 255;
 
 public:
     nsSOCKSSocketInfo();
     virtual ~nsSOCKSSocketInfo() { HandshakeFinished(); }
 
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSISOCKSSOCKETINFO
     NS_DECL_NSIDNSLISTENER
 
     void Init(int32_t version,
               int32_t family,
               const char *proxyHost,
               int32_t proxyPort,
               const char *destinationHost,
@@ -172,17 +172,17 @@ nsSOCKSSocketInfo::Init(int32_t version,
     mVersion         = version;
     mDestinationFamily = family;
     mProxyHost       = proxyHost;
     mProxyPort       = proxyPort;
     mDestinationHost = host;
     mFlags           = flags;
 }
 
-NS_IMPL_THREADSAFE_ISUPPORTS2(nsSOCKSSocketInfo, nsISOCKSSocketInfo, nsIDNSListener)
+NS_IMPL_ISUPPORTS2(nsSOCKSSocketInfo, nsISOCKSSocketInfo, nsIDNSListener)
 
 NS_IMETHODIMP 
 nsSOCKSSocketInfo::GetExternalProxyAddr(NetAddr * *aExternalProxyAddr)
 {
     memcpy(*aExternalProxyAddr, &mExternalProxyAddr, sizeof(NetAddr));
     return NS_OK;
 }
 
--- a/netwerk/socket/nsSOCKSSocketProvider.cpp
+++ b/netwerk/socket/nsSOCKSSocketProvider.cpp
@@ -7,17 +7,17 @@
 #include "nsIServiceManager.h"
 #include "nsSOCKSSocketProvider.h"
 #include "nsSOCKSIOLayer.h"
 #include "nsCOMPtr.h"
 #include "nsError.h"
 
 //////////////////////////////////////////////////////////////////////////
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(nsSOCKSSocketProvider, nsISocketProvider)
+NS_IMPL_ISUPPORTS1(nsSOCKSSocketProvider, nsISocketProvider)
 
 nsresult
 nsSOCKSSocketProvider::CreateV4(nsISupports *aOuter, REFNSIID aIID, void **aResult)
 {
     nsresult rv;
     nsCOMPtr<nsISocketProvider> inst =
             new nsSOCKSSocketProvider(NS_SOCKS_VERSION_4);
     if (!inst)
--- a/netwerk/socket/nsSOCKSSocketProvider.h
+++ b/netwerk/socket/nsSOCKSSocketProvider.h
@@ -13,17 +13,17 @@
 enum {
     NS_SOCKS_VERSION_4 = 4,
     NS_SOCKS_VERSION_5 = 5
 };
 
 class nsSOCKSSocketProvider : public nsISocketProvider
 {
 public:
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSISOCKETPROVIDER
     
     nsSOCKSSocketProvider(uint32_t version) : mVersion(version) {}
     virtual ~nsSOCKSSocketProvider() {}
     
     static nsresult CreateV4(nsISupports *, REFNSIID aIID, void **aResult);
     static nsresult CreateV5(nsISupports *, REFNSIID aIID, void **aResult);
     
--- a/netwerk/socket/nsSocketProviderService.cpp
+++ b/netwerk/socket/nsSocketProviderService.cpp
@@ -18,17 +18,17 @@ nsSocketProviderService::Create(nsISuppo
   nsCOMPtr<nsISocketProviderService> inst = new nsSocketProviderService();
   if (!inst)
     rv = NS_ERROR_OUT_OF_MEMORY;
   else
     rv = inst->QueryInterface(aIID, aResult);
   return rv;
 }
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(nsSocketProviderService, nsISocketProviderService)
+NS_IMPL_ISUPPORTS1(nsSocketProviderService, nsISocketProviderService)
 
 ////////////////////////////////////////////////////////////////////////////////
 
 NS_IMETHODIMP
 nsSocketProviderService::GetSocketProvider(const char         *type,
                                            nsISocketProvider **result)
 {
   nsresult rv;
--- a/netwerk/socket/nsSocketProviderService.h
+++ b/netwerk/socket/nsSocketProviderService.h
@@ -6,17 +6,17 @@
 #ifndef nsSocketProviderService_h__
 #define nsSocketProviderService_h__
 
 #include "nsISocketProviderService.h"
 
 class nsSocketProviderService : public nsISocketProviderService
 {
 public:
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSISOCKETPROVIDERSERVICE
 
   nsSocketProviderService() {}
   virtual ~nsSocketProviderService() {}
 
   static nsresult Create(nsISupports *, REFNSIID aIID, void **aResult);
 };
 
--- a/netwerk/socket/nsUDPSocketProvider.cpp
+++ b/netwerk/socket/nsUDPSocketProvider.cpp
@@ -1,17 +1,17 @@
 /* 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/. */
 
 #include "nsUDPSocketProvider.h"
 
 #include "nspr.h"
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(nsUDPSocketProvider, nsISocketProvider)
+NS_IMPL_ISUPPORTS1(nsUDPSocketProvider, nsISocketProvider)
 
 nsUDPSocketProvider::~nsUDPSocketProvider()
 {
 }
 
 NS_IMETHODIMP 
 nsUDPSocketProvider::NewSocket(int32_t aFamily,
                                const char *aHost, 
--- a/netwerk/socket/nsUDPSocketProvider.h
+++ b/netwerk/socket/nsUDPSocketProvider.h
@@ -6,17 +6,17 @@
 #define nsUDPSocketProvider_h__
 
 #include "nsISocketProvider.h"
 #include "mozilla/Attributes.h"
 
 class nsUDPSocketProvider MOZ_FINAL : public nsISocketProvider
 {
 public:
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSISOCKETPROVIDER
 
 private:
     ~nsUDPSocketProvider();
 
 };
 
 #endif /* nsUDPSocketProvider_h__ */
--- a/netwerk/streamconv/converters/nsHTTPCompressConv.cpp
+++ b/netwerk/streamconv/converters/nsHTTPCompressConv.cpp
@@ -12,20 +12,20 @@
 #include "nsCOMPtr.h"
 #include "nsReadableUtils.h"
 #include "nsError.h"
 #include "nsStreamUtils.h"
 #include "nsStringStream.h"
 #include "nsComponentManagerUtils.h"
 
 // nsISupports implementation
-NS_IMPL_THREADSAFE_ISUPPORTS3(nsHTTPCompressConv,
-                              nsIStreamConverter,
-                              nsIStreamListener,
-                              nsIRequestObserver)
+NS_IMPL_ISUPPORTS3(nsHTTPCompressConv,
+                   nsIStreamConverter,
+                   nsIStreamListener,
+                   nsIRequestObserver)
 
 // nsFTPDirListingConv methods
 nsHTTPCompressConv::nsHTTPCompressConv()
     : mListener(nullptr)
     , mMode(HTTP_COMPRESS_IDENTITY)
     , mOutBuffer(NULL)
     , mInpBuffer(NULL)
     , mOutBufferLen(0)
--- a/netwerk/streamconv/converters/nsHTTPCompressConv.h
+++ b/netwerk/streamconv/converters/nsHTTPCompressConv.h
@@ -35,17 +35,17 @@ typedef enum    {
         HTTP_COMPRESS_DEFLATE,
         HTTP_COMPRESS_COMPRESS,
         HTTP_COMPRESS_IDENTITY
     }   CompressMode;
 
 class nsHTTPCompressConv	: public nsIStreamConverter	{
 public:
     // nsISupports methods
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
 
 	NS_DECL_NSIREQUESTOBSERVER
     NS_DECL_NSISTREAMLISTENER
 
     // nsIStreamConverter methods
     NS_DECL_NSISTREAMCONVERTER
 
 
--- a/netwerk/system/win32/nsNotifyAddrListener.cpp
+++ b/netwerk/system/win32/nsNotifyAddrListener.cpp
@@ -46,20 +46,20 @@ static void FreeDynamicLibraries(void)
 {
     if (sNetshell) {
         sNcFreeNetconProperties = nullptr;
         FreeLibrary(sNetshell);
         sNetshell = nullptr;
     }
 }
 
-NS_IMPL_THREADSAFE_ISUPPORTS3(nsNotifyAddrListener,
-                              nsINetworkLinkService,
-                              nsIRunnable,
-                              nsIObserver)
+NS_IMPL_ISUPPORTS3(nsNotifyAddrListener,
+                   nsINetworkLinkService,
+                   nsIRunnable,
+                   nsIObserver)
 
 nsNotifyAddrListener::nsNotifyAddrListener()
     : mLinkUp(true)  // assume true by default
     , mStatusKnown(false)
     , mCheckAttempted(false)
     , mShutdownEvent(nullptr)
 {
 }
--- a/netwerk/system/win32/nsNotifyAddrListener.h
+++ b/netwerk/system/win32/nsNotifyAddrListener.h
@@ -15,17 +15,17 @@
 #include "nsThreadUtils.h"
 #include "nsCOMPtr.h"
 
 class nsNotifyAddrListener : public nsINetworkLinkService,
                              public nsIRunnable,
                              public nsIObserver
 {
 public:
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSINETWORKLINKSERVICE
     NS_DECL_NSIRUNNABLE
     NS_DECL_NSIOBSERVER
 
     nsNotifyAddrListener();
     virtual ~nsNotifyAddrListener();
 
     nsresult Init(void);
--- a/netwerk/test/TestCallbacks.cpp
+++ b/netwerk/test/TestCallbacks.cpp
@@ -40,32 +40,32 @@ public:
     NS_DECLARE_STATIC_IID_ACCESSOR(NS_IEQUALS_IID)
     NS_IMETHOD Equals(void *aPtr, bool *_retval) = 0;
 };
 
 NS_DEFINE_STATIC_IID_ACCESSOR(nsIEquals, NS_IEQUALS_IID)
 
 class ConsumerContext MOZ_FINAL : public nsIEquals {
 public:
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
 
     ConsumerContext() { }
 
     NS_IMETHOD Equals(void *aPtr, bool *_retval) {
         *_retval = true;
         if (aPtr != this) *_retval = false;
         return NS_OK;
     }
 };
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(ConsumerContext, nsIEquals)
+NS_IMPL_ISUPPORTS1(ConsumerContext, nsIEquals)
 
 class Consumer : public nsIStreamListener {
 public:
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSIREQUESTOBSERVER
     NS_DECL_NSISTREAMLISTENER
 
     Consumer();
     virtual ~Consumer();
     nsresult Init(nsIURI *aURI, nsIChannel *aChannel, nsISupports *aContext);
     nsresult Validate(nsIRequest *request, nsISupports *aContext);
 
@@ -74,17 +74,17 @@ public:
     bool    mOnStop;  // have we received an onStop?
     int32_t mOnDataCount; // number of times OnData was called.
     nsCOMPtr<nsIURI>     mURI;
     nsCOMPtr<nsIChannel> mChannel;
     nsCOMPtr<nsIEquals>  mContext;
 };
 
 // nsISupports implementation
-NS_IMPL_THREADSAFE_ISUPPORTS2(Consumer, nsIStreamListener, nsIRequestObserver)
+NS_IMPL_ISUPPORTS2(Consumer, nsIStreamListener, nsIRequestObserver)
 
 
 // nsIRequestObserver implementation
 NS_IMETHODIMP
 Consumer::OnStartRequest(nsIRequest *request, nsISupports* aContext) {
     fprintf(stderr, "Consumer::OnStart() -> in\n\n");
 
     if (mOnStart) {
--- a/netwerk/test/TestCommon.h
+++ b/netwerk/test/TestCommon.h
@@ -15,23 +15,23 @@ inline int test_common_init(int *argc, c
 }
 
 //-----------------------------------------------------------------------------
 
 static bool gKeepPumpingEvents = false;
 
 class nsQuitPumpingEvent MOZ_FINAL : public nsIRunnable {
 public:
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_IMETHOD Run() {
     gKeepPumpingEvents = false;
     return NS_OK;
   }
 };
-NS_IMPL_THREADSAFE_ISUPPORTS1(nsQuitPumpingEvent, nsIRunnable)
+NS_IMPL_ISUPPORTS1(nsQuitPumpingEvent, nsIRunnable)
 
 static inline void PumpEvents()
 {
   nsCOMPtr<nsIThread> thread = do_GetCurrentThread();
 
   gKeepPumpingEvents = true;
   while (gKeepPumpingEvents)
     NS_ProcessNextEvent(thread);
--- a/netwerk/test/TestDNS.cpp
+++ b/netwerk/test/TestDNS.cpp
@@ -17,17 +17,17 @@
 #include "prthread.h"
 #include "prnetdb.h"
 #include "nsXPCOM.h"
 #include "nsServiceManagerUtils.h"
 
 class myDNSListener : public nsIDNSListener
 {
 public:
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
 
     myDNSListener(const char *host, int32_t index)
         : mHost(host)
         , mIndex(index) {}
     virtual ~myDNSListener() {}
 
     NS_IMETHOD OnLookupComplete(nsICancelable *request,
                                 nsIDNSRecord  *rec,
@@ -52,17 +52,17 @@ public:
         return NS_OK;
     }
 
 private:
     nsCString mHost;
     int32_t   mIndex;
 };
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(myDNSListener, nsIDNSListener)
+NS_IMPL_ISUPPORTS1(myDNSListener, nsIDNSListener)
 
 static bool IsAscii(const char *s)
 {
   for (; *s; ++s) {
     if (*s & 0x80)
       return false;
   }
 
--- a/netwerk/test/TestHttp.cpp
+++ b/netwerk/test/TestHttp.cpp
@@ -83,27 +83,27 @@ MyListener::OnDataAvailable(nsIRequest *
 //-----------------------------------------------------------------------------
 // NotificationCallbacks implementation
 //-----------------------------------------------------------------------------
 
 class MyNotifications : public nsIInterfaceRequestor
                       , public nsIProgressEventSink
 {
 public:
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSIINTERFACEREQUESTOR
     NS_DECL_NSIPROGRESSEVENTSINK
 
     MyNotifications() { }
     virtual ~MyNotifications() {}
 };
 
-NS_IMPL_THREADSAFE_ISUPPORTS2(MyNotifications,
-                              nsIInterfaceRequestor,
-                              nsIProgressEventSink)
+NS_IMPL_ISUPPORTS2(MyNotifications,
+                   nsIInterfaceRequestor,
+                   nsIProgressEventSink)
 
 NS_IMETHODIMP
 MyNotifications::GetInterface(const nsIID &iid, void **result)
 {
     return QueryInterface(iid, result);
 }
 
 NS_IMETHODIMP
--- a/netwerk/test/TestIOThreads.cpp
+++ b/netwerk/test/TestIOThreads.cpp
@@ -16,29 +16,29 @@
 // set NSPR_LOG_MODULES=Test:5
 //
 static PRLogModuleInfo *gTestLog = nullptr;
 #endif
 #define LOG(args) PR_LOG(gTestLog, PR_LOG_DEBUG, args)
 
 class nsIOEvent : public nsIRunnable {
 public:
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
 
     nsIOEvent(int i) : mIndex(i) {}
 
     NS_IMETHOD Run() {
         LOG(("Run [%d]\n", mIndex));
         return NS_OK;
     }
 
 private:
     int mIndex;
 };
-NS_IMPL_THREADSAFE_ISUPPORTS1(nsIOEvent, nsIRunnable)
+NS_IMPL_ISUPPORTS1(nsIOEvent, nsIRunnable)
 
 static nsresult RunTest()
 {
     nsresult rv;
     nsCOMPtr<nsIEventTarget> target =
         do_GetService(NS_STREAMTRANSPORTSERVICE_CONTRACTID, &rv);
     if (NS_FAILED(rv))
         return rv;
--- a/netwerk/test/TestPageLoad.cpp
+++ b/netwerk/test/TestPageLoad.cpp
@@ -191,27 +191,27 @@ MyListener::OnDataAvailable(nsIRequest *
 //-----------------------------------------------------------------------------
 // NotificationCallbacks implementation
 //-----------------------------------------------------------------------------
 
 class MyNotifications : public nsIInterfaceRequestor
                       , public nsIProgressEventSink
 {
 public:
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSIINTERFACEREQUESTOR
     NS_DECL_NSIPROGRESSEVENTSINK
 
     MyNotifications() { }
     virtual ~MyNotifications() {}
 };
 
-NS_IMPL_THREADSAFE_ISUPPORTS2(MyNotifications,
-                              nsIInterfaceRequestor,
-                              nsIProgressEventSink)
+NS_IMPL_ISUPPORTS2(MyNotifications,
+                   nsIInterfaceRequestor,
+                   nsIProgressEventSink)
 
 NS_IMETHODIMP
 MyNotifications::GetInterface(const nsIID &iid, void **result)
 {
     return QueryInterface(iid, result);
 }
 
 NS_IMETHODIMP
--- a/netwerk/test/TestProtocols.cpp
+++ b/netwerk/test/TestProtocols.cpp
@@ -191,17 +191,17 @@ HeaderVisitor::VisitHeader(const nsACStr
 class URLLoadInfo : public nsISupports
 {
 public:
 
   URLLoadInfo(const char* aUrl);
   virtual ~URLLoadInfo();
 
   // ISupports interface...
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
 
   const char* Name() { return mURLString.get(); }
   int64_t   mBytesRead;
   PRTime    mTotalTime;
   PRTime    mConnectTime;
   nsCString mURLString;
 };
 
@@ -211,17 +211,17 @@ URLLoadInfo::URLLoadInfo(const char *aUr
   mConnectTime = mTotalTime = PR_Now();
 }
 
 URLLoadInfo::~URLLoadInfo()
 {
 }
 
 
-NS_IMPL_THREADSAFE_ISUPPORTS0(URLLoadInfo)
+NS_IMPL_ISUPPORTS0(URLLoadInfo)
 
 //-----------------------------------------------------------------------------
 // TestChannelEventSink
 //-----------------------------------------------------------------------------
 
 class TestChannelEventSink : public nsIChannelEventSink
 {
 public:
--- a/netwerk/test/TestServ.cpp
+++ b/netwerk/test/TestServ.cpp
@@ -19,24 +19,24 @@
 //
 static PRLogModuleInfo *gTestLog = nullptr;
 #endif
 #define LOG(args) PR_LOG(gTestLog, PR_LOG_DEBUG, args)
 
 class MySocketListener : public nsIServerSocketListener
 {
 public:
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSISERVERSOCKETLISTENER
 
     MySocketListener() {}
     virtual ~MySocketListener() {}
 };
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(MySocketListener, nsIServerSocketListener)
+NS_IMPL_ISUPPORTS1(MySocketListener, nsIServerSocketListener)
 
 NS_IMETHODIMP
 MySocketListener::OnSocketAccepted(nsIServerSocket *serv,
                                    nsISocketTransport *trans)
 {
     LOG(("MySocketListener::OnSocketAccepted [serv=%p trans=%p]\n", serv, trans));
 
     nsAutoCString host;
--- a/netwerk/test/TestSocketTransport.cpp
+++ b/netwerk/test/TestSocketTransport.cpp
@@ -40,17 +40,17 @@ static PRLogModuleInfo *gTestLog = nullp
 static NS_DEFINE_CID(kSocketTransportServiceCID, NS_SOCKETTRANSPORTSERVICE_CID);
 
 ////////////////////////////////////////////////////////////////////////////////
 
 class MyHandler : public nsIOutputStreamCallback
                 , public nsIInputStreamCallback
 {
 public:
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
 
     MyHandler(const char *path,
               nsIAsyncInputStream *in,
               nsIAsyncOutputStream *out)
         : mInput(in)
         , mOutput(out)
         , mWriteOffset(0)
         {
@@ -110,19 +110,19 @@ public:
 
 private:
     nsCOMPtr<nsIAsyncInputStream>  mInput;
     nsCOMPtr<nsIAsyncOutputStream> mOutput;
     nsCString mBuf;
     uint32_t  mWriteOffset;
 };
 
-NS_IMPL_THREADSAFE_ISUPPORTS2(MyHandler,
-                              nsIOutputStreamCallback,
-                              nsIInputStreamCallback)
+NS_IMPL_ISUPPORTS2(MyHandler,
+                   nsIOutputStreamCallback,
+                   nsIInputStreamCallback)
 
 ////////////////////////////////////////////////////////////////////////////////
 
 /**
  * create transport, open streams, and close
  */
 static nsresult
 RunCloseTest(nsISocketTransportService *sts,
--- a/netwerk/test/TestStreamTransport.cpp
+++ b/netwerk/test/TestStreamTransport.cpp
@@ -40,17 +40,17 @@ static NS_DEFINE_CID(kStreamTransportSer
 ////////////////////////////////////////////////////////////////////////////////
 
 #define CHUNK_SIZE 500
 
 class MyCopier : public nsIInputStreamCallback
                , public nsIOutputStreamCallback
 {
 public:
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
 
     MyCopier()
         : mLock(nullptr)
         , mInputCondition(NS_OK)
     {
     }
 
     virtual ~MyCopier()
@@ -157,19 +157,19 @@ public:
 
 protected:
     PRLock                        *mLock;
     nsCOMPtr<nsIAsyncInputStream>  mInput;
     nsCOMPtr<nsIAsyncOutputStream> mOutput;
     nsresult                       mInputCondition;
 };
 
-NS_IMPL_THREADSAFE_ISUPPORTS2(MyCopier,
-                              nsIInputStreamCallback,
-                              nsIOutputStreamCallback)
+NS_IMPL_ISUPPORTS2(MyCopier,
+                   nsIInputStreamCallback,
+                   nsIOutputStreamCallback)
 
 ////////////////////////////////////////////////////////////////////////////////
 
 /**
  * asynchronously copy file.
  */
 static nsresult
 RunTest(nsIFile *srcFile, nsIFile *destFile)
--- a/netwerk/test/TestUDPServerSocket.cpp
+++ b/netwerk/test/TestUDPServerSocket.cpp
@@ -40,26 +40,26 @@
   PR_END_MACRO
 
 /*
  * UDPListener: listens for incomming UDP packets
  */
 class UDPListener : public nsIUDPServerSocketListener
 {
 public:
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIUDPSERVERSOCKETLISTENER
 
   virtual ~UDPListener();
 
   nsresult mResult;
 };
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(UDPListener,
-                              nsIUDPServerSocketListener)
+NS_IMPL_ISUPPORTS1(UDPListener,
+                   nsIUDPServerSocketListener)
 
 UDPListener::~UDPListener()
 {
 }
 
 NS_IMETHODIMP
 UDPListener::OnPacketReceived(nsIUDPServerSocket* socket, nsIUDPMessage* message)
 {
--- a/netwerk/wifi/nsWifiAccessPoint.cpp
+++ b/netwerk/wifi/nsWifiAccessPoint.cpp
@@ -8,17 +8,17 @@
 #include "prlog.h"
 
 #if defined(PR_LOGGING)
 extern PRLogModuleInfo *gWifiMonitorLog;
 #endif
 #define LOG(args)     PR_LOG(gWifiMonitorLog, PR_LOG_DEBUG, args)
 
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(nsWifiAccessPoint, nsIWifiAccessPoint)
+NS_IMPL_ISUPPORTS1(nsWifiAccessPoint, nsIWifiAccessPoint)
 
 nsWifiAccessPoint::nsWifiAccessPoint()
 {
   // make sure these are null terminated (because we are paranoid)
   mMac[0] = '\0';
   mSsid[0] = '\0';
   mSsidLen = 0;
 }
--- a/netwerk/wifi/nsWifiAccessPoint.h
+++ b/netwerk/wifi/nsWifiAccessPoint.h
@@ -10,17 +10,17 @@
 #include "mozilla/Attributes.h"
 
 #ifndef __nsWifiAccessPoint__
 #define __nsWifiAccessPoint__
 
 class nsWifiAccessPoint MOZ_FINAL : public nsIWifiAccessPoint
 {
 public:
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIWIFIACCESSPOINT
 
   nsWifiAccessPoint();
   ~nsWifiAccessPoint();
 
   char mMac[18];
   int  mSignal;
   char mSsid[33];
--- a/netwerk/wifi/nsWifiMonitor.cpp
+++ b/netwerk/wifi/nsWifiMonitor.cpp
@@ -19,20 +19,20 @@
 #include "mozilla/Services.h"
 
 using namespace mozilla;
 
 #if defined(PR_LOGGING)
 PRLogModuleInfo *gWifiMonitorLog;
 #endif
 
-NS_IMPL_THREADSAFE_ISUPPORTS3(nsWifiMonitor,
-                              nsIRunnable,
-                              nsIObserver,
-                              nsIWifiMonitor)
+NS_IMPL_ISUPPORTS3(nsWifiMonitor,
+                   nsIRunnable,
+                   nsIObserver,
+                   nsIWifiMonitor)
 
 nsWifiMonitor::nsWifiMonitor()
 : mKeepGoing(true)
 , mReentrantMonitor("nsWifiMonitor.mReentrantMonitor")
 {
 #if defined(PR_LOGGING)
   gWifiMonitorLog = PR_NewLogModule("WifiMonitor");
 #endif
@@ -112,32 +112,32 @@ NS_IMETHODIMP nsWifiMonitor::StopWatchin
   return NS_OK;
 }
 
 typedef nsTArray<nsMainThreadPtrHandle<nsIWifiListener> > WifiListenerArray;
 
 class nsPassErrorToWifiListeners MOZ_FINAL : public nsIRunnable
 {
  public:
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIRUNNABLE
 
   nsPassErrorToWifiListeners(nsAutoPtr<WifiListenerArray> aListeners,
                              nsresult aResult)
   : mListeners(aListeners),
     mResult(aResult)
   {}
 
  private:
   nsAutoPtr<WifiListenerArray> mListeners;
   nsresult mResult;
 };
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(nsPassErrorToWifiListeners,
-                              nsIRunnable)
+NS_IMPL_ISUPPORTS1(nsPassErrorToWifiListeners,
+                   nsIRunnable)
 
 NS_IMETHODIMP nsPassErrorToWifiListeners::Run()
 {
   LOG(("About to send error to the wifi listeners\n"));
   for (size_t i = 0; i < mListeners->Length(); i++) {
     (*mListeners)[i]->OnError(mResult);
   }
   return NS_OK;
@@ -172,32 +172,32 @@ NS_IMETHODIMP nsWifiMonitor::Run()
   }
 
   return NS_OK;
 }
 
 class nsCallWifiListeners MOZ_FINAL : public nsIRunnable
 {
  public:
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIRUNNABLE
 
   nsCallWifiListeners(nsAutoPtr<WifiListenerArray> aListeners,
                       nsAutoPtr<nsTArray<nsIWifiAccessPoint*> > aAccessPoints)
   : mListeners(aListeners),
     mAccessPoints(aAccessPoints)
   {}
 
  private:
   nsAutoPtr<WifiListenerArray> mListeners;
   nsAutoPtr<nsTArray<nsIWifiAccessPoint*> > mAccessPoints;
 };
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(nsCallWifiListeners,
-                              nsIRunnable)
+NS_IMPL_ISUPPORTS1(nsCallWifiListeners,
+                   nsIRunnable)
 
 NS_IMETHODIMP nsCallWifiListeners::Run()
 {
   LOG(("About to send data to the wifi listeners\n"));
   for (size_t i = 0; i < mListeners->Length(); i++) {
     (*mListeners)[i]->OnChange(mAccessPoints->Elements(), mAccessPoints->Length());
   }
   return NS_OK;
--- a/netwerk/wifi/nsWifiMonitor.h
+++ b/netwerk/wifi/nsWifiMonitor.h
@@ -42,17 +42,17 @@ class nsWifiListener
   nsMainThreadPtrHandle<nsIWifiListener> mListener;
   bool mHasSentData;
 };
 
 #ifndef MOZ_WIDGET_GONK
 class nsWifiMonitor MOZ_FINAL : nsIRunnable, nsIWifiMonitor, nsIObserver
 {
  public:
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIWIFIMONITOR
   NS_DECL_NSIRUNNABLE
   NS_DECL_NSIOBSERVER
 
   nsWifiMonitor();
 
  private:
   ~nsWifiMonitor();