Bug 1067547 - unify ScopedLogging implementations and use in nsEmbedFunctions; r=bsmedberg

MozReview-Commit-ID: 6hDZDaBsNFM

--HG--
extra : rebase_source : 9422c235ebdffd84e06137bb2c63ce106cb39f0b
This commit is contained in:
Tom Tromey 2016-09-26 11:06:38 -06:00
parent 1b3a828426
commit 7bc8491bea
6 changed files with 23 additions and 56 deletions

View File

@ -80,16 +80,6 @@ static bool IsArg(const char* arg, const char* s)
return false;
}
/**
* A helper class which calls NS_LogInit/NS_LogTerm in its scope.
*/
class ScopedLogging
{
public:
ScopedLogging() { NS_LogInit(); }
~ScopedLogging() { NS_LogTerm(); }
};
XRE_GetFileFromPathType XRE_GetFileFromPath;
XRE_CreateAppDataType XRE_CreateAppData;
XRE_FreeAppDataType XRE_FreeAppData;

View File

@ -1557,16 +1557,6 @@ ScopedXPCOMStartup::CreateAppSupport(nsISupports* aOuter, REFNSIID aIID, void**
nsINativeAppSupport* ScopedXPCOMStartup::gNativeAppSupport;
/**
* A helper class which calls NS_LogInit/NS_LogTerm in its scope.
*/
class ScopedLogging
{
public:
ScopedLogging() { NS_LogInit(); }
~ScopedLogging() { NS_LogTerm(); }
};
static void DumpArbitraryHelp()
{
nsresult rv;

View File

@ -367,7 +367,7 @@ XRE_InitChildProcess(int aArgc,
#endif
// NB: This must be called before profiler_init
NS_LogInit();
ScopedLogging logger;
// This is needed by Telemetry to initialize histogram collection.
// NB: This must be called after NS_LogInit().
@ -380,7 +380,7 @@ XRE_InitChildProcess(int aArgc,
mozilla::LogModule::Init();
char aLocal;
profiler_init(&aLocal);
GeckoProfilerInitRAII profiler(&aLocal);
PROFILER_LABEL("Startup", "XRE_InitChildProcess",
js::ProfileEntry::Category::OTHER);
@ -559,8 +559,6 @@ XRE_InitChildProcess(int aArgc,
nsresult rv = XRE_InitCommandLine(aArgc, aArgv);
if (NS_FAILED(rv)) {
profiler_shutdown();
NS_LogTerm();
return NS_ERROR_FAILURE;
}
@ -669,8 +667,6 @@ XRE_InitChildProcess(int aArgc,
}
if (!process->Init()) {
profiler_shutdown();
NS_LogTerm();
return NS_ERROR_FAILURE;
}
@ -717,8 +713,6 @@ XRE_InitChildProcess(int aArgc,
}
Telemetry::DestroyStatisticsRecorder();
profiler_shutdown();
NS_LogTerm();
return XRE_DeinitCommandLine();
}

View File

@ -75,20 +75,6 @@ void passed(const char* msg, ...)
//-----------------------------------------------------------------------------
class ScopedLogging
{
public:
ScopedLogging()
{
NS_LogInit();
}
~ScopedLogging()
{
NS_LogTerm();
}
};
static class ScopedXPCOM : public nsIDirectoryServiceProvider2
{
public:

View File

@ -268,6 +268,27 @@ XPCOM_API(void) NS_LogInit();
XPCOM_API(void) NS_LogTerm();
#ifdef __cplusplus
/**
* A helper class that calls NS_LogInit in its constructor and
* NS_LogTerm in its destructor.
*/
class ScopedLogging
{
public:
ScopedLogging()
{
NS_LogInit();
}
~ScopedLogging()
{
NS_LogTerm();
}
};
#endif
/**
* Log construction and destruction of objects. Processing tools can use the
* stacktraces printed by these functions to identify objects that are being

View File

@ -73,20 +73,6 @@ void passed(const char* msg, ...)
//-----------------------------------------------------------------------------
class ScopedLogging
{
public:
ScopedLogging()
{
NS_LogInit();
}
~ScopedLogging()
{
NS_LogTerm();
}
};
class ScopedXPCOM : public nsIDirectoryServiceProvider2
{
public: