Bug 1598787 - Rename XRE_ChildProcessTypeToString to XRE_GeckoProcessTypeToString. r=froydnj

This function works on all GeckoProcessTypes, not just those for child
processes.

Differential Revision: https://phabricator.services.mozilla.com/D54375

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Andrew McCreight 2019-11-25 22:45:31 +00:00
parent b7e760c953
commit d25c3b20ae
17 changed files with 26 additions and 26 deletions

View File

@ -43,7 +43,7 @@ void MMPrinter::PrintImpl(char const* aLocation, const nsAString& aMsg,
MOZ_LOG(MMPrinter::sMMLog, LogLevel::Debug, MOZ_LOG(MMPrinter::sMMLog, LogLevel::Debug,
("%s Message: %s in process type: %s", aLocation, charMsg.get(), ("%s Message: %s in process type: %s", aLocation, charMsg.get(),
XRE_ChildProcessTypeToString(XRE_GetProcessType()))); XRE_GeckoProcessTypeToString(XRE_GetProcessType())));
if (!MOZ_LOG_TEST(sMMLog, LogLevel::Verbose)) { if (!MOZ_LOG_TEST(sMMLog, LogLevel::Verbose)) {
return; return;
@ -76,4 +76,4 @@ void MMPrinter::PrintImpl(char const* aLocation, const nsAString& aMsg,
} }
} // namespace dom } // namespace dom
} // namespace mozilla } // namespace mozilla

View File

@ -233,7 +233,7 @@ void GPUChild::ActorDestroy(ActorDestroyReason aWhy) {
Telemetry::Accumulate( Telemetry::Accumulate(
Telemetry::SUBPROCESS_ABNORMAL_ABORT, Telemetry::SUBPROCESS_ABNORMAL_ABORT,
nsDependentCString(XRE_ChildProcessTypeToString(GeckoProcessType_GPU)), nsDependentCString(XRE_GeckoProcessTypeToString(GeckoProcessType_GPU)),
1); 1);
// Notify the Telemetry environment so that we can refresh and do a // Notify the Telemetry environment so that we can refresh and do a

View File

@ -94,7 +94,7 @@ void VRChild::ActorDestroy(ActorDestroyReason aWhy) {
Telemetry::Accumulate( Telemetry::Accumulate(
Telemetry::SUBPROCESS_ABNORMAL_ABORT, Telemetry::SUBPROCESS_ABNORMAL_ABORT,
nsDependentCString(XRE_ChildProcessTypeToString(GeckoProcessType_VR)), nsDependentCString(XRE_GeckoProcessTypeToString(GeckoProcessType_VR)),
1); 1);
} }
gfxVars::RemoveReceiver(this); gfxVars::RemoveReceiver(this);

View File

@ -179,7 +179,7 @@ class BaseProcessLauncher {
void GetChildLogName(const char* origLogName, nsACString& buffer); void GetChildLogName(const char* origLogName, nsACString& buffer);
const char* ChildProcessType() { const char* ChildProcessType() {
return XRE_ChildProcessTypeToString(mProcessType); return XRE_GeckoProcessTypeToString(mProcessType);
} }
nsCOMPtr<nsISerialEventTarget> mLaunchThread; nsCOMPtr<nsISerialEventTarget> mLaunchThread;
@ -680,10 +680,10 @@ bool GeckoChildProcessHost::AsyncLaunch(std::vector<std::string> aExtraOpts) {
// If something failed let's set the error state and notify. // If something failed let's set the error state and notify.
CHROMIUM_LOG(ERROR) CHROMIUM_LOG(ERROR)
<< "Failed to launch " << "Failed to launch "
<< XRE_ChildProcessTypeToString(mProcessType) << " subprocess"; << XRE_GeckoProcessTypeToString(mProcessType) << " subprocess";
Telemetry::Accumulate( Telemetry::Accumulate(
Telemetry::SUBPROCESS_LAUNCH_FAILURE, Telemetry::SUBPROCESS_LAUNCH_FAILURE,
nsDependentCString(XRE_ChildProcessTypeToString(mProcessType))); nsDependentCString(XRE_GeckoProcessTypeToString(mProcessType)));
{ {
MonitorAutoLock lock(mMonitor); MonitorAutoLock lock(mMonitor);
mProcessState = PROCESS_ERROR; mProcessState = PROCESS_ERROR;

View File

@ -92,7 +92,7 @@ void StreamSamplesAndMarkers(const char* aName, int aThreadId,
double aSinceTime, UniqueStacks& aUniqueStacks) { double aSinceTime, UniqueStacks& aUniqueStacks) {
aWriter.StringProperty( aWriter.StringProperty(
"processType", "processType",
"(unknown)" /* XRE_ChildProcessTypeToString(XRE_GetProcessType()) */); "(unknown)" /* XRE_GeckoProcessTypeToString(XRE_GetProcessType()) */);
aWriter.StringProperty("name", aName); aWriter.StringProperty("name", aName);

View File

@ -60,7 +60,7 @@ bool RemoteSandboxBrokerParent::DuplicateFromLauncher(HANDLE aLauncherHandle,
void RemoteSandboxBrokerParent::ActorDestroy(ActorDestroyReason aWhy) { void RemoteSandboxBrokerParent::ActorDestroy(ActorDestroyReason aWhy) {
if (AbnormalShutdown == aWhy) { if (AbnormalShutdown == aWhy) {
Telemetry::Accumulate(Telemetry::SUBPROCESS_ABNORMAL_ABORT, Telemetry::Accumulate(Telemetry::SUBPROCESS_ABNORMAL_ABORT,
nsDependentCString(XRE_ChildProcessTypeToString( nsDependentCString(XRE_GeckoProcessTypeToString(
GeckoProcessType_RemoteSandboxBroker)), GeckoProcessType_RemoteSandboxBroker)),
1); 1);
GenerateCrashReport(OtherPid()); GenerateCrashReport(OtherPid());

View File

@ -258,7 +258,7 @@ bool SandboxBroker::LaunchApp(const wchar_t* aPath, const wchar_t* aArguments,
&last_warning, &last_error, &targetInfo); &last_warning, &last_error, &targetInfo);
if (sandbox::SBOX_ALL_OK != result) { if (sandbox::SBOX_ALL_OK != result) {
nsAutoCString key; nsAutoCString key;
key.AppendASCII(XRE_ChildProcessTypeToString(aProcessType)); key.AppendASCII(XRE_GeckoProcessTypeToString(aProcessType));
key.AppendLiteral("/0x"); key.AppendLiteral("/0x");
key.AppendInt(static_cast<uint32_t>(last_error), 16); key.AppendInt(static_cast<uint32_t>(last_error), 16);

View File

@ -127,7 +127,7 @@ def process_leak_log(leak_log_file, leak_thresholds=None,
The base of leak_log_file for a non-default process needs to end with The base of leak_log_file for a non-default process needs to end with
_proctype_pid12345.log _proctype_pid12345.log
"proctype" is a string denoting the type of the process, which should "proctype" is a string denoting the type of the process, which should
be the result of calling XRE_ChildProcessTypeToString(). 12345 is be the result of calling XRE_GeckoProcessTypeToString(). 12345 is
a series of digits that is the pid for the process. The .log is a series of digits that is the pid for the process. The .log is
optional. optional.

View File

@ -504,7 +504,7 @@ void BackgroundHangThread::ReportHang(TimeDuration aHangTime,
HangDetails hangDetails( HangDetails hangDetails(
aHangTime, aHangTime,
nsDependentCString(XRE_ChildProcessTypeToString(XRE_GetProcessType())), nsDependentCString(XRE_GeckoProcessTypeToString(XRE_GetProcessType())),
VoidString(), mThreadName, mRunnableName, std::move(mHangStack), VoidString(), mThreadName, mRunnableName, std::move(mHangStack),
std::move(mAnnotations)); std::move(mAnnotations));

View File

@ -302,7 +302,7 @@ static nsresult GetPerProcObject(JSContext* aCx, const IndexMap& aModuleIndices,
if (aData.mProcessType == GeckoProcessType_Default) { if (aData.mProcessType == GeckoProcessType_Default) {
strProcType.Rebind(NS_LITERAL_CSTRING("browser"), 0); strProcType.Rebind(NS_LITERAL_CSTRING("browser"), 0);
} else { } else {
strProcType.Rebind(XRE_ChildProcessTypeToString(aData.mProcessType)); strProcType.Rebind(XRE_GeckoProcessTypeToString(aData.mProcessType));
} }
JS::RootedValue jsProcType(aCx); JS::RootedValue jsProcType(aCx);

View File

@ -179,7 +179,7 @@ void RunWatchdog(void* arg) {
continue; continue;
} }
NoteIntentionalCrash(XRE_ChildProcessTypeToString(XRE_GetProcessType())); NoteIntentionalCrash(XRE_GeckoProcessTypeToString(XRE_GetProcessType()));
// The shutdown steps are not completed yet. Let's report the last one. // The shutdown steps are not completed yet. Let's report the last one.
if (!sShutdownNotified) { if (!sShutdownNotified) {

View File

@ -224,7 +224,7 @@ void XRE_TermEmbedding() {
delete gDirServiceProvider; delete gDirServiceProvider;
} }
const char* XRE_ChildProcessTypeToString(GeckoProcessType aProcessType) { const char* XRE_GeckoProcessTypeToString(GeckoProcessType aProcessType) {
return (aProcessType < GeckoProcessType_End) return (aProcessType < GeckoProcessType_End)
? kGeckoProcessTypeString[aProcessType] ? kGeckoProcessTypeString[aProcessType]
: "invalid"; : "invalid";
@ -241,7 +241,7 @@ const char* XRE_ChildProcessTypeToAnnotation(GeckoProcessType aProcessType) {
case GeckoProcessType_Content: case GeckoProcessType_Content:
return "content"; return "content";
default: default:
return XRE_ChildProcessTypeToString(aProcessType); return XRE_GeckoProcessTypeToString(aProcessType);
} }
} }
@ -582,7 +582,7 @@ nsresult XRE_InitChildProcess(int aArgc, char* aArgv[],
# endif # endif
printf_stderr( printf_stderr(
"\n\nCHILDCHILDCHILDCHILD (process type %s)\n debug me @ %d\n\n", "\n\nCHILDCHILDCHILDCHILD (process type %s)\n debug me @ %d\n\n",
XRE_ChildProcessTypeToString(XRE_GetProcessType()), XRE_GeckoProcessTypeToString(XRE_GetProcessType()),
base::GetCurrentProcId()); base::GetCurrentProcId());
sleep(GetDebugChildPauseTime()); sleep(GetDebugChildPauseTime());
} }
@ -594,7 +594,7 @@ nsresult XRE_InitChildProcess(int aArgc, char* aArgv[],
} else if (PR_GetEnv("MOZ_DEBUG_CHILD_PAUSE")) { } else if (PR_GetEnv("MOZ_DEBUG_CHILD_PAUSE")) {
printf_stderr( printf_stderr(
"\n\nCHILDCHILDCHILDCHILD (process type %s)\n debug me @ %d\n\n", "\n\nCHILDCHILDCHILDCHILD (process type %s)\n debug me @ %d\n\n",
XRE_ChildProcessTypeToString(XRE_GetProcessType()), XRE_GeckoProcessTypeToString(XRE_GetProcessType()),
base::GetCurrentProcId()); base::GetCurrentProcId());
::Sleep(GetDebugChildPauseTime()); ::Sleep(GetDebugChildPauseTime());
} }

View File

@ -166,7 +166,7 @@ Faulty::Faulty()
mIsValidProcessType(IsValidProcessType()) { mIsValidProcessType(IsValidProcessType()) {
if (mIsValidProcessType) { if (mIsValidProcessType) {
FAULTY_LOG("Initializing for new process of type '%s' with pid %u.", FAULTY_LOG("Initializing for new process of type '%s' with pid %u.",
XRE_ChildProcessTypeToString(XRE_GetProcessType()), getpid()); XRE_GeckoProcessTypeToString(XRE_GetProcessType()), getpid());
/* Setup random seed. */ /* Setup random seed. */
const char* userSeed = PR_GetEnv("FAULTY_SEED"); const char* userSeed = PR_GetEnv("FAULTY_SEED");
@ -230,7 +230,7 @@ bool Faulty::IsValidProcessType(void) {
if (!isValidProcessType) { if (!isValidProcessType) {
FAULTY_LOG("Disabled for this process of type '%s' with pid %d.", FAULTY_LOG("Disabled for this process of type '%s' with pid %d.",
XRE_ChildProcessTypeToString(XRE_GetProcessType()), getpid()); XRE_GeckoProcessTypeToString(XRE_GetProcessType()), getpid());
} }
return isValidProcessType; return isValidProcessType;

View File

@ -207,7 +207,7 @@ void StreamSamplesAndMarkers(const char* aName, int aThreadId,
const mozilla::TimeStamp& aUnregisterTime, const mozilla::TimeStamp& aUnregisterTime,
double aSinceTime, UniqueStacks& aUniqueStacks) { double aSinceTime, UniqueStacks& aUniqueStacks) {
aWriter.StringProperty("processType", aWriter.StringProperty("processType",
XRE_ChildProcessTypeToString(XRE_GetProcessType())); XRE_GeckoProcessTypeToString(XRE_GetProcessType()));
aWriter.StringProperty("name", aName); aWriter.StringProperty("name", aName);

View File

@ -438,7 +438,7 @@ NS_DebugBreak(uint32_t aSeverity, const char* aStr, const char* aExpr,
} }
static void Abort(const char* aMsg) { static void Abort(const char* aMsg) {
NoteIntentionalCrash(XRE_ChildProcessTypeToString(XRE_GetProcessType())); NoteIntentionalCrash(XRE_GeckoProcessTypeToString(XRE_GetProcessType()));
mozalloc_abort(aMsg); mozalloc_abort(aMsg);
} }

View File

@ -249,7 +249,7 @@ class BloatEntry {
bool PrintDumpHeader(FILE* aOut, const char* aMsg) { bool PrintDumpHeader(FILE* aOut, const char* aMsg) {
fprintf(aOut, "\n== BloatView: %s, %s process %d\n", aMsg, fprintf(aOut, "\n== BloatView: %s, %s process %d\n", aMsg,
XRE_ChildProcessTypeToString(XRE_GetProcessType()), getpid()); XRE_GeckoProcessTypeToString(XRE_GetProcessType()), getpid());
if (gLogLeaksOnly && !mStats.HaveLeaks()) { if (gLogLeaksOnly && !mStats.HaveLeaks()) {
return false; return false;
} }
@ -507,7 +507,7 @@ static bool InitLog(const EnvCharType* aEnvVar, const char* aMsg,
} }
fname.Append('_'); fname.Append('_');
const char* processType = const char* processType =
XRE_ChildProcessTypeToString(XRE_GetProcessType()); XRE_GeckoProcessTypeToString(XRE_GetProcessType());
fname.AppendASCII(processType); fname.AppendASCII(processType);
fname.AppendLiteral("_pid"); fname.AppendLiteral("_pid");
fname.AppendInt((uint32_t)getpid()); fname.AppendInt((uint32_t)getpid());
@ -827,7 +827,7 @@ static void LogDMDFile() {
} }
const char* logProcessEnv = PR_GetEnv("MOZ_DMD_LOG_PROCESS"); const char* logProcessEnv = PR_GetEnv("MOZ_DMD_LOG_PROCESS");
if (logProcessEnv && !!strcmp(logProcessEnv, XRE_ChildProcessTypeToString( if (logProcessEnv && !!strcmp(logProcessEnv, XRE_GeckoProcessTypeToString(
XRE_GetProcessType()))) { XRE_GetProcessType()))) {
return; return;
} }

View File

@ -380,7 +380,7 @@ static const char* const kGeckoProcessTypeString[] = {
static_assert(MOZ_ARRAY_LENGTH(kGeckoProcessTypeString) == GeckoProcessType_End, static_assert(MOZ_ARRAY_LENGTH(kGeckoProcessTypeString) == GeckoProcessType_End,
"Array length mismatch"); "Array length mismatch");
XRE_API(const char*, XRE_ChildProcessTypeToString, XRE_API(const char*, XRE_GeckoProcessTypeToString,
(GeckoProcessType aProcessType)) (GeckoProcessType aProcessType))
XRE_API(const char*, XRE_ChildProcessTypeToAnnotation, XRE_API(const char*, XRE_ChildProcessTypeToAnnotation,
(GeckoProcessType aProcessType)) (GeckoProcessType aProcessType))