mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 15:23:51 +00:00
Bug 1599521 - Add helper method for getting a string for the current process type. r=froydnj
I also removed the unused forward declaration of GMPLoader. It used to be needed for the declaration of XRE_InitChildProcess. Differential Revision: https://phabricator.services.mozilla.com/D54819 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
e0a840160a
commit
a102cb7648
@ -43,7 +43,7 @@ void MMPrinter::PrintImpl(char const* aLocation, const nsAString& aMsg,
|
||||
|
||||
MOZ_LOG(MMPrinter::sMMLog, LogLevel::Debug,
|
||||
("%s Message: %s in process type: %s", aLocation, charMsg.get(),
|
||||
XRE_GeckoProcessTypeToString(XRE_GetProcessType())));
|
||||
XRE_GetProcessTypeString()));
|
||||
|
||||
if (!MOZ_LOG_TEST(sMMLog, LogLevel::Verbose)) {
|
||||
return;
|
||||
|
@ -502,11 +502,10 @@ void BackgroundHangThread::ReportHang(TimeDuration aHangTime,
|
||||
// Recovered from a hang; called on the monitor thread
|
||||
// mManager->mLock IS locked
|
||||
|
||||
HangDetails hangDetails(
|
||||
aHangTime,
|
||||
nsDependentCString(XRE_GeckoProcessTypeToString(XRE_GetProcessType())),
|
||||
VoidString(), mThreadName, mRunnableName, std::move(mHangStack),
|
||||
std::move(mAnnotations));
|
||||
HangDetails hangDetails(aHangTime,
|
||||
nsDependentCString(XRE_GetProcessTypeString()),
|
||||
VoidString(), mThreadName, mRunnableName,
|
||||
std::move(mHangStack), std::move(mAnnotations));
|
||||
|
||||
PersistedToDisk persistedToDisk = aPersistedToDisk;
|
||||
if (aPersistedToDisk == PersistedToDisk::Yes && XRE_IsParentProcess() &&
|
||||
|
@ -179,7 +179,7 @@ void RunWatchdog(void* arg) {
|
||||
continue;
|
||||
}
|
||||
|
||||
NoteIntentionalCrash(XRE_GeckoProcessTypeToString(XRE_GetProcessType()));
|
||||
NoteIntentionalCrash(XRE_GetProcessTypeString());
|
||||
|
||||
// The shutdown steps are not completed yet. Let's report the last one.
|
||||
if (!sShutdownNotified) {
|
||||
|
@ -4915,6 +4915,10 @@ GeckoProcessType XRE_GetProcessType() {
|
||||
return mozilla::startup::sChildProcessType;
|
||||
}
|
||||
|
||||
const char* XRE_GetProcessTypeString() {
|
||||
return XRE_GeckoProcessTypeToString(XRE_GetProcessType());
|
||||
}
|
||||
|
||||
bool XRE_IsE10sParentProcess() {
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
return XRE_IsParentProcess() && BrowserTabsRemoteAutostart() &&
|
||||
|
@ -582,8 +582,7 @@ nsresult XRE_InitChildProcess(int aArgc, char* aArgv[],
|
||||
# endif
|
||||
printf_stderr(
|
||||
"\n\nCHILDCHILDCHILDCHILD (process type %s)\n debug me @ %d\n\n",
|
||||
XRE_GeckoProcessTypeToString(XRE_GetProcessType()),
|
||||
base::GetCurrentProcId());
|
||||
XRE_GetProcessTypeString(), base::GetCurrentProcId());
|
||||
sleep(GetDebugChildPauseTime());
|
||||
}
|
||||
#elif defined(OS_WIN)
|
||||
@ -594,8 +593,7 @@ nsresult XRE_InitChildProcess(int aArgc, char* aArgv[],
|
||||
} else if (PR_GetEnv("MOZ_DEBUG_CHILD_PAUSE")) {
|
||||
printf_stderr(
|
||||
"\n\nCHILDCHILDCHILDCHILD (process type %s)\n debug me @ %d\n\n",
|
||||
XRE_GeckoProcessTypeToString(XRE_GetProcessType()),
|
||||
base::GetCurrentProcId());
|
||||
XRE_GetProcessTypeString(), base::GetCurrentProcId());
|
||||
::Sleep(GetDebugChildPauseTime());
|
||||
}
|
||||
#endif
|
||||
|
@ -166,7 +166,7 @@ Faulty::Faulty()
|
||||
mIsValidProcessType(IsValidProcessType()) {
|
||||
if (mIsValidProcessType) {
|
||||
FAULTY_LOG("Initializing for new process of type '%s' with pid %u.",
|
||||
XRE_GeckoProcessTypeToString(XRE_GetProcessType()), getpid());
|
||||
XRE_GetProcessTypeString(), getpid());
|
||||
|
||||
/* Setup random seed. */
|
||||
const char* userSeed = PR_GetEnv("FAULTY_SEED");
|
||||
@ -230,7 +230,7 @@ bool Faulty::IsValidProcessType(void) {
|
||||
|
||||
if (!isValidProcessType) {
|
||||
FAULTY_LOG("Disabled for this process of type '%s' with pid %d.",
|
||||
XRE_GeckoProcessTypeToString(XRE_GetProcessType()), getpid());
|
||||
XRE_GetProcessTypeString(), getpid());
|
||||
}
|
||||
|
||||
return isValidProcessType;
|
||||
|
@ -206,8 +206,7 @@ void StreamSamplesAndMarkers(const char* aName, int aThreadId,
|
||||
const mozilla::TimeStamp& aRegisterTime,
|
||||
const mozilla::TimeStamp& aUnregisterTime,
|
||||
double aSinceTime, UniqueStacks& aUniqueStacks) {
|
||||
aWriter.StringProperty("processType",
|
||||
XRE_GeckoProcessTypeToString(XRE_GetProcessType()));
|
||||
aWriter.StringProperty("processType", XRE_GetProcessTypeString());
|
||||
|
||||
aWriter.StringProperty("name", aName);
|
||||
|
||||
|
@ -438,7 +438,7 @@ NS_DebugBreak(uint32_t aSeverity, const char* aStr, const char* aExpr,
|
||||
}
|
||||
|
||||
static void Abort(const char* aMsg) {
|
||||
NoteIntentionalCrash(XRE_GeckoProcessTypeToString(XRE_GetProcessType()));
|
||||
NoteIntentionalCrash(XRE_GetProcessTypeString());
|
||||
mozalloc_abort(aMsg);
|
||||
}
|
||||
|
||||
|
@ -249,7 +249,7 @@ class BloatEntry {
|
||||
|
||||
bool PrintDumpHeader(FILE* aOut, const char* aMsg) {
|
||||
fprintf(aOut, "\n== BloatView: %s, %s process %d\n", aMsg,
|
||||
XRE_GeckoProcessTypeToString(XRE_GetProcessType()), getpid());
|
||||
XRE_GetProcessTypeString(), getpid());
|
||||
if (gLogLeaksOnly && !mStats.HaveLeaks()) {
|
||||
return false;
|
||||
}
|
||||
@ -506,8 +506,7 @@ static bool InitLog(const EnvCharType* aEnvVar, const char* aMsg,
|
||||
fname.Cut(fname.Length() - 4, 4);
|
||||
}
|
||||
fname.Append('_');
|
||||
const char* processType =
|
||||
XRE_GeckoProcessTypeToString(XRE_GetProcessType());
|
||||
const char* processType = XRE_GetProcessTypeString();
|
||||
fname.AppendASCII(processType);
|
||||
fname.AppendLiteral("_pid");
|
||||
fname.AppendInt((uint32_t)getpid());
|
||||
@ -827,8 +826,7 @@ static void LogDMDFile() {
|
||||
}
|
||||
|
||||
const char* logProcessEnv = PR_GetEnv("MOZ_DMD_LOG_PROCESS");
|
||||
if (logProcessEnv && !!strcmp(logProcessEnv, XRE_GeckoProcessTypeToString(
|
||||
XRE_GetProcessType()))) {
|
||||
if (logProcessEnv && !!strcmp(logProcessEnv, XRE_GetProcessTypeString())) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -410,17 +410,20 @@ XRE_API(bool, XRE_SetRemoteExceptionHandler,
|
||||
XRE_API(bool, XRE_SetRemoteExceptionHandler, (const char* aPipe))
|
||||
#endif
|
||||
|
||||
namespace mozilla {
|
||||
namespace gmp {
|
||||
class GMPLoader;
|
||||
} // namespace gmp
|
||||
} // namespace mozilla
|
||||
|
||||
XRE_API(nsresult, XRE_InitChildProcess,
|
||||
(int aArgc, char* aArgv[], const XREChildData* aChildData))
|
||||
|
||||
/**
|
||||
* Return the GeckoProcessType of the current process.
|
||||
*/
|
||||
XRE_API(GeckoProcessType, XRE_GetProcessType, ())
|
||||
|
||||
/**
|
||||
* Return the string representation of the GeckoProcessType of the current
|
||||
* process.
|
||||
*/
|
||||
XRE_API(const char*, XRE_GetProcessTypeString, ())
|
||||
|
||||
/**
|
||||
* Returns true when called in the e10s parent process. Does *NOT* return true
|
||||
* when called in the main process if e10s is disabled.
|
||||
|
Loading…
Reference in New Issue
Block a user