From 086c044dc34dfc0f74fbe41f4ecb402b2cd34884 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 03:13:33 +0200 Subject: Merging upstream version 125.0.1. Signed-off-by: Daniel Baumann --- ipc/chromium/moz.build | 37 +++++++++++++--------- ipc/chromium/src/base/message_pump_mac.h | 20 ++++++++++++ ipc/chromium/src/base/message_pump_mac.mm | 27 ++++++++++++++-- ipc/chromium/src/base/process_util_ios.cpp | 17 ++++++++++ ipc/chromium/src/base/process_util_posix.cc | 2 +- ipc/chromium/src/chrome/common/ipc_message.h | 1 + ipc/chromium/src/chrome/common/mach_ipc_mac.h | 1 - ipc/chromium/src/mojo/core/ports/node.cc | 2 ++ .../src/third_party/libeventcommon.mozbuild | 37 ++++++---------------- ipc/chromium/src/third_party/moz.build | 8 ++--- 10 files changed, 101 insertions(+), 51 deletions(-) create mode 100644 ipc/chromium/src/base/process_util_ios.cpp (limited to 'ipc/chromium') diff --git a/ipc/chromium/moz.build b/ipc/chromium/moz.build index 56f24c24bb..429c068d34 100644 --- a/ipc/chromium/moz.build +++ b/ipc/chromium/moz.build @@ -39,7 +39,7 @@ UNIFIED_SOURCES += [ "src/mojo/core/ports/user_message.cc", ] -if os_win: +if CONFIG["TARGET_KERNEL"] == "WINNT": SOURCES += [ "src/base/condition_variable_win.cc", "src/base/lock_impl_win.cc", @@ -60,7 +60,7 @@ if os_win: elif not CONFIG["MOZ_SYSTEM_LIBEVENT"]: DIRS += ["src/third_party"] -if os_posix: +if CONFIG["TARGET_KERNEL"] != "WINNT": UNIFIED_SOURCES += [ "src/base/condition_variable_posix.cc", "src/base/lock_impl_posix.cc", @@ -75,12 +75,9 @@ if os_posix: "src/chrome/common/process_watcher_posix_sigchld.cc", ] -if os_macosx: +if CONFIG["TARGET_KERNEL"] == "Darwin": UNIFIED_SOURCES += [ - "src/base/chrome_application_mac.mm", - "src/base/mac_util.mm", "src/base/message_pump_mac.mm", - "src/base/process_util_mac.mm", "src/base/scoped_nsautorelease_pool.mm", "src/base/sys_string_conversions_mac.mm", "src/base/time_mac.cc", @@ -93,13 +90,25 @@ if os_macosx: "src/base/platform_thread_mac.mm", ] -if os_bsd: +if CONFIG["TARGET_OS"] == "OSX": + UNIFIED_SOURCES += [ + "src/base/chrome_application_mac.mm", + "src/base/mac_util.mm", + "src/base/process_util_mac.mm", + ] + +if CONFIG["TARGET_OS"] == "iOS": + UNIFIED_SOURCES += [ + "src/base/process_util_ios.cpp", + ] + +if CONFIG["TARGET_KERNEL"] in ("DragonFly", "FreeBSD", "NetBSD", "OpenBSD"): SOURCES += [ "src/base/process_util_linux.cc", "src/base/time_posix.cc", ] -if os_linux: +if CONFIG["TARGET_KERNEL"] == "Linux": SOURCES += [ "src/base/process_util_linux.cc", "src/base/set_process_title_linux.cc", @@ -112,17 +121,15 @@ if os_linux: DEFINES["ANDROID"] = True DEFINES["_POSIX_MONOTONIC_CLOCK"] = 0 -if os_bsd or os_linux: - if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk": - SOURCES += [ - "src/base/message_pump_glib.cc", - ] - -if os_solaris: +if CONFIG["TARGET_KERNEL"] == "SunOS": SOURCES += [ "src/base/process_util_linux.cc", "src/base/time_posix.cc", ] +elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk": + SOURCES += [ + "src/base/message_pump_glib.cc", + ] if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk": CXXFLAGS += CONFIG["MOZ_GTK3_CFLAGS"] diff --git a/ipc/chromium/src/base/message_pump_mac.h b/ipc/chromium/src/base/message_pump_mac.h index 13902bbf3e..7d7796b98b 100644 --- a/ipc/chromium/src/base/message_pump_mac.h +++ b/ipc/chromium/src/base/message_pump_mac.h @@ -144,11 +144,13 @@ class MessagePumpCFRunLoopBase : public MessagePump { // the basis of run loops starting and stopping. virtual void EnterExitRunLoop(CFRunLoopActivity activity); +#if !defined(XP_IOS) // IOKit power state change notification callback, called when the system // enters and leaves the sleep state. static void PowerStateNotification(void* info, io_service_t service, uint32_t message_type, void* message_argument); +#endif // The thread's run loop. CFRunLoopRef run_loop_; @@ -241,6 +243,23 @@ class MessagePumpNSRunLoop : public MessagePumpCFRunLoopBase { DISALLOW_COPY_AND_ASSIGN(MessagePumpNSRunLoop); }; +#if defined(XP_IOS) +// This is a fake message pump. It attaches sources to the main thread's +// CFRunLoop, so PostTask() will work, but it is unable to drive the loop +// directly, so calling Run() or Quit() are errors. +class MessagePumpUIApplication : public MessagePumpCFRunLoopBase { + public: + MessagePumpUIApplication() {} + + void DoRun(Delegate* delegate) override; + void Quit() override; + + private: + DISALLOW_COPY_AND_ASSIGN(MessagePumpUIApplication); +}; + +#else + class MessagePumpNSApplication : public MessagePumpCFRunLoopBase { public: MessagePumpNSApplication(); @@ -264,6 +283,7 @@ class MessagePumpNSApplication : public MessagePumpCFRunLoopBase { DISALLOW_COPY_AND_ASSIGN(MessagePumpNSApplication); }; +#endif class MessagePumpMac { public: diff --git a/ipc/chromium/src/base/message_pump_mac.mm b/ipc/chromium/src/base/message_pump_mac.mm index 1382e2a0dc..a5e7092d16 100644 --- a/ipc/chromium/src/base/message_pump_mac.mm +++ b/ipc/chromium/src/base/message_pump_mac.mm @@ -4,14 +4,18 @@ #include "base/message_pump_mac.h" -#import +#if !defined(XP_IOS) +# import +# include +#endif #import #include -#include #include -#import "base/chrome_application_mac.h" +#if !defined(XP_IOS) +# import "base/chrome_application_mac.h" +#endif #include "base/logging.h" #include "base/time.h" @@ -120,6 +124,7 @@ MessagePumpCFRunLoopBase::MessagePumpCFRunLoopBase() EnterExitObserver, &observer_context); CFRunLoopAddObserver(run_loop_, enter_exit_observer_, kCFRunLoopCommonModes); +#if !defined(XP_IOS) root_power_domain_ = IORegisterForSystemPower(this, &power_notification_port_, PowerStateNotification, &power_notification_object_); @@ -128,12 +133,14 @@ MessagePumpCFRunLoopBase::MessagePumpCFRunLoopBase() run_loop_, IONotificationPortGetRunLoopSource(power_notification_port_), kCFRunLoopCommonModes); } +#endif } // Ideally called on the run loop thread. If other run loops were running // lower on the run loop thread's stack when this object was created, the // same number of run loops must be running when this object is destroyed. MessagePumpCFRunLoopBase::~MessagePumpCFRunLoopBase() { +#if !defined(XP_IOS) if (root_power_domain_ != MACH_PORT_NULL) { CFRunLoopRemoveSource( run_loop_, IONotificationPortGetRunLoopSource(power_notification_port_), @@ -142,6 +149,7 @@ MessagePumpCFRunLoopBase::~MessagePumpCFRunLoopBase() { IOServiceClose(root_power_domain_); IONotificationPortDestroy(power_notification_port_); } +#endif CFRunLoopRemoveObserver(run_loop_, enter_exit_observer_, kCFRunLoopCommonModes); @@ -478,6 +486,7 @@ void MessagePumpCFRunLoopBase::EnterExitObserver(CFRunLoopObserverRef observer, self->EnterExitRunLoop(activity); } +#if !defined(XP_IOS) // Called from the run loop. // static void MessagePumpCFRunLoopBase::PowerStateNotification(void* info, @@ -544,6 +553,7 @@ void MessagePumpCFRunLoopBase::PowerStateNotification(void* info, break; } } +#endif // Called by MessagePumpCFRunLoopBase::EnterExitRunLoop. The default // implementation is a no-op. @@ -630,6 +640,12 @@ void MessagePumpNSRunLoop::Quit() { CFRunLoopWakeUp(run_loop()); } +#if defined(XP_IOS) +void MessagePumpUIApplication::DoRun(Delegate* delegate) { NOTREACHED(); } + +void MessagePumpUIApplication::Quit() { NOTREACHED(); } + +#else MessagePumpNSApplication::MessagePumpNSApplication() : keep_running_(true), running_own_loop_(false) {} @@ -722,11 +738,16 @@ NSAutoreleasePool* MessagePumpNSApplication::CreateAutoreleasePool() { } return pool; } +#endif // static MessagePump* MessagePumpMac::Create() { if ([NSThread isMainThread]) { +#if defined(XP_IOS) + return new MessagePumpUIApplication; +#else return new MessagePumpNSApplication; +#endif } return new MessagePumpNSRunLoop; diff --git a/ipc/chromium/src/base/process_util_ios.cpp b/ipc/chromium/src/base/process_util_ios.cpp new file mode 100644 index 0000000000..1ec4e77561 --- /dev/null +++ b/ipc/chromium/src/base/process_util_ios.cpp @@ -0,0 +1,17 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=8 sts=2 et sw=2 tw=80: */ +// Copyright (c) 2008 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "base/process_util.h" + +namespace base { + +Result LaunchApp(const std::vector& argv, + LaunchOptions&& options, + ProcessHandle* process_handle) { + return Err(LaunchError("LaunchApp is not supported on iOS")); +} + +} // namespace base diff --git a/ipc/chromium/src/base/process_util_posix.cc b/ipc/chromium/src/base/process_util_posix.cc index 3229570ad8..d91dc25e9f 100644 --- a/ipc/chromium/src/base/process_util_posix.cc +++ b/ipc/chromium/src/base/process_util_posix.cc @@ -198,7 +198,7 @@ void CloseSuperfluousFds(void* aCtx, bool (*aShouldPreserve)(void*, int)) { bool IsProcessDead(ProcessHandle handle, bool blocking) { auto handleForkServer = [handle]() -> mozilla::Maybe { #ifdef MOZ_ENABLE_FORKSERVER - if (errno == ECHILD && mozilla::ipc::ForkServiceChild::Get()) { + if (errno == ECHILD && mozilla::ipc::ForkServiceChild::WasUsed()) { // We only know if a process exists, but not if it has crashed. // // Since content processes are not direct children of the chrome diff --git a/ipc/chromium/src/chrome/common/ipc_message.h b/ipc/chromium/src/chrome/common/ipc_message.h index 733ae9e493..281a6d6bad 100644 --- a/ipc/chromium/src/chrome/common/ipc_message.h +++ b/ipc/chromium/src/chrome/common/ipc_message.h @@ -37,6 +37,7 @@ namespace IPC { //------------------------------------------------------------------------------ // Generated by IPDL compiler +bool IPCMessageTypeIsSync(uint32_t aMessageType); const char* StringFromIPCMessageType(uint32_t aMessageType); class Channel; diff --git a/ipc/chromium/src/chrome/common/mach_ipc_mac.h b/ipc/chromium/src/chrome/common/mach_ipc_mac.h index c9af70c0c6..4d2af64176 100644 --- a/ipc/chromium/src/chrome/common/mach_ipc_mac.h +++ b/ipc/chromium/src/chrome/common/mach_ipc_mac.h @@ -9,7 +9,6 @@ #include #include -#include #include #include "mozilla/Maybe.h" diff --git a/ipc/chromium/src/mojo/core/ports/node.cc b/ipc/chromium/src/mojo/core/ports/node.cc index 63e58c9928..935771eeb7 100644 --- a/ipc/chromium/src/mojo/core/ports/node.cc +++ b/ipc/chromium/src/mojo/core/ports/node.cc @@ -516,6 +516,7 @@ int Node::AcceptEvent(const NodeName& from_node, ScopedEvent event) { return AcceptEventInternal(port_ref, from_node, std::move(event)); } +#ifndef FUZZING_SNAPSHOT // Before processing the event, verify the sender and sequence number. { SinglePortLocker locker(&port_ref); @@ -532,6 +533,7 @@ int Node::AcceptEvent(const NodeName& from_node, ScopedEvent event) { return OK; } } +#endif int ret = AcceptEventInternal(port_ref, from_node, std::move(event)); diff --git a/ipc/chromium/src/third_party/libeventcommon.mozbuild b/ipc/chromium/src/third_party/libeventcommon.mozbuild index 5037ec77a5..e8a74bf802 100644 --- a/ipc/chromium/src/third_party/libeventcommon.mozbuild +++ b/ipc/chromium/src/third_party/libeventcommon.mozbuild @@ -4,35 +4,18 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -os_win = 0 -os_posix = 0 -os_macosx = 0 -os_bsd = 0 -os_linux = 0 -os_solaris = 0 - -if CONFIG['OS_ARCH'] == 'WINNT': - os_win = 1 +if CONFIG['TARGET_KERNEL'] == 'Darwin': + libevent_include_suffix = 'mac' +elif CONFIG['TARGET_KERNEL'] in ('DragonFly', 'FreeBSD', 'NetBSD', 'OpenBSD'): + libevent_include_suffix = 'bsd' +elif CONFIG['TARGET_KERNEL'] == 'SunOS': + libevent_include_suffix = 'solaris' +elif CONFIG['TARGET_OS'] == 'Android': + libevent_include_suffix = 'android' else: - os_posix = 1 - if CONFIG['OS_ARCH'] == 'Darwin': - os_macosx = 1 - libevent_include_suffix = 'mac' - elif CONFIG['OS_ARCH'] in ['DragonFly', 'FreeBSD', 'GNU_kFreeBSD', - 'NetBSD', 'OpenBSD']: - os_bsd = 1 - libevent_include_suffix = 'bsd' - elif CONFIG['OS_ARCH'] == 'SunOS': - os_solaris = 1 - libevent_include_suffix = 'solaris' - else: - os_linux = 1 - if CONFIG['OS_TARGET'] == 'Android': - libevent_include_suffix = 'android' - else: - libevent_include_suffix = 'linux' + libevent_include_suffix = 'linux' -if os_posix and not CONFIG['MOZ_SYSTEM_LIBEVENT']: +if CONFIG["TARGET_KERNEL"] != "WINNT" and not CONFIG['MOZ_SYSTEM_LIBEVENT']: DEFINES['HAVE_CONFIG_H'] = True LOCAL_INCLUDES += sorted([ 'libevent', diff --git a/ipc/chromium/src/third_party/moz.build b/ipc/chromium/src/third_party/moz.build index 6572d01aa9..4a7dfd3fd1 100644 --- a/ipc/chromium/src/third_party/moz.build +++ b/ipc/chromium/src/third_party/moz.build @@ -7,7 +7,7 @@ libevent_path_prefix = '.' include(libevent_path_prefix + '/libeventcommon.mozbuild') -if os_win: +if CONFIG["TARGET_KERNEL"] == "WINNT": error('should not reach here on Windows') if CONFIG['MOZ_SYSTEM_LIBEVENT']: @@ -42,12 +42,12 @@ SOURCES += [ # 'libevent/evrpc.c', # Unused file. # conflicting TAILQ_ENTRY definition ] -if os_macosx or os_bsd: +if CONFIG["TARGET_KERNEL"] in ("Darwin", "DragonFly", "FreeBSD", "NetBSD", "OpenBSD"): UNIFIED_SOURCES += [ 'libevent/kqueue.c', ] -if os_linux: +if CONFIG["TARGET_KERNEL"] == "Linux": UNIFIED_SOURCES += [ 'libevent/epoll.c', ] @@ -56,7 +56,7 @@ if os_linux: 'libevent/epoll_sub.c', ] -if os_solaris: +if CONFIG["TARGET_KERNEL"] == "SunOS": SOURCES += [ 'libevent/devpoll.c', 'libevent/evport.c', -- cgit v1.2.3