Bug 1836890 - Remove uses of chromium's OS_* macros in Gecko code. r=nika,media-playback-reviewers,keeler,gfx-reviewers,emilio,necko-reviewers,kershaw,karlt,jrmuizel

Differential Revision: https://phabricator.services.mozilla.com/D180039
This commit is contained in:
Mike Hommey 2023-06-06 20:00:47 +00:00
Родитель fbc6dc56d3
Коммит 1903893346
19 изменённых файлов: 45 добавлений и 45 удалений

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

@ -829,11 +829,11 @@ void ContentChild::SetProcessName(const nsACString& aName,
const nsACString* aCurrentProfile) {
char* name;
if ((name = PR_GetEnv("MOZ_DEBUG_APP_PROCESS")) && aName.EqualsASCII(name)) {
#ifdef OS_POSIX
#ifdef XP_UNIX
printf_stderr("\n\nCHILDCHILDCHILDCHILD\n [%s] debug me @%d\n\n", name,
getpid());
sleep(30);
#elif defined(OS_WIN)
#elif defined(XP_WIN)
// Windows has a decent JIT debugging story, so NS_DebugBreak does the
// right thing.
NS_DebugBreak(NS_DEBUG_BREAK,
@ -1735,11 +1735,11 @@ mozilla::ipc::IPCResult ContentChild::RecvSetProcessSandbox(
CrashReporter::AnnotateCrashReport(
CrashReporter::Annotation::ContentSandboxEnabled, sandboxEnabled);
# if defined(XP_LINUX) && !defined(OS_ANDROID)
# if defined(XP_LINUX) && !defined(ANDROID)
CrashReporter::AnnotateCrashReport(
CrashReporter::Annotation::ContentSandboxCapabilities,
static_cast<int>(SandboxInfo::Get().AsInteger()));
# endif /* XP_LINUX && !OS_ANDROID */
# endif /* XP_LINUX && !ANDROID */
#endif /* MOZ_SANDBOX */
return IPC_OK();

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

@ -31,7 +31,7 @@ static nsresult GetGREDir(nsIFile** aResult) {
nsresult rv = XRE_GetBinaryPath(getter_AddRefs(current));
NS_ENSURE_SUCCESS(rv, rv);
#ifdef OS_MACOSX
#ifdef XP_DARWIN
// Walk out of [subprocess].app/Contents/MacOS to the real GRE dir
const int depth = 4;
#else
@ -47,7 +47,7 @@ static nsresult GetGREDir(nsIFile** aResult) {
NS_ENSURE_TRUE(current, NS_ERROR_UNEXPECTED);
}
#ifdef OS_MACOSX
#ifdef XP_DARWIN
rv = current->SetNativeLeafName("Resources"_ns);
NS_ENSURE_SUCCESS(rv, rv);
#endif

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

@ -226,7 +226,7 @@ bool GMPChild::GetUTF8LibPath(nsACString& aOutLibPath) {
#if defined(XP_MACOSX)
nsAutoString binaryName = u"lib"_ns + baseName + u".dylib"_ns;
#elif defined(OS_POSIX)
#elif defined(XP_UNIX)
nsAutoString binaryName = u"lib"_ns + baseName + u".so"_ns;
#elif defined(XP_WIN)
nsAutoString binaryName = baseName + u".dll"_ns;

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

@ -19,14 +19,14 @@ GMPProcessChild::~GMPProcessChild() = default;
bool GMPProcessChild::Init(int aArgc, char* aArgv[]) {
nsAutoString pluginFilename;
#if defined(OS_POSIX)
#if defined(XP_UNIX)
// NB: need to be very careful in ensuring that the first arg
// (after the binary name) here is indeed the plugin module path.
// Keep in sync with dom/plugins/PluginModuleParent.
std::vector<std::string> values = CommandLine::ForCurrentProcess()->argv();
MOZ_ASSERT(values.size() >= 2, "not enough args");
CopyUTF8toUTF16(nsDependentCString(values[1].c_str()), pluginFilename);
#elif defined(OS_WIN)
#elif defined(XP_WIN)
std::vector<std::wstring> values =
CommandLine::ForCurrentProcess()->GetLooseValues();
MOZ_ASSERT(values.size() >= 1, "not enough loose args");

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

@ -8,7 +8,7 @@
#include "mozilla/ipc/IOThreadChild.h"
#include "mozilla/GeckoArgs.h"
#if defined(OS_WIN) && defined(MOZ_SANDBOX)
#if defined(XP_WIN) && defined(MOZ_SANDBOX)
# include "mozilla/sandboxTarget.h"
#elif defined(__OpenBSD__) && defined(MOZ_SANDBOX)
# include "mozilla/SandboxSettings.h"
@ -22,7 +22,7 @@ using namespace ipc;
RDDProcessImpl::~RDDProcessImpl() = default;
bool RDDProcessImpl::Init(int aArgc, char* aArgv[]) {
#if defined(MOZ_SANDBOX) && defined(OS_WIN)
#if defined(MOZ_SANDBOX) && defined(XP_WIN)
// Preload AV dlls so we can enable Binary Signature Policy
// to restrict further dll loads.
LoadLibraryW(L"mozavcodec.dll");

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

@ -12,7 +12,7 @@
#include "mozilla/HoldDropJSObjects.h"
#include "mozilla/Preferences.h"
#ifdef OS_WIN
#ifdef XP_WIN
# include "WinWebAuthnManager.h"
#endif
@ -93,7 +93,7 @@ PublicKeyCredential::IsUserVerifyingPlatformAuthenticatorAvailable(
//
// If on latest windows, call system APIs, otherwise return false, as we don't
// have other UVPAAs available at this time.
#ifdef OS_WIN
#ifdef XP_WIN
if (WinWebAuthnManager::IsUserVerifyingPlatformAuthenticatorAvailable()) {
promise->MaybeResolve(true);
@ -129,7 +129,7 @@ PublicKeyCredential::IsExternalCTAP2SecurityKeySupported(GlobalObject& aGlobal,
return nullptr;
}
#ifdef OS_WIN
#ifdef XP_WIN
if (WinWebAuthnManager::AreWebAuthNApisAvailable()) {
promise->MaybeResolve(true);
} else {

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

@ -23,7 +23,7 @@
#include "mozilla/ipc/BackgroundChild.h"
#include "mozilla/ipc/PBackgroundChild.h"
#ifdef OS_WIN
#ifdef XP_WIN
# include "WinWebAuthnManager.h"
#endif
@ -451,7 +451,7 @@ already_AddRefed<Promise> WebAuthnManager::MakeCredential(
adjustedTimeout, excludeList, rpInfo, userInfo, coseAlgos, extensions,
authSelection, attestation, context->Top()->Id());
#ifdef OS_WIN
#ifdef XP_WIN
if (!WinWebAuthnManager::AreWebAuthNApisAvailable()) {
ListenForVisibilityEvents();
}
@ -658,7 +658,7 @@ already_AddRefed<Promise> WebAuthnManager::GetAssertion(
extensions, aOptions.mUserVerification,
context->Top()->Id());
#ifdef OS_WIN
#ifdef XP_WIN
if (!WinWebAuthnManager::AreWebAuthNApisAvailable()) {
ListenForVisibilityEvents();
}

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

@ -13,7 +13,7 @@
#include "nsThreadUtils.h"
#ifdef OS_WIN
#ifdef XP_WIN
# include "WinWebAuthnManager.h"
#endif
@ -24,7 +24,7 @@ mozilla::ipc::IPCResult WebAuthnTransactionParent::RecvRequestRegister(
const WebAuthnMakeCredentialInfo& aTransactionInfo) {
::mozilla::ipc::AssertIsOnBackgroundThread();
#ifdef OS_WIN
#ifdef XP_WIN
if (WinWebAuthnManager::AreWebAuthNApisAvailable()) {
WinWebAuthnManager* mgr = WinWebAuthnManager::Get();
mgr->Register(this, aTransactionId, aTransactionInfo);
@ -51,7 +51,7 @@ mozilla::ipc::IPCResult WebAuthnTransactionParent::RecvRequestSign(
const WebAuthnGetAssertionInfo& aTransactionInfo) {
::mozilla::ipc::AssertIsOnBackgroundThread();
#ifdef OS_WIN
#ifdef XP_WIN
if (WinWebAuthnManager::AreWebAuthNApisAvailable()) {
WinWebAuthnManager* mgr = WinWebAuthnManager::Get();
mgr->Sign(this, aTransactionId, aTransactionInfo);
@ -77,7 +77,7 @@ mozilla::ipc::IPCResult WebAuthnTransactionParent::RecvRequestCancel(
const Tainted<uint64_t>& aTransactionId) {
::mozilla::ipc::AssertIsOnBackgroundThread();
#ifdef OS_WIN
#ifdef XP_WIN
if (WinWebAuthnManager::AreWebAuthNApisAvailable()) {
WinWebAuthnManager* mgr = WinWebAuthnManager::Get();
mgr->Cancel(this, aTransactionId);
@ -124,7 +124,7 @@ void WebAuthnTransactionParent::ActorDestroy(ActorDestroyReason aWhy) {
// Called either by Send__delete__() in RecvDestroyMe() above, or when
// the channel disconnects. Ensure the token manager forgets about us.
#ifdef OS_WIN
#ifdef XP_WIN
if (WinWebAuthnManager::AreWebAuthNApisAvailable()) {
WinWebAuthnManager* mgr = WinWebAuthnManager::Get();
if (mgr) {

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

@ -9,7 +9,7 @@
#include "mozilla/ipc/ProcessUtils.h"
#include "mozilla/GeckoArgs.h"
#if defined(OS_WIN) && defined(MOZ_SANDBOX)
#if defined(XP_WIN) && defined(MOZ_SANDBOX)
# include "mozilla/sandboxTarget.h"
#elif defined(__OpenBSD__) && defined(MOZ_SANDBOX)
# include "mozilla/SandboxSettings.h"
@ -23,7 +23,7 @@ using namespace ipc;
GPUProcessImpl::~GPUProcessImpl() = default;
bool GPUProcessImpl::Init(int aArgc, char* aArgv[]) {
#if defined(MOZ_SANDBOX) && defined(OS_WIN)
#if defined(MOZ_SANDBOX) && defined(XP_WIN)
mozilla::SandboxTarget::Instance()->StartSandbox();
#elif defined(__OpenBSD__) && defined(MOZ_SANDBOX)
StartOpenBSDSandbox(GeckoProcessType_GPU);

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

@ -26,7 +26,7 @@ void HostIPCAllocator::SendPendingAsyncMessages() {
// Some type of AsyncParentMessageData message could have
// one file descriptor (e.g. OpDeliverFence).
// A number of file descriptors per gecko ipc message have a limitation
// on OS_POSIX (MACOSX or LINUX).
// on XP_UNIX (MACOSX or LINUX).
static const uint32_t kMaxMessageNumber =
IPC::Message::MAX_DESCRIPTORS_PER_MESSAGE;

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

@ -35,7 +35,7 @@
#include "mozilla/layers/TextureHost.h"
#include "nsThreadUtils.h"
#if defined(OS_WIN)
#if defined(XP_WIN)
# include "mozilla/layers/TextureD3D11.h"
#endif

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

@ -107,7 +107,7 @@
#include "mozilla/dom/WebIDLGlobalNameHash.h"
#include "mozilla/dom/U2FTokenManager.h"
#include "mozilla/dom/WebAuthnController.h"
#ifdef OS_WIN
#ifdef XP_WIN
# include "mozilla/dom/WinWebAuthnManager.h"
#endif
#include "mozilla/dom/PointerEventHandler.h"
@ -265,7 +265,7 @@ nsresult nsLayoutStatics::Initialize() {
mozilla::dom::U2FTokenManager::Initialize();
mozilla::dom::WebAuthnController::Initialize();
#ifdef OS_WIN
#ifdef XP_WIN
mozilla::dom::WinWebAuthnManager::Initialize();
#endif

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

@ -14,14 +14,14 @@
#include "mozilla/ipc/ProcessUtils.h"
#include "mozilla/ipc/IOThreadChild.h"
#if defined(OS_WIN) && defined(MOZ_SANDBOX)
#if defined(XP_WIN) && defined(MOZ_SANDBOX)
# include "mozilla/sandboxTarget.h"
#elif defined(__OpenBSD__) && defined(MOZ_SANDBOX)
# include "mozilla/SandboxSettings.h"
# include "prlink.h"
#endif
#ifdef OS_POSIX
#ifdef XP_UNIX
# include <unistd.h> // For sleep().
#endif
@ -35,14 +35,14 @@ LazyLogModule gSocketProcessLog("socketprocess");
SocketProcessImpl::~SocketProcessImpl() = default;
bool SocketProcessImpl::Init(int aArgc, char* aArgv[]) {
#ifdef OS_POSIX
#ifdef XP_UNIX
if (PR_GetEnv("MOZ_DEBUG_SOCKET_PROCESS")) {
printf_stderr("\n\nSOCKETPROCESSnSOCKETPROCESS\n debug me @ %d\n\n",
base::GetCurrentProcId());
sleep(30);
}
#endif
#if defined(MOZ_SANDBOX) && defined(OS_WIN)
#if defined(MOZ_SANDBOX) && defined(XP_WIN)
LoadLibraryW(L"nss3.dll");
LoadLibraryW(L"softokn3.dll");
LoadLibraryW(L"freebl3.dll");

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

@ -15,7 +15,7 @@
#include "common/using_std_string.h"
#include "processor/logging.h"
#if defined(OS_ANDROID) && !defined(__LP64__)
#if defined(ANDROID) && !defined(__LP64__)
// In 32-bit mode, Bionic's inttypes.h defines PRI/SCNxPTR as an
// unsigned long int, which is incompatible with Bionic's stdint.h
// defining uintptr_t as an unsigned int:

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

@ -5925,7 +5925,7 @@ int XRE_main(int argc, char* argv[], const BootstrapConfig& aConfig) {
nsresult XRE_InitCommandLine(int aArgc, char* aArgv[]) {
nsresult rv = NS_OK;
#if defined(OS_WIN)
#if defined(XP_WIN)
CommandLine::Init(aArgc, aArgv);
#else

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

@ -226,15 +226,15 @@ int GetDebugChildPauseTime() {
if (pauseStr && *pauseStr) {
int pause = atoi(pauseStr);
if (pause != 1) { // must be !=1 since =1 enables the default pause time
#if defined(OS_WIN)
#if defined(XP_WIN)
pause *= 1000; // convert to ms
#endif
return pause;
}
}
#ifdef OS_POSIX
#ifdef XP_UNIX
return 30; // seconds
#elif defined(OS_WIN)
#elif defined(XP_WIN)
return 10000; // milliseconds
#else
return 0;
@ -432,7 +432,7 @@ nsresult XRE_InitChildProcess(int aArgc, char* aArgv[],
g_set_prgname(aArgv[0]);
#endif
#ifdef OS_POSIX
#ifdef XP_UNIX
if (PR_GetEnv("MOZ_DEBUG_CHILD_PROCESS") ||
PR_GetEnv("MOZ_DEBUG_CHILD_PAUSE")) {
# if defined(XP_LINUX) && defined(DEBUG)
@ -445,7 +445,7 @@ nsresult XRE_InitChildProcess(int aArgc, char* aArgv[],
XRE_GetProcessTypeString(), base::GetCurrentProcId());
sleep(GetDebugChildPauseTime());
}
#elif defined(OS_WIN)
#elif defined(XP_WIN)
if (PR_GetEnv("MOZ_DEBUG_CHILD_PROCESS")) {
NS_DebugBreak(NS_DEBUG_BREAK,
"Invoking NS_DebugBreak() to debug child process", nullptr,

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

@ -608,7 +608,7 @@ WidgetWheelEvent PinchGestureInput::ToWidgetEvent(nsIWidget* aWidget) const {
}
double PinchGestureInput::ComputeDeltaY(nsIWidget* aWidget) const {
#if defined(OS_MACOSX)
#if defined(XP_DARWIN)
// This converts the pinch gesture value to a fake wheel event that has the
// control key pressed so that pages can implement custom pinch gesture
// handling. It may seem strange that this doesn't use a wheel event with

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

@ -199,7 +199,7 @@ bool LimitFileToLessThanSize(const char* aFilename, uint32_t aSize,
ScopedCloseFile temp;
#if defined(OS_WIN)
#if defined(XP_WIN)
// This approach was cribbed from
// https://searchfox.org/mozilla-central/rev/868935867c6241e1302e64cf9be8f56db0fd0d1c/xpcom/build/LateWriteChecks.cpp#158.
HANDLE hFile;
@ -222,7 +222,7 @@ bool LimitFileToLessThanSize(const char* aFilename, uint32_t aSize,
}
temp.reset(_fdopen(fd, "ab"));
#elif defined(OS_POSIX)
#elif defined(XP_UNIX)
// Coverity would prefer us to set a secure umask before using `mkstemp`.
// However, the umask is process-wide, so setting it may lead to difficult
@ -273,13 +273,13 @@ bool LimitFileToLessThanSize(const char* aFilename, uint32_t aSize,
return false;
}
#if defined(OS_WIN)
#if defined(XP_WIN)
if (!::ReplaceFileA(aFilename, tempFilename, nullptr, 0, 0, 0)) {
NS_WARNING(
nsPrintfCString("ReplaceFileA failed: %lu\n", GetLastError()).get());
return false;
}
#elif defined(OS_POSIX)
#elif defined(XP_UNIX)
if (rename(tempFilename, aFilename)) {
NS_WARNING(
nsPrintfCString("rename failed: %s (%d)\n", strerror(errno), errno)

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

@ -359,7 +359,7 @@ NS_InitXPCOM(nsIServiceManager** aResult, nsIFile* aBinDirectory,
}
if ((sCommandLineWasInitialized = !CommandLine::IsInitialized())) {
#ifdef OS_WIN
#ifdef XP_WIN
CommandLine::Init(0, nullptr);
#else
nsCOMPtr<nsIFile> binaryFile;