Bug 1835185 - Replace OS_WIN with XP_WIN in ipc code. r=ipc-reviewers,mccr8

Differential Revision: https://phabricator.services.mozilla.com/D180044
This commit is contained in:
Mike Hommey 2023-06-06 21:05:31 +00:00
parent eb02cb32ad
commit 30c664bf9c
41 changed files with 122 additions and 122 deletions

View file

@ -40,7 +40,7 @@ const int64_t kint64max = ((int64_t)GG_LONGLONG(0x7FFFFFFFFFFFFFFF));
# define PRId64L "I64d"
# define PRIu64L "I64u"
# define PRIx64L "I64x"
#elif defined(OS_WIN)
#elif defined(XP_WIN)
# define PRId64L L"I64d"
# define PRIu64L L"I64u"
# define PRIx64L L"I64x"

View file

@ -6,7 +6,7 @@
#include "base/command_line.h"
#if defined(OS_WIN)
#if defined(XP_WIN)
# include <windows.h>
# include <shellapi.h>
# include "mozilla/DynamicallyLinkedFunctionPtr.h"
@ -23,7 +23,7 @@ CommandLine* CommandLine::current_process_commandline_ = NULL;
// Since we use a lazy match, make sure that longer versions (like L"--")
// are listed before shorter versions (like L"-") of similar prefixes.
#if defined(OS_WIN)
#if defined(XP_WIN)
const wchar_t* const kSwitchPrefixes[] = {L"--", L"-", L"/"};
const wchar_t kSwitchTerminator[] = L"--";
const wchar_t kSwitchValueSeparator[] = L"=";
@ -34,7 +34,7 @@ const char kSwitchTerminator[] = "--";
const char kSwitchValueSeparator[] = "=";
#endif
#if defined(OS_WIN)
#if defined(XP_WIN)
// Lowercase a string. This is used to lowercase switch names.
// Is this what we really want? It seems crazy to me. I've left it in
// for backwards compatibility on Windows.
@ -43,7 +43,7 @@ static void Lowercase(std::wstring* parameter) {
}
#endif
#if defined(OS_WIN)
#if defined(XP_WIN)
void CommandLine::ParseFromString(const std::wstring& command_line) {
TrimWhitespace(command_line, TRIM_ALL, &command_line_string_);
@ -159,7 +159,7 @@ bool CommandLine::IsSwitch(const StringType& parameter_string,
parameter_string.substr(switch_start, equals_position - switch_start);
*switch_value = parameter_string.substr(equals_position + 1);
}
#if defined(OS_WIN)
#if defined(XP_WIN)
Lowercase(&switch_native);
*switch_string = WideToASCII(switch_native);
#else
@ -175,7 +175,7 @@ bool CommandLine::IsSwitch(const StringType& parameter_string,
// static
void CommandLine::Init(int argc, const char* const* argv) {
DCHECK(current_process_commandline_ == NULL);
#if defined(OS_WIN)
#if defined(XP_WIN)
current_process_commandline_ = new CommandLine;
current_process_commandline_->ParseFromString(::GetCommandLineW());
#elif defined(XP_UNIX)
@ -191,7 +191,7 @@ void CommandLine::Terminate() {
bool CommandLine::HasSwitch(const std::wstring& switch_string) const {
std::wstring lowercased_switch(switch_string);
#if defined(OS_WIN)
#if defined(XP_WIN)
Lowercase(&lowercased_switch);
#endif
return switches_.find(WideToASCII(lowercased_switch)) != switches_.end();
@ -200,7 +200,7 @@ bool CommandLine::HasSwitch(const std::wstring& switch_string) const {
std::wstring CommandLine::GetSwitchValue(
const std::wstring& switch_string) const {
std::wstring lowercased_switch(switch_string);
#if defined(OS_WIN)
#if defined(XP_WIN)
Lowercase(&lowercased_switch);
#endif
@ -210,7 +210,7 @@ std::wstring CommandLine::GetSwitchValue(
if (result == switches_.end()) {
return L"";
} else {
#if defined(OS_WIN)
#if defined(XP_WIN)
return result->second;
#else
return ASCIIToWide(result->second);
@ -218,7 +218,7 @@ std::wstring CommandLine::GetSwitchValue(
}
}
#if defined(OS_WIN)
#if defined(XP_WIN)
std::vector<std::wstring> CommandLine::GetLooseValues() const {
return loose_values_;
}
@ -254,7 +254,7 @@ std::wstring CommandLine::PrefixedSwitchStringWithValue(
value_string.c_str());
}
#if defined(OS_WIN)
#if defined(XP_WIN)
void CommandLine::AppendSwitch(const std::wstring& switch_string) {
std::wstring prefixed_switch_string = PrefixedSwitchString(switch_string);
command_line_string_.append(L" ");

View file

@ -32,7 +32,7 @@ class InProcessBrowserTest;
class CommandLine {
public:
#if defined(OS_WIN)
#if defined(XP_WIN)
// Creates a parsed version of the given command-line string.
// The program name is assumed to be the first item in the string.
void ParseFromString(const std::wstring& command_line);
@ -82,7 +82,7 @@ class CommandLine {
// WARNING: this is incorrect on POSIX; we must do string conversions.
std::vector<std::wstring> GetLooseValues() const;
#if defined(OS_WIN)
#if defined(XP_WIN)
// Returns the original command line string.
const std::wstring& command_line_string() const {
return command_line_string_;
@ -116,7 +116,7 @@ class CommandLine {
// Append a loose value to the command line.
void AppendLooseValue(const std::wstring& value);
#if defined(OS_WIN)
#if defined(XP_WIN)
void AppendLooseValue(const wchar_t* value) {
AppendLooseValue(std::wstring(value));
}
@ -148,7 +148,7 @@ class CommandLine {
// We store a platform-native version of the command line, used when building
// up a new command line to be executed. This ifdef delimits that code.
#if defined(OS_WIN)
#if defined(XP_WIN)
// The quoted, space-separated command-line string.
std::wstring command_line_string_;

View file

@ -75,7 +75,7 @@
# include <pthread.h>
#endif
#if defined(OS_WIN)
#if defined(XP_WIN)
# include <windows.h>
#endif
@ -103,7 +103,7 @@ class ConditionVariable {
void Signal();
private:
#if defined(OS_WIN)
#if defined(XP_WIN)
CONDITION_VARIABLE cv_;
SRWLOCK* const srwlock_;
#elif defined(XP_UNIX)

View file

@ -244,7 +244,7 @@ FilePath FilePath::Append(const FilePath& component) const {
FilePath FilePath::AppendASCII(const std::string& component) const {
DCHECK(IsStringASCII(component));
#if defined(OS_WIN)
#if defined(XP_WIN)
return Append(ASCIIToWide(component));
#elif defined(XP_UNIX)
return Append(component);
@ -266,7 +266,7 @@ FilePath FilePath::FromWStringHack(const std::wstring& wstring) {
std::wstring FilePath::ToWStringHack() const {
return base::SysNativeMBToWide(path_);
}
#elif defined(OS_WIN)
#elif defined(XP_WIN)
// static
FilePath FilePath::FromWStringHack(const std::wstring& wstring) {
return FilePath(wstring);

View file

@ -76,10 +76,10 @@
// enabled and disabled independently, to aid testing. These #defines are
// here so that the same setting can be used in both the implementation and
// in the unit test.
#if defined(OS_WIN)
#if defined(XP_WIN)
# define FILE_PATH_USES_DRIVE_LETTERS
# define FILE_PATH_USES_WIN_SEPARATORS
#endif // OS_WIN
#endif // XP_WIN
// An abstraction to isolate users from the differences between native
// pathnames on different platforms.
@ -90,11 +90,11 @@ class FilePath {
// may or may not be specified. On Mac OS X, native pathnames are encoded
// in UTF-8.
typedef std::string StringType;
#elif defined(OS_WIN)
#elif defined(XP_WIN)
// On Windows, for Unicode-aware applications, native pathnames are wchar_t
// arrays encoded in UTF-16.
typedef std::wstring StringType;
#endif // OS_WIN
#endif // XP_WIN
typedef StringType::value_type CharType;
@ -117,7 +117,7 @@ class FilePath {
FilePath(const FilePath& that) : path_(that.path_) {}
explicit FilePath(const StringType& path) : path_(path) {}
#if defined(OS_WIN)
#if defined(XP_WIN)
explicit FilePath(const wchar_t* path) : path_(path) {}
#endif
@ -241,8 +241,8 @@ class FilePath {
// Macros for string literal initialization of FilePath::CharType[].
#if defined(XP_UNIX)
# define FILE_PATH_LITERAL(x) x
#elif defined(OS_WIN)
#elif defined(XP_WIN)
# define FILE_PATH_LITERAL(x) L##x
#endif // OS_WIN
#endif // XP_WIN
#endif // BASE_FILE_PATH_H_

View file

@ -37,7 +37,7 @@ class Lock {
// POSIX mitigates priority inversion by setting the priority of a thread
// holding a Lock to the maximum priority of any other thread waiting on it.
return base::internal::LockImpl::PriorityInheritanceAvailable();
#elif defined(OS_WIN)
#elif defined(XP_WIN)
// Windows mitigates priority inversion by randomly boosting the priority of
// ready threads.
// https://msdn.microsoft.com/library/windows/desktop/ms684831.aspx
@ -47,7 +47,7 @@ class Lock {
#endif
}
#if defined(XP_UNIX) || defined(OS_WIN)
#if defined(XP_UNIX) || defined(XP_WIN)
// Both Windows and POSIX implementations of ConditionVariable need to be
// able to see our lock and tweak our debugging counters, as they release and
// acquire locks inside of their condition variable APIs.

View file

@ -10,7 +10,7 @@
#include "base/basictypes.h"
#include "build/build_config.h"
#if defined(OS_WIN)
#if defined(XP_WIN)
# include <windows.h>
#elif defined(XP_UNIX)
# include <pthread.h>
@ -24,7 +24,7 @@ namespace internal {
// should instead use Lock.
class LockImpl {
public:
#if defined(OS_WIN)
#if defined(XP_WIN)
using NativeHandle = SRWLOCK;
#elif defined(XP_UNIX)
using NativeHandle = pthread_mutex_t;

View file

@ -52,7 +52,7 @@ static base::ThreadLocalPointer<MessageLoop>& get_tls_ptr() {
//------------------------------------------------------------------------------
#if defined(OS_WIN)
#if defined(XP_WIN)
// Upon a SEH exception in this thread, it restores the original unhandled
// exception filter.
@ -70,7 +70,7 @@ static LPTOP_LEVEL_EXCEPTION_FILTER GetTopSEHFilter() {
return top_filter;
}
#endif // defined(OS_WIN)
#endif // defined(XP_WIN)
//------------------------------------------------------------------------------
@ -220,9 +220,9 @@ MessageLoop::MessageLoop(Type type, nsISerialEventTarget* aEventTarget)
state_(NULL),
run_depth_base_(1),
shutting_down_(false),
#ifdef OS_WIN
#ifdef XP_WIN
os_modal_loop_(false),
#endif // OS_WIN
#endif // XP_WIN
transient_hang_timeout_(0),
permanent_hang_timeout_(0),
next_sequence_num_(0) {
@ -250,7 +250,7 @@ MessageLoop::MessageLoop(Type type, nsISerialEventTarget* aEventTarget)
case TYPE_MOZILLA_NONMAINTHREAD:
pump_ = new mozilla::ipc::MessagePumpForNonMainThreads(aEventTarget);
return;
#if defined(OS_WIN) || defined(OS_MACOSX)
#if defined(XP_WIN) || defined(OS_MACOSX)
case TYPE_MOZILLA_NONMAINUITHREAD:
pump_ = new mozilla::ipc::MessagePumpForNonMainUIThreads(aEventTarget);
return;
@ -265,7 +265,7 @@ MessageLoop::MessageLoop(Type type, nsISerialEventTarget* aEventTarget)
break;
}
#if defined(OS_WIN)
#if defined(XP_WIN)
// TODO(rvargas): Get rid of the OS guards.
if (type_ == TYPE_DEFAULT) {
pump_ = new base::MessagePumpDefault();
@ -349,7 +349,7 @@ void MessageLoop::Run() {
// enable_SEH_restoration_ = true : any unhandled exception goes to the filter
// that was existed before the loop was run.
void MessageLoop::RunHandler() {
#if defined(OS_WIN)
#if defined(XP_WIN)
if (exception_restoration_) {
LPTOP_LEVEL_EXCEPTION_FILTER current_filter = GetTopSEHFilter();
MOZ_SEH_TRY { RunInternal(); }
@ -627,7 +627,7 @@ MessageLoop::AutoRunState::AutoRunState(MessageLoop* loop) : loop_(loop) {
// Initialize the other fields:
quit_received = false;
#if defined(OS_WIN)
#if defined(XP_WIN)
dispatcher = NULL;
#endif
}
@ -664,7 +664,7 @@ nsISerialEventTarget* MessageLoop::SerialEventTarget() { return mEventTarget; }
//------------------------------------------------------------------------------
// MessageLoopForUI
#if defined(OS_WIN)
#if defined(XP_WIN)
void MessageLoopForUI::Run(Dispatcher* dispatcher) {
AutoRunState save_state(this);
@ -690,12 +690,12 @@ void MessageLoopForUI::PumpOutPendingPaintMessages() {
pump_ui()->PumpOutPendingPaintMessages();
}
#endif // defined(OS_WIN)
#endif // defined(XP_WIN)
//------------------------------------------------------------------------------
// MessageLoopForIO
#if defined(OS_WIN)
#if defined(XP_WIN)
void MessageLoopForIO::RegisterIOHandler(HANDLE file, IOHandler* handler) {
pump_io()->RegisterIOHandler(file, handler);

View file

@ -18,7 +18,7 @@
#include "mozilla/Mutex.h"
#if defined(OS_WIN)
#if defined(XP_WIN)
// We need this to declare base::MessagePumpWin::Dispatcher, which we should
// really just eliminate.
# include "base/message_pump_win.h"
@ -247,11 +247,11 @@ class MessageLoop : public base::MessagePump::Delegate {
exception_restoration_ = restore;
}
#if defined(OS_WIN)
#if defined(XP_WIN)
void set_os_modal_loop(bool os_modal_loop) { os_modal_loop_ = os_modal_loop; }
bool& os_modal_loop() { return os_modal_loop_; }
#endif // OS_WIN
#endif // XP_WIN
// Set the timeouts for background hang monitoring.
// A value of 0 indicates there is no timeout.
@ -273,7 +273,7 @@ class MessageLoop : public base::MessagePump::Delegate {
// once it becomes idle.
bool quit_received;
#if defined(OS_WIN)
#if defined(XP_WIN)
base::MessagePumpWin::Dispatcher* dispatcher;
#endif
};
@ -325,7 +325,7 @@ class MessageLoop : public base::MessagePump::Delegate {
typedef std::queue<PendingTask> TaskQueue;
typedef std::priority_queue<PendingTask> DelayedTaskQueue;
#if defined(OS_WIN)
#if defined(XP_WIN)
base::MessagePumpWin* pump_win() {
return static_cast<base::MessagePumpWin*>(pump_.get());
}
@ -428,7 +428,7 @@ class MessageLoop : public base::MessagePump::Delegate {
int run_depth_base_;
bool shutting_down_;
#if defined(OS_WIN)
#if defined(XP_WIN)
// Should be set to true before calling Windows APIs like TrackPopupMenu, etc
// which enter a modal message loop.
bool os_modal_loop_;
@ -469,7 +469,7 @@ class MessageLoopForUI : public MessageLoop {
return static_cast<MessageLoopForUI*>(loop);
}
#if defined(OS_WIN)
#if defined(XP_WIN)
typedef base::MessagePumpWin::Dispatcher Dispatcher;
typedef base::MessagePumpWin::Observer Observer;
@ -486,7 +486,7 @@ class MessageLoopForUI : public MessageLoop {
base::MessagePumpForUI* pump_ui() {
return static_cast<base::MessagePumpForUI*>(pump_.get());
}
#endif // defined(OS_WIN)
#endif // defined(XP_WIN)
};
// Do not add any member variables to MessageLoopForUI! This is important b/c
@ -513,7 +513,7 @@ class MessageLoopForIO : public MessageLoop {
return static_cast<MessageLoopForIO*>(loop);
}
#if defined(OS_WIN)
#if defined(XP_WIN)
typedef base::MessagePumpForIO::IOHandler IOHandler;
typedef base::MessagePumpForIO::IOContext IOContext;

View file

@ -8,7 +8,7 @@
#define BASE_PLATFORM_FILE_H_
#include "build/build_config.h"
#if defined(OS_WIN)
#if defined(XP_WIN)
# include <windows.h>
#endif
@ -16,7 +16,7 @@
namespace base {
#if defined(OS_WIN)
#if defined(XP_WIN)
typedef HANDLE PlatformFile;
const PlatformFile kInvalidPlatformFileValue = INVALID_HANDLE_VALUE;
#elif defined(XP_UNIX)

View file

@ -17,7 +17,7 @@
// standard intends to allow pthread_t to be a structure. This means you
// should not initialize it to a value, like 0. If it's a member variable, the
// constructor can safely "value initialize" using () in the initializer list.
#if defined(OS_WIN)
#if defined(XP_WIN)
# include <windows.h>
typedef DWORD PlatformThreadId;
typedef void* PlatformThreadHandle; // HANDLE

View file

@ -56,7 +56,7 @@ namespace base {
} // namespace base
// Define an OS-neutral wrapper for shared library entry points
#if defined(OS_WIN)
#if defined(XP_WIN)
# define API_CALL __stdcall
#elif defined(OS_LINUX) || defined(OS_MACOSX)
# define API_CALL

View file

@ -10,7 +10,7 @@
#include "base/basictypes.h"
#include <sys/types.h>
#ifdef OS_WIN
#ifdef XP_WIN
# include <windows.h>
#endif
@ -19,7 +19,7 @@ namespace base {
// ProcessHandle is a platform specific type which represents the underlying OS
// handle to a process.
// ProcessId is a number which identifies the process in the OS.
#if defined(OS_WIN)
#if defined(XP_WIN)
typedef HANDLE ProcessHandle;
typedef DWORD ProcessId;
// inttypes.h-like macro for ProcessId formatting.

View file

@ -12,7 +12,7 @@
#include "base/basictypes.h"
#if defined(OS_WIN)
#if defined(XP_WIN)
# include "mozilla/ipc/EnvironmentMap.h"
# include <windows.h>
# include <tlhelp32.h>
@ -128,7 +128,7 @@ struct LaunchOptions {
// immediately.
bool wait = false;
#if defined(OS_WIN)
#if defined(XP_WIN)
bool start_hidden = false;
// Start as an independent process rather than a process that is closed by the
@ -188,7 +188,7 @@ struct LaunchOptions {
#endif // OS_MACOSX
};
#if defined(OS_WIN)
#if defined(XP_WIN)
// Runs the given application name with the given command line. Normally, the
// first command line argument should be the path to the process, and don't
// forget to quote it.
@ -314,7 +314,7 @@ class EnvironmentLog {
private:
explicit EnvironmentLog(const char* varname, size_t len);
#if defined(OS_WIN)
#if defined(XP_WIN)
std::wstring fname_;
#else
std::string fname_;
@ -330,7 +330,7 @@ typedef std::tuple<mozilla::ipc::FileDescriptor, int> FdMapping;
} // namespace mozilla
#if defined(OS_WIN)
#if defined(XP_WIN)
// Undo the windows.h damage
# undef GetMessage
# undef CreateEvent

View file

@ -7,7 +7,7 @@
#ifndef BASE_SCOPED_BSTR_WIN_H_
#define BASE_SCOPED_BSTR_WIN_H_
#include "base/basictypes.h" // needed to pick up OS_WIN
#include "base/basictypes.h" // needed to pick up XP_WIN
#include "base/logging.h"

View file

@ -11,7 +11,7 @@
#include "base/basictypes.h"
#if defined(OS_WIN)
#if defined(XP_WIN)
# include "base/scoped_handle_win.h"
#endif

View file

@ -180,7 +180,7 @@ class SharedMemory {
UniqueMapping memory_;
size_t max_size_ = 0;
mozilla::UniqueFileHandle mapped_file_;
#if defined(OS_WIN)
#if defined(XP_WIN)
// If true indicates this came from an external source so needs extra checks
// before being mapped.
bool external_section_ = false;

View file

@ -138,7 +138,7 @@ class StringToInt64Traits {
static const int kBase = 10;
static inline value_type convert_func(const string_type::value_type* str,
string_type::value_type** endptr) {
#ifdef OS_WIN
#ifdef XP_WIN
return _strtoi64(str, endptr, kBase);
#else // assume XP_UNIX
return strtoll(str, endptr, kBase);
@ -156,7 +156,7 @@ class String16ToInt64Traits {
static const int kBase = 10;
static inline value_type convert_func(const string_type::value_type* str,
string_type::value_type** endptr) {
#ifdef OS_WIN
#ifdef XP_WIN
return _wcstoi64(str, endptr, kBase);
#else // assume XP_UNIX
std::string ascii_string = UTF16ToASCII(string16(str));
@ -355,7 +355,7 @@ static void StringAppendVT(StringType* dst,
va_list backup_ap;
base_va_copy(backup_ap, ap);
#if !defined(OS_WIN)
#if !defined(XP_WIN)
errno = 0;
#endif
int result = vsnprintfT(stack_buf, arraysize(stack_buf), format, backup_ap);
@ -371,7 +371,7 @@ static void StringAppendVT(StringType* dst,
int mem_length = arraysize(stack_buf);
while (true) {
if (result < 0) {
#if !defined(OS_WIN)
#if !defined(XP_WIN)
// On Windows, vsnprintfT always returns the number of characters in a
// fully-formatted string, so if we reach this point, something else is
// wrong and no amount of buffer-doubling is going to fix it.

View file

@ -102,7 +102,7 @@ bool IsWprintfFormatPortable(const wchar_t* format);
} // namespace base
#if defined(OS_WIN)
#if defined(XP_WIN)
# include "base/string_util_win.h"
#elif defined(XP_UNIX)
# include "base/string_util_posix.h"

View file

@ -52,7 +52,7 @@
#include "base/basictypes.h"
#if defined(OS_WIN)
#if defined(XP_WIN)
# include <windows.h>
#elif defined(XP_UNIX)
# include <pthread.h>
@ -62,7 +62,7 @@ namespace base {
// Helper functions that abstract the cross-platform APIs. Do not use directly.
struct ThreadLocalPlatform {
#if defined(OS_WIN)
#if defined(XP_WIN)
typedef DWORD SlotType;
#elif defined(XP_UNIX)
typedef pthread_key_t SlotType;

View file

@ -56,7 +56,7 @@ class ThreadLocalStorage {
private:
// The internals of this struct should be considered private.
bool initialized_;
#if defined(OS_WIN)
#if defined(XP_WIN)
int slot_;
#elif defined(XP_UNIX)
pthread_key_t key_;
@ -65,7 +65,7 @@ class ThreadLocalStorage {
DISALLOW_COPY_AND_ASSIGN(Slot);
};
#if defined(OS_WIN)
#if defined(XP_WIN)
// Function called when on thread exit to call TLS
// destructor functions. This function is used internally.
static void ThreadExit();
@ -83,7 +83,7 @@ class ThreadLocalStorage {
static long tls_key_;
static long tls_max_;
static TLSDestructorFunc tls_destructors_[kThreadLocalStorageSize];
#endif // OS_WIN
#endif // XP_WIN
DISALLOW_COPY_AND_ASSIGN(ThreadLocalStorage);
};

View file

@ -9,7 +9,7 @@
#include "base/basictypes.h"
#if defined(OS_WIN)
#if defined(XP_WIN)
# include <windows.h>
#endif
@ -75,7 +75,7 @@ class WaitableEvent {
// does not necessarily mean that max_time was exceeded.
bool TimedWait(const TimeDelta& max_time);
#if defined(OS_WIN)
#if defined(XP_WIN)
HANDLE handle() const { return handle_; }
#endif
@ -121,7 +121,7 @@ class WaitableEvent {
private:
friend class WaitableEventWatcher;
#if defined(OS_WIN)
#if defined(XP_WIN)
HANDLE handle_;
#else
// On Windows, one can close a HANDLE which is currently being waited on. The

View file

@ -28,7 +28,7 @@ bool ChildProcessHost::CreateChannel() {
channel_id_ = IPC::Channel::GenerateVerifiedChannelID();
channel_.reset(
new IPC::Channel(channel_id_, IPC::Channel::MODE_SERVER, &listener_));
#if defined(OS_WIN)
#if defined(XP_WIN)
channel_->StartAcceptingHandles(IPC::Channel::MODE_SERVER);
#elif defined(OS_MACOSX)
channel_->StartAcceptingMachPorts(IPC::Channel::MODE_SERVER);

View file

@ -31,7 +31,7 @@ ChildThread* ChildThread::current() {
void ChildThread::Init() {
auto channel = mozilla::MakeUnique<IPC::Channel>(
channel_name_, IPC::Channel::MODE_CLIENT, nullptr);
#if defined(OS_WIN)
#if defined(XP_WIN)
channel->StartAcceptingHandles(IPC::Channel::MODE_CLIENT);
#elif defined(OS_MACOSX)
channel->StartAcceptingMachPorts(IPC::Channel::MODE_CLIENT);

View file

@ -17,7 +17,7 @@
#include "mozilla/WeakPtr.h"
#include "chrome/common/ipc_message.h"
#ifdef OS_WIN
#ifdef XP_WIN
# include <string>
#endif
@ -38,7 +38,7 @@ class Channel {
// but on Unix we use unnamed socketpairs and pass capabilities
// directly using SCM_RIGHTS messages. This type abstracts away
// that difference.
#ifdef OS_WIN
#ifdef XP_WIN
typedef std::wstring ChannelId;
#else
struct ChannelId {};
@ -161,7 +161,7 @@ class Channel {
void StartAcceptingMachPorts(Mode mode);
# endif
#elif defined(OS_WIN)
#elif defined(XP_WIN)
// Tell this pipe to accept handles. Exactly one side of the IPC connection
// must be set as `MODE_SERVER`, and that side will be responsible for calling
// `DuplicateHandle` to transfer the handle between processes.

View file

@ -337,7 +337,7 @@ class Message : public mojo::core::ports::UserMessage, public Pickle {
#endif
uint32_t num_relayed_attachments() const {
#if defined(OS_WIN)
#if defined(XP_WIN)
return num_handles();
#elif defined(OS_MACOSX) || defined(OS_IOS)
return num_send_rights();

View file

@ -26,7 +26,7 @@
#include "mozilla/CheckedInt.h"
#include "mozilla/IntegerRange.h"
#if defined(OS_WIN)
#if defined(XP_WIN)
# include <windows.h>
#endif
@ -891,7 +891,7 @@ struct ParamTraitsStd<std::map<K, V>> {
template <class P>
struct ParamTraitsWindows : ParamTraitsStd<P> {};
#if defined(OS_WIN)
#if defined(XP_WIN)
template <>
struct ParamTraitsWindows<HANDLE> {
static_assert(sizeof(HANDLE) == sizeof(intptr_t), "Wrong size for HANDLE?");
@ -915,7 +915,7 @@ struct ParamTraitsWindows<HWND> {
return reader->ReadIntPtr(reinterpret_cast<intptr_t*>(r));
}
};
#endif // defined(OS_WIN)
#endif // defined(XP_WIN)
// Various ipc/chromium types.

View file

@ -682,7 +682,7 @@ components that the process expects to use:
.. code-block:: c++
bool DemoChild::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_Demo);

View file

@ -7,7 +7,7 @@
#include "mozilla/ipc/BrowserProcessSubThread.h"
#include "mozilla/ipc/NodeController.h"
#if defined(OS_WIN)
#if defined(XP_WIN)
# include <objbase.h>
#endif
@ -46,7 +46,7 @@ BrowserProcessSubThread::~BrowserProcessSubThread() {
}
void BrowserProcessSubThread::Init() {
#if defined(OS_WIN)
#if defined(XP_WIN)
// Initializes the COM library on the current thread.
CoInitialize(nullptr);
#endif
@ -62,7 +62,7 @@ void BrowserProcessSubThread::CleanUp() {
NodeController::CleanUp();
}
#if defined(OS_WIN)
#if defined(XP_WIN)
// Closes the COM library on the current thread. CoInitialize must
// be balanced by a corresponding call to CoUninitialize.
CoUninitialize();

View file

@ -10,10 +10,10 @@
#include "base/process.h"
#include "mozilla/Mutex.h"
#if defined(OS_WIN)
#if defined(XP_WIN)
# include "mozilla/UniquePtrExtensions.h"
#endif
#if !defined(OS_WIN) && !defined(OS_NETBSD) && !defined(OS_OPENBSD)
#if !defined(XP_WIN) && !defined(OS_NETBSD) && !defined(OS_OPENBSD)
# include <pthread.h>
# include "mozilla/ipc/SharedMemoryBasic.h"
# include "mozilla/Atomics.h"
@ -36,7 +36,7 @@ struct ParamTraits;
// preferred to making bare calls to CrossProcessMutex.Lock and Unlock.
//
namespace mozilla {
#if defined(OS_WIN)
#if defined(XP_WIN)
typedef mozilla::UniqueFileHandle CrossProcessMutexHandle;
#elif !defined(OS_NETBSD) && !defined(OS_OPENBSD)
typedef mozilla::ipc::SharedMemoryBasic::Handle CrossProcessMutexHandle;
@ -101,7 +101,7 @@ class CrossProcessMutex {
CrossProcessMutex(const CrossProcessMutex&);
CrossProcessMutex& operator=(const CrossProcessMutex&);
#if defined(OS_WIN)
#if defined(XP_WIN)
HANDLE mMutex;
#elif !defined(OS_NETBSD) && !defined(OS_OPENBSD)
RefPtr<mozilla::ipc::SharedMemoryBasic> mSharedBuffer;

View file

@ -11,10 +11,10 @@
#include "mozilla/TimeStamp.h"
#include "mozilla/Maybe.h"
#if defined(OS_WIN)
#if defined(XP_WIN)
# include "mozilla/UniquePtrExtensions.h"
#endif
#if !defined(OS_WIN) && !defined(OS_MACOSX)
#if !defined(XP_WIN) && !defined(OS_MACOSX)
# include <pthread.h>
# include <semaphore.h>
# include "mozilla/ipc/SharedMemoryBasic.h"
@ -37,7 +37,7 @@ inline bool IsHandleValid(const T& handle) {
return bool(handle);
}
#if defined(OS_WIN)
#if defined(XP_WIN)
typedef mozilla::UniqueFileHandle CrossProcessSemaphoreHandle;
#elif !defined(OS_MACOSX)
typedef mozilla::ipc::SharedMemoryBasic::Handle CrossProcessSemaphoreHandle;
@ -102,7 +102,7 @@ class CrossProcessSemaphore {
CrossProcessSemaphore(const CrossProcessSemaphore&);
CrossProcessSemaphore& operator=(const CrossProcessSemaphore&);
#if defined(OS_WIN)
#if defined(XP_WIN)
explicit CrossProcessSemaphore(HANDLE aSemaphore);
HANDLE mSemaphore;

View file

@ -13,7 +13,7 @@
namespace base {
#if defined(OS_WIN)
#if defined(XP_WIN)
typedef std::wstring NativeEnvironmentString;
typedef std::map<NativeEnvironmentString, NativeEnvironmentString>

View file

@ -551,7 +551,7 @@ mozilla::BinPathType BaseProcessLauncher::GetPathToBinary(
BinPathType pathType = XRE_GetChildProcBinPathType(processType);
if (pathType == BinPathType::Self) {
#if defined(OS_WIN)
#if defined(XP_WIN)
wchar_t exePathBuf[MAXPATHLEN];
if (!::GetModuleFileNameW(nullptr, exePathBuf, MAXPATHLEN)) {
MOZ_CRASH("GetModuleFileNameW failed (FIXME)");
@ -583,7 +583,7 @@ mozilla::BinPathType BaseProcessLauncher::GetPathToBinary(
if (ShouldHaveDirectoryService()) {
MOZ_ASSERT(gGREBinPath);
#ifdef OS_WIN
#ifdef XP_WIN
exePath = FilePath(char16ptr_t(gGREBinPath));
#elif MOZ_WIDGET_COCOA
nsCOMPtr<nsIFile> childProcPath;
@ -606,7 +606,7 @@ mozilla::BinPathType BaseProcessLauncher::GetPathToBinary(
}
if (exePath.empty()) {
#ifdef OS_WIN
#ifdef XP_WIN
exePath =
FilePath::FromWStringHack(CommandLine::ForCurrentProcess()->program());
#else

View file

@ -42,7 +42,7 @@
#include "nsPrintfCString.h"
#include "nsThreadUtils.h"
#ifdef OS_WIN
#ifdef XP_WIN
# include "mozilla/gfx/Logging.h"
#endif
@ -438,7 +438,7 @@ MessageChannel::MessageChannel(const char* aName, IToplevelProtocol* aListener)
: mName(aName), mListener(aListener), mMonitor(new RefCountedMonitor()) {
MOZ_COUNT_CTOR(ipc::MessageChannel);
#ifdef OS_WIN
#ifdef XP_WIN
mEvent = CreateEventW(nullptr, TRUE, FALSE, nullptr);
MOZ_RELEASE_ASSERT(mEvent, "CreateEvent failed! Nothing is going to work!");
#endif
@ -452,7 +452,7 @@ MessageChannel::~MessageChannel() {
MonitorAutoLock lock(*mMonitor);
MOZ_RELEASE_ASSERT(!mOnCxxStack,
"MessageChannel destroyed while code on CxxStack");
#ifdef OS_WIN
#ifdef XP_WIN
if (mEvent) {
BOOL ok = CloseHandle(mEvent);
mEvent = nullptr;
@ -1235,7 +1235,7 @@ bool MessageChannel::Send(UniquePtr<Message> aMsg, UniquePtr<Message>* aReply) {
RefPtr<ActorLifecycleProxy> proxy = Listener()->GetLifecycleProxy();
#ifdef OS_WIN
#ifdef XP_WIN
SyncStackFrame frame(this);
NeuteredWindowRegion neuteredRgn(mFlags &
REQUIRE_DEFERRED_MESSAGE_PROTECTION);
@ -1838,7 +1838,7 @@ bool MessageChannel::WaitResponse(bool aWaitTimedOut) {
return true;
}
#ifndef OS_WIN
#ifndef XP_WIN
bool MessageChannel::WaitForSyncNotify() {
AssertWorkerThread();
# ifdef DEBUG

View file

@ -14,9 +14,9 @@
#include "mozilla/LinkedList.h"
#include "mozilla/Monitor.h"
#include "mozilla/Vector.h"
#if defined(OS_WIN)
#if defined(XP_WIN)
# include "mozilla/ipc/Neutering.h"
#endif // defined(OS_WIN)
#endif // defined(XP_WIN)
#include <functional>
#include <map>
@ -316,7 +316,7 @@ class MessageChannel : HasResultCodes {
}
#endif
#ifdef OS_WIN
#ifdef XP_WIN
struct MOZ_STACK_CLASS SyncStackFrame {
explicit SyncStackFrame(MessageChannel* channel);
~SyncStackFrame();
@ -355,7 +355,7 @@ class MessageChannel : HasResultCodes {
private:
void SpinInternalEventLoop();
#endif // defined(OS_WIN)
#endif // defined(XP_WIN)
private:
void PostErrorNotifyTask() MOZ_REQUIRES(*mMonitor);
@ -761,7 +761,7 @@ class MessageChannel : HasResultCodes {
// Map of async Callbacks that are still waiting replies.
CallbackMap mPendingResponses;
#ifdef OS_WIN
#ifdef XP_WIN
HANDLE mEvent;
#endif

View file

@ -61,14 +61,14 @@ namespace base {
// converters, and implementing the one that doesn't exist for OS X
// and Windows.
#if !defined(OS_MACOSX) && !defined(OS_WIN)
#if !defined(OS_MACOSX) && !defined(XP_WIN)
std::string SysWideToUTF8(const std::wstring& wide) {
// FIXME/cjones: do this with iconv
return GhettoStringConvert<std::wstring, std::string>(wide);
}
#endif
#if !defined(OS_MACOSX) && !defined(OS_WIN)
#if !defined(OS_MACOSX) && !defined(XP_WIN)
std::wstring SysUTF8ToWide(const StringPiece& utf8) {
// FIXME/cjones: do this with iconv
return GhettoStringConvert<StringPiece, std::wstring>(utf8);

View file

@ -78,7 +78,7 @@ void UtilityAudioDecoderParent::GenericPreloadForSandbox() {
/* static */
void UtilityAudioDecoderParent::WMFPreloadForSandbox() {
#if defined(MOZ_SANDBOX) && defined(OS_WIN)
#if defined(MOZ_SANDBOX) && defined(XP_WIN)
// mfplat.dll and mf.dll will be preloaded by
// wmf::MediaFoundationInitializer::HasInitialized()
# if defined(DEBUG)
@ -91,7 +91,7 @@ void UtilityAudioDecoderParent::WMFPreloadForSandbox() {
NS_WARNING("Failed to init Media Foundation in the Utility process");
return;
}
#endif // defined(MOZ_SANDBOX) && defined(OS_WIN)
#endif // defined(MOZ_SANDBOX) && defined(XP_WIN)
}
void UtilityAudioDecoderParent::Start(

View file

@ -8,11 +8,11 @@
#include "mozilla/ipc/IOThreadChild.h"
#include "mozilla/GeckoArgs.h"
#if defined(OS_WIN)
#if defined(XP_WIN)
# include "nsExceptionHandler.h"
#endif
#if defined(OS_WIN) && defined(MOZ_SANDBOX)
#if defined(XP_WIN) && defined(MOZ_SANDBOX)
# include "mozilla/sandboxTarget.h"
# include "WMF.h"
# include "WMFDecoderModule.h"
@ -80,7 +80,7 @@ bool UtilityProcessImpl::Init(int aArgc, char* aArgv[]) {
return false;
}
#if defined(MOZ_SANDBOX) && defined(OS_WIN)
#if defined(MOZ_SANDBOX) && defined(XP_WIN)
// We delay load winmm.dll so that its dependencies don't interfere with COM
// initialization when win32k is locked down. We need to load it before we
// lower the sandbox in processes where the policy will prevent loading.

View file

@ -4202,7 +4202,7 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
)
processnative.addcode(
"""
#ifdef OS_WIN
#ifdef XP_WIN
GetIPCChannel()->ProcessNativeEventsInInterruptCall();
#else
FatalError("This method is Windows-only");

View file

@ -51,7 +51,7 @@ char* gIPDLUnitTestName = nullptr;
const char* IPDLUnitTestName() {
if (!gIPDLUnitTestName) {
#if defined(OS_WIN)
#if defined(XP_WIN)
vector<wstring> args = CommandLine::ForCurrentProcess()->GetLooseValues();
gIPDLUnitTestName = ::strdup(WideToUTF8(args[0]).c_str());
#elif defined(XP_UNIX)