Backed out changeset 2c56aed63687 (bug 1219482) to hopefully fix the intermittent hazard failures CLOSED TREE

--HG--
extra : commitid : 7egFNnxx2ut
This commit is contained in:
Wes Kocher 2016-01-29 10:15:38 -08:00
Родитель a40af4aa59
Коммит b9d77f5943
27 изменённых файлов: 121 добавлений и 50 удалений

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

@ -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";
@ -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

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

@ -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:
@ -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); \
@ -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); \

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

@ -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)

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

@ -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;
}

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

@ -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)
@ -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)
{

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

@ -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,

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

@ -19,7 +19,7 @@
#include "nsIScriptError.h"
#include "jswrapper.h"
extern mozilla::LazyLogModule MCD;
extern PRLogModuleInfo *MCD;
using mozilla::AutoSafeJSContext;
//*****************************************************************************

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

@ -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,
@ -75,6 +75,8 @@ NS_IMPL_ISUPPORTS(nsReadConfig, nsIReadConfig, nsIObserver)
nsReadConfig::nsReadConfig() :
mRead(false)
{
if (!MCD)
MCD = PR_NewLogModule("MCD");
}
nsresult nsReadConfig::Init()

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

@ -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;
}

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

@ -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(...) \

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

@ -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);
@ -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&

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

@ -45,8 +45,8 @@ public:
void printf(const char* fmt, ...);
private:
static mozilla::LazyLogModule gChromiumPRLog;
// static PRLogModuleInfo* GetLog();
static PRLogModuleInfo* gChromiumPRLog;
static PRLogModuleInfo* GetLog();
LogSeverity mSeverity;
const char* mFile;

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

@ -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)
@ -198,6 +198,10 @@ mozJSComponentLoader::mozJSComponentLoader()
{
MOZ_ASSERT(!sSelf, "mozJSComponentLoader should be a singleton");
if (!gJSCLLog) {
gJSCLLog = PR_NewLogModule("JSComponentLoader");
}
sSelf = this;
}

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

@ -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;
@ -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;
}

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

@ -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()
@ -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

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

@ -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)
@ -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

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

@ -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.
@ -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)));
@ -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(),
@ -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(),
@ -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",
@ -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)."));
@ -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)));

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

@ -45,7 +45,7 @@
#include "mozilla/Logging.h"
#include "prprf.h"
#include <stdio.h>
mozilla::LazyLogModule nsRDFLog("RDF");
PRLogModuleInfo* nsRDFLog = nullptr;
//----------------------------------------------------------------------
//
@ -490,6 +490,8 @@ CompositeDataSourceImpl::CompositeDataSourceImpl(void)
mCoalesceDuplicateArcs(true),
mUpdateBatchNest(0)
{
if (nsRDFLog == nullptr)
nsRDFLog = PR_NewLogModule("RDF");
}
//----------------------------------------------------------------------

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

@ -352,10 +352,10 @@ public:
bool mPropagateChanges;
private:
static mozilla::LazyLogModule gLog;
static PRLogModuleInfo* gLog;
};
mozilla::LazyLogModule InMemoryDataSource::gLog("InMemoryDataSource");
PRLogModuleInfo* InMemoryDataSource::gLog;
//----------------------------------------------------------------------
//
@ -743,6 +743,9 @@ InMemoryDataSource::InMemoryDataSource(nsISupports* aOuter)
mPropagateChanges = true;
MOZ_COUNT_CTOR(InMemoryDataSource);
if (! gLog)
gLog = PR_NewLogModule("InMemoryDataSource");
}

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

@ -226,7 +226,7 @@ protected:
nsCOMPtr<nsIURI> mDocumentURL;
private:
static mozilla::LazyLogModule gLog;
static PRLogModuleInfo* gLog;
};
int32_t RDFContentSinkImpl::gRefCnt = 0;
@ -239,7 +239,7 @@ nsIRDFResource* RDFContentSinkImpl::kRDF_Bag;
nsIRDFResource* RDFContentSinkImpl::kRDF_Seq;
nsIRDFResource* RDFContentSinkImpl::kRDF_nextVal;
mozilla::LazyLogModule RDFContentSinkImpl::gLog("nsRDFContentSink");
PRLogModuleInfo* RDFContentSinkImpl::gLog;
////////////////////////////////////////////////////////////////////////
@ -290,6 +290,9 @@ RDFContentSinkImpl::RDFContentSinkImpl()
NS_RegisterStaticAtoms(rdf_atoms);
}
if (! gLog)
gLog = PR_NewLogModule("nsRDFContentSink");
}

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

@ -71,7 +71,7 @@ static NS_DEFINE_IID(kIRDFIntIID, NS_IRDFINT_IID);
static NS_DEFINE_IID(kIRDFNodeIID, NS_IRDFNODE_IID);
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static LazyLogModule gLog("nsRDFService");
static PRLogModuleInfo* gLog = nullptr;
class BlobImpl;
@ -748,6 +748,9 @@ RDFServiceImpl::Init()
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get default resource factory");
if (NS_FAILED(rv)) return rv;
if (! gLog)
gLog = PR_NewLogModule("nsRDFService");
return NS_OK;
}

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

@ -135,7 +135,7 @@ protected:
static int32_t gRefCnt;
static nsIRDFService* gRDFService;
static mozilla::LazyLogModule gLog;
static PRLogModuleInfo* gLog;
nsresult Init();
RDFXMLDataSourceImpl(void);
@ -359,7 +359,7 @@ protected:
int32_t RDFXMLDataSourceImpl::gRefCnt = 0;
nsIRDFService* RDFXMLDataSourceImpl::gRDFService;
mozilla::LazyLogModule RDFXMLDataSourceImpl::gLog("nsRDFXMLDataSource");
PRLogModuleInfo* RDFXMLDataSourceImpl::gLog;
static const char kFileURIPrefix[] = "file:";
static const char kResourceURIPrefix[] = "resource:";
@ -397,6 +397,8 @@ RDFXMLDataSourceImpl::RDFXMLDataSourceImpl(void)
mIsDirty(false),
mLoadState(eLoadState_Unloaded)
{
if (! gLog)
gLog = PR_NewLogModule("nsRDFXMLDataSource");
}

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

@ -39,7 +39,7 @@
// Time between subsequent vacuum calls for a certain database.
#define VACUUM_INTERVAL_SECONDS 30 * 86400 // 30 days.
extern mozilla::LazyLogModule gStorageLog;
extern PRLogModuleInfo *gStorageLog;
namespace mozilla {
namespace storage {

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

@ -27,7 +27,7 @@
#include "mozilla/Logging.h"
extern mozilla::LazyLogModule gStorageLog;
extern PRLogModuleInfo *gStorageLog;
namespace mozilla {
namespace storage {

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

@ -49,7 +49,7 @@
// Maximum size of the pages cache per connection.
#define MAX_CACHE_SIZE_KIBIBYTES 2048 // 2 MiB
mozilla::LazyLogModule gStorageLog("mozStorage");
PRLogModuleInfo* gStorageLog = nullptr;
// Checks that the protected code is running on the main-thread only if the
// connection was also opened on it.
@ -692,6 +692,9 @@ Connection::initializeInternal()
// Properly wrap the database handle's mutex.
sharedDBMutex.initWithMutex(sqlite3_db_mutex(mDBConn));
if (!gStorageLog)
gStorageLog = ::PR_NewLogModule("mozStorage");
// SQLite tracing can slow down queries (especially long queries)
// significantly. Don't trace unless the user is actively monitoring SQLite.
if (MOZ_LOG_TEST(gStorageLog, LogLevel::Debug)) {

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

@ -24,7 +24,7 @@
#include "mozIStorageBindingParams.h"
#include "mozilla/Logging.h"
extern mozilla::LazyLogModule gStorageLog;
extern PRLogModuleInfo* gStorageLog;
namespace mozilla {
namespace storage {

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

@ -28,7 +28,7 @@
#include "mozilla/Logging.h"
extern mozilla::LazyLogModule gStorageLog;
extern PRLogModuleInfo* gStorageLog;
namespace mozilla {
namespace storage {