diff --git a/netwerk/base/EventTokenBucket.cpp b/netwerk/base/EventTokenBucket.cpp index 22b7dc0d6ae9..d6696a979333 100644 --- a/netwerk/base/EventTokenBucket.cpp +++ b/netwerk/base/EventTokenBucket.cpp @@ -19,8 +19,6 @@ #include #endif -extern PRThread *gSocketThread; - namespace mozilla { namespace net { diff --git a/netwerk/base/TLSServerSocket.cpp b/netwerk/base/TLSServerSocket.cpp index cbdb5ce680cd..5d9046f901a7 100644 --- a/netwerk/base/TLSServerSocket.cpp +++ b/netwerk/base/TLSServerSocket.cpp @@ -20,8 +20,6 @@ #include "ScopedNSSTypes.h" #include "ssl.h" -extern PRThread *gSocketThread; - namespace mozilla { namespace net { diff --git a/netwerk/base/nsSocketTransportService2.cpp b/netwerk/base/nsSocketTransportService2.cpp index 06ec9b6a2601..491c9a0c5db8 100644 --- a/netwerk/base/nsSocketTransportService2.cpp +++ b/netwerk/base/nsSocketTransportService2.cpp @@ -17,6 +17,7 @@ #include "nsIPrefBranch.h" #include "nsServiceManagerUtils.h" #include "nsIObserverService.h" +#include "mozilla/Atomics.h" #include "mozilla/Services.h" #include "mozilla/Likely.h" #include "mozilla/PublicSSL.h" @@ -33,7 +34,7 @@ LazyLogModule gSocketTransportLog("nsSocketTransport"); LazyLogModule gUDPSocketLog("UDPSocket"); nsSocketTransportService *gSocketTransportService = nullptr; -PRThread *gSocketThread = nullptr; +Atomic gSocketThread; #define SEND_BUFFER_PREF "network.tcp.sendbuffer" #define KEEPALIVE_ENABLED_PREF "network.tcp.keepalive.enabled" diff --git a/netwerk/base/nsSocketTransportService2.h b/netwerk/base/nsSocketTransportService2.h index 578ad14eb8d1..6da694b309ae 100644 --- a/netwerk/base/nsSocketTransportService2.h +++ b/netwerk/base/nsSocketTransportService2.h @@ -262,6 +262,6 @@ private: }; extern nsSocketTransportService *gSocketTransportService; -extern PRThread *gSocketThread; +extern mozilla::Atomic gSocketThread; #endif // !nsSocketTransportService_h__ diff --git a/netwerk/protocol/http/ConnectionDiagnostics.cpp b/netwerk/protocol/http/ConnectionDiagnostics.cpp index a331e3dbfabd..5a3b818b23b5 100644 --- a/netwerk/protocol/http/ConnectionDiagnostics.cpp +++ b/netwerk/protocol/http/ConnectionDiagnostics.cpp @@ -15,8 +15,7 @@ #include "nsIConsoleService.h" #include "nsHttpRequestHead.h" #include "nsServiceManagerUtils.h" - -extern PRThread *gSocketThread; +#include "nsSocketTransportService2.h" namespace mozilla { namespace net { diff --git a/netwerk/protocol/http/Http2Compression.cpp b/netwerk/protocol/http/Http2Compression.cpp index d718cb4a4b4f..8fc30393de63 100644 --- a/netwerk/protocol/http/Http2Compression.cpp +++ b/netwerk/protocol/http/Http2Compression.cpp @@ -18,8 +18,6 @@ #include "Http2HuffmanOutgoing.h" #include "mozilla/StaticPtr.h" -extern PRThread *gSocketThread; - namespace mozilla { namespace net { diff --git a/netwerk/protocol/http/Http2Session.cpp b/netwerk/protocol/http/Http2Session.cpp index 18ac243bade8..b87cd5b2a8fc 100644 --- a/netwerk/protocol/http/Http2Session.cpp +++ b/netwerk/protocol/http/Http2Session.cpp @@ -35,11 +35,7 @@ #include "prnetdb.h" #include "sslt.h" #include "mozilla/Snprintf.h" - -#ifdef DEBUG -// defined by the socket transport service while active -extern PRThread *gSocketThread; -#endif +#include "nsSocketTransportService2.h" namespace mozilla { namespace net { diff --git a/netwerk/protocol/http/Http2Stream.cpp b/netwerk/protocol/http/Http2Stream.cpp index cbfe0715ee86..437cccbce413 100644 --- a/netwerk/protocol/http/Http2Stream.cpp +++ b/netwerk/protocol/http/Http2Stream.cpp @@ -32,11 +32,6 @@ #include "nsStandardURL.h" #include "prnetdb.h" -#ifdef DEBUG -// defined by the socket transport service while active -extern PRThread *gSocketThread; -#endif - namespace mozilla { namespace net { diff --git a/netwerk/protocol/http/SpdySession31.cpp b/netwerk/protocol/http/SpdySession31.cpp index f83884e0be6f..1c8209162f00 100644 --- a/netwerk/protocol/http/SpdySession31.cpp +++ b/netwerk/protocol/http/SpdySession31.cpp @@ -26,14 +26,10 @@ #include "SpdySession31.h" #include "SpdyStream31.h" #include "SpdyZlibReporter.h" +#include "nsSocketTransportService2.h" #include -#ifdef DEBUG -// defined by the socket transport service while active -extern PRThread *gSocketThread; -#endif - namespace mozilla { namespace net { diff --git a/netwerk/protocol/http/SpdyStream31.cpp b/netwerk/protocol/http/SpdyStream31.cpp index 24138161e98a..c3cee26bc22d 100644 --- a/netwerk/protocol/http/SpdyStream31.cpp +++ b/netwerk/protocol/http/SpdyStream31.cpp @@ -28,11 +28,6 @@ #include -#ifdef DEBUG -// defined by the socket transport service while active -extern PRThread *gSocketThread; -#endif - namespace mozilla { namespace net { diff --git a/netwerk/protocol/http/TunnelUtils.cpp b/netwerk/protocol/http/TunnelUtils.cpp index 7252b2d6b593..31f578cc13f8 100644 --- a/netwerk/protocol/http/TunnelUtils.cpp +++ b/netwerk/protocol/http/TunnelUtils.cpp @@ -24,11 +24,6 @@ #include "nsServiceManagerUtils.h" #include "nsComponentManagerUtils.h" -#ifdef DEBUG -// defined by the socket transport service while active -extern PRThread *gSocketThread; -#endif - namespace mozilla { namespace net { diff --git a/netwerk/protocol/http/nsHttpConnection.cpp b/netwerk/protocol/http/nsHttpConnection.cpp index cca671699d67..dcb877ee949a 100644 --- a/netwerk/protocol/http/nsHttpConnection.cpp +++ b/netwerk/protocol/http/nsHttpConnection.cpp @@ -33,11 +33,6 @@ #include "sslt.h" #include "TunnelUtils.h" -#ifdef DEBUG -// defined by the socket transport service while active -extern PRThread *gSocketThread; -#endif - namespace mozilla { namespace net { diff --git a/netwerk/protocol/http/nsHttpConnectionMgr.cpp b/netwerk/protocol/http/nsHttpConnectionMgr.cpp index 8dd6cf599e2b..fccc97285915 100644 --- a/netwerk/protocol/http/nsHttpConnectionMgr.cpp +++ b/netwerk/protocol/http/nsHttpConnectionMgr.cpp @@ -37,9 +37,6 @@ #include "mozilla/Telemetry.h" -// defined by the socket transport service while active -extern PRThread *gSocketThread; - namespace mozilla { namespace net { diff --git a/netwerk/protocol/http/nsHttpHandler.cpp b/netwerk/protocol/http/nsHttpHandler.cpp index 8214d39c0d38..f34cb791620d 100644 --- a/netwerk/protocol/http/nsHttpHandler.cpp +++ b/netwerk/protocol/http/nsHttpHandler.cpp @@ -51,6 +51,7 @@ #include "nsHttpChannelAuthProvider.h" #include "nsServiceManagerUtils.h" #include "nsComponentManagerUtils.h" +#include "nsSocketTransportService2.h" #include "mozilla/net/NeckoChild.h" #include "mozilla/ipc/URIUtils.h" @@ -73,11 +74,6 @@ #include "mozilla/net/HttpChannelChild.h" -#ifdef DEBUG -// defined by the socket transport service while active -extern PRThread *gSocketThread; -#endif - #define UA_PREF_PREFIX "general.useragent." #ifdef XP_WIN #define UA_SPARE_PLATFORM diff --git a/netwerk/protocol/http/nsHttpPipeline.cpp b/netwerk/protocol/http/nsHttpPipeline.cpp index d21c424e2118..c21a018129b6 100644 --- a/netwerk/protocol/http/nsHttpPipeline.cpp +++ b/netwerk/protocol/http/nsHttpPipeline.cpp @@ -12,12 +12,11 @@ #include "nsISocketTransport.h" #include "nsIPipe.h" #include "nsCOMPtr.h" +#include "nsSocketTransportService2.h" #include #ifdef DEBUG #include "prthread.h" -// defined by the socket transport service while active -extern PRThread *gSocketThread; #endif namespace mozilla { diff --git a/netwerk/protocol/http/nsHttpTransaction.cpp b/netwerk/protocol/http/nsHttpTransaction.cpp index 94549231f3bc..ec5aaaa34e30 100644 --- a/netwerk/protocol/http/nsHttpTransaction.cpp +++ b/netwerk/protocol/http/nsHttpTransaction.cpp @@ -44,13 +44,6 @@ //----------------------------------------------------------------------------- -#ifdef DEBUG -// defined by the socket transport service while active -extern PRThread *gSocketThread; -#endif - -//----------------------------------------------------------------------------- - static NS_DEFINE_CID(kMultiplexInputStream, NS_MULTIPLEXINPUTSTREAM_CID); // Place a limit on how much non-compliant HTTP can be skipped while diff --git a/netwerk/protocol/websocket/WebSocketChannel.cpp b/netwerk/protocol/websocket/WebSocketChannel.cpp index ca850695d8af..5c1e6125ef8b 100644 --- a/netwerk/protocol/websocket/WebSocketChannel.cpp +++ b/netwerk/protocol/websocket/WebSocketChannel.cpp @@ -55,6 +55,7 @@ #include "mozilla/StaticMutex.h" #include "mozilla/Telemetry.h" #include "mozilla/TimeStamp.h" +#include "nsSocketTransportService2.h" #include "plbase64.h" #include "prmem.h" @@ -70,8 +71,6 @@ // dupe one constant we need from it #define CLOSE_GOING_AWAY 1001 -extern PRThread *gSocketThread; - using namespace mozilla; using namespace mozilla::net; diff --git a/netwerk/protocol/websocket/WebSocketEventService.cpp b/netwerk/protocol/websocket/WebSocketEventService.cpp index 06984e75ef32..3855cc7f735f 100644 --- a/netwerk/protocol/websocket/WebSocketEventService.cpp +++ b/netwerk/protocol/websocket/WebSocketEventService.cpp @@ -12,8 +12,7 @@ #include "mozilla/StaticPtr.h" #include "nsISupportsPrimitives.h" #include "nsXULAppAPI.h" - -extern PRThread *gSocketThread; +#include "nsSocketTransportService2.h" namespace mozilla { namespace net { diff --git a/netwerk/protocol/websocket/WebSocketFrame.cpp b/netwerk/protocol/websocket/WebSocketFrame.cpp index 209942dc56a7..c8ce329f112f 100644 --- a/netwerk/protocol/websocket/WebSocketFrame.cpp +++ b/netwerk/protocol/websocket/WebSocketFrame.cpp @@ -7,8 +7,7 @@ #include "WebSocketFrame.h" #include "WebSocketChannel.h" - -extern PRThread *gSocketThread; +#include "nsSocketTransportService2.h" namespace mozilla { namespace net {