Bug 1390488 - Clean up ifdef indenting and balancing comments, no functional changes. r=froydnj

This function is very large and has many nested ifdefs. Without this cleanup
it was really hard to figure out where all I needed to add code.

MozReview-Commit-ID: IeA0AWW62Mn

--HG--
extra : rebase_source : a8447df42c60da79f1c982111c8f65bd0175f1de
This commit is contained in:
Kartikaya Gupta 2017-09-13 10:17:39 -04:00
parent c96d204fcd
commit 2d2252c7b9

View File

@ -748,7 +748,7 @@ GeckoChildProcessHost::PerformAsyncLaunchInternal(std::vector<std::string>& aExt
// anyway.
newEnvVars["NO_AT_BRIDGE"] = "1";
}
#endif
# endif // defined(MOZ_WIDGET_GTK)
// XPCOM may not be initialized in some subprocesses. We don't want
// to initialize XPCOM just for the directory service, especially
@ -767,14 +767,14 @@ GeckoChildProcessHost::PerformAsyncLaunchInternal(std::vector<std::string>& aExt
new_ld_lib_path.Append("/gtk2:");
new_ld_lib_path.Append(path.get());
}
#endif
# endif // (MOZ_WIDGET_GTK == 3)
if (ld_library_path && *ld_library_path) {
new_ld_lib_path.Append(':');
new_ld_lib_path.Append(ld_library_path);
}
newEnvVars["LD_LIBRARY_PATH"] = new_ld_lib_path.get();
# elif OS_MACOSX
# elif OS_MACOSX // defined(OS_LINUX) || defined(OS_BSD)
newEnvVars["DYLD_LIBRARY_PATH"] = path.get();
// XXX DYLD_INSERT_LIBRARIES should only be set when launching a plugin
// process, and has no effect on other subprocesses (the hooks in
@ -795,9 +795,9 @@ GeckoChildProcessHost::PerformAsyncLaunchInternal(std::vector<std::string>& aExt
interpose.Append(path.get());
interpose.AppendLiteral("/libplugin_child_interpose.dylib");
newEnvVars["DYLD_INSERT_LIBRARIES"] = interpose.get();
# endif // OS_LINUX
# endif // defined(OS_LINUX) || defined(OS_BSD)
}
#endif // OS_LINUX || OS_MACOSX
# endif // defined(OS_LINUX) || defined(OS_MACOSX) || defined(OS_BSD) || defined(OS_SOLARIS)
FilePath exePath;
BinaryPathType pathType = GetPathToBinary(exePath, mProcessType);
@ -821,7 +821,7 @@ GeckoChildProcessHost::PerformAsyncLaunchInternal(std::vector<std::string>& aExt
// isn't retaining a pointer to the nsCString's buffer.
newEnvVars["LD_PRELOAD"] = std::string(preload.get());
}
#endif
# endif // defined(XP_LINUX) && defined(MOZ_SANDBOX)
// remap the IPC socket fd to a well-known int, as the OS does for
// STDOUT_FILENO, for example
@ -878,10 +878,10 @@ GeckoChildProcessHost::PerformAsyncLaunchInternal(std::vector<std::string>& aExt
// "false" == crash reporting disabled
childArgv.push_back("false");
}
# elif defined(MOZ_WIDGET_COCOA)
# elif defined(MOZ_WIDGET_COCOA) // defined(OS_LINUX) || defined(OS_BSD) || defined(OS_SOLARIS)
childArgv.push_back(CrashReporter::GetChildNotificationPipe());
# endif // OS_LINUX || OS_BSD || OS_SOLARIS
#endif
# endif // defined(OS_LINUX) || defined(OS_BSD) || defined(OS_SOLARIS)
# endif // defined(MOZ_CRASHREPORTER)
# if defined(XP_LINUX) && defined(MOZ_SANDBOX)
{
@ -890,7 +890,7 @@ GeckoChildProcessHost::PerformAsyncLaunchInternal(std::vector<std::string>& aExt
->GetClientFileDescriptorMapping(&srcFd, &dstFd);
mFileMap.push_back(std::make_pair(srcFd, dstFd));
}
#endif
# endif // defined(XP_LINUX) && defined(MOZ_SANDBOX)
# ifdef MOZ_WIDGET_COCOA
// Add a mach port to the command line so the child can communicate its
@ -901,17 +901,17 @@ GeckoChildProcessHost::PerformAsyncLaunchInternal(std::vector<std::string>& aExt
std::string mach_connection_name = StringPrintf("org.mozilla.machname.%d",
base::RandInt(0, std::numeric_limits<int>::max()));
childArgv.push_back(mach_connection_name.c_str());
#endif
# endif // MOZ_WIDGET_COCOA
childArgv.push_back(childProcessType);
# if defined(MOZ_WIDGET_ANDROID)
LaunchAndroidService(childProcessType, childArgv, mFileMap, &process);
#else
# else // goes with defined(MOZ_WIDGET_ANDROID)
base::LaunchApp(childArgv, mFileMap,
# if defined(OS_LINUX) || defined(OS_MACOSX) || defined(OS_BSD) || defined(OS_SOLARIS)
newEnvVars, privs,
#endif
# endif // defined(OS_LINUX) || defined(OS_MACOSX) || defined(OS_BSD) || defined(OS_SOLARIS)
false, &process, arch);
# endif // defined(MOZ_WIDGET_ANDROID)
@ -983,10 +983,10 @@ GeckoChildProcessHost::PerformAsyncLaunchInternal(std::vector<std::string>& aExt
SharedMemoryBasic::SetupMachMemory(process, parent_recv_port_memory, parent_recv_port_memory_ack,
parent_send_port_memory, parent_send_port_memory_ack, false);
#endif
# endif // MOZ_WIDGET_COCOA
//--------------------------------------------------
#elif defined(OS_WIN)
#elif defined(OS_WIN) // defined(OS_POSIX)
FilePath exePath;
BinaryPathType pathType = GetPathToBinary(exePath, mProcessType);
@ -1039,7 +1039,7 @@ GeckoChildProcessHost::PerformAsyncLaunchInternal(std::vector<std::string>& aExt
mPrivileges);
shouldSandboxCurrentProcess = true;
}
#endif // MOZ_CONTENT_SANDBOX
# endif // defined(MOZ_CONTENT_SANDBOX)
break;
case GeckoProcessType_Plugin:
if (mSandboxLevel > 0 &&
@ -1092,7 +1092,7 @@ GeckoChildProcessHost::PerformAsyncLaunchInternal(std::vector<std::string>& aExt
mSandboxBroker.AllowReadFile(it->c_str());
}
}
#endif // XP_WIN && MOZ_SANDBOX
# endif // defined(XP_WIN) && defined(MOZ_SANDBOX)
// Add the application directory path (-appdir path)
AddAppDirToCommandLine(cmdLine);
@ -1110,7 +1110,7 @@ GeckoChildProcessHost::PerformAsyncLaunchInternal(std::vector<std::string>& aExt
# if defined(MOZ_CRASHREPORTER)
cmdLine.AppendLooseValue(
UTF8ToWide(CrashReporter::GetChildNotificationPipe()));
#endif
# endif // defined(MOZ_CRASHREPORTER)
// Process type
cmdLine.AppendLooseValue(UTF8ToWide(childProcessType));
@ -1128,7 +1128,7 @@ GeckoChildProcessHost::PerformAsyncLaunchInternal(std::vector<std::string>& aExt
cmdLine.command_line_string().c_str());
}
} else
#endif
# endif // defined(XP_WIN) && defined(MOZ_SANDBOX)
{
base::LaunchApp(cmdLine, false, false, &process);
@ -1142,12 +1142,12 @@ GeckoChildProcessHost::PerformAsyncLaunchInternal(std::vector<std::string>& aExt
NS_WARNING("Failed to add content process as target peer.");
}
}
#endif
# endif // MOZ_SANDBOX
}
#else
#else // goes with defined(OS_POSIX)
# error Sorry
#endif
#endif // defined(OS_POSIX)
if (!process) {
return false;
@ -1157,7 +1157,7 @@ GeckoChildProcessHost::PerformAsyncLaunchInternal(std::vector<std::string>& aExt
// best way to fix that is to refactor this file, hard.
#if defined(MOZ_WIDGET_COCOA)
mChildTask = child_task;
#endif
#endif // defined(MOZ_WIDGET_COCOA)
if (!OpenPrivilegedHandle(base::GetProcId(process))
#ifdef XP_WIN
@ -1169,7 +1169,7 @@ GeckoChildProcessHost::PerformAsyncLaunchInternal(std::vector<std::string>& aExt
PROCESS_QUERY_INFORMATION | PROCESS_VM_READ |
SYNCHRONIZE,
FALSE, 0)
#endif
#endif // XP_WIN
) {
MOZ_CRASH("cannot open handle to child process");
}