Bug 1162309 - Part 1: Remove instances of #ifdef PR_LOGGING in uriloader. r=froydnj

PR_LOGGING is now always defined, we can remove #ifdefs checking for it.
This commit is contained in:
Eric Rahm 2015-05-07 10:14:55 -07:00
Родитель 4b7cf76438
Коммит d94083f05b
11 изменённых файлов: 1 добавлений и 60 удалений

Просмотреть файл

@ -37,7 +37,6 @@
static NS_DEFINE_CID(kThisImplCID, NS_THIS_DOCLOADER_IMPL_CID);
#if defined(PR_LOGGING)
//
// Log module for nsIDocumentLoader logging...
//
@ -50,7 +49,6 @@ static NS_DEFINE_CID(kThisImplCID, NS_THIS_DOCLOADER_IMPL_CID);
// the file nspr.log
//
PRLogModuleInfo* gDocLoaderLog = nullptr;
#endif /* PR_LOGGING */
#if defined(DEBUG)
@ -105,11 +103,9 @@ nsDocLoader::nsDocLoader()
mDontFlushLayout(false),
mIsFlushingLayout(false)
{
#if defined(PR_LOGGING)
if (nullptr == gDocLoaderLog) {
gDocLoaderLog = PR_NewLogModule("DocLoader");
}
#endif /* PR_LOGGING */
static const PLDHashTableOps hash_table_ops =
{
@ -402,7 +398,6 @@ nsDocLoader::OnStartRequest(nsIRequest *request, nsISupports *aCtxt)
{
// called each time a request is added to the group.
#ifdef PR_LOGGING
if (PR_LOG_TEST(gDocLoaderLog, PR_LOG_DEBUG)) {
nsAutoCString name;
request->GetName(name);
@ -417,7 +412,7 @@ nsDocLoader::OnStartRequest(nsIRequest *request, nsISupports *aCtxt)
(mIsLoadingDocument ? "true" : "false"),
count));
}
#endif /* PR_LOGGING */
bool bJustStartedLoading = false;
nsLoadFlags loadFlags = 0;
@ -483,7 +478,6 @@ nsDocLoader::OnStopRequest(nsIRequest *aRequest,
{
nsresult rv = NS_OK;
#ifdef PR_LOGGING
if (PR_LOG_TEST(gDocLoaderLog, PR_LOG_DEBUG)) {
nsAutoCString name;
aRequest->GetName(name);
@ -498,7 +492,6 @@ nsDocLoader::OnStopRequest(nsIRequest *aRequest,
aStatus, (mIsLoadingDocument ? "true" : "false"),
count));
}
#endif
bool bFireTransferring = false;

Просмотреть файл

@ -51,9 +51,7 @@
#include "mozilla/Attributes.h"
#include "mozilla/Preferences.h"
#ifdef PR_LOGGING
PRLogModuleInfo* nsURILoader::mLog = nullptr;
#endif
#define LOG(args) PR_LOG(nsURILoader::mLog, PR_LOG_DEBUG, args)
#define LOG_ERROR(args) PR_LOG(nsURILoader::mLog, PR_LOG_ERROR, args)
@ -475,11 +473,9 @@ nsresult nsDocumentOpenInfo::DispatchContent(nsIRequest *request, nsISupports *
LOG((" Content handler failed. Aborting load"));
request->Cancel(rv);
}
#ifdef PR_LOGGING
else {
LOG((" Content handler taking over load"));
}
#endif
return rv;
}
@ -759,11 +755,9 @@ nsDocumentOpenInfo::TryContentListener(nsIURIContentListener* aListener,
nsURILoader::nsURILoader()
{
#ifdef PR_LOGGING
if (!mLog) {
mLog = PR_NewLogModule("URILoader");
}
#endif
}
nsURILoader::~nsURILoader()
@ -807,7 +801,6 @@ NS_IMETHODIMP nsURILoader::OpenURI(nsIChannel *channel,
{
NS_ENSURE_ARG_POINTER(channel);
#ifdef PR_LOGGING
if (LOG_ENABLED()) {
nsCOMPtr<nsIURI> uri;
channel->GetURI(getter_AddRefs(uri));
@ -815,7 +808,6 @@ NS_IMETHODIMP nsURILoader::OpenURI(nsIChannel *channel,
uri->GetAsciiSpec(spec);
LOG(("nsURILoader::OpenURI for %s", spec.get()));
}
#endif
nsCOMPtr<nsIStreamListener> loader;
nsresult rv = OpenChannel(channel,
@ -854,7 +846,6 @@ nsresult nsURILoader::OpenChannel(nsIChannel* channel,
NS_ASSERTION(channel, "Trying to open a null channel!");
NS_ASSERTION(aWindowContext, "Window context must not be null");
#ifdef PR_LOGGING
if (LOG_ENABLED()) {
nsCOMPtr<nsIURI> uri;
channel->GetURI(getter_AddRefs(uri));
@ -862,7 +853,6 @@ nsresult nsURILoader::OpenChannel(nsIChannel* channel,
uri->GetAsciiSpec(spec);
LOG(("nsURILoader::OpenChannel for %s", spec.get()));
}
#endif
// Let the window context's uriListener know that the open is starting. This
// gives that window a chance to abort the load process.

Просмотреть файл

@ -48,12 +48,10 @@ protected:
*/
nsCOMArray<nsIWeakReference> m_listeners;
#ifdef PR_LOGGING
/**
* NSPR logging. The module is called "URILoader"
*/
static PRLogModuleInfo* mLog;
#endif
friend class nsDocumentOpenInfo;
};

Просмотреть файл

@ -122,9 +122,7 @@ enum {
, NS_FOLDER_VALUE_CUSTOM = 2
};
#ifdef PR_LOGGING
PRLogModuleInfo* nsExternalHelperAppService::mLog = nullptr;
#endif
// Using level 3 here because the OSHelperAppServices use a log level
// of PR_LOG_DEBUG (4), and we want less detailed output here
@ -591,13 +589,11 @@ nsresult nsExternalHelperAppService::Init()
if (!obs)
return NS_ERROR_FAILURE;
#ifdef PR_LOGGING
if (!mLog) {
mLog = PR_NewLogModule("HelperAppService");
if (!mLog)
return NS_ERROR_OUT_OF_MEMORY;
}
#endif
nsresult rv = obs->AddObserver(this, "profile-before-change", true);
NS_ENSURE_SUCCESS(rv, rv);
@ -1612,12 +1608,10 @@ NS_IMETHODIMP nsExternalAppHandler::OnStartRequest(nsIRequest *request, nsISuppo
nsresult transferError = rv;
rv = CreateFailedTransfer(aChannel && NS_UsePrivateBrowsing(aChannel));
#ifdef PR_LOGGING
if (NS_FAILED(rv)) {
LOG(("Failed to create transfer to report failure."
"Will fallback to prompter!"));
}
#endif
mCanceled = true;
request->Cancel(transferError);
@ -2637,7 +2631,6 @@ NS_IMETHODIMP nsExternalHelperAppService::GetFromTypeAndExtension(const nsACStri
(*_retval)->SetPrimaryExtension(aFileExt);
}
#ifdef PR_LOGGING
if (LOG_ENABLED()) {
nsAutoCString type;
(*_retval)->GetMIMEType(type);
@ -2646,7 +2639,6 @@ NS_IMETHODIMP nsExternalHelperAppService::GetFromTypeAndExtension(const nsACStri
(*_retval)->GetPrimaryExtension(ext);
LOG(("MIME Info Summary: Type '%s', Primary Ext '%s'\n", type.get(), ext.get()));
}
#endif
return NS_OK;
}

Просмотреть файл

@ -141,7 +141,6 @@ protected:
bool GetTypeFromExtras(const nsACString& aExtension,
nsACString& aMIMEType);
#ifdef PR_LOGGING
/**
* NSPR Logging Module. Usage: set NSPR_LOG_MODULES=HelperAppService:level,
* where level should be 2 for errors, 3 for debug messages from the cross-
@ -149,7 +148,6 @@ protected:
*/
static PRLogModuleInfo* mLog;
#endif
// friend, so that it can access the nspr log module.
friend class nsExternalAppHandler;

Просмотреть файл

@ -36,7 +36,6 @@ using namespace mozilla::net;
using mozilla::dom::TabChild;
using mozilla::dom::ContentChild;
#if defined(PR_LOGGING)
//
// To enable logging (see prlog.h for full details):
//
@ -47,7 +46,6 @@ using mozilla::dom::ContentChild;
// the file offlineupdate.log
//
extern PRLogModuleInfo *gOfflineCacheUpdateLog;
#endif
#undef LOG
#define LOG(args) PR_LOG(gOfflineCacheUpdateLog, 4, args)
@ -153,7 +151,6 @@ OfflineCacheUpdateChild::AssociateDocument(nsIDOMDocument *aDocument,
NS_ENSURE_SUCCESS(rv, rv);
if (!existingCache) {
#if defined(PR_LOGGING)
if (LOG_ENABLED()) {
nsAutoCString clientID;
if (aApplicationCache) {
@ -162,7 +159,6 @@ OfflineCacheUpdateChild::AssociateDocument(nsIDOMDocument *aDocument,
LOG(("Update %p: associating app cache %s to document %p",
this, clientID.get(), aDocument));
}
#endif
rv = container->SetApplicationCache(aApplicationCache);
NS_ENSURE_SUCCESS(rv, rv);

Просмотреть файл

@ -14,7 +14,6 @@
#include "nsIDocument.h"
#include "prlog.h"
#if defined(PR_LOGGING)
//
// To enable logging (see prlog.h for full details):
//
@ -25,7 +24,6 @@
// the file offlineupdate.log
//
extern PRLogModuleInfo *gOfflineCacheUpdateLog;
#endif
#undef LOG
#define LOG(args) PR_LOG(gOfflineCacheUpdateLog, 4, args)
@ -203,7 +201,6 @@ OfflineCacheUpdateGlue::ApplicationCacheAvailable(nsIApplicationCache *aApplicat
NS_ENSURE_SUCCESS(rv, rv);
if (!existingCache) {
#if defined(PR_LOGGING)
if (LOG_ENABLED()) {
nsAutoCString clientID;
if (aApplicationCache) {
@ -212,7 +209,6 @@ OfflineCacheUpdateGlue::ApplicationCacheAvailable(nsIApplicationCache *aApplicat
LOG(("Update %p: associating app cache %s to document %p",
this, clientID.get(), mDocument.get()));
}
#endif
rv = container->SetApplicationCache(aApplicationCache);
NS_ENSURE_SUCCESS(rv, rv);

Просмотреть файл

@ -17,7 +17,6 @@
using namespace mozilla::ipc;
using mozilla::dom::TabParent;
#if defined(PR_LOGGING)
//
// To enable logging (see prlog.h for full details):
//
@ -28,7 +27,6 @@ using mozilla::dom::TabParent;
// the file offlineupdate.log
//
extern PRLogModuleInfo *gOfflineCacheUpdateLog;
#endif
#undef LOG
#define LOG(args) PR_LOG(gOfflineCacheUpdateLog, 4, args)

Просмотреть файл

@ -51,7 +51,6 @@ static const uint32_t kParallelLoadLimit = 15;
// Quota for offline apps when preloading
static const int32_t kCustomProfileQuota = 512000;
#if defined(PR_LOGGING)
//
// To enable logging (see prlog.h for full details):
//
@ -62,7 +61,6 @@ static const int32_t kCustomProfileQuota = 512000;
// the file offlineupdate.log
//
extern PRLogModuleInfo *gOfflineCacheUpdateLog;
#endif
#undef LOG
#define LOG(args) PR_LOG(gOfflineCacheUpdateLog, 4, args)
@ -343,13 +341,11 @@ nsOfflineCacheUpdateItem::~nsOfflineCacheUpdateItem()
nsresult
nsOfflineCacheUpdateItem::OpenChannel(nsOfflineCacheUpdate *aUpdate)
{
#if defined(PR_LOGGING)
if (LOG_ENABLED()) {
nsAutoCString spec;
mURI->GetSpec(spec);
LOG(("%p: Opening channel for %s", this, spec.get()));
}
#endif
if (mUpdate) {
// Holding a reference to the update means this item is already
@ -466,14 +462,12 @@ nsOfflineCacheUpdateItem::OnStopRequest(nsIRequest *aRequest,
nsISupports *aContext,
nsresult aStatus)
{
#if defined(PR_LOGGING)
if (LOG_ENABLED()) {
nsAutoCString spec;
mURI->GetSpec(spec);
LOG(("%p: Done fetching offline item %s [status=%x]\n",
this, spec.get(), aStatus));
}
#endif
if (mBytesRead == 0 && aStatus == NS_OK) {
// we didn't need to read (because LOAD_ONLY_IF_MODIFIED was
@ -1879,13 +1873,11 @@ nsOfflineCacheUpdate::ProcessNextURI()
return NS_OK;
}
#if defined(PR_LOGGING)
if (LOG_ENABLED()) {
nsAutoCString spec;
runItem->mURI->GetSpec(spec);
LOG(("%p: Opening channel for %s", this, spec.get()));
}
#endif
++mItemsInProgress;
NotifyState(nsIOfflineCacheUpdateObserver::STATE_ITEMSTARTED);

Просмотреть файл

@ -70,7 +70,6 @@ typedef mozilla::docshell::OfflineCacheUpdateParent OfflineCacheUpdateParent;
typedef mozilla::docshell::OfflineCacheUpdateChild OfflineCacheUpdateChild;
typedef mozilla::docshell::OfflineCacheUpdateGlue OfflineCacheUpdateGlue;
#if defined(PR_LOGGING)
//
// To enable logging (see prlog.h for full details):
//
@ -81,7 +80,6 @@ typedef mozilla::docshell::OfflineCacheUpdateGlue OfflineCacheUpdateGlue;
// the file offlineupdate.log
//
PRLogModuleInfo *gOfflineCacheUpdateLog;
#endif
#undef LOG
#define LOG(args) PR_LOG(gOfflineCacheUpdateLog, 4, args)
@ -295,10 +293,8 @@ nsOfflineCacheUpdateService::~nsOfflineCacheUpdateService()
nsresult
nsOfflineCacheUpdateService::Init()
{
#if defined(PR_LOGGING)
if (!gOfflineCacheUpdateLog)
gOfflineCacheUpdateLog = PR_NewLogModule("nsOfflineCacheUpdate");
#endif
// Observe xpcom-shutdown event
nsCOMPtr<nsIObserverService> observerService =

Просмотреть файл

@ -32,7 +32,6 @@
using namespace mozilla;
#if defined(PR_LOGGING)
//
// To enable logging (see prlog.h for full details):
//
@ -43,7 +42,6 @@ using namespace mozilla;
// the file http.log
//
static PRLogModuleInfo *gPrefetchLog;
#endif
#undef LOG
#define LOG(args) PR_LOG(gPrefetchLog, 4, args)
@ -410,10 +408,8 @@ nsPrefetchService::~nsPrefetchService()
nsresult
nsPrefetchService::Init()
{
#if defined(PR_LOGGING)
if (!gPrefetchLog)
gPrefetchLog = PR_NewLogModule("nsPrefetch");
#endif
nsresult rv;
@ -449,13 +445,11 @@ nsPrefetchService::ProcessNextURI()
if (NS_FAILED(rv)) break;
#if defined(PR_LOGGING)
if (LOG_ENABLED()) {
nsAutoCString spec;
mCurrentNode->mURI->GetSpec(spec);
LOG(("ProcessNextURI [%s]\n", spec.get()));
}
#endif
//
// if opening the channel fails, then just skip to the next uri
@ -636,13 +630,11 @@ nsPrefetchService::Prefetch(nsIURI *aURI,
NS_ENSURE_ARG_POINTER(aURI);
NS_ENSURE_ARG_POINTER(aReferrerURI);
#if defined(PR_LOGGING)
if (LOG_ENABLED()) {
nsAutoCString spec;
aURI->GetSpec(spec);
LOG(("PrefetchURI [%s]\n", spec.get()));
}
#endif
if (mDisabled) {
LOG(("rejected: prefetch service is disabled\n"));