Bug 1219470 - Replace PRLogModuleInfo with LazyLogModule. r=roc

This commit is contained in:
sajitk 2015-11-05 23:35:03 +01:00
Родитель cf35fa9aa2
Коммит 85550613ed
20 изменённых файлов: 65 добавлений и 184 удалений

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

@ -1,23 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "AccessibleCaretLogger.h"
namespace mozilla {
PRLogModuleInfo*
GetAccessibleCaretLog()
{
static PRLogModuleInfo* log = nullptr;
if (!log) {
log = PR_NewLogModule("AccessibleCaret");
}
return log;
}
} // namespace mozilla

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

@ -11,15 +11,15 @@
namespace mozilla {
PRLogModuleInfo* GetAccessibleCaretLog();
static LazyLogModule sAccessibleCaretLog("AccessibleCaret");
#ifndef AC_LOG_BASE
#define AC_LOG_BASE(...) MOZ_LOG(GetAccessibleCaretLog(), mozilla::LogLevel::Debug, (__VA_ARGS__));
#define AC_LOG_BASE(...) MOZ_LOG(sAccessibleCaretLog, mozilla::LogLevel::Debug, (__VA_ARGS__));
#endif
#ifndef AC_LOGV_BASE
#define AC_LOGV_BASE(...) \
MOZ_LOG(GetAccessibleCaretLog(), LogLevel::Verbose, (__VA_ARGS__));
MOZ_LOG(sAccessibleCaretLog, LogLevel::Verbose, (__VA_ARGS__));
#endif
} // namespace mozilla

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

@ -8,16 +8,6 @@
#include "LayoutLogging.h"
PRLogModuleInfo* GetLayoutLog()
{
static PRLogModuleInfo* log = nullptr;
if (!log) {
log = PR_NewLogModule("layout");
}
return log;
}
namespace mozilla {
namespace detail {
@ -25,13 +15,13 @@ void LayoutLogWarning(const char* aStr, const char* aExpr,
const char* aFile, int32_t aLine)
{
if (aExpr) {
MOZ_LOG(GetLayoutLog(),
MOZ_LOG(sLayoutLog,
mozilla::LogLevel::Warning,
("[%d] WARNING: %s: '%s', file %s, line %d",
base::GetCurrentProcId(),
aStr, aExpr, aFile, aLine));
} else {
MOZ_LOG(GetLayoutLog(),
MOZ_LOG(sLayoutLog,
mozilla::LogLevel::Warning,
("[%d] WARNING: %s: file %s, line %d",
base::GetCurrentProcId(),

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

@ -11,7 +11,7 @@
/**
* Retrieves the log module to use for layout logging.
*/
PRLogModuleInfo* GetLayoutLog();
static mozilla::LazyLogModule sLayoutLog("layout");
/**
* Use the layout log to warn if a given condition is false.
@ -22,7 +22,7 @@ PRLogModuleInfo* GetLayoutLog();
#ifdef DEBUG
#define LAYOUT_WARN_IF_FALSE(_cond, _msg) \
PR_BEGIN_MACRO \
if (MOZ_LOG_TEST(GetLayoutLog(), mozilla::LogLevel::Warning) && \
if (MOZ_LOG_TEST(sLayoutLog, mozilla::LogLevel::Warning) && \
!(_cond)) { \
mozilla::detail::LayoutLogWarning(_msg, #_cond, __FILE__, __LINE__); \
} \
@ -42,7 +42,7 @@ PRLogModuleInfo* GetLayoutLog();
#ifdef DEBUG
#define LAYOUT_WARNING(_msg) \
PR_BEGIN_MACRO \
if (MOZ_LOG_TEST(GetLayoutLog(), mozilla::LogLevel::Warning)) { \
if (MOZ_LOG_TEST(sLayoutLog, mozilla::LogLevel::Warning)) { \
mozilla::detail::LayoutLogWarning(_msg, nullptr, __FILE__, __LINE__); \
} \
PR_END_MACRO

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

@ -40,8 +40,8 @@
using namespace mozilla;
using namespace mozilla::dom;
static PRLogModuleInfo* gSelectionCaretsLog;
static const char* kSelectionCaretsLogModuleName = "SelectionCarets";
static mozilla::LazyLogModule gSelectionCaretsLog(kSelectionCaretsLogModuleName);
// To enable all the SELECTIONCARETS_LOG print statements, set the environment
// variable NSPR_LOG_MODULES=SelectionCarets:5
@ -85,10 +85,6 @@ SelectionCarets::SelectionCarets(nsIPresShell* aPresShell)
{
MOZ_ASSERT(NS_IsMainThread());
if (!gSelectionCaretsLog) {
gSelectionCaretsLog = PR_NewLogModule(kSelectionCaretsLogModuleName);
}
SELECTIONCARETS_LOG("Constructor, PresShell=%p", mPresShell);
static bool addedPref = false;

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

@ -36,8 +36,8 @@
using namespace mozilla;
static PRLogModuleInfo* gTouchCaretLog;
static const char* kTouchCaretLogModuleName = "TouchCaret";
static mozilla::LazyLogModule gTouchCaretLog(kTouchCaretLogModuleName);
// To enable all the TOUCHCARET_LOG print statements, set the environment
// variable NSPR_LOG_MODULES=TouchCaret:5
@ -79,10 +79,6 @@ TouchCaret::TouchCaret(nsIPresShell* aPresShell)
{
MOZ_ASSERT(NS_IsMainThread());
if (!gTouchCaretLog) {
gTouchCaretLog = PR_NewLogModule(kTouchCaretLogModuleName);
}
TOUCHCARET_LOG("Constructor, PresShell=%p", aPresShell);
static bool addedTouchCaretPref = false;

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

@ -110,7 +110,6 @@ EXPORTS.mozilla += [
UNIFIED_SOURCES += [
'AccessibleCaret.cpp',
'AccessibleCaretEventHub.cpp',
'AccessibleCaretLogger.cpp',
'AccessibleCaretManager.cpp',
'ActiveLayerTracker.cpp',
'DisplayItemClip.cpp',

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

@ -136,15 +136,9 @@ using namespace mozilla::dom;
#include "mozilla/Logging.h"
#ifdef NS_PRINTING
static PRLogModuleInfo *
GetPrintingLog()
{
static PRLogModuleInfo *sLog;
if (!sLog)
sLog = PR_NewLogModule("printing");
return sLog;
}
#define PR_PL(_p1) MOZ_LOG(GetPrintingLog(), mozilla::LogLevel::Debug, _p1);
static mozilla::LazyLogModule gPrintingLog("printing");
#define PR_PL(_p1) MOZ_LOG(gPrintingLog, mozilla::LogLevel::Debug, _p1);
#endif // NS_PRINTING
#define PRT_YESNO(_p) ((_p)?"YES":"NO")

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

@ -536,7 +536,7 @@ private:
bool PresShell::sDisableNonTestMouseEvents = false;
PRLogModuleInfo* PresShell::gLog;
mozilla::LazyLogModule PresShell::gLog("PresShell");
#ifdef DEBUG
static void
@ -764,9 +764,7 @@ PresShell::PresShell()
mReflowCountMgr->SetPresShell(this);
#endif
mLoadBegin = TimeStamp::Now();
if (!gLog) {
gLog = PR_NewLogModule("PresShell");
}
mSelectionFlags = nsISelectionDisplay::DISPLAY_TEXT | nsISelectionDisplay::DISPLAY_IMAGES;
mIsThemeSupportDisabled = false;
mIsActive = true;
@ -2465,7 +2463,7 @@ PresShell::BeginLoad(nsIDocument *aDocument)
tp = mPresContext->GetTextPerfMetrics();
}
bool shouldLog = gLog && MOZ_LOG_TEST(gLog, LogLevel::Debug);
bool shouldLog = MOZ_LOG_TEST(gLog, LogLevel::Debug);
if (shouldLog || tp) {
mLoadBegin = TimeStamp::Now();
}
@ -2501,7 +2499,7 @@ PresShell::LoadComplete()
}
// log load
bool shouldLog = gLog && MOZ_LOG_TEST(gLog, LogLevel::Debug);
bool shouldLog = MOZ_LOG_TEST(gLog, LogLevel::Debug);
if (shouldLog || tp) {
TimeDuration loadTime = TimeStamp::Now() - mLoadBegin;
nsIURI* uri = mDocument->GetDocumentURI();

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

@ -335,7 +335,7 @@ public:
virtual void VerifyStyleTree() override;
#endif
static PRLogModuleInfo* gLog;
static mozilla::LazyLogModule gLog;
virtual void DisableNonTestMouseEvents(bool aDisable) override;

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

@ -75,8 +75,8 @@ using namespace mozilla::widget;
using namespace mozilla::ipc;
using namespace mozilla::layout;
static PRLogModuleInfo *gLog = nullptr;
#define LOG(...) MOZ_LOG(gLog, mozilla::LogLevel::Debug, (__VA_ARGS__))
static mozilla::LazyLogModule sRefreshDriverLog("nsRefreshDriver");
#define LOG(...) MOZ_LOG(sRefreshDriverLog, mozilla::LogLevel::Debug, (__VA_ARGS__))
#define DEFAULT_THROTTLED_FRAME_RATE 1
#define DEFAULT_RECOMPUTE_VISIBILITY_INTERVAL_MS 1000
@ -771,9 +771,6 @@ GetFirstFrameDelay(imgIRequest* req)
/* static */ void
nsRefreshDriver::InitializeStatics()
{
if (!gLog) {
gLog = PR_NewLogModule("nsRefreshDriver");
}
}
/* static */ void

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

@ -33,14 +33,7 @@ typedef nsFlexContainerFrame::FlexLine FlexLine;
typedef nsFlexContainerFrame::FlexboxAxisTracker FlexboxAxisTracker;
typedef nsFlexContainerFrame::StrutInfo StrutInfo;
static PRLogModuleInfo*
GetFlexContainerLog()
{
static PRLogModuleInfo *sLog;
if (!sLog)
sLog = PR_NewLogModule("nsFlexContainerFrame");
return sLog;
}
static mozilla::LazyLogModule gFlexContainerLog("nsFlexContainerFrame");
// XXXdholbert Some of this helper-stuff should be separated out into a general
// "main/cross-axis utils" header, shared by grid & flexbox?
@ -2157,7 +2150,7 @@ FlexLine::FreezeOrRestoreEachFlexibleSize(const nscoord aTotalViolation,
void
FlexLine::ResolveFlexibleLengths(nscoord aFlexContainerMainSize)
{
MOZ_LOG(GetFlexContainerLog(), LogLevel::Debug, ("ResolveFlexibleLengths\n"));
MOZ_LOG(gFlexContainerLog, LogLevel::Debug, ("ResolveFlexibleLengths\n"));
// Determine whether we're going to be growing or shrinking items.
const bool isUsingFlexGrow =
@ -2205,7 +2198,7 @@ FlexLine::ResolveFlexibleLengths(nscoord aFlexContainerMainSize)
availableFreeSpace -= item->GetMainSize();
}
MOZ_LOG(GetFlexContainerLog(), LogLevel::Debug,
MOZ_LOG(gFlexContainerLog, LogLevel::Debug,
(" available free space = %d\n", availableFreeSpace));
@ -2317,7 +2310,7 @@ FlexLine::ResolveFlexibleLengths(nscoord aFlexContainerMainSize)
}
}
MOZ_LOG(GetFlexContainerLog(), LogLevel::Debug,
MOZ_LOG(gFlexContainerLog, LogLevel::Debug,
(" Distributing available space:"));
// Since this loop only operates on unfrozen flex items, we can break as
// soon as we have seen all of them.
@ -2365,7 +2358,7 @@ FlexLine::ResolveFlexibleLengths(nscoord aFlexContainerMainSize)
availableFreeSpace -= sizeDelta;
item->SetMainSize(item->GetMainSize() + sizeDelta);
MOZ_LOG(GetFlexContainerLog(), LogLevel::Debug,
MOZ_LOG(gFlexContainerLog, LogLevel::Debug,
(" child %p receives %d, for a total of %d\n",
item, sizeDelta, item->GetMainSize()));
}
@ -2375,7 +2368,7 @@ FlexLine::ResolveFlexibleLengths(nscoord aFlexContainerMainSize)
// Fix min/max violations:
nscoord totalViolation = 0; // keeps track of adjustments for min/max
MOZ_LOG(GetFlexContainerLog(), LogLevel::Debug,
MOZ_LOG(gFlexContainerLog, LogLevel::Debug,
(" Checking for violations:"));
// Since this loop only operates on unfrozen flex items, we can break as
@ -2404,7 +2397,7 @@ FlexLine::ResolveFlexibleLengths(nscoord aFlexContainerMainSize)
FreezeOrRestoreEachFlexibleSize(totalViolation,
iterationCounter + 1 == mNumItems);
MOZ_LOG(GetFlexContainerLog(), LogLevel::Debug,
MOZ_LOG(gFlexContainerLog, LogLevel::Debug,
(" Total violation: %d\n", totalViolation));
if (mNumFrozenItems == mNumItems) {
@ -3611,7 +3604,7 @@ nsFlexContainerFrame::Reflow(nsPresContext* aPresContext,
MarkInReflow();
DO_GLOBAL_REFLOW_COUNT("nsFlexContainerFrame");
DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
MOZ_LOG(GetFlexContainerLog(), LogLevel::Debug,
MOZ_LOG(gFlexContainerLog, LogLevel::Debug,
("Reflow() for nsFlexContainerFrame %p\n", this));
if (IsFrameTreeTooDeep(aReflowState, aDesiredSize, aStatus)) {

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

@ -214,9 +214,9 @@ bool nsFrame::GetShowEventTargetFrameBorder()
* Note: the log module is created during library initialization which
* means that you cannot perform logging before then.
*/
static PRLogModuleInfo* gLogModule;
mozilla::LazyLogModule nsFrame::sFrameLogModule("frame");
static PRLogModuleInfo* gStyleVerifyTreeLogModuleInfo;
static mozilla::LazyLogModule sStyleVerifyTreeLogModuleInfo("styleverifytree");
static uint32_t gStyleVerifyTreeEnable = 0x55;
@ -224,10 +224,7 @@ bool
nsFrame::GetVerifyStyleTreeEnable()
{
if (gStyleVerifyTreeEnable == 0x55) {
if (nullptr == gStyleVerifyTreeLogModuleInfo) {
gStyleVerifyTreeLogModuleInfo = PR_NewLogModule("styleverifytree");
gStyleVerifyTreeEnable = 0 != gStyleVerifyTreeLogModuleInfo->level;
}
gStyleVerifyTreeEnable = 0 != (int)((mozilla::LogModule*)sStyleVerifyTreeLogModuleInfo)->Level();
}
return gStyleVerifyTreeEnable;
}
@ -238,15 +235,6 @@ nsFrame::SetVerifyStyleTreeEnable(bool aEnabled)
gStyleVerifyTreeEnable = aEnabled;
}
PRLogModuleInfo*
nsFrame::GetLogModuleInfo()
{
if (nullptr == gLogModule) {
gLogModule = PR_NewLogModule("frame");
}
return gLogModule;
}
#endif
NS_DECLARE_FRAME_PROPERTY(AbsoluteContainingBlockProperty,
@ -9143,7 +9131,7 @@ GetTagName(nsFrame* aFrame, nsIContent* aContent, int aResultSize,
void
nsFrame::Trace(const char* aMethod, bool aEnter)
{
if (NS_FRAME_LOG_TEST(GetLogModuleInfo(), NS_FRAME_TRACE_CALLS)) {
if (NS_FRAME_LOG_TEST(sFrameLogModule, NS_FRAME_TRACE_CALLS)) {
char tagbuf[40];
GetTagName(this, mContent, sizeof(tagbuf), tagbuf);
PR_LogPrint("%s: %s %s", tagbuf, aEnter ? "enter" : "exit", aMethod);
@ -9153,7 +9141,7 @@ nsFrame::Trace(const char* aMethod, bool aEnter)
void
nsFrame::Trace(const char* aMethod, bool aEnter, nsReflowStatus aStatus)
{
if (NS_FRAME_LOG_TEST(GetLogModuleInfo(), NS_FRAME_TRACE_CALLS)) {
if (NS_FRAME_LOG_TEST(sFrameLogModule, NS_FRAME_TRACE_CALLS)) {
char tagbuf[40];
GetTagName(this, mContent, sizeof(tagbuf), tagbuf);
PR_LogPrint("%s: %s %s, status=%scomplete%s",
@ -9166,7 +9154,7 @@ nsFrame::Trace(const char* aMethod, bool aEnter, nsReflowStatus aStatus)
void
nsFrame::TraceMsg(const char* aFormatString, ...)
{
if (NS_FRAME_LOG_TEST(GetLogModuleInfo(), NS_FRAME_TRACE_CALLS)) {
if (NS_FRAME_LOG_TEST(sFrameLogModule, NS_FRAME_TRACE_CALLS)) {
// Format arguments into a buffer
char argbuf[200];
va_list ap;

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

@ -30,12 +30,12 @@
#define NS_FRAME_TRACE_CHILD_REFLOW 0x4
#define NS_FRAME_TRACE_NEW_FRAMES 0x8
#define NS_FRAME_LOG_TEST(_lm,_bit) (int((_lm)->level) & (_bit))
#define NS_FRAME_LOG_TEST(_lm,_bit) (int(((mozilla::LogModule*)_lm)->Level()) & (_bit))
#ifdef DEBUG
#define NS_FRAME_LOG(_bit,_args) \
PR_BEGIN_MACRO \
if (NS_FRAME_LOG_TEST(nsFrame::GetLogModuleInfo(),_bit)) { \
if (NS_FRAME_LOG_TEST(nsFrame::sFrameLogModule,_bit)) { \
PR_LogPrint _args; \
} \
PR_END_MACRO
@ -52,14 +52,14 @@
// XXX remove me
#define NS_FRAME_TRACE_MSG(_bit,_args) \
PR_BEGIN_MACRO \
if (NS_FRAME_LOG_TEST(nsFrame::GetLogModuleInfo(),_bit)) { \
if (NS_FRAME_LOG_TEST(nsFrame::sFrameLogModule,_bit)) { \
TraceMsg _args; \
} \
PR_END_MACRO
#define NS_FRAME_TRACE(_bit,_args) \
PR_BEGIN_MACRO \
if (NS_FRAME_LOG_TEST(nsFrame::GetLogModuleInfo(),_bit)) { \
if (NS_FRAME_LOG_TEST(nsFrame::sFrameLogModule,_bit)) { \
TraceMsg _args; \
} \
PR_END_MACRO
@ -723,14 +723,7 @@ public:
*/
static void SetVerifyStyleTreeEnable(bool aEnabled);
/**
* The frame class and related classes share an nspr log module
* for logging frame activity.
*
* Note: the log module is created during library initialization which
* means that you cannot perform logging before then.
*/
static PRLogModuleInfo* GetLogModuleInfo();
static mozilla::LazyLogModule sFrameLogModule;
// Show frame borders when rendering
static void ShowFrameBorders(bool aEnable);

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

@ -22,8 +22,8 @@
#include "nsIPrintSettings.h"
#include "mozilla/Logging.h"
extern PRLogModuleInfo *GetLayoutPrintingLog();
#define PR_PL(_p1) MOZ_LOG(GetLayoutPrintingLog(), mozilla::LogLevel::Debug, _p1)
extern mozilla::LazyLogModule gLayoutPrintingLog;
#define PR_PL(_p1) MOZ_LOG(gLayoutPrintingLog, mozilla::LogLevel::Debug, _p1)
using namespace mozilla;
using namespace mozilla::gfx;

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

@ -94,14 +94,7 @@ using mozilla::DefaultXDisplay;
#undef CreateEvent
#endif
static PRLogModuleInfo *
GetObjectFrameLog()
{
static PRLogModuleInfo *sLog;
if (!sLog)
sLog = PR_NewLogModule("nsPluginFrame");
return sLog;
}
static mozilla::LazyLogModule sPluginFrameLog("nsPluginFrame");
using namespace mozilla;
using namespace mozilla::gfx;
@ -160,13 +153,13 @@ nsPluginFrame::nsPluginFrame(nsStyleContext* aContext)
, mReflowCallbackPosted(false)
, mIsHiddenDueToScroll(false)
{
MOZ_LOG(GetObjectFrameLog(), LogLevel::Debug,
MOZ_LOG(sPluginFrameLog, LogLevel::Debug,
("Created new nsPluginFrame %p\n", this));
}
nsPluginFrame::~nsPluginFrame()
{
MOZ_LOG(GetObjectFrameLog(), LogLevel::Debug,
MOZ_LOG(sPluginFrameLog, LogLevel::Debug,
("nsPluginFrame %p deleted\n", this));
}
@ -196,7 +189,7 @@ nsPluginFrame::Init(nsIContent* aContent,
nsContainerFrame* aParent,
nsIFrame* aPrevInFlow)
{
MOZ_LOG(GetObjectFrameLog(), LogLevel::Debug,
MOZ_LOG(sPluginFrameLog, LogLevel::Debug,
("Initializing nsPluginFrame %p for content %p\n", this, aContent));
nsPluginFrameSuper::Init(aContent, aParent, aPrevInFlow);

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

@ -42,15 +42,9 @@ static const char sPrintOptionsContractID[] = "@mozilla.org/gfx/printsettings-se
//
#include "mozilla/Logging.h"
PRLogModuleInfo *
GetLayoutPrintingLog()
{
static PRLogModuleInfo *sLog;
if (!sLog)
sLog = PR_NewLogModule("printing-layout");
return sLog;
}
#define PR_PL(_p1) MOZ_LOG(GetLayoutPrintingLog(), mozilla::LogLevel::Debug, _p1)
mozilla::LazyLogModule gLayoutPrintingLog("printing-layout");
#define PR_PL(_p1) MOZ_LOG(gLayoutPrintingLog, mozilla::LogLevel::Debug, _p1)
nsSimplePageSequenceFrame*
NS_NewSimplePageSequenceFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)

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

@ -17,15 +17,9 @@
#include "mozilla/Logging.h"
#define DUMP_LAYOUT_LEVEL 9 // this turns on the dumping of each doucment's layout info
static PRLogModuleInfo *
GetPrintingLog()
{
static PRLogModuleInfo *sLog;
if (!sLog)
sLog = PR_NewLogModule("printing");
return sLog;
}
#define PR_PL(_p1) MOZ_LOG(GetPrintingLog(), mozilla::LogLevel::Debug, _p1);
static mozilla::LazyLogModule gPrintingLog("printing");
#define PR_PL(_p1) MOZ_LOG(gPrintingLog, mozilla::LogLevel::Debug, _p1);
//---------------------------------------------------
//-- nsPrintData Class Impl

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

@ -140,15 +140,9 @@ using namespace mozilla::dom;
#define DUMP_LAYOUT_LEVEL 9 // this turns on the dumping of each doucment's layout info
#ifndef PR_PL
static PRLogModuleInfo *
GetPrintingLog()
{
static PRLogModuleInfo *sLog;
if (!sLog)
sLog = PR_NewLogModule("printing");
return sLog;
}
#define PR_PL(_p1) MOZ_LOG(GetPrintingLog(), mozilla::LogLevel::Debug, _p1);
static mozilla::LazyLogModule gPrintingLog("printing")
#define PR_PL(_p1) MOZ_LOG(gPrintingLog, mozilla::LogLevel::Debug, _p1);
#endif
#ifdef EXTENDED_DEBUG_PRINTING
@ -1644,7 +1638,7 @@ nsPrintEngine::SetupToPrintContent()
NS_ENSURE_SUCCESS(rv, rv);
}
if (MOZ_LOG_TEST(GetPrintingLog(), LogLevel::Debug)) {
if (MOZ_LOG_TEST(gPrintingLog, LogLevel::Debug)) {
float calcRatio = 0.0f;
if (mPrt->mPrintDocList.Length() > 1 && mPrt->mPrintObject->mFrameType == eFrameSet) {
nsPrintObject* smallestPO = FindSmallestSTF();

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

@ -266,33 +266,18 @@ private:
#include "mozilla/Logging.h"
static PRLogModuleInfo *
GetLoaderLog()
{
static PRLogModuleInfo *sLog;
if (!sLog)
sLog = PR_NewLogModule("nsCSSLoader");
return sLog;
}
static mozilla::LazyLogModule sCssLoaderLog("nsCSSLoader");
static PRLogModuleInfo*
GetSriLog()
{
static PRLogModuleInfo *gSriPRLog;
if (!gSriPRLog) {
gSriPRLog = PR_NewLogModule("SRI");
}
return gSriPRLog;
}
static mozilla::LazyLogModule gSriPRLog("SRI");
#define LOG_ERROR(args) MOZ_LOG(GetLoaderLog(), mozilla::LogLevel::Error, args)
#define LOG_WARN(args) MOZ_LOG(GetLoaderLog(), mozilla::LogLevel::Warning, args)
#define LOG_DEBUG(args) MOZ_LOG(GetLoaderLog(), mozilla::LogLevel::Debug, args)
#define LOG_ERROR(args) MOZ_LOG(sCssLoaderLog, mozilla::LogLevel::Error, args)
#define LOG_WARN(args) MOZ_LOG(sCssLoaderLog, mozilla::LogLevel::Warning, args)
#define LOG_DEBUG(args) MOZ_LOG(sCssLoaderLog, mozilla::LogLevel::Debug, args)
#define LOG(args) LOG_DEBUG(args)
#define LOG_ERROR_ENABLED() MOZ_LOG_TEST(GetLoaderLog(), mozilla::LogLevel::Error)
#define LOG_WARN_ENABLED() MOZ_LOG_TEST(GetLoaderLog(), mozilla::LogLevel::Warning)
#define LOG_DEBUG_ENABLED() MOZ_LOG_TEST(GetLoaderLog(), mozilla::LogLevel::Debug)
#define LOG_ERROR_ENABLED() MOZ_LOG_TEST(sCssLoaderLog, mozilla::LogLevel::Error)
#define LOG_WARN_ENABLED() MOZ_LOG_TEST(sCssLoaderLog, mozilla::LogLevel::Warning)
#define LOG_DEBUG_ENABLED() MOZ_LOG_TEST(sCssLoaderLog, mozilla::LogLevel::Debug)
#define LOG_ENABLED() LOG_DEBUG_ENABLED()
#define LOG_URI(format, uri) \
@ -982,7 +967,7 @@ SheetLoadData::OnStreamComplete(nsIUnicharStreamLoader* aLoader,
mSheet->GetCORSMode(), aBuffer,
mLoader->mDocument))) {
LOG((" Load was blocked by SRI"));
MOZ_LOG(GetSriLog(), mozilla::LogLevel::Debug,
MOZ_LOG(gSriPRLog, mozilla::LogLevel::Debug,
("css::Loader::OnStreamComplete, bad metadata"));
mLoader->SheetComplete(this, NS_ERROR_SRI_CORRUPT);
return NS_OK;
@ -1271,7 +1256,7 @@ Loader::CreateSheet(nsIURI* aURI,
SRIMetadata sriMetadata;
if (!aIntegrity.IsEmpty()) {
MOZ_LOG(GetSriLog(), mozilla::LogLevel::Debug,
MOZ_LOG(gSriPRLog, mozilla::LogLevel::Debug,
("css::Loader::CreateSheet, integrity=%s",
NS_ConvertUTF16toUTF8(aIntegrity).get()));
SRICheck::IntegrityMetadata(aIntegrity, mDocument, &sriMetadata);