Skip to content

Commit 0d181ba

Browse files
committed
Bug 1219910 - make gSocketThread a relaxed atomic variable; r=mcmanus
Many places that (re-)declared gSocketThread already included nsSocketTransportService2.h; we can delete the declaration for those places. For all the other places, we need to include nsSocketTransportService2.h.
1 parent ac15b09 commit 0d181ba

19 files changed

+11
-63
lines changed

netwerk/base/EventTokenBucket.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
#include <mmsystem.h>
2020
#endif
2121

22-
extern PRThread *gSocketThread;
23-
2422
namespace mozilla {
2523
namespace net {
2624

netwerk/base/TLSServerSocket.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
#include "ScopedNSSTypes.h"
2121
#include "ssl.h"
2222

23-
extern PRThread *gSocketThread;
24-
2523
namespace mozilla {
2624
namespace net {
2725

netwerk/base/nsSocketTransportService2.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include "nsIPrefBranch.h"
1818
#include "nsServiceManagerUtils.h"
1919
#include "nsIObserverService.h"
20+
#include "mozilla/Atomics.h"
2021
#include "mozilla/Services.h"
2122
#include "mozilla/Likely.h"
2223
#include "mozilla/PublicSSL.h"
@@ -33,7 +34,7 @@ LazyLogModule gSocketTransportLog("nsSocketTransport");
3334
LazyLogModule gUDPSocketLog("UDPSocket");
3435

3536
nsSocketTransportService *gSocketTransportService = nullptr;
36-
PRThread *gSocketThread = nullptr;
37+
Atomic<PRThread*, Relaxed> gSocketThread;
3738

3839
#define SEND_BUFFER_PREF "network.tcp.sendbuffer"
3940
#define KEEPALIVE_ENABLED_PREF "network.tcp.keepalive.enabled"

netwerk/base/nsSocketTransportService2.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,6 @@ class nsSocketTransportService final : public nsPISocketTransportService
262262
};
263263

264264
extern nsSocketTransportService *gSocketTransportService;
265-
extern PRThread *gSocketThread;
265+
extern mozilla::Atomic<PRThread*, mozilla::Relaxed> gSocketThread;
266266

267267
#endif // !nsSocketTransportService_h__

netwerk/protocol/http/ConnectionDiagnostics.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@
1515
#include "nsIConsoleService.h"
1616
#include "nsHttpRequestHead.h"
1717
#include "nsServiceManagerUtils.h"
18-
19-
extern PRThread *gSocketThread;
18+
#include "nsSocketTransportService2.h"
2019

2120
namespace mozilla {
2221
namespace net {

netwerk/protocol/http/Http2Compression.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
#include "Http2HuffmanOutgoing.h"
1919
#include "mozilla/StaticPtr.h"
2020

21-
extern PRThread *gSocketThread;
22-
2321
namespace mozilla {
2422
namespace net {
2523

netwerk/protocol/http/Http2Session.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,7 @@
3535
#include "prnetdb.h"
3636
#include "sslt.h"
3737
#include "mozilla/Snprintf.h"
38-
39-
#ifdef DEBUG
40-
// defined by the socket transport service while active
41-
extern PRThread *gSocketThread;
42-
#endif
38+
#include "nsSocketTransportService2.h"
4339

4440
namespace mozilla {
4541
namespace net {

netwerk/protocol/http/Http2Stream.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,6 @@
3232
#include "nsStandardURL.h"
3333
#include "prnetdb.h"
3434

35-
#ifdef DEBUG
36-
// defined by the socket transport service while active
37-
extern PRThread *gSocketThread;
38-
#endif
39-
4035
namespace mozilla {
4136
namespace net {
4237

netwerk/protocol/http/SpdySession31.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,10 @@
2626
#include "SpdySession31.h"
2727
#include "SpdyStream31.h"
2828
#include "SpdyZlibReporter.h"
29+
#include "nsSocketTransportService2.h"
2930

3031
#include <algorithm>
3132

32-
#ifdef DEBUG
33-
// defined by the socket transport service while active
34-
extern PRThread *gSocketThread;
35-
#endif
36-
3733
namespace mozilla {
3834
namespace net {
3935

netwerk/protocol/http/SpdyStream31.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,6 @@
2828

2929
#include <algorithm>
3030

31-
#ifdef DEBUG
32-
// defined by the socket transport service while active
33-
extern PRThread *gSocketThread;
34-
#endif
35-
3631
namespace mozilla {
3732
namespace net {
3833

0 commit comments

Comments
 (0)