Skip to content

Commit

Permalink
Backed out changeset 2c56aed63687 (bug 1219482) to hopefully fix the …
Browse files Browse the repository at this point in the history
…intermittent hazard failures CLOSED TREE

--HG--
extra : commitid : 7egFNnxx2ut
  • Loading branch information
KWierso committed Jan 29, 2016
1 parent a40af4a commit b9d77f5
Show file tree
Hide file tree
Showing 27 changed files with 121 additions and 50 deletions.
16 changes: 13 additions & 3 deletions docshell/base/nsDocShell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -266,9 +266,9 @@ static uint32_t gValidateOrigin = 0xffffffff;
#define NS_EVENT_STARVATION_DELAY_HINT 2000

#ifdef DEBUG
static mozilla::LazyLogModule gDocShellLog("nsDocShell");
static PRLogModuleInfo* gDocShellLog;
#endif
static mozilla::LazyLogModule gDocShellLeakLog("nsDocShellLeak");;
static PRLogModuleInfo* gDocShellLeakLog;

const char kBrandBundleURL[] = "chrome://branding/locale/brand.properties";
const char kAppstringsBundleURL[] = "chrome://global/locale/appstrings.properties";
Expand Down Expand Up @@ -818,7 +818,17 @@ nsDocShell::nsDocShell()
CallGetService(NS_URIFIXUP_CONTRACTID, &sURIFixup);
}

MOZ_LOG(gDocShellLeakLog, LogLevel::Debug, ("DOCSHELL %p created\n", this));
#ifdef DEBUG
if (!gDocShellLog) {
gDocShellLog = PR_NewLogModule("nsDocShell");
}
#endif
if (!gDocShellLeakLog) {
gDocShellLeakLog = PR_NewLogModule("nsDocShellLeak");
}
if (gDocShellLeakLog) {
MOZ_LOG(gDocShellLeakLog, LogLevel::Debug, ("DOCSHELL %p created\n", this));
}

#ifdef DEBUG
// We're counting the number of |nsDocShells| to help find leaks
Expand Down
17 changes: 12 additions & 5 deletions docshell/shistory/nsSHistory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,16 @@ int32_t nsSHistory::sHistoryMaxTotalViewers = -1;
// entries were touched, so that we can evict older entries first.
static uint32_t gTouchCounter = 0;

static LazyLogModule gSHistoryLog("nsSHistory");

#define LOG(format) MOZ_LOG(gSHistoryLog, mozilla::LogLevel::Debug, format)
static PRLogModuleInfo*
GetSHistoryLog()
{
static PRLogModuleInfo* sLog;
if (!sLog) {
sLog = PR_NewLogModule("nsSHistory");
}
return sLog;
}
#define LOG(format) MOZ_LOG(GetSHistoryLog(), mozilla::LogLevel::Debug, format)

// This macro makes it easier to print a log message which includes a URI's
// spec. Example use:
Expand All @@ -71,7 +78,7 @@ static LazyLogModule gSHistoryLog("nsSHistory");
//
#define LOG_SPEC(format, uri) \
PR_BEGIN_MACRO \
if (MOZ_LOG_TEST(gSHistoryLog, LogLevel::Debug)) { \
if (MOZ_LOG_TEST(GetSHistoryLog(), LogLevel::Debug)) { \
nsAutoCString _specStr(NS_LITERAL_CSTRING("(null)"));\
if (uri) { \
uri->GetSpec(_specStr); \
Expand All @@ -89,7 +96,7 @@ static LazyLogModule gSHistoryLog("nsSHistory");
//
#define LOG_SHENTRY_SPEC(format, shentry) \
PR_BEGIN_MACRO \
if (MOZ_LOG_TEST(gSHistoryLog, LogLevel::Debug)) { \
if (MOZ_LOG_TEST(GetSHistoryLog(), LogLevel::Debug)) { \
nsCOMPtr<nsIURI> uri; \
shentry->GetURI(getter_AddRefs(uri)); \
LOG_SPEC(format, uri); \
Expand Down
2 changes: 1 addition & 1 deletion extensions/auth/nsAuth.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ enum pType {
// set NSPR_LOG_MODULES=negotiateauth:4
// set NSPR_LOG_FILE=negotiateauth.log
//
extern mozilla::LazyLogModule gNegotiateLog;
extern PRLogModuleInfo* gNegotiateLog;

#define LOG(args) MOZ_LOG(gNegotiateLog, mozilla::LogLevel::Debug, args)

Expand Down
3 changes: 2 additions & 1 deletion extensions/auth/nsAuthFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,12 +220,13 @@ static const mozilla::Module::ContractIDEntry kAuthContracts[] = {
};

//-----------------------------------------------------------------------------
mozilla::LazyLogModule gNegotiateLog("negotiateauth");
PRLogModuleInfo *gNegotiateLog;

// setup nspr logging ...
static nsresult
InitNegotiateAuth()
{
gNegotiateLog = PR_NewLogModule("negotiateauth");
return NS_OK;
}

Expand Down
4 changes: 3 additions & 1 deletion extensions/gio/nsGIOProtocolHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
//-----------------------------------------------------------------------------

// NSPR_LOG_MODULES=gio:5
static mozilla::LazyLogModule sGIOLog("gio");
static PRLogModuleInfo *sGIOLog;
#define LOG(args) MOZ_LOG(sGIOLog, mozilla::LogLevel::Debug, args)


Expand Down Expand Up @@ -911,6 +911,8 @@ NS_IMPL_ISUPPORTS(nsGIOProtocolHandler, nsIProtocolHandler, nsIObserver)
nsresult
nsGIOProtocolHandler::Init()
{
sGIOLog = PR_NewLogModule("gio");

nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
if (prefs)
{
Expand Down
2 changes: 1 addition & 1 deletion extensions/pref/autoconfig/src/nsAutoConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

using mozilla::LogLevel;

mozilla::LazyLogModule MCD("MCD");
PRLogModuleInfo *MCD;

extern nsresult EvaluateAdminConfigScript(const char *js_buffer, size_t length,
const char *filename,
Expand Down
2 changes: 1 addition & 1 deletion extensions/pref/autoconfig/src/nsJSConfigTriggers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include "nsIScriptError.h"
#include "jswrapper.h"

extern mozilla::LazyLogModule MCD;
extern PRLogModuleInfo *MCD;
using mozilla::AutoSafeJSContext;

//*****************************************************************************
Expand Down
4 changes: 3 additions & 1 deletion extensions/pref/autoconfig/src/nsReadConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include "nsXULAppAPI.h"
#include "nsContentUtils.h"

extern mozilla::LazyLogModule MCD;
extern PRLogModuleInfo *MCD;

extern nsresult EvaluateAdminConfigScript(const char *js_buffer, size_t length,
const char *filename,
Expand Down Expand Up @@ -75,6 +75,8 @@ NS_IMPL_ISUPPORTS(nsReadConfig, nsIReadConfig, nsIObserver)
nsReadConfig::nsReadConfig() :
mRead(false)
{
if (!MCD)
MCD = PR_NewLogModule("MCD");
}

nsresult nsReadConfig::Init()
Expand Down
7 changes: 5 additions & 2 deletions hal/Hal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,13 @@ using namespace mozilla::dom;
namespace mozilla {
namespace hal {

mozilla::LogModule *
PRLogModuleInfo *
GetHalLog()
{
static mozilla::LazyLogModule sHalLog("hal");
static PRLogModuleInfo *sHalLog;
if (!sHalLog) {
sHalLog = PR_NewLogModule("hal");
}
return sHalLog;
}

Expand Down
2 changes: 1 addition & 1 deletion hal/HalLog.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace mozilla {

namespace hal {

mozilla::LogModule *GetHalLog();
extern PRLogModuleInfo *GetHalLog();
#define HAL_LOG(...) \
MOZ_LOG(mozilla::hal::GetHalLog(), LogLevel::Debug, (__VA_ARGS__))
#define HAL_ERR(...) \
Expand Down
12 changes: 10 additions & 2 deletions ipc/chromium/src/base/logging.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Logger::~Logger()
break;
}

MOZ_LOG(gChromiumPRLog, prlevel, ("%s:%i: %s", mFile, mLine, mMsg ? mMsg : "<no message>"));
MOZ_LOG(GetLog(), prlevel, ("%s:%i: %s", mFile, mLine, mMsg ? mMsg : "<no message>"));
if (xpcomlevel != -1)
NS_DebugBreak(xpcomlevel, mMsg, NULL, mFile, mLine);

Expand All @@ -58,7 +58,15 @@ Logger::printf(const char* fmt, ...)
va_end(args);
}

LazyLogModule Logger::gChromiumPRLog("chromium");
PRLogModuleInfo* Logger::gChromiumPRLog;

PRLogModuleInfo* Logger::GetLog()
{
if (!gChromiumPRLog)
gChromiumPRLog = PR_NewLogModule("chromium");
return gChromiumPRLog;
}

} // namespace mozilla

mozilla::Logger&
Expand Down
4 changes: 2 additions & 2 deletions ipc/chromium/src/base/logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ class Logger
void printf(const char* fmt, ...);

private:
static mozilla::LazyLogModule gChromiumPRLog;
// static PRLogModuleInfo* GetLog();
static PRLogModuleInfo* gChromiumPRLog;
static PRLogModuleInfo* GetLog();

LogSeverity mSeverity;
const char* mFile;
Expand Down
6 changes: 5 additions & 1 deletion js/xpconnect/loader/mozJSComponentLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ static const char kJSCachePrefix[] = "jsloader";
#define XPC_DESERIALIZATION_BUFFER_SIZE (12 * 8192)

// NSPR_LOG_MODULES=JSComponentLoader:5
static LazyLogModule gJSCLLog("JSComponentLoader");
static PRLogModuleInfo* gJSCLLog;

#define LOG(args) MOZ_LOG(gJSCLLog, mozilla::LogLevel::Debug, args)

Expand Down Expand Up @@ -198,6 +198,10 @@ mozJSComponentLoader::mozJSComponentLoader()
{
MOZ_ASSERT(!sSelf, "mozJSComponentLoader should be a singleton");

if (!gJSCLLog) {
gJSCLLog = PR_NewLogModule("JSComponentLoader");
}

sSelf = this;
}

Expand Down
7 changes: 5 additions & 2 deletions js/xpconnect/src/XPCLog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,13 @@
static char* g_Spaces;
static int g_InitState = 0;
static int g_Indent = 0;
static mozilla::LazyLogModule g_LogMod("xpclog");
static PRLogModuleInfo* g_LogMod = nullptr;

static bool Init()
{
g_LogMod = PR_NewLogModule("xpclog");
g_Spaces = new char[SPACE_COUNT+1];
if (!g_Spaces || !MOZ_LOG_TEST(g_LogMod,LogLevel::Error)) {
if (!g_LogMod || !g_Spaces || !MOZ_LOG_TEST(g_LogMod,LogLevel::Error)) {
g_InitState = 1;
XPC_Log_Finish();
return false;
Expand All @@ -46,6 +47,8 @@ XPC_Log_Finish()
{
if (g_InitState == 1) {
delete [] g_Spaces;
// we'd like to properly cleanup the LogModule, but nspr owns that
g_LogMod = nullptr;
}
g_InitState = -1;
}
Expand Down
15 changes: 10 additions & 5 deletions js/xpconnect/src/nsXPConnect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ xpc::ErrorReport::Init(JSErrorReport* aReport, const char* aFallbackMessage,
mIsMuted = aReport->isMuted;
}

static LazyLogModule gJSDiagnostics("JSDiagnostics");
static PRLogModuleInfo* gJSDiagnostics;

void
xpc::ErrorReport::LogToConsole()
Expand Down Expand Up @@ -232,10 +232,15 @@ xpc::ErrorReport::LogToConsoleWithStack(JS::HandleObject aStack)
fflush(stderr);
}

MOZ_LOG(gJSDiagnostics,
JSREPORT_IS_WARNING(mFlags) ? LogLevel::Warning : LogLevel::Error,
("file %s, line %u\n%s", NS_LossyConvertUTF16toASCII(mFileName).get(),
mLineNumber, NS_LossyConvertUTF16toASCII(mErrorMsg).get()));
// Log to the PR Log Module.
if (!gJSDiagnostics)
gJSDiagnostics = PR_NewLogModule("JSDiagnostics");
if (gJSDiagnostics) {
MOZ_LOG(gJSDiagnostics,
JSREPORT_IS_WARNING(mFlags) ? LogLevel::Warning : LogLevel::Error,
("file %s, line %u\n%s", NS_LossyConvertUTF16toASCII(mFileName).get(),
mLineNumber, NS_LossyConvertUTF16toASCII(mErrorMsg).get()));
}

// Log to the console. We do this last so that we can simply return if
// there's no console service without affecting the other reporting
Expand Down
5 changes: 4 additions & 1 deletion modules/libjar/nsJARChannel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ static NS_DEFINE_CID(kZipReaderCID, NS_ZIPREADER_CID);
//
// set NSPR_LOG_MODULES=nsJarProtocol:5
//
static LazyLogModule gJarProtocolLog("nsJarProtocol");
static PRLogModuleInfo *gJarProtocolLog = nullptr;

#define LOG(args) MOZ_LOG(gJarProtocolLog, mozilla::LogLevel::Debug, args)
#define LOG_ENABLED() MOZ_LOG_TEST(gJarProtocolLog, mozilla::LogLevel::Debug)
Expand Down Expand Up @@ -203,6 +203,9 @@ nsJARChannel::nsJARChannel()
, mOpeningRemote(false)
, mBlockRemoteFiles(false)
{
if (!gJarProtocolLog)
gJarProtocolLog = PR_NewLogModule("nsJarProtocol");

mBlockRemoteFiles = Preferences::GetBool("network.jar.block-remote-files", false);

// hold an owning reference to the jar handler
Expand Down
21 changes: 14 additions & 7 deletions parser/htmlparser/nsExpatDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,14 @@ using mozilla::LogLevel;

static const char16_t kUTF16[] = { 'U', 'T', 'F', '-', '1', '6', '\0' };

static mozilla::LazyLogModule gExpatDriverLog("expatdriver");
static PRLogModuleInfo *
GetExpatDriverLog()
{
static PRLogModuleInfo *sLog;
if (!sLog)
sLog = PR_NewLogModule("expatdriver");
return sLog;
}

/***************************** EXPAT CALL BACKS ******************************/
// The callback handlers that get called from the expat parser.
Expand Down Expand Up @@ -1052,7 +1059,7 @@ nsExpatDriver::ConsumeToken(nsScanner& aScanner, bool& aFlushTokens)
nsScannerIterator end;
aScanner.EndReading(end);

MOZ_LOG(gExpatDriverLog, LogLevel::Debug,
MOZ_LOG(GetExpatDriverLog(), LogLevel::Debug,
("Remaining in expat's buffer: %i, remaining in scanner: %i.",
mExpatBuffered, Distance(start, end)));

Expand All @@ -1073,7 +1080,7 @@ nsExpatDriver::ConsumeToken(nsScanner& aScanner, bool& aFlushTokens)
length = 0;

if (blocked) {
MOZ_LOG(gExpatDriverLog, LogLevel::Debug,
MOZ_LOG(GetExpatDriverLog(), LogLevel::Debug,
("Resuming Expat, will parse data remaining in Expat's "
"buffer.\nContent of Expat's buffer:\n-----\n%s\n-----\n",
NS_ConvertUTF16toUTF8(currentExpatPosition.get(),
Expand All @@ -1082,7 +1089,7 @@ nsExpatDriver::ConsumeToken(nsScanner& aScanner, bool& aFlushTokens)
else {
NS_ASSERTION(mExpatBuffered == Distance(currentExpatPosition, end),
"Didn't pass all the data to Expat?");
MOZ_LOG(gExpatDriverLog, LogLevel::Debug,
MOZ_LOG(GetExpatDriverLog(), LogLevel::Debug,
("Last call to Expat, will parse data remaining in Expat's "
"buffer.\nContent of Expat's buffer:\n-----\n%s\n-----\n",
NS_ConvertUTF16toUTF8(currentExpatPosition.get(),
Expand All @@ -1093,7 +1100,7 @@ nsExpatDriver::ConsumeToken(nsScanner& aScanner, bool& aFlushTokens)
buffer = start.get();
length = uint32_t(start.size_forward());

MOZ_LOG(gExpatDriverLog, LogLevel::Debug,
MOZ_LOG(GetExpatDriverLog(), LogLevel::Debug,
("Calling Expat, will parse data remaining in Expat's buffer and "
"new data.\nContent of Expat's buffer:\n-----\n%s\n-----\nNew "
"data:\n-----\n%s\n-----\n",
Expand Down Expand Up @@ -1133,7 +1140,7 @@ nsExpatDriver::ConsumeToken(nsScanner& aScanner, bool& aFlushTokens)
mExpatBuffered += length - consumed;

if (BlockedOrInterrupted()) {
MOZ_LOG(gExpatDriverLog, LogLevel::Debug,
MOZ_LOG(GetExpatDriverLog(), LogLevel::Debug,
("Blocked or interrupted parser (probably for loading linked "
"stylesheets or scripts)."));

Expand Down Expand Up @@ -1194,7 +1201,7 @@ nsExpatDriver::ConsumeToken(nsScanner& aScanner, bool& aFlushTokens)
aScanner.SetPosition(currentExpatPosition, true);
aScanner.Mark();

MOZ_LOG(gExpatDriverLog, LogLevel::Debug,
MOZ_LOG(GetExpatDriverLog(), LogLevel::Debug,
("Remaining in expat's buffer: %i, remaining in scanner: %i.",
mExpatBuffered, Distance(currentExpatPosition, end)));

Expand Down
4 changes: 3 additions & 1 deletion rdf/base/nsCompositeDataSource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
#include "mozilla/Logging.h"
#include "prprf.h"
#include <stdio.h>
mozilla::LazyLogModule nsRDFLog("RDF");
PRLogModuleInfo* nsRDFLog = nullptr;

//----------------------------------------------------------------------
//
Expand Down Expand Up @@ -490,6 +490,8 @@ CompositeDataSourceImpl::CompositeDataSourceImpl(void)
mCoalesceDuplicateArcs(true),
mUpdateBatchNest(0)
{
if (nsRDFLog == nullptr)
nsRDFLog = PR_NewLogModule("RDF");
}

//----------------------------------------------------------------------
Expand Down
Loading

0 comments on commit b9d77f5

Please sign in to comment.