Backed out 2 changesets (bug 1162336) for breaking at least windows builds

Backed out changeset 8952a7fa4050 (bug 1162336)
Backed out changeset 0170a6c2a5be (bug 1162336)
This commit is contained in:
Wes Kocher 2015-05-07 11:13:24 -07:00
parent fdacda5a7d
commit e81f5e76ce
77 changed files with 405 additions and 94 deletions

View File

@ -33,9 +33,14 @@ namespace mozilla {
namespace net {
// NSPR_LOG_MODULES=BackgroundFileSaver:5
#if defined(PR_LOGGING)
PRLogModuleInfo *BackgroundFileSaver::prlog = nullptr;
#define LOG(args) PR_LOG(BackgroundFileSaver::prlog, PR_LOG_DEBUG, args)
#define LOG_ENABLED() PR_LOG_TEST(BackgroundFileSaver::prlog, 4)
#else
#define LOG(args)
#define LOG_ENABLED() (false)
#endif
////////////////////////////////////////////////////////////////////////////////
//// Globals
@ -110,8 +115,10 @@ BackgroundFileSaver::BackgroundFileSaver()
, mActualTargetKeepPartial(false)
, mDigestContext(nullptr)
{
#if defined(PR_LOGGING)
if (!prlog)
prlog = PR_NewLogModule("BackgroundFileSaver");
#endif
LOG(("Created BackgroundFileSaver [this = %p]", this));
}

View File

@ -53,8 +53,12 @@ namespace net {
Predictor *Predictor::sSelf = nullptr;
#if defined(PR_LOGGING)
static PRLogModuleInfo *gPredictorLog = nullptr;
#define PREDICTOR_LOG(args) PR_LOG(gPredictorLog, 4, args)
#else
#define PREDICTOR_LOG(args)
#endif
#define RETURN_IF_FAILED(_rv) \
do { \
@ -311,7 +315,9 @@ Predictor::Predictor()
,mMaxResourcesPerEntry(PREDICTOR_MAX_RESOURCES_DEFAULT)
,mStartupCount(1)
{
#if defined(PR_LOGGING)
gPredictorLog = PR_NewLogModule("NetworkPredictor");
#endif
MOZ_ASSERT(!sSelf, "multiple Predictor instances!");
sSelf = this;

View File

@ -14,6 +14,7 @@
#include "nsIAsyncVerifyRedirectCallback.h"
#undef LOG
#ifdef PR_LOGGING
static PRLogModuleInfo *
GetRedirectLog()
{
@ -23,6 +24,9 @@ GetRedirectLog()
return sLog;
}
#define LOG(args) PR_LOG(GetRedirectLog(), PR_LOG_DEBUG, args)
#else
#define LOG(args)
#endif
NS_IMPL_ISUPPORTS(nsAsyncRedirectVerifyHelper,
nsIAsyncVerifyRedirectCallback,

View File

@ -13,10 +13,12 @@
using namespace mozilla;
#undef LOG
#if defined(PR_LOGGING)
//
// NSPR_LOG_MODULES=nsStreamCopier:5
//
static PRLogModuleInfo *gStreamCopierLog = nullptr;
#endif
#define LOG(args) PR_LOG(gStreamCopierLog, PR_LOG_DEBUG, args)
/**
@ -67,8 +69,10 @@ nsAsyncStreamCopier::nsAsyncStreamCopier()
, mIsPending(false)
, mShouldSniffBuffering(false)
{
#if defined(PR_LOGGING)
if (!gStreamCopierLog)
gStreamCopierLog = PR_NewLogModule("nsStreamCopier");
#endif
LOG(("Creating nsAsyncStreamCopier @%x\n", this));
}

View File

@ -29,7 +29,9 @@
// the file nspr.log
//
#ifdef PR_LOGGING
static PRLogModuleInfo* gLog = nullptr;
#endif
#undef LOGD
#undef LOGE
@ -62,8 +64,10 @@ nsAutodial::~nsAutodial()
// Returns NS_ERROR_FAILURE if error or NS_OK if success.
nsresult nsAutodial::Init()
{
#ifdef PR_LOGGING
if (!gLog)
gLog = PR_NewLogModule("Autodial");
#endif
mDefaultEntryName[0] = '\0';
mNumRASConnectionEntries = 0;

View File

@ -36,10 +36,12 @@
using mozilla::ArrayLength;
using mozilla::Preferences;
#if defined(PR_LOGGING)
//
// NSPR_LOG_MODULES=nsChannelClassifier:5
//
static PRLogModuleInfo *gChannelClassifierLog;
#endif
#undef LOG
#define LOG(args) PR_LOG(gChannelClassifierLog, PR_LOG_DEBUG, args)
@ -50,8 +52,10 @@ nsChannelClassifier::nsChannelClassifier()
: mIsAllowListed(false),
mSuspendedChannel(false)
{
#if defined(PR_LOGGING)
if (!gChannelClassifierLog)
gChannelClassifierLog = PR_NewLogModule("nsChannelClassifier");
#endif
}
nsresult

View File

@ -18,7 +18,9 @@
#include "nsDirectoryIndexStream.h"
#include "prlog.h"
#include "prtime.h"
#ifdef PR_LOGGING
static PRLogModuleInfo* gLog;
#endif
#include "nsISimpleEnumerator.h"
#ifdef THREADSAFE_I18N
@ -44,8 +46,10 @@ static PRLogModuleInfo* gLog;
nsDirectoryIndexStream::nsDirectoryIndexStream()
: mOffset(0), mStatus(NS_OK), mPos(0)
{
#ifdef PR_LOGGING
if (! gLog)
gLog = PR_NewLogModule("nsDirectoryIndexStream");
#endif
PR_LOG(gLog, PR_LOG_DEBUG,
("nsDirectoryIndexStream[%p]: created", this));
@ -92,6 +96,7 @@ nsDirectoryIndexStream::Init(nsIFile* aDir)
if (!isDir)
return NS_ERROR_ILLEGAL_VALUE;
#ifdef PR_LOGGING
if (PR_LOG_TEST(gLog, PR_LOG_DEBUG)) {
nsAutoCString path;
aDir->GetNativePath(path);
@ -99,6 +104,7 @@ nsDirectoryIndexStream::Init(nsIFile* aDir)
("nsDirectoryIndexStream[%p]: initialized on %s",
this, path.get()));
}
#endif
// Sigh. We have to allocate on the heap because there are no
// assignment operators defined.
@ -239,6 +245,7 @@ nsDirectoryIndexStream::Read(char* aBuf, uint32_t aCount, uint32_t* aReadCount)
nsIFile* current = mArray.ObjectAt(mPos);
++mPos;
#ifdef PR_LOGGING
if (PR_LOG_TEST(gLog, PR_LOG_DEBUG)) {
nsAutoCString path;
current->GetNativePath(path);
@ -246,6 +253,7 @@ nsDirectoryIndexStream::Read(char* aBuf, uint32_t aCount, uint32_t* aReadCount)
("nsDirectoryIndexStream[%p]: iterated %s",
this, path.get()));
}
#endif
// rjc: don't return hidden files/directories!
// bbaetz: why not?

View File

@ -21,10 +21,12 @@
static NS_DEFINE_CID(kStreamTransportServiceCID, NS_STREAMTRANSPORTSERVICE_CID);
#if defined(PR_LOGGING)
//
// NSPR_LOG_MODULES=nsStreamPump:5
//
static PRLogModuleInfo *gStreamPumpLog = nullptr;
#endif
#undef LOG
#define LOG(args) PR_LOG(gStreamPumpLog, PR_LOG_DEBUG, args)
@ -45,8 +47,10 @@ nsInputStreamPump::nsInputStreamPump()
, mRetargeting(false)
, mMonitor("nsInputStreamPump")
{
#if defined(PR_LOGGING)
if (!gStreamPumpLog)
gStreamPumpLog = PR_NewLogModule("nsStreamPump");
#endif
}
nsInputStreamPump::~nsInputStreamPump()

View File

@ -27,6 +27,7 @@
using namespace mozilla;
using namespace mozilla::net;
#if defined(PR_LOGGING)
//
// Log module for nsILoadGroup logging...
//
@ -39,6 +40,7 @@ using namespace mozilla::net;
// the file nspr.log
//
static PRLogModuleInfo* gLoadGroupLog = nullptr;
#endif
#undef LOG
#define LOG(args) PR_LOG(gLoadGroupLog, PR_LOG_DEBUG, args)
@ -121,9 +123,11 @@ nsLoadGroup::nsLoadGroup(nsISupports* outer)
{
NS_INIT_AGGREGATED(outer);
#if defined(PR_LOGGING)
// Initialize the global PRLogModule for nsILoadGroup logging
if (nullptr == gLoadGroupLog)
gLoadGroupLog = PR_NewLogModule("LoadGroup");
#endif
LOG(("LOADGROUP [%x]: Created.\n", this));
}
@ -257,12 +261,12 @@ nsLoadGroup::Cancel(nsresult status)
continue;
}
if (PR_LOG_TEST(gLoadGroupLog, PR_LOG_DEBUG)) {
nsAutoCString nameStr;
request->GetName(nameStr);
LOG(("LOADGROUP [%x]: Canceling request %x %s.\n",
this, request, nameStr.get()));
}
#if defined(PR_LOGGING)
nsAutoCString nameStr;
request->GetName(nameStr);
LOG(("LOADGROUP [%x]: Canceling request %x %s.\n",
this, request, nameStr.get()));
#endif
//
// Remove the request from the load group... This may cause
@ -325,12 +329,12 @@ nsLoadGroup::Suspend()
if (!request)
continue;
if (PR_LOG_TEST(gLoadGroupLog, PR_LOG_DEBUG)) {
nsAutoCString nameStr;
request->GetName(nameStr);
LOG(("LOADGROUP [%x]: Suspending request %x %s.\n",
this, request, nameStr.get()));
}
#if defined(PR_LOGGING)
nsAutoCString nameStr;
request->GetName(nameStr);
LOG(("LOADGROUP [%x]: Suspending request %x %s.\n",
this, request, nameStr.get()));
#endif
// Suspend the request...
rv = request->Suspend();
@ -377,12 +381,12 @@ nsLoadGroup::Resume()
if (!request)
continue;
if (PR_LOG_TEST(gLoadGroupLog, PR_LOG_DEBUG)) {
nsAutoCString nameStr;
request->GetName(nameStr);
LOG(("LOADGROUP [%x]: Resuming request %x %s.\n",
this, request, nameStr.get()));
}
#if defined(PR_LOGGING)
nsAutoCString nameStr;
request->GetName(nameStr);
LOG(("LOADGROUP [%x]: Resuming request %x %s.\n",
this, request, nameStr.get()));
#endif
// Resume the request...
rv = request->Resume();
@ -466,12 +470,14 @@ nsLoadGroup::AddRequest(nsIRequest *request, nsISupports* ctxt)
{
nsresult rv;
if (PR_LOG_TEST(gLoadGroupLog, PR_LOG_DEBUG)) {
#if defined(PR_LOGGING)
{
nsAutoCString nameStr;
request->GetName(nameStr);
LOG(("LOADGROUP [%x]: Adding request %x %s (count=%d).\n",
this, request, nameStr.get(), mRequests.EntryCount()));
}
#endif /* PR_LOGGING */
NS_ASSERTION(!PL_DHashTableSearch(&mRequests, request),
"Entry added to loadgroup twice, don't do that");
@ -480,8 +486,11 @@ nsLoadGroup::AddRequest(nsIRequest *request, nsISupports* ctxt)
// Do not add the channel, if the loadgroup is being canceled...
//
if (mIsCanceling) {
#if defined(PR_LOGGING)
LOG(("LOADGROUP [%x]: AddChannel() ABORTED because LoadGroup is"
" being canceled!!\n", this));
#endif /* PR_LOGGING */
return NS_BINDING_ABORTED;
}
@ -563,12 +572,14 @@ nsLoadGroup::RemoveRequest(nsIRequest *request, nsISupports* ctxt,
NS_ENSURE_ARG_POINTER(request);
nsresult rv;
if (PR_LOG_TEST(gLoadGroupLog, PR_LOG_DEBUG)) {
#if defined(PR_LOGGING)
{
nsAutoCString nameStr;
request->GetName(nameStr);
LOG(("LOADGROUP [%x]: Removing request %x %s status %x (count=%d).\n",
this, request, nameStr.get(), aStatus, mRequests.EntryCount() - 1));
}
#endif
// Make sure we have a owning reference to the request we're about
// to remove.
@ -651,10 +662,12 @@ nsLoadGroup::RemoveRequest(nsIRequest *request, nsISupports* ctxt,
rv = observer->OnStopRequest(request, ctxt, aStatus);
#if defined(PR_LOGGING)
if (NS_FAILED(rv)) {
LOG(("LOADGROUP [%x]: OnStopRequest for request %x FAILED.\n",
this, request));
}
#endif
}
// If that was the last request -> remove ourselves from loadgroup

View File

@ -25,6 +25,8 @@
using namespace mozilla;
using namespace mozilla::net;
#if defined(PR_LOGGING)
#endif
#undef LOG
#define LOG(args) PR_LOG(GetProxyLog(), PR_LOG_DEBUG, args)

View File

@ -48,6 +48,8 @@ namespace mozilla {
using namespace mozilla;
#include "prlog.h"
#if defined(PR_LOGGING)
#endif
#undef LOG
#define LOG(args) PR_LOG(net::GetProxyLog(), PR_LOG_DEBUG, args)

View File

@ -13,7 +13,9 @@
using namespace mozilla;
#if defined(PR_LOGGING)
static PRLogModuleInfo *gRequestObserverProxyLog;
#endif
#undef LOG
#define LOG(args) PR_LOG(gRequestObserverProxyLog, PR_LOG_DEBUG, args)
@ -174,8 +176,10 @@ nsRequestObserverProxy::Init(nsIRequestObserver *observer, nsISupports *context)
{
NS_ENSURE_ARG_POINTER(observer);
#if defined(PR_LOGGING)
if (!gRequestObserverProxyLog)
gRequestObserverProxyLog = PR_NewLogModule("nsRequestObserverProxy");
#endif
mObserver = new nsMainThreadPtrHolder<nsIRequestObserver>(observer);
mContext = new nsMainThreadPtrHolder<nsISupports>(context);

View File

@ -1251,6 +1251,7 @@ nsSocketTransport::InitiateSocket()
// connected - Bug 853423.
if (mConnectionFlags & nsISocketTransport::DISABLE_RFC1918 &&
IsIPAddrLocal(&mNetAddr)) {
#ifdef PR_LOGGING
if (SOCKET_LOG_ENABLED()) {
nsAutoCString netAddrCString;
netAddrCString.SetCapacity(kIPv6CStrBufSize);
@ -1264,6 +1265,7 @@ nsSocketTransport::InitiateSocket()
mHost.get(), mPort, mProxyHost.get(), mProxyPort,
netAddrCString.get()));
}
#endif
mCondition = NS_ERROR_CONNECTION_REFUSED;
OnSocketDetached(nullptr);
return mCondition;
@ -1370,11 +1372,13 @@ nsSocketTransport::InitiateSocket()
mPollTimeout = mTimeouts[TIMEOUT_CONNECT];
SendStatus(NS_NET_STATUS_CONNECTING_TO);
#if defined(PR_LOGGING)
if (SOCKET_LOG_ENABLED()) {
char buf[kNetAddrMaxCStrBufSize];
NetAddrToString(&mNetAddr, buf, sizeof(buf));
SOCKET_LOG((" trying address: %s\n", buf));
}
#endif
//
// Initiate the connect() to the host...
@ -2803,7 +2807,7 @@ nsSocketTransport::TraceOutBuf(const char *buf, int32_t n)
static void LogNSPRError(const char* aPrefix, const void *aObjPtr)
{
#if defined(DEBUG)
#if defined(PR_LOGGING) && defined(DEBUG)
PRErrorCode errCode = PR_GetError();
int errLen = PR_GetErrorTextLength();
nsAutoCString errStr;
@ -2843,7 +2847,7 @@ nsSocketTransport::PRFileDescAutoLock::SetKeepaliveEnabled(bool aEnable)
static void LogOSError(const char *aPrefix, const void *aObjPtr)
{
#if defined(DEBUG)
#if defined(PR_LOGGING) && defined(DEBUG)
MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread, "wrong thread");
#ifdef XP_WIN

View File

@ -29,7 +29,9 @@
using namespace mozilla;
using namespace mozilla::net;
#if defined(PR_LOGGING)
PRLogModuleInfo *gSocketTransportLog = nullptr;
#endif
nsSocketTransportService *gSocketTransportService = nullptr;
PRThread *gSocketThread = nullptr;
@ -78,7 +80,9 @@ nsSocketTransportService::nsSocketTransportService()
, mTelemetryEnabledPref(false)
, mProbedMaxCount(false)
{
#if defined(PR_LOGGING)
gSocketTransportLog = PR_NewLogModule("nsSocketTransport");
#endif
NS_ASSERTION(NS_IsMainThread(), "wrong thread");

View File

@ -25,10 +25,12 @@ struct PRPollDesc;
//-----------------------------------------------------------------------------
#if defined(PR_LOGGING)
//
// set NSPR_LOG_MODULES=nsSocketTransport:5
//
extern PRLogModuleInfo *gSocketTransportLog;
#endif
#define SOCKET_LOG(args) PR_LOG(gSocketTransportLog, PR_LOG_DEBUG, args)
#define SOCKET_LOG_ENABLED() PR_LOG_TEST(gSocketTransportLog, PR_LOG_DEBUG)

View File

@ -37,10 +37,12 @@ bool nsStandardURL::gEscapeUTF8 = true;
bool nsStandardURL::gAlwaysEncodeInUTF8 = true;
char nsStandardURL::gHostLimitDigits[] = { '/', '\\', '?', '#', 0 };
#if defined(PR_LOGGING)
//
// setenv NSPR_LOG_MODULES nsStandardURL:5
//
static PRLogModuleInfo *gStandardURLLog;
#endif
// The Chromium code defines its own LOG macro which we don't want
#undef LOG
@ -252,8 +254,10 @@ nsStandardURL::nsStandardURL(bool aSupportsFileURL, bool aTrackURL)
, mMutable(true)
, mSupportsFileURL(aSupportsFileURL)
{
#if defined(PR_LOGGING)
if (!gStandardURLLog)
gStandardURLLog = PR_NewLogModule("nsStandardURL");
#endif
LOG(("Creating nsStandardURL @%p\n", this));
@ -1202,6 +1206,7 @@ nsStandardURL::SetSpec(const nsACString &input)
return rv;
}
#if defined(PR_LOGGING)
if (LOG_ENABLED()) {
LOG((" spec = %s\n", mSpec.get()));
LOG((" port = %d\n", mPort));
@ -1218,6 +1223,7 @@ nsStandardURL::SetSpec(const nsACString &input)
LOG((" query = (%u,%d)\n", mQuery.mPos, mQuery.mLen));
LOG((" ref = (%u,%d)\n", mRef.mPos, mRef.mLen));
}
#endif
return rv;
}
@ -2704,12 +2710,14 @@ nsStandardURL::GetFile(nsIFile **result)
if (NS_FAILED(rv))
return rv;
#if defined(PR_LOGGING)
if (LOG_ENABLED()) {
nsAutoCString path;
mFile->GetNativePath(path);
LOG(("nsStandardURL::GetFile [this=%p spec=%s resulting_path=%s]\n",
this, mSpec.get(), path.get()));
}
#endif
// clone the file, so the caller can modify it.
// XXX nsIFileURL.idl specifies that the consumer must _not_ modify the

View File

@ -14,6 +14,7 @@
* Cache Service Utility Functions
*/
#if defined(PR_LOGGING)
PRLogModuleInfo * gCacheLog = nullptr;
@ -38,6 +39,8 @@ CacheLogPrintPath(PRLogModuleLevel level, const char * format, nsIFile * item)
}
}
#endif
uint32_t
SecondsFromPRTime(PRTime prTime)

View File

@ -19,6 +19,7 @@
#include "nsError.h"
// PR_LOG args = "format string", arg, arg, ...
#if defined(PR_LOGGING)
extern PRLogModuleInfo * gCacheLog;
void CacheLogInit();
void CacheLogPrintPath(PRLogModuleLevel level,
@ -31,6 +32,14 @@ void CacheLogPrintPath(PRLogModuleLevel level,
#define CACHE_LOG_DEBUG(args) PR_LOG(gCacheLog, PR_LOG_DEBUG, args)
#define CACHE_LOG_PATH(level, format, item) \
CacheLogPrintPath(level, format, item)
#else
#define CACHE_LOG_INIT() {}
#define CACHE_LOG_ALWAYS(args) {}
#define CACHE_LOG_ERROR(args) {}
#define CACHE_LOG_WARNING(args) {}
#define CACHE_LOG_DEBUG(args) {}
#define CACHE_LOG_PATH(level, format, item) {}
#endif
extern uint32_t SecondsFromPRTime(PRTime prTime);

View File

@ -296,7 +296,9 @@ public:
NS_IMETHOD Run()
{
nsCacheServiceAutoLock autoLock(LOCK_TELEM(NSBLOCKONCACHETHREADEVENT_RUN));
#ifdef PR_LOGGING
CACHE_LOG_DEBUG(("nsBlockOnCacheThreadEvent [%p]\n", this));
#endif
nsCacheService::gService->mCondVar.Notify();
return NS_OK;
}
@ -1250,7 +1252,9 @@ nsCacheService::Shutdown()
mCustomOfflineDevices.Enumerate(&nsCacheService::ShutdownCustomCacheDeviceEnum, nullptr);
#ifdef PR_LOGGING
LogCacheStatistics();
#endif
mClearingEntries = false;
mCacheIOThread.swap(cacheIOThread);
@ -1767,12 +1771,12 @@ nsCacheService::CreateCustomOfflineDevice(nsIFile *aProfileDir,
{
NS_ENSURE_ARG(aProfileDir);
if (PR_LOG_TEST(gCacheLog, PR_LOG_ALWAYS)) {
nsAutoCString profilePath;
aProfileDir->GetNativePath(profilePath);
CACHE_LOG_ALWAYS(("Creating custom offline device, %s, %d",
profilePath.BeginReading(), aQuota));
}
#if defined(PR_LOGGING)
nsAutoCString profilePath;
aProfileDir->GetNativePath(profilePath);
CACHE_LOG_ALWAYS(("Creating custom offline device, %s, %d",
profilePath.BeginReading(), aQuota));
#endif
if (!mInitialized) return NS_ERROR_NOT_AVAILABLE;
if (!mEnableOfflineDevice) return NS_ERROR_NOT_AVAILABLE;
@ -3113,6 +3117,7 @@ void nsCacheService::GetAppCacheDirectory(nsIFile ** result)
}
#if defined(PR_LOGGING)
void
nsCacheService::LogCacheStatistics()
{
@ -3132,6 +3137,7 @@ nsCacheService::LogCacheStatistics()
CACHE_LOG_ALWAYS((" Deactivated Unbound Entries = %d\n",
mDeactivatedUnboundEntries));
}
#endif
nsresult
nsCacheService::SetDiskSmartSize()

View File

@ -325,7 +325,9 @@ private:
PLDHashOperator ShutdownCustomCacheDeviceEnum(const nsAString& aProfileDir,
nsRefPtr<nsOfflineCacheDevice>& aDevice,
void* aUserArg);
#if defined(PR_LOGGING)
void LogCacheStatistics();
#endif
nsresult SetDiskSmartSize_Locked();

View File

@ -65,7 +65,9 @@ public:
NS_IMETHOD Run()
{
nsCacheServiceAutoLock lock(LOCK_TELEM(NSDISKCACHEDEVICEDEACTIVATEENTRYEVENT_RUN));
#ifdef PR_LOGGING
CACHE_LOG_DEBUG(("nsDiskCacheDeviceDeactivateEntryEvent[%p]\n", this));
#endif
if (!mCanceled) {
(void) mDevice->DeactivateEntry_Private(mEntry, mBinding);
}

View File

@ -225,11 +225,11 @@ nsOfflineCacheEvictionFunction::Apply()
LOG(("nsOfflineCacheEvictionFunction::Apply\n"));
for (int32_t i = 0; i < mItems.Count(); i++) {
if (PR_LOG_TEST(gCacheLog, PR_LOG_DEBUG)) {
nsAutoCString path;
mItems[i]->GetNativePath(path);
LOG((" removing %s\n", path.get()));
}
#if defined(PR_LOGGING)
nsAutoCString path;
mItems[i]->GetNativePath(path);
LOG((" removing %s\n", path.get()));
#endif
mItems[i]->Remove(false);
}

View File

@ -1877,7 +1877,10 @@ CacheFile::FailUpdateListeners(
nsRefPtr<CacheFileChunk>& aChunk,
void* aClosure)
{
#ifdef PR_LOGGING
CacheFile *file = static_cast<CacheFile*>(aClosure);
#endif
LOG(("CacheFile::FailUpdateListeners() [this=%p, idx=%u]",
file, aIdx));

View File

@ -246,8 +246,10 @@ CacheFileContextEvictor::PersistEvictionInfoToDisk(
return rv;
}
#ifdef PR_LOGGING
nsAutoCString path;
file->GetNativePath(path);
#endif
PRFileDesc *fd;
rv = file->OpenNSPRFileDesc(PR_RDWR | PR_CREATE_FILE | PR_TRUNCATE, 0600,
@ -283,8 +285,10 @@ CacheFileContextEvictor::RemoveEvictInfoFromDisk(
return rv;
}
#ifdef PR_LOGGING
nsAutoCString path;
file->GetNativePath(path);
#endif
rv = file->Remove(false);
if (NS_WARN_IF(NS_FAILED(rv))) {

View File

@ -2968,8 +2968,10 @@ CacheFileIOManager::CacheIndexStateChangedInternal()
nsresult
CacheFileIOManager::TrashDirectory(nsIFile *aFile)
{
#ifdef PR_LOGGING
nsAutoCString path;
aFile->GetNativePath(path);
#endif
LOG(("CacheFileIOManager::TrashDirectory() [file=%s]", path.get()));
nsresult rv;
@ -3199,13 +3201,13 @@ CacheFileIOManager::RemoveTrashInternal()
if (isDir) {
NS_WARNING("Found a directory in a trash directory! It will be removed "
"recursively, but this can block IO thread for a while!");
if (LOG_ENABLED()) {
nsAutoCString path;
file->GetNativePath(path);
LOG(("CacheFileIOManager::RemoveTrashInternal() - Found a directory in a trash "
"directory! It will be removed recursively, but this can block IO "
"thread for a while! [file=%s]", path.get()));
}
#ifdef PR_LOGGING
nsAutoCString path;
file->GetNativePath(path);
#endif
LOG(("CacheFileIOManager::RemoveTrashInternal() - Found a directory in a trash "
"directory! It will be removed recursively, but this can block IO "
"thread for a while! [file=%s]", path.get()));
}
file->Remove(isDir);
}
@ -3759,12 +3761,13 @@ CacheFileIOManager::SyncRemoveDir(nsIFile *aFile, const char *aDir)
}
}
if (LOG_ENABLED()) {
nsAutoCString path;
file->GetNativePath(path);
LOG(("CacheFileIOManager::SyncRemoveDir() - Removing directory %s",
path.get()));
}
#ifdef PR_LOGGING
nsAutoCString path;
file->GetNativePath(path);
#endif
LOG(("CacheFileIOManager::SyncRemoveDir() - Removing directory %s",
path.get()));
rv = file->Remove(true);
if (NS_WARN_IF(NS_FAILED(rv))) {

View File

@ -3082,6 +3082,7 @@ CacheIndex::RemoveNonFreshEntries(CacheIndexEntry *aEntry, void* aClosure)
return PL_DHASH_REMOVE;
}
#ifdef PR_LOGGING
// static
char const *
CacheIndex::StateString(EState aState)
@ -3099,6 +3100,7 @@ CacheIndex::StateString(EState aState)
MOZ_ASSERT(false, "Unexpected state!");
return "?";
}
#endif
void
CacheIndex::ChangeState(EState aNewState)

View File

@ -906,7 +906,9 @@ private:
SHUTDOWN = 6
};
#ifdef PR_LOGGING
static char const * StateString(EState aState);
#endif
void ChangeState(EState aNewState);
// Allocates and releases buffer used for reading and writing index.

View File

@ -7,6 +7,7 @@
namespace mozilla {
namespace net {
#if defined(PR_LOGGING)
// Log module for cache2 (2013) cache implementation logging...
//
// To enable logging (see prlog.h for full details):
@ -23,6 +24,7 @@ PRLogModuleInfo* GetCache2Log()
sLog = PR_NewLogModule("cache2");
return sLog;
}
#endif
} // net
} // mozilla

View File

@ -10,9 +10,12 @@
namespace mozilla {
namespace net {
#if defined(PR_LOGGING)
extern PRLogModuleInfo* GetCache2Log();
#define LOG(x) PR_LOG(GetCache2Log(), PR_LOG_DEBUG, x)
#define LOG_ENABLED() PR_LOG_TEST(GetCache2Log(), PR_LOG_DEBUG)
#else
#define LOG(x)
#endif /* PR_LOGGING */
} // net
} // mozilla

View File

@ -1206,7 +1206,9 @@ CacheStorageService::PurgeOverMemoryLimit()
void
CacheStorageService::MemoryPool::PurgeOverMemoryLimit()
{
#ifdef PR_LOGGING
TimeStamp start(TimeStamp::Now());
#endif
uint32_t const memoryLimit = Limit();
if (mMemorySize > memoryLimit) {
@ -1442,12 +1444,12 @@ CacheStorageService::CheckStorageEntry(CacheStorage const* aStorage,
AppendMemoryStorageID(contextKey);
}
if (LOG_ENABLED()) {
nsAutoCString uriSpec;
aURI->GetAsciiSpec(uriSpec);
LOG(("CacheStorageService::CheckStorageEntry [uri=%s, eid=%s, contextKey=%s]",
uriSpec.get(), aIdExtension.BeginReading(), contextKey.get()));
}
#ifdef PR_LOGGING
nsAutoCString uriSpec;
aURI->GetAsciiSpec(uriSpec);
LOG(("CacheStorageService::CheckStorageEntry [uri=%s, eid=%s, contextKey=%s]",
uriSpec.get(), aIdExtension.BeginReading(), contextKey.get()));
#endif
{
mozilla::MutexAutoLock lock(mLock);

View File

@ -190,6 +190,7 @@ struct nsListIter
#define SET_COOKIE true
#define GET_COOKIE false
#ifdef PR_LOGGING
static PRLogModuleInfo *
GetCookieLog()
{
@ -321,6 +322,13 @@ LogSuccess(bool aSetCookie, nsIURI *aHostURI, const nsAFlatCString &aCookieStrin
LogSuccess(aSetCookie, aHostURI, aCookieString.get(), aCookie, aReplacing);
}
#else
#define COOKIE_LOGFAILURE(a, b, c, d) PR_BEGIN_MACRO /* nothing */ PR_END_MACRO
#define COOKIE_LOGSUCCESS(a, b, c, d, e) PR_BEGIN_MACRO /* nothing */ PR_END_MACRO
#define COOKIE_LOGEVICTED(a, b) PR_BEGIN_MACRO /* nothing */ PR_END_MACRO
#define COOKIE_LOGSTRING(a, b) PR_BEGIN_MACRO /* nothing */ PR_END_MACRO
#endif
#ifdef DEBUG
#define NS_ASSERT_SUCCESS(res) \
PR_BEGIN_MACRO \
@ -351,17 +359,17 @@ protected:
public:
NS_IMETHOD HandleError(mozIStorageError* aError) override
{
if (PR_LOG_TEST(GetCookieLog(), PR_LOG_WARNING)) {
int32_t result = -1;
aError->GetResult(&result);
int32_t result = -1;
aError->GetResult(&result);
nsAutoCString message;
aError->GetMessage(message);
COOKIE_LOGSTRING(PR_LOG_WARNING,
("DBListenerErrorHandler::HandleError(): Error %d occurred while "
"performing operation '%s' with message '%s'; rebuilding database.",
result, GetOpType(), message.get()));
}
#ifdef PR_LOGGING
nsAutoCString message;
aError->GetMessage(message);
COOKIE_LOGSTRING(PR_LOG_WARNING,
("DBListenerErrorHandler::HandleError(): Error %d occurred while "
"performing operation '%s' with message '%s'; rebuilding database.",
result, GetOpType(), message.get()));
#endif
// Rebuild the database.
gCookieService->HandleCorruptDB(mDBState);
@ -3770,10 +3778,12 @@ nsCookieService::PurgeCookies(int64_t aCurrentTimeInUsec)
NS_ASSERTION(mDBState->hostTable.Count() > 0, "table is empty");
EnsureReadComplete();
#ifdef PR_LOGGING
uint32_t initialCookieCount = mDBState->cookieCount;
COOKIE_LOGSTRING(PR_LOG_DEBUG,
("PurgeCookies(): beginning purge with %ld cookies and %lld oldest age",
mDBState->cookieCount, aCurrentTimeInUsec - mDBState->cookieOldestTime));
#endif
nsAutoTArray<nsListIter, kMaxNumberOfCookies> purgeList;
@ -3791,7 +3801,9 @@ nsCookieService::PurgeCookies(int64_t aCurrentTimeInUsec)
aCurrentTimeInUsec - mCookiePurgeAge, purgeList, removedList, paramsArray);
mDBState->hostTable.EnumerateEntries(purgeCookiesCallback, &data);
#ifdef PR_LOGGING
uint32_t postExpiryCookieCount = mDBState->cookieCount;
#endif
// now we have a list of iterators for cookies over the age limit.
// sort them by age, and then we'll see how many to remove...

View File

@ -23,11 +23,16 @@
#endif
#include "prlog.h"
#if defined(PR_LOGGING)
static PRLogModuleInfo *gGetAddrInfoLog = PR_NewLogModule("GetAddrInfo");
#define LOG(msg, ...) \
PR_LOG(gGetAddrInfoLog, PR_LOG_DEBUG, ("[DNS]: " msg, ##__VA_ARGS__))
#define LOG_WARNING(msg, ...) \
PR_LOG(gGetAddrInfoLog, PR_LOG_WARNING, ("[DNS]: " msg, ##__VA_ARGS__))
#else
#define LOG(args)
#define LOG_WARNING(args)
#endif
#if DNSQUERY_AVAILABLE
// There is a bug in windns.h where the type of parameter ppQueryResultsSet for

View File

@ -69,8 +69,12 @@ PR_STATIC_ASSERT (HighThreadThreshold <= MAX_RESOLVER_THREADS);
//----------------------------------------------------------------------------
#if defined(PR_LOGGING)
static PRLogModuleInfo *gHostResolverLog = nullptr;
#define LOG(args) PR_LOG(gHostResolverLog, PR_LOG_DEBUG, args)
#else
#define LOG(args)
#endif
#define LOG_HOST(host, interface) host, \
(interface && interface[0] != '\0') ? " on interface " : "", \
@ -439,7 +443,7 @@ HostDB_ClearEntry(PLDHashTable *table,
LOG(("Clearing cache db entry for host [%s%s%s].\n",
LOG_HOST(hr->host, hr->netInterface)));
#if defined(DEBUG)
#if defined(DEBUG) && defined(PR_LOGGING)
{
MutexAutoLock lock(hr->addr_info_lock);
if (!hr->addr_info) {
@ -1048,10 +1052,12 @@ nsHostResolver::ConditionallyCreateThread(nsHostRecord *rec)
return NS_ERROR_OUT_OF_MEMORY;
}
}
#if defined(PR_LOGGING)
else {
LOG((" Unable to find a thread for looking up host [%s%s%s].\n",
LOG_HOST(rec->host, rec->netInterface)));
}
#endif
return NS_OK;
}
@ -1491,8 +1497,10 @@ nsHostResolver::Create(uint32_t maxCacheEntries,
uint32_t defaultGracePeriod,
nsHostResolver **result)
{
#if defined(PR_LOGGING)
if (!gHostResolverLog)
gHostResolverLog = PR_NewLogModule("nsHostResolver");
#endif
nsHostResolver *res = new nsHostResolver(maxCacheEntries, defaultCacheEntryLifetime,
defaultGracePeriod);

View File

@ -10,7 +10,9 @@
#include "nsThreadUtils.h"
#include "mozilla/Attributes.h"
#if defined(PR_LOGGING)
extern PRLogModuleInfo* gFTPLog;
#endif /* PR_LOGGING */
// There are two transport connections established for an
// ftp connection. One is used for the command channel , and

View File

@ -45,7 +45,9 @@
#include "NetStatistics.h"
#endif
#if defined(PR_LOGGING)
extern PRLogModuleInfo* gFTPLog;
#endif
#define LOG(args) PR_LOG(gFTPLog, PR_LOG_DEBUG, args)
#define LOG_ALWAYS(args) PR_LOG(gFTPLog, PR_LOG_ALWAYS, args)

View File

@ -15,7 +15,9 @@
#include "nsNetCID.h"
#include <algorithm>
#if defined(PR_LOGGING)
extern PRLogModuleInfo* gFTPLog;
#endif
#define LOG(args) PR_LOG(gFTPLog, PR_LOG_DEBUG, args)
#define LOG_ALWAYS(args) PR_LOG(gFTPLog, PR_LOG_ALWAYS, args)

View File

@ -34,6 +34,7 @@ using namespace mozilla::net;
//-----------------------------------------------------------------------------
#if defined(PR_LOGGING)
//
// Log module for FTP Protocol logging...
//
@ -46,6 +47,7 @@ using namespace mozilla::net;
// the file nspr.log
//
PRLogModuleInfo* gFTPLog = nullptr;
#endif
#undef LOG
#define LOG(args) PR_LOG(gFTPLog, PR_LOG_DEBUG, args)
@ -67,9 +69,10 @@ nsFtpProtocolHandler::nsFtpProtocolHandler()
, mControlQoSBits(0x00)
, mDataQoSBits(0x00)
{
#if defined(PR_LOGGING)
if (!gFTPLog)
gFTPLog = PR_NewLogModule("nsFtp");
#endif
LOG(("FTP:creating handler @%x\n", this));
gFtpHandler = this;

View File

@ -82,6 +82,8 @@ private:
extern nsFtpProtocolHandler *gFtpHandler;
#ifdef PR_LOGGING
extern PRLogModuleInfo* gFTPLog;
#endif
#endif // !nsFtpProtocolHandler_h__

View File

@ -2356,17 +2356,16 @@ HttpBaseChannel::SetupReplacementChannel(nsIURI *newURI,
// Transfer existing redirect information. Add all of our existing
// redirects to the new channel.
for (int32_t i = 0; i < mRedirects.Count(); ++i) {
if (LOG_ENABLED()) {
nsCOMPtr<nsIURI> uri;
mRedirects[i]->GetURI(getter_AddRefs(uri));
nsCString spec;
if (uri) {
uri->GetSpec(spec);
}
LOG(("HttpBaseChannel::SetupReplacementChannel adding redirect \'%s\' "
"[this=%p]", spec.get(), this));
#ifdef PR_LOGGING
nsCOMPtr<nsIURI> uri;
mRedirects[i]->GetURI(getter_AddRefs(uri));
nsCString spec;
if (uri) {
uri->GetSpec(spec);
}
LOG(("HttpBaseChannel::SetupReplacementChannel adding redirect \'%s\' "
"[this=%p]", spec.get(), this));
#endif
httpInternal->AddRedirect(mRedirects[i]);
}

View File

@ -23,6 +23,7 @@
// Get rid of Chromium's LOG definition
#undef LOG
#if defined(PR_LOGGING)
//
// Log module for HTTP Protocol logging...
//
@ -35,6 +36,7 @@
// the file http.log
//
extern PRLogModuleInfo *gHttpLog;
#endif
// http logging
#define LOG1(args) PR_LOG(gHttpLog, 1, args)

View File

@ -13,7 +13,9 @@
#include "mozilla/HashFunctions.h"
#include "nsCRT.h"
#if defined(PR_LOGGING)
PRLogModuleInfo *gHttpLog = nullptr;
#endif
namespace mozilla {
namespace net {

View File

@ -6558,12 +6558,12 @@ nsHttpChannel::MaybeInvalidateCacheEntryForSubsequentGet()
}
// Invalidate the request-uri.
if (LOG_ENABLED()) {
nsAutoCString key;
mURI->GetAsciiSpec(key);
LOG(("MaybeInvalidateCacheEntryForSubsequentGet [this=%p uri=%s]\n",
this, key.get()));
}
#ifdef PR_LOGGING
nsAutoCString key;
mURI->GetAsciiSpec(key);
LOG(("MaybeInvalidateCacheEntryForSubsequentGet [this=%p uri=%s]\n",
this, key.get()));
#endif
DoInvalidateCacheEntry(mURI);
@ -6606,12 +6606,11 @@ nsHttpChannel::DoInvalidateCacheEntry(nsIURI* aURI)
nsresult rv;
#ifdef PR_LOGGING
nsAutoCString key;
if (LOG_ENABLED()) {
aURI->GetAsciiSpec(key);
}
aURI->GetAsciiSpec(key);
LOG(("DoInvalidateCacheEntry [channel=%p key=%s]", this, key.get()));
#endif
nsCOMPtr<nsICacheStorageService> cacheStorageService =
do_GetService("@mozilla.org/netwerk/cache-storage-service;1", &rv);

View File

@ -214,7 +214,9 @@ nsHttpHandler::nsHttpHandler()
, mTCPKeepaliveLongLivedIdleTimeS(600)
, mEnforceH1Framing(FRAMECHECK_BARELY)
{
#if defined(PR_LOGGING)
gHttpLog = PR_NewLogModule("nsHttp");
#endif
LOG(("Creating nsHttpHandler [this=%p].\n", this));

View File

@ -274,8 +274,10 @@ nsHttpNTLMAuth::ChallengeReceived(nsIHttpAuthenticableChannel *channel,
*identityInvalid = true;
}
#endif // XP_WIN
#ifdef PR_LOGGING
if (!module)
LOG(("Native sys-ntlm auth module not found.\n"));
#endif
}
#ifdef XP_WIN

View File

@ -63,6 +63,7 @@ namespace net {
// helpers
//-----------------------------------------------------------------------------
#if defined(PR_LOGGING)
static void
LogHeaders(const char *lineStart)
{
@ -80,6 +81,7 @@ LogHeaders(const char *lineStart)
lineStart = endOfLine + 2;
}
}
#endif
//-----------------------------------------------------------------------------
// nsHttpTransaction <public>
@ -318,11 +320,13 @@ nsHttpTransaction::Init(uint32_t caps,
mReqHeaderBuf.Truncate();
requestHead->Flatten(mReqHeaderBuf, pruneProxyHeaders);
#if defined(PR_LOGGING)
if (LOG3_ENABLED()) {
LOG3(("http request [\n"));
LogHeaders(mReqHeaderBuf.get());
LOG3(("]\n"));
}
#endif
// If the request body does not include headers or if there is no request
// body, then we must add the header/body separator manually.
@ -1470,6 +1474,7 @@ nsHttpTransaction::HandleContentStart()
MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
if (mResponseHead) {
#if defined(PR_LOGGING)
if (LOG3_ENABLED()) {
LOG3(("http response [\n"));
nsAutoCString headers;
@ -1477,7 +1482,7 @@ nsHttpTransaction::HandleContentStart()
LogHeaders(headers.get());
LOG3(("]\n"));
}
#endif
// Save http version, mResponseHead isn't available anymore after
// TakeResponseHead() is called
mHttpVersion = mResponseHead->Version();
@ -1556,8 +1561,10 @@ nsHttpTransaction::HandleContentStart()
// Ignore server specified Content-Length.
mContentLength = -1;
}
#if defined(PR_LOGGING)
else if (mContentLength == int64_t(-1))
LOG(("waiting for the server to close the connection.\n"));
#endif
}
if (mRestartInProgressVerifier.IsSetup() &&
!mRestartInProgressVerifier.Verify(mContentLength, mResponseHead)) {

View File

@ -23,6 +23,7 @@ static NS_DEFINE_CID(kResURLCID, NS_RESURL_CID);
static nsResProtocolHandler *gResHandler = nullptr;
#if defined(PR_LOGGING)
//
// Log module for Resource Protocol logging...
//
@ -35,6 +36,7 @@ static nsResProtocolHandler *gResHandler = nullptr;
// the file log.txt
//
static PRLogModuleInfo *gResLog;
#endif
#define kAPP NS_LITERAL_CSTRING("app")
#define kGRE NS_LITERAL_CSTRING("gre")
@ -102,7 +104,9 @@ nsResURL::GetClassIDNoAlloc(nsCID *aClassIDNoAlloc)
nsResProtocolHandler::nsResProtocolHandler()
: mSubstitutions(16)
{
#if defined(PR_LOGGING)
gResLog = PR_NewLogModule("nsResProtocol");
#endif
NS_ASSERTION(!gResHandler, "res handler already created!");
gResHandler = this;
@ -447,11 +451,13 @@ nsResProtocolHandler::ResolveURI(nsIURI *uri, nsACString &result)
rv = baseURI->Resolve(nsDependentCString(p, path.Length()-1), result);
#if defined(PR_LOGGING)
if (PR_LOG_TEST(gResLog, PR_LOG_DEBUG)) {
nsAutoCString spec;
uri->GetAsciiSpec(spec);
PR_LOG(gResLog, PR_LOG_DEBUG,
("%s\n -> %s\n", spec.get(), PromiseFlatCString(result).get()));
}
#endif
return rv;
}

View File

@ -70,8 +70,10 @@ RtspControllerChild::RtspControllerChild(nsIChannel *channel)
, mPlayTimer(nullptr)
, mPauseTimer(nullptr)
{
#if defined(PR_LOGGING)
if (!gRtspChildLog)
gRtspChildLog = PR_NewLogModule("nsRtspChild");
#endif
AddIPDLReference();
gNeckoChild->SendPRtspControllerConstructor(this);
}

View File

@ -62,8 +62,10 @@ RtspControllerParent::RtspControllerParent()
: mIPCOpen(true)
, mTotalTracks(0)
{
#if defined(PR_LOGGING)
if (!gRtspLog)
gRtspLog = PR_NewLogModule("nsRtsp");
#endif
}
RtspControllerParent::~RtspControllerParent()

View File

@ -13,7 +13,9 @@
#include "nsProxyRelease.h"
#include "nsStandardURL.h"
#if defined(PR_LOGGING)
PRLogModuleInfo *webSocketLog = nullptr;
#endif
namespace mozilla {
namespace net {
@ -27,8 +29,10 @@ BaseWebSocketChannel::BaseWebSocketChannel()
, mPingInterval(0)
, mPingResponseTimeout(10000)
{
#if defined(PR_LOGGING)
if (!webSocketLog)
webSocketLog = PR_NewLogModule("nsWebSocket");
#endif
}
//-----------------------------------------------------------------------------

View File

@ -33,8 +33,10 @@ WebSocketChannelParent::WebSocketChannelParent(nsIAuthPromptProvider* aAuthProvi
{
// Websocket channels can't have a private browsing override
MOZ_ASSERT_IF(!aLoadContext, aOverrideStatus == kPBOverride_Unset);
#if defined(PR_LOGGING)
if (!webSocketLog)
webSocketLog = PR_NewLogModule("nsWebSocket");
#endif
mObserver = new OfflineObserver(this);
}

View File

@ -11,7 +11,9 @@
#include "prlog.h"
#include "mozilla/net/NeckoChild.h"
#ifdef PR_LOGGING
extern PRLogModuleInfo* webSocketLog;
#endif
#undef LOG
#define LOG(args) PR_LOG(webSocketLog, PR_LOG_DEBUG, args)

View File

@ -25,8 +25,10 @@ WyciwygChannelParent::WyciwygChannelParent()
: mIPCClosed(false)
, mReceivedAppData(false)
{
#if defined(PR_LOGGING)
if (!gWyciwygLog)
gWyciwygLog = PR_NewLogModule("nsWyciwygChannel");
#endif
}
WyciwygChannelParent::~WyciwygChannelParent()

View File

@ -5,5 +5,7 @@
#include "nsWyciwyg.h"
#include "nscore.h"
#if defined(PR_LOGGING)
PRLogModuleInfo *gWyciwygLog = nullptr;
#endif

View File

@ -12,6 +12,7 @@
#include "prlog.h"
#if defined(PR_LOGGING)
//
// Log module for HTTP Protocol logging...
//
@ -24,6 +25,7 @@
// the file wyciwyg.log
//
extern PRLogModuleInfo *gWyciwygLog;
#endif
// http logging
#define LOG1(args) PR_LOG(gWyciwygLog, 1, args)

View File

@ -23,8 +23,10 @@ using namespace mozilla::net;
nsWyciwygProtocolHandler::nsWyciwygProtocolHandler()
{
#if defined(PR_LOGGING)
if (!gWyciwygLog)
gWyciwygLog = PR_NewLogModule("nsWyciwygChannel");
#endif
LOG(("Creating nsWyciwygProtocolHandler [this=%p].\n", this));
}

View File

@ -50,6 +50,7 @@
#include "DataChannel.h"
#include "DataChannelProtocol.h"
#ifdef PR_LOGGING
PRLogModuleInfo*
GetDataChannelLog()
{
@ -67,6 +68,7 @@ GetSCTPLog()
sLog = PR_NewLogModule("SCTP");
return sLog;
}
#endif
// Let us turn on and off important assertions in non-debug builds
#ifdef DEBUG
@ -172,6 +174,7 @@ receive_cb(struct socket* sock, union sctp_sockstore addr,
return connection->ReceiveCallback(sock, data, datalen, rcv, flags);
}
#ifdef PR_LOGGING
static void
debug_printf(const char *format, ...)
{
@ -190,6 +193,7 @@ debug_printf(const char *format, ...)
va_end(ap);
}
}
#endif
DataChannelConnection::DataChannelConnection(DataConnectionListener *listener) :
mLock("netwerk::sctp::DataChannelConnection")
@ -321,7 +325,11 @@ DataChannelConnection::Init(unsigned short aPort, uint16_t aNumStreams, bool aUs
#ifdef MOZ_PEERCONNECTION
usrsctp_init(0,
DataChannelConnection::SctpDtlsOutput,
#ifdef PR_LOGGING
debug_printf
#else
nullptr
#endif
);
#else
NS_ASSERTION(!aUsingDtls, "Trying to use SCTP/DTLS without mtransport");
@ -330,15 +338,20 @@ DataChannelConnection::Init(unsigned short aPort, uint16_t aNumStreams, bool aUs
LOG(("sctp_init(%u)", aPort));
usrsctp_init(aPort,
nullptr,
#ifdef PR_LOGGING
debug_printf
#else
nullptr
#endif
);
}
#ifdef PR_LOGGING
// Set logging to SCTP:PR_LOG_DEBUG to get SCTP debugs
if (PR_LOG_TEST(GetSCTPLog(), PR_LOG_ALWAYS)) {
usrsctp_sysctl_set_sctp_debug_on(SCTP_DEBUG_ALL);
}
#endif
usrsctp_sysctl_set_sctp_blackhole(2);
// ECN is currently not supported by the Firefox code
usrsctp_sysctl_set_sctp_ecn_enable(0);
@ -653,6 +666,7 @@ void
DataChannelConnection::SctpDtlsInput(TransportFlow *flow,
const unsigned char *data, size_t len)
{
#ifdef PR_LOGGING
if (PR_LOG_TEST(GetSCTPLog(), PR_LOG_DEBUG)) {
char *buf;
@ -661,6 +675,7 @@ DataChannelConnection::SctpDtlsInput(TransportFlow *flow,
usrsctp_freedumpbuffer(buf);
}
}
#endif
// Pass the data to SCTP
usrsctp_conninput(static_cast<void *>(this), data, len, 0);
}
@ -683,6 +698,7 @@ DataChannelConnection::SctpDtlsOutput(void *addr, void *buffer, size_t length,
DataChannelConnection *peer = static_cast<DataChannelConnection *>(addr);
int res;
#ifdef PR_LOGGING
if (PR_LOG_TEST(GetSCTPLog(), PR_LOG_DEBUG)) {
char *buf;
@ -691,6 +707,7 @@ DataChannelConnection::SctpDtlsOutput(void *addr, void *buffer, size_t length,
usrsctp_freedumpbuffer(buf);
}
}
#endif
// We're async proxying even if on the STSThread because this is called
// with internal SCTP locks held in some cases (such as in usrsctp_connect()).
// SCTP has an option for Apple, on IP connections only, to release at least

View File

@ -10,8 +10,10 @@
#include "base/basictypes.h"
#include "prlog.h"
#ifdef PR_LOGGING
extern PRLogModuleInfo* GetDataChannelLog();
extern PRLogModuleInfo* GetSCTPLog();
#endif
#undef LOG
#define LOG(args) PR_LOG(GetDataChannelLog(), PR_LOG_DEBUG, args)

View File

@ -28,10 +28,16 @@ static PRIOMethods nsSOCKSIOLayerMethods;
static bool firstTime = true;
static bool ipv6Supported = true;
#if defined(PR_LOGGING)
static PRLogModuleInfo *gSOCKSLog;
#define LOGDEBUG(args) PR_LOG(gSOCKSLog, PR_LOG_DEBUG, args)
#define LOGERROR(args) PR_LOG(gSOCKSLog, PR_LOG_ERROR , args)
#else
#define LOGDEBUG(args)
#define LOGERROR(args)
#endif
class nsSOCKSSocketInfo : public nsISOCKSSocketInfo
, public nsIDNSListener
{
@ -423,13 +429,12 @@ nsSOCKSSocketInfo::ConnectToProxy(PRFileDesc *fd)
return PR_FAILURE;
}
if (PR_LOG_TEST(gSOCKSLog, PR_LOG_DEBUG)) {
char buf[kIPv6CStrBufSize];
NetAddrToString(&mInternalProxyAddr, buf, sizeof(buf));
LOGDEBUG(("socks: trying proxy server, %s:%hu",
buf, ntohs(mInternalProxyAddr.inet.port)));
}
#if defined(PR_LOGGING)
char buf[kIPv6CStrBufSize];
NetAddrToString(&mInternalProxyAddr, buf, sizeof(buf));
LOGDEBUG(("socks: trying proxy server, %s:%hu",
buf, ntohs(mInternalProxyAddr.inet.port)));
#endif
NetAddr proxy = mInternalProxyAddr;
FixupAddressFamily(fd, &proxy);
PRNetAddr prProxy;
@ -1306,7 +1311,10 @@ nsSOCKSIOLayerAddToSocket(int32_t family,
firstTime = false;
#if defined(PR_LOGGING)
gSOCKSLog = PR_NewLogModule("SOCKS");
#endif
}
LOGDEBUG(("Entering nsSOCKSIOLayerAddToSocket()."));

View File

@ -19,6 +19,7 @@
#include "ParseFTPList.h"
#include <algorithm>
#if defined(PR_LOGGING)
//
// Log module for FTP dir listing stream converter logging...
//
@ -32,6 +33,7 @@
//
PRLogModuleInfo* gFTPDirListConvLog = nullptr;
#endif /* PR_LOGGING */
// nsISupports implementation
NS_IMPL_ISUPPORTS(nsFTPDirListingConv,
@ -191,6 +193,7 @@ nsFTPDirListingConv::~nsFTPDirListingConv() {
nsresult
nsFTPDirListingConv::Init() {
#if defined(PR_LOGGING)
//
// Initialize the global PRLogModule for FTP Protocol logging
// if necessary...
@ -198,6 +201,7 @@ nsFTPDirListingConv::Init() {
if (nullptr == gFTPDirListConvLog) {
gFTPDirListConvLog = PR_NewLogModule("nsFTPDirListingConv");
}
#endif /* PR_LOGGING */
return NS_OK;
}

View File

@ -38,8 +38,12 @@
using namespace mozilla;
#if defined(PR_LOGGING)
static PRLogModuleInfo *gNotifyAddrLog = nullptr;
#define LOG(args) PR_LOG(gNotifyAddrLog, PR_LOG_DEBUG, args)
#else
#define LOG(args)
#endif
#define NETWORK_NOTIFY_CHANGED_PREF "network.notify.changed"
@ -299,8 +303,10 @@ class NuwaMarkLinkMonitorThreadRunner : public nsRunnable
nsresult
nsNotifyAddrListener::Init(void)
{
#if defined(PR_LOGGING)
if (!gNotifyAddrLog)
gNotifyAddrLog = PR_NewLogModule("nsNotifyAddr");
#endif
nsCOMPtr<nsIObserverService> observerService =
mozilla::services::GetObserverService();

View File

@ -34,8 +34,12 @@
using namespace mozilla;
#if defined(PR_LOGGING)
static PRLogModuleInfo *gNotifyAddrLog = nullptr;
#define LOG(args) PR_LOG(gNotifyAddrLog, PR_LOG_DEBUG, args)
#else
#define LOG(args)
#endif
static HMODULE sNetshell;
static decltype(NcFreeNetconProperties)* sNcFreeNetconProperties;
@ -215,8 +219,10 @@ nsNotifyAddrListener::Observe(nsISupports *subject,
nsresult
nsNotifyAddrListener::Init(void)
{
#if defined(PR_LOGGING)
if (!gNotifyAddrLog)
gNotifyAddrLog = PR_NewLogModule("nsNotifyAddr");
#endif
nsCOMPtr<nsIObserverService> observerService =
mozilla::services::GetObserverService();

View File

@ -19,10 +19,12 @@
////////////////////////////////////////////////////////////////////////////////
#if defined(PR_LOGGING)
//
// set NSPR_LOG_MODULES=Test:5
//
static PRLogModuleInfo *gTestLog = nullptr;
#endif
#define LOG(args) PR_LOG(gTestLog, PR_LOG_DEBUG, args)
////////////////////////////////////////////////////////////////////////////////
@ -102,15 +104,19 @@ main(int argc, char* argv[])
nsCOMPtr<nsIServiceManager> servMan;
NS_InitXPCOM2(getter_AddRefs(servMan), nullptr, nullptr);
#if defined(PR_LOGGING)
gTestLog = PR_NewLogModule("Test");
#endif
nsCOMPtr<nsIFile> file;
rv = NS_NewNativeLocalFile(nsDependentCString(fileName), false, getter_AddRefs(file));
if (NS_FAILED(rv)) return -1;
rv = RunBlockingTest(nsDependentCString(hostName), port, file);
#if defined(PR_LOGGING)
if (NS_FAILED(rv))
LOG(("RunBlockingTest failed [rv=%x]\n", rv));
#endif
// give background threads a chance to finish whatever work they may
// be doing.

View File

@ -11,10 +11,12 @@
#include "nsNetCID.h"
#include "prlog.h"
#if defined(PR_LOGGING)
//
// 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 {
@ -57,7 +59,9 @@ int main(int argc, char **argv)
nsresult rv;
#if defined(PR_LOGGING)
gTestLog = PR_NewLogModule("Test");
#endif
rv = NS_InitXPCOM2(nullptr, nullptr, nullptr);
if (NS_FAILED(rv))

View File

@ -26,8 +26,12 @@
#include "nsCOMPtr.h"
#include "nsIByteArrayInputStream.h"
#if defined(PR_LOGGING)
static PRLogModuleInfo *gTestSocketIOLog;
#define LOG(args) PR_LOG(gTestSocketIOLog, PR_LOG_DEBUG, args)
#else
#define LOG(args)
#endif
static NS_DEFINE_CID(kSocketTransportServiceCID, NS_SOCKETTRANSPORTSERVICE_CID);
static NS_DEFINE_CID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID);
@ -229,7 +233,9 @@ main(int argc, char* argv[])
signal(SIGSEGV, sighandler);
#if defined(PR_LOGGING)
gTestSocketIOLog = PR_NewLogModule("TestSocketIO");
#endif
if (argc < 3)
usage(argv);

View File

@ -61,10 +61,12 @@ using namespace mozilla;
namespace TestProtocols {
#if defined(PR_LOGGING)
//
// set NSPR_LOG_MODULES=Test:5
//
static PRLogModuleInfo *gTestLog = nullptr;
#endif
#define LOG(args) PR_LOG(gTestLog, PR_LOG_DEBUG, args)
static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
@ -833,7 +835,9 @@ main(int argc, char* argv[])
return -1;
}
#if defined(PR_LOGGING)
gTestLog = PR_NewLogModule("Test");
#endif
/*
The following code only deals with XPCOM registration stuff. and setting

View File

@ -13,10 +13,12 @@
#include "nsCOMPtr.h"
#include "prlog.h"
#if defined(PR_LOGGING)
//
// set NSPR_LOG_MODULES=Test:5
//
static PRLogModuleInfo *gTestLog = nullptr;
#endif
#define LOG(args) PR_LOG(gTestLog, PR_LOG_DEBUG, args)
class MySocketListener : public nsIServerSocketListener
@ -117,7 +119,9 @@ main(int argc, char* argv[])
return -1;
}
#if defined(PR_LOGGING)
gTestLog = PR_NewLogModule("Test");
#endif
/*
* The following code only deals with XPCOM registration stuff. and setting

View File

@ -25,8 +25,12 @@
#include "nsCOMPtr.h"
#include "nsIByteArrayInputStream.h"
#if defined(PR_LOGGING)
static PRLogModuleInfo *gTestSocketIOLog;
#define LOG(args) PR_LOG(gTestSocketIOLog, PR_LOG_DEBUG, args)
#else
#define LOG(args)
#endif
static NS_DEFINE_CID(kSocketTransportServiceCID, NS_SOCKETTRANSPORTSERVICE_CID);
static NS_DEFINE_CID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID);
@ -223,7 +227,9 @@ main(int argc, char* argv[])
signal(SIGSEGV, sighandler);
#if defined(PR_LOGGING)
gTestSocketIOLog = PR_NewLogModule("TestSocketIO");
#endif
if (argc < 3)
usage(argv);

View File

@ -27,10 +27,12 @@
////////////////////////////////////////////////////////////////////////////////
#if defined(PR_LOGGING)
//
// set NSPR_LOG_MODULES=Test:5
//
static PRLogModuleInfo *gTestLog = nullptr;
#endif
#define LOG(args) PR_LOG(gTestLog, PR_LOG_DEBUG, args)
////////////////////////////////////////////////////////////////////////////////
@ -221,7 +223,9 @@ main(int argc, char* argv[])
if (registrar)
registrar->AutoRegister(nullptr);
#if defined(PR_LOGGING)
gTestLog = PR_NewLogModule("Test");
#endif
// Make sure the DNS service is initialized on the main thread
nsCOMPtr<nsIDNSService> dns =

View File

@ -25,11 +25,15 @@
////////////////////////////////////////////////////////////////////////////////
#if defined(PR_LOGGING)
//
// set NSPR_LOG_MODULES=Test:5
//
static PRLogModuleInfo *gTestLog = nullptr;
#define LOG(args) PR_LOG(gTestLog, PR_LOG_DEBUG, args)
#else
#define LOG(args)
#endif
////////////////////////////////////////////////////////////////////////////////
@ -180,7 +184,9 @@ main(int argc, char* argv[])
if (registrar)
registrar->AutoRegister(nullptr);
#if defined(PR_LOGGING)
gTestLog = PR_NewLogModule("Test");
#endif
nsCOMPtr<nsIFile> file;
rv = NS_NewNativeLocalFile(nsDependentCString(fileName), false, getter_AddRefs(file));

View File

@ -6,10 +6,12 @@
#include "mozilla/Attributes.h"
#include "nsIScriptSecurityManager.h"
#if defined(PR_LOGGING)
//
// set NSPR_LOG_MODULES=Test:5
//
static PRLogModuleInfo *gTestLog = nullptr;
#endif
#define LOG(args) PR_LOG(gTestLog, PR_LOG_DEBUG, args)
class MyStreamLoaderObserver final : public nsIStreamLoaderObserver
@ -50,7 +52,9 @@ int main(int argc, char **argv)
return -1;
}
#if defined(PR_LOGGING)
gTestLog = PR_NewLogModule("Test");
#endif
nsresult rv = NS_InitXPCOM2(nullptr, nullptr, nullptr);
if (NS_FAILED(rv))

View File

@ -27,11 +27,15 @@
////////////////////////////////////////////////////////////////////////////////
#if defined(PR_LOGGING)
//
// set NSPR_LOG_MODULES=Test:5
//
static PRLogModuleInfo *gTestLog = nullptr;
#define LOG(args) PR_LOG(gTestLog, PR_LOG_DEBUG, args)
#else
#define LOG(args)
#endif
////////////////////////////////////////////////////////////////////////////////
@ -151,7 +155,9 @@ main(int argc, char* argv[])
if (registrar)
registrar->AutoRegister(nullptr);
#if defined(PR_LOGGING)
gTestLog = PR_NewLogModule("Test");
#endif
nsCOMPtr<nsIFile> file;
rv = NS_NewNativeLocalFile(nsDependentCString(fileName), false, getter_AddRefs(file));

View File

@ -25,10 +25,12 @@
////////////////////////////////////////////////////////////////////////////////
#if defined(PR_LOGGING)
//
// set NSPR_LOG_MODULES=Test:5
//
static PRLogModuleInfo *gTestLog = nullptr;
#endif
#define LOG(args) PR_LOG(gTestLog, PR_LOG_DEBUG, args)
////////////////////////////////////////////////////////////////////////////////
@ -278,7 +280,9 @@ main(int argc, char* argv[])
if (registrar)
registrar->AutoRegister(nullptr);
#if defined(PR_LOGGING)
gTestLog = PR_NewLogModule("Test");
#endif
nsCOMPtr<nsIFile> srcFile;
rv = NS_NewNativeLocalFile(nsDependentCString(fileName), false, getter_AddRefs(srcFile));

View File

@ -16,10 +16,12 @@
#include "nsIUploadChannel.h"
#include "prlog.h"
#if defined(PR_LOGGING)
//
// set NSPR_LOG_MODULES=Test:5
//
static PRLogModuleInfo *gTestLog = nullptr;
#endif
#define LOG(args) PR_LOG(gTestLog, PR_LOG_DEBUG, args)
//-----------------------------------------------------------------------------
@ -108,7 +110,9 @@ main(int argc, char* argv[])
char* uriSpec = argv[1];
char* fileName = argv[2];
#if defined(PR_LOGGING)
gTestLog = PR_NewLogModule("Test");
#endif
{
nsCOMPtr<nsIServiceManager> servMan;

View File

@ -7,7 +7,9 @@
#include "nsMemory.h"
#include "prlog.h"
#if defined(PR_LOGGING)
extern PRLogModuleInfo *gWifiMonitorLog;
#endif
#define LOG(args) PR_LOG(gWifiMonitorLog, PR_LOG_DEBUG, args)

View File

@ -20,7 +20,9 @@
using namespace mozilla;
#if defined(PR_LOGGING)
PRLogModuleInfo *gWifiMonitorLog;
#endif
NS_IMPL_ISUPPORTS(nsWifiMonitor,
nsIRunnable,
@ -32,7 +34,9 @@ nsWifiMonitor::nsWifiMonitor()
, mThreadComplete(false)
, mReentrantMonitor("nsWifiMonitor.mReentrantMonitor")
{
#if defined(PR_LOGGING)
gWifiMonitorLog = PR_NewLogModule("WifiMonitor");
#endif
nsCOMPtr<nsIObserverService> obsSvc = mozilla::services::GetObserverService();
if (obsSvc)

View File

@ -26,7 +26,9 @@
#include "win_wifiScanner.h"
#endif
#if defined(PR_LOGGING)
extern PRLogModuleInfo *gWifiMonitorLog;
#endif
#define LOG(args) PR_LOG(gWifiMonitorLog, PR_LOG_DEBUG, args)
class nsWifiAccessPoint;

View File

@ -22,7 +22,9 @@
using namespace mozilla;
#if defined(PR_LOGGING)
PRLogModuleInfo *gWifiMonitorLog;
#endif
NS_IMPL_ISUPPORTS(nsWifiMonitor,
nsIWifiMonitor,
@ -31,7 +33,9 @@ NS_IMPL_ISUPPORTS(nsWifiMonitor,
nsWifiMonitor::nsWifiMonitor()
{
#if defined(PR_LOGGING)
gWifiMonitorLog = PR_NewLogModule("WifiMonitor");
#endif
nsCOMPtr<nsIObserverService> obsSvc = mozilla::services::GetObserverService();
if (obsSvc) {