Skip to content

Commit ba22eb7

Browse files
committed
Bug 1162336 - Part 1: Remove instances of #ifdef PR_LOGGING in netwerk. r=froydnj
PR_LOGGING is now always defined, we can remove #ifdefs checking for it.
1 parent c3a38c8 commit ba22eb7

File tree

77 files changed

+8
-347
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+8
-347
lines changed

netwerk/base/BackgroundFileSaver.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,9 @@ namespace mozilla {
3333
namespace net {
3434

3535
// NSPR_LOG_MODULES=BackgroundFileSaver:5
36-
#if defined(PR_LOGGING)
3736
PRLogModuleInfo *BackgroundFileSaver::prlog = nullptr;
3837
#define LOG(args) PR_LOG(BackgroundFileSaver::prlog, PR_LOG_DEBUG, args)
3938
#define LOG_ENABLED() PR_LOG_TEST(BackgroundFileSaver::prlog, 4)
40-
#else
41-
#define LOG(args)
42-
#define LOG_ENABLED() (false)
43-
#endif
4439

4540
////////////////////////////////////////////////////////////////////////////////
4641
//// Globals
@@ -115,10 +110,8 @@ BackgroundFileSaver::BackgroundFileSaver()
115110
, mActualTargetKeepPartial(false)
116111
, mDigestContext(nullptr)
117112
{
118-
#if defined(PR_LOGGING)
119113
if (!prlog)
120114
prlog = PR_NewLogModule("BackgroundFileSaver");
121-
#endif
122115
LOG(("Created BackgroundFileSaver [this = %p]", this));
123116
}
124117

netwerk/base/Predictor.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,8 @@ namespace net {
5353

5454
Predictor *Predictor::sSelf = nullptr;
5555

56-
#if defined(PR_LOGGING)
5756
static PRLogModuleInfo *gPredictorLog = nullptr;
5857
#define PREDICTOR_LOG(args) PR_LOG(gPredictorLog, 4, args)
59-
#else
60-
#define PREDICTOR_LOG(args)
61-
#endif
6258

6359
#define RETURN_IF_FAILED(_rv) \
6460
do { \
@@ -315,9 +311,7 @@ Predictor::Predictor()
315311
,mMaxResourcesPerEntry(PREDICTOR_MAX_RESOURCES_DEFAULT)
316312
,mStartupCount(1)
317313
{
318-
#if defined(PR_LOGGING)
319314
gPredictorLog = PR_NewLogModule("NetworkPredictor");
320-
#endif
321315

322316
MOZ_ASSERT(!sSelf, "multiple Predictor instances!");
323317
sSelf = this;

netwerk/base/nsAsyncRedirectVerifyHelper.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#include "nsIAsyncVerifyRedirectCallback.h"
1515

1616
#undef LOG
17-
#ifdef PR_LOGGING
1817
static PRLogModuleInfo *
1918
GetRedirectLog()
2019
{
@@ -24,9 +23,6 @@ GetRedirectLog()
2423
return sLog;
2524
}
2625
#define LOG(args) PR_LOG(GetRedirectLog(), PR_LOG_DEBUG, args)
27-
#else
28-
#define LOG(args)
29-
#endif
3026

3127
NS_IMPL_ISUPPORTS(nsAsyncRedirectVerifyHelper,
3228
nsIAsyncVerifyRedirectCallback,

netwerk/base/nsAsyncStreamCopier.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,10 @@
1313
using namespace mozilla;
1414

1515
#undef LOG
16-
#if defined(PR_LOGGING)
1716
//
1817
// NSPR_LOG_MODULES=nsStreamCopier:5
1918
//
2019
static PRLogModuleInfo *gStreamCopierLog = nullptr;
21-
#endif
2220
#define LOG(args) PR_LOG(gStreamCopierLog, PR_LOG_DEBUG, args)
2321

2422
/**
@@ -69,10 +67,8 @@ nsAsyncStreamCopier::nsAsyncStreamCopier()
6967
, mIsPending(false)
7068
, mShouldSniffBuffering(false)
7169
{
72-
#if defined(PR_LOGGING)
7370
if (!gStreamCopierLog)
7471
gStreamCopierLog = PR_NewLogModule("nsStreamCopier");
75-
#endif
7672
LOG(("Creating nsAsyncStreamCopier @%x\n", this));
7773
}
7874

netwerk/base/nsAutodialWin.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@
2929
// the file nspr.log
3030
//
3131

32-
#ifdef PR_LOGGING
3332
static PRLogModuleInfo* gLog = nullptr;
34-
#endif
3533

3634
#undef LOGD
3735
#undef LOGE
@@ -64,10 +62,8 @@ nsAutodial::~nsAutodial()
6462
// Returns NS_ERROR_FAILURE if error or NS_OK if success.
6563
nsresult nsAutodial::Init()
6664
{
67-
#ifdef PR_LOGGING
6865
if (!gLog)
6966
gLog = PR_NewLogModule("Autodial");
70-
#endif
7167

7268
mDefaultEntryName[0] = '\0';
7369
mNumRASConnectionEntries = 0;

netwerk/base/nsChannelClassifier.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,10 @@
3636
using mozilla::ArrayLength;
3737
using mozilla::Preferences;
3838

39-
#if defined(PR_LOGGING)
4039
//
4140
// NSPR_LOG_MODULES=nsChannelClassifier:5
4241
//
4342
static PRLogModuleInfo *gChannelClassifierLog;
44-
#endif
4543
#undef LOG
4644
#define LOG(args) PR_LOG(gChannelClassifierLog, PR_LOG_DEBUG, args)
4745

@@ -52,10 +50,8 @@ nsChannelClassifier::nsChannelClassifier()
5250
: mIsAllowListed(false),
5351
mSuspendedChannel(false)
5452
{
55-
#if defined(PR_LOGGING)
5653
if (!gChannelClassifierLog)
5754
gChannelClassifierLog = PR_NewLogModule("nsChannelClassifier");
58-
#endif
5955
}
6056

6157
nsresult

netwerk/base/nsDirectoryIndexStream.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@
1818
#include "nsDirectoryIndexStream.h"
1919
#include "prlog.h"
2020
#include "prtime.h"
21-
#ifdef PR_LOGGING
2221
static PRLogModuleInfo* gLog;
23-
#endif
2422

2523
#include "nsISimpleEnumerator.h"
2624
#ifdef THREADSAFE_I18N
@@ -46,10 +44,8 @@ static PRLogModuleInfo* gLog;
4644
nsDirectoryIndexStream::nsDirectoryIndexStream()
4745
: mOffset(0), mStatus(NS_OK), mPos(0)
4846
{
49-
#ifdef PR_LOGGING
5047
if (! gLog)
5148
gLog = PR_NewLogModule("nsDirectoryIndexStream");
52-
#endif
5349

5450
PR_LOG(gLog, PR_LOG_DEBUG,
5551
("nsDirectoryIndexStream[%p]: created", this));
@@ -96,15 +92,13 @@ nsDirectoryIndexStream::Init(nsIFile* aDir)
9692
if (!isDir)
9793
return NS_ERROR_ILLEGAL_VALUE;
9894

99-
#ifdef PR_LOGGING
10095
if (PR_LOG_TEST(gLog, PR_LOG_DEBUG)) {
10196
nsAutoCString path;
10297
aDir->GetNativePath(path);
10398
PR_LOG(gLog, PR_LOG_DEBUG,
10499
("nsDirectoryIndexStream[%p]: initialized on %s",
105100
this, path.get()));
106101
}
107-
#endif
108102

109103
// Sigh. We have to allocate on the heap because there are no
110104
// assignment operators defined.
@@ -245,15 +239,13 @@ nsDirectoryIndexStream::Read(char* aBuf, uint32_t aCount, uint32_t* aReadCount)
245239
nsIFile* current = mArray.ObjectAt(mPos);
246240
++mPos;
247241

248-
#ifdef PR_LOGGING
249242
if (PR_LOG_TEST(gLog, PR_LOG_DEBUG)) {
250243
nsAutoCString path;
251244
current->GetNativePath(path);
252245
PR_LOG(gLog, PR_LOG_DEBUG,
253246
("nsDirectoryIndexStream[%p]: iterated %s",
254247
this, path.get()));
255248
}
256-
#endif
257249

258250
// rjc: don't return hidden files/directories!
259251
// bbaetz: why not?

netwerk/base/nsInputStreamPump.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,10 @@
2121

2222
static NS_DEFINE_CID(kStreamTransportServiceCID, NS_STREAMTRANSPORTSERVICE_CID);
2323

24-
#if defined(PR_LOGGING)
2524
//
2625
// NSPR_LOG_MODULES=nsStreamPump:5
2726
//
2827
static PRLogModuleInfo *gStreamPumpLog = nullptr;
29-
#endif
3028
#undef LOG
3129
#define LOG(args) PR_LOG(gStreamPumpLog, PR_LOG_DEBUG, args)
3230

@@ -47,10 +45,8 @@ nsInputStreamPump::nsInputStreamPump()
4745
, mRetargeting(false)
4846
, mMonitor("nsInputStreamPump")
4947
{
50-
#if defined(PR_LOGGING)
5148
if (!gStreamPumpLog)
5249
gStreamPumpLog = PR_NewLogModule("nsStreamPump");
53-
#endif
5450
}
5551

5652
nsInputStreamPump::~nsInputStreamPump()

netwerk/base/nsLoadGroup.cpp

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
using namespace mozilla;
2828
using namespace mozilla::net;
2929

30-
#if defined(PR_LOGGING)
3130
//
3231
// Log module for nsILoadGroup logging...
3332
//
@@ -40,7 +39,6 @@ using namespace mozilla::net;
4039
// the file nspr.log
4140
//
4241
static PRLogModuleInfo* gLoadGroupLog = nullptr;
43-
#endif
4442

4543
#undef LOG
4644
#define LOG(args) PR_LOG(gLoadGroupLog, PR_LOG_DEBUG, args)
@@ -123,11 +121,9 @@ nsLoadGroup::nsLoadGroup(nsISupports* outer)
123121
{
124122
NS_INIT_AGGREGATED(outer);
125123

126-
#if defined(PR_LOGGING)
127124
// Initialize the global PRLogModule for nsILoadGroup logging
128125
if (nullptr == gLoadGroupLog)
129126
gLoadGroupLog = PR_NewLogModule("LoadGroup");
130-
#endif
131127

132128
LOG(("LOADGROUP [%x]: Created.\n", this));
133129
}
@@ -261,12 +257,10 @@ nsLoadGroup::Cancel(nsresult status)
261257
continue;
262258
}
263259

264-
#if defined(PR_LOGGING)
265260
nsAutoCString nameStr;
266261
request->GetName(nameStr);
267262
LOG(("LOADGROUP [%x]: Canceling request %x %s.\n",
268263
this, request, nameStr.get()));
269-
#endif
270264

271265
//
272266
// Remove the request from the load group... This may cause
@@ -329,12 +323,10 @@ nsLoadGroup::Suspend()
329323
if (!request)
330324
continue;
331325

332-
#if defined(PR_LOGGING)
333326
nsAutoCString nameStr;
334327
request->GetName(nameStr);
335328
LOG(("LOADGROUP [%x]: Suspending request %x %s.\n",
336329
this, request, nameStr.get()));
337-
#endif
338330

339331
// Suspend the request...
340332
rv = request->Suspend();
@@ -381,12 +373,10 @@ nsLoadGroup::Resume()
381373
if (!request)
382374
continue;
383375

384-
#if defined(PR_LOGGING)
385376
nsAutoCString nameStr;
386377
request->GetName(nameStr);
387378
LOG(("LOADGROUP [%x]: Resuming request %x %s.\n",
388379
this, request, nameStr.get()));
389-
#endif
390380

391381
// Resume the request...
392382
rv = request->Resume();
@@ -470,14 +460,12 @@ nsLoadGroup::AddRequest(nsIRequest *request, nsISupports* ctxt)
470460
{
471461
nsresult rv;
472462

473-
#if defined(PR_LOGGING)
474463
{
475464
nsAutoCString nameStr;
476465
request->GetName(nameStr);
477466
LOG(("LOADGROUP [%x]: Adding request %x %s (count=%d).\n",
478467
this, request, nameStr.get(), mRequests.EntryCount()));
479468
}
480-
#endif /* PR_LOGGING */
481469

482470
NS_ASSERTION(!PL_DHashTableSearch(&mRequests, request),
483471
"Entry added to loadgroup twice, don't do that");
@@ -486,11 +474,8 @@ nsLoadGroup::AddRequest(nsIRequest *request, nsISupports* ctxt)
486474
// Do not add the channel, if the loadgroup is being canceled...
487475
//
488476
if (mIsCanceling) {
489-
490-
#if defined(PR_LOGGING)
491477
LOG(("LOADGROUP [%x]: AddChannel() ABORTED because LoadGroup is"
492478
" being canceled!!\n", this));
493-
#endif /* PR_LOGGING */
494479

495480
return NS_BINDING_ABORTED;
496481
}
@@ -572,14 +557,12 @@ nsLoadGroup::RemoveRequest(nsIRequest *request, nsISupports* ctxt,
572557
NS_ENSURE_ARG_POINTER(request);
573558
nsresult rv;
574559

575-
#if defined(PR_LOGGING)
576560
{
577561
nsAutoCString nameStr;
578562
request->GetName(nameStr);
579563
LOG(("LOADGROUP [%x]: Removing request %x %s status %x (count=%d).\n",
580564
this, request, nameStr.get(), aStatus, mRequests.EntryCount() - 1));
581565
}
582-
#endif
583566

584567
// Make sure we have a owning reference to the request we're about
585568
// to remove.
@@ -662,12 +645,10 @@ nsLoadGroup::RemoveRequest(nsIRequest *request, nsISupports* ctxt,
662645

663646
rv = observer->OnStopRequest(request, ctxt, aStatus);
664647

665-
#if defined(PR_LOGGING)
666648
if (NS_FAILED(rv)) {
667649
LOG(("LOADGROUP [%x]: OnStopRequest for request %x FAILED.\n",
668650
this, request));
669651
}
670-
#endif
671652
}
672653

673654
// If that was the last request -> remove ourselves from loadgroup

netwerk/base/nsPACMan.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@
2525
using namespace mozilla;
2626
using namespace mozilla::net;
2727

28-
#if defined(PR_LOGGING)
29-
#endif
3028
#undef LOG
3129
#define LOG(args) PR_LOG(GetProxyLog(), PR_LOG_DEBUG, args)
3230

netwerk/base/nsProtocolProxyService.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@ namespace mozilla {
4848
using namespace mozilla;
4949

5050
#include "prlog.h"
51-
#if defined(PR_LOGGING)
52-
#endif
5351
#undef LOG
5452
#define LOG(args) PR_LOG(net::GetProxyLog(), PR_LOG_DEBUG, args)
5553

netwerk/base/nsRequestObserverProxy.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@
1313

1414
using namespace mozilla;
1515

16-
#if defined(PR_LOGGING)
1716
static PRLogModuleInfo *gRequestObserverProxyLog;
18-
#endif
1917

2018
#undef LOG
2119
#define LOG(args) PR_LOG(gRequestObserverProxyLog, PR_LOG_DEBUG, args)
@@ -176,10 +174,8 @@ nsRequestObserverProxy::Init(nsIRequestObserver *observer, nsISupports *context)
176174
{
177175
NS_ENSURE_ARG_POINTER(observer);
178176

179-
#if defined(PR_LOGGING)
180177
if (!gRequestObserverProxyLog)
181178
gRequestObserverProxyLog = PR_NewLogModule("nsRequestObserverProxy");
182-
#endif
183179

184180
mObserver = new nsMainThreadPtrHolder<nsIRequestObserver>(observer);
185181
mContext = new nsMainThreadPtrHolder<nsISupports>(context);

0 commit comments

Comments
 (0)