diff --git a/dev-qt/qtwebengine/patches/qtwebengine-5.15.16.patchset b/dev-qt/qtwebengine/patches/qtwebengine-5.15.16.patchset new file mode 100644 index 000000000..e0eba8c75 --- /dev/null +++ b/dev-qt/qtwebengine/patches/qtwebengine-5.15.16.patchset @@ -0,0 +1,11329 @@ +From ecf131d19f5f0c1866e64df5fa37fede12889df7 Mon Sep 17 00:00:00 2001 +From: Gerasim Troeglazov <3dEyes@gmail.com> +Date: Thu, 7 Dec 2023 18:33:47 +1000 +Subject: Patchset based on qtwebengine patches for FreeBSD, as well as patches + by Kacper Kasper (Kapix), Jérôme Duval (korli) and Gerasim Troeglazov (3dEyes). + + +diff --git a/configure.pri b/configure.pri +index 3a33bdc..8be641c 100644 +--- a/configure.pri ++++ b/configure.pri +@@ -123,6 +123,9 @@ defineTest(qtConfTest_detectPlatform) { + macos:qtwebengine_isMacOsPlatformSupported() { + $${1}.platform = "macos" + } ++ unix:qtwebengine_isLinuxPlatformSupported() { ++ $${1}.platform = "linux" ++ } + ios:qtwebengine_isMacOsPlatformSupported() { + $${1}.platform = "ios" + } +diff --git a/mkspecs/features/functions.prf b/mkspecs/features/functions.prf +index 7f63058..dc536cc 100644 +--- a/mkspecs/features/functions.prf ++++ b/mkspecs/features/functions.prf +@@ -89,6 +89,10 @@ defineReplace(gnWebEngineArgs) { + include($$QTWEBENGINE_ROOT/src/buildtools/config/windows.pri) + include($$QTWEBENGINE_ROOT/src/core/config/windows.pri) + } ++ haiku { ++ include($$QTWEBENGINE_ROOT/src/buildtools/config/haiku.pri) ++ include($$QTWEBENGINE_ROOT/src/core/config/haiku.pri) ++ } + isEmpty(gn_args): error(No gn_args found please make sure you have valid configuration.) + return($$gn_args) + } +@@ -98,6 +102,7 @@ defineReplace(gnPdfArgs) { + macos: include($$QTWEBENGINE_ROOT/src/buildtools/config/mac_osx.pri) + ios: include($$QTWEBENGINE_ROOT/src/pdf/config/ios.pri) + win32: include($$QTWEBENGINE_ROOT/src/buildtools/config/windows.pri) ++ haiku: include($$QTWEBENGINE_ROOT/src/buildtools/config/haiku.pri) + include($$QTWEBENGINE_ROOT/src/pdf/config/common.pri) + isEmpty(gn_args): error(No gn_args found please make sure you have valid configuration.) + return($$gn_args) +@@ -119,6 +124,7 @@ defineReplace(gnOS) { + macos: return(mac) + win32: return(win) + linux: return(linux) ++ haiku: return(haiku) + error(Unsupported platform) + return(unknown) + } +diff --git a/src/3rdparty/chromium/BUILD.gn b/src/3rdparty/chromium/BUILD.gn +index 8d9657d..5f6954b 100644 +--- a/src/3rdparty/chromium/BUILD.gn ++++ b/src/3rdparty/chromium/BUILD.gn +@@ -423,7 +423,7 @@ group("gn_all") { + ] + } + +- if (is_linux || is_chromeos || is_android) { ++ if ((is_linux && !is_haiku) || is_chromeos || is_android) { + deps += [ + "//third_party/breakpad:breakpad_unittests", + "//third_party/breakpad:core-2-minidump", +@@ -464,8 +464,6 @@ group("gn_all") { + "//net:disk_cache_memory_test", + "//net:quic_client", + "//net:quic_server", +- "//sandbox/linux:chrome_sandbox", +- "//sandbox/linux:sandbox_linux_unittests", + "//testing:empty_main", + ] + +@@ -520,10 +518,6 @@ group("gn_all") { + "//chrome/test:load_library_perf_tests", + "//chrome/test:sync_performance_tests", + "//chrome/test/chromedriver:chromedriver", +- "//courgette:courgette", +- "//courgette:courgette_fuzz", +- "//courgette:courgette_minimal_tool", +- "//courgette:courgette_unittests", + "//media/cast:generate_barcode_video", + "//media/cast:generate_timecode_audio", + "//net:crash_cache", +@@ -595,13 +589,9 @@ group("gn_all") { + "//mojo:mojo_perftests", + "//services/service_manager/public/cpp", + "//testing/gmock:gmock_main", +- "//third_party/breakpad:dump_syms($host_toolchain)", +- "//third_party/breakpad:microdump_stackwalk($host_toolchain)", +- "//third_party/breakpad:minidump_dump($host_toolchain)", +- "//third_party/breakpad:minidump_stackwalk($host_toolchain)", + ] + +- if (!is_android) { ++ if (!is_android && !is_haiku) { + deps += [ + "//chrome/test:chrome_app_unittests", + "//gpu/khronos_glcts_support:khronos_glcts_test", +@@ -676,7 +666,7 @@ group("gn_all") { + host_os == "win" && !use_qt) { + deps += [ "//chrome/test/mini_installer:mini_installer_tests" ] + } +- } else if (!is_android && !is_ios && !is_fuchsia && !is_win) { ++ } else if (!is_android && !is_ios && !is_fuchsia && !is_win && !is_haiku) { + deps += [ "//third_party/breakpad:symupload($host_toolchain)" ] + } + +@@ -810,7 +800,6 @@ group("gn_all") { + "//chrome/browser/vr:vr_common_perftests", + "//chrome/browser/vr:vr_common_unittests", + "//chrome/browser/vr:vr_pixeltests", +- "//tools/perf/contrib/vr_benchmarks:vr_perf_tests", + ] + if (is_android) { + deps += [ "//chrome/browser/android/vr:vr_android_unittests" ] +@@ -1103,7 +1092,7 @@ if (!is_ios && !use_qt) { + data_deps += [ "//content/web_test:web_test_common_mojom_js_data_deps" ] + } + +- if (!is_win && !is_android) { ++ if (!is_win && !is_android && !is_haiku) { + data_deps += + [ "//third_party/breakpad:minidump_stackwalk($host_toolchain)" ] + } +@@ -1112,7 +1101,7 @@ if (!is_ios && !use_qt) { + data_deps += [ "//third_party/breakpad:dump_syms($host_toolchain)" ] + } + +- if (is_linux || is_chromeos) { ++ if ((is_linux && !is_haiku) || is_chromeos) { + data_deps += [ "//third_party/breakpad:dump_syms($host_toolchain)" ] + } + +@@ -1308,9 +1297,6 @@ group("chromium_builder_perf") { + + if (is_win) { + data_deps += [ "//chrome/installer/mini_installer:mini_installer" ] +- } else { +- data_deps += +- [ "//third_party/breakpad:minidump_stackwalk($host_toolchain)" ] + } + if (is_win || is_android) { + data_deps += [ +@@ -1420,6 +1406,7 @@ assert( + "*\bmac/*", + "*\bposix/*", + "*\bwin/*", ++ "*\bhaiku/*", + ]) != [], + "Do not use a platform name in your output directory (found \"$root_build_dir\"). http://crbug.com/548283") + +diff --git a/src/3rdparty/chromium/base/BUILD.gn b/src/3rdparty/chromium/base/BUILD.gn +index c15b2b2..03bde29 100644 +--- a/src/3rdparty/chromium/base/BUILD.gn ++++ b/src/3rdparty/chromium/base/BUILD.gn +@@ -54,7 +54,7 @@ declare_args() { + # replacement base::Location::Current(). On by default in non-official builds + # for testing purposes. + # TODO(https://crbug.com/974061): remove this eventually. +- from_here_uses_location_builtins = !is_official_build ++ from_here_uses_location_builtins = !is_official_build && !is_haiku + + # Unsafe developer build. Has developer-friendly features that may weaken or + # disable security measures like sandboxing or ASLR. +@@ -886,7 +886,7 @@ jumbo_component("base") { + "timer/hi_res_timer_manager_posix.cc", + ] + +- if (!is_nacl && !is_apple) { ++ if (!is_nacl && !is_apple && !is_haiku) { + sources += [ + "cpu_affinity_posix.cc", + "cpu_affinity_posix.h", +@@ -897,6 +897,12 @@ jumbo_component("base") { + "profiler/thread_delegate_posix.h", + ] + } ++ ++ if (is_haiku) { ++ sources += [ ++ "profiler/stack_sampler_posix.cc", ++ ] ++ } + } + + jumbo_excluded_sources = [ +@@ -1213,7 +1219,9 @@ jumbo_component("base") { + "process/process_metrics_linux.cc", + "threading/platform_thread_linux.cc", + ] +- jumbo_excluded_sources += [ "process/memory_linux.cc" ] ++ #jumbo_excluded_sources += [ "process/memory_linux.cc" ] ++ jumbo_excluded_sources += [ "metrics/histogram.cc" ] ++ jumbo_excluded_sources += [ "metrics/sparse_histogram.cc" ] + } + + if (!is_nacl) { +@@ -1355,7 +1363,7 @@ jumbo_component("base") { + "allocator/allocator_shim_default_dispatch_to_mac_zoned_malloc.cc", + ] + } +- if (is_chromeos || is_linux) { ++ if (is_chromeos || (is_linux && !is_haiku)) { + sources += [ "allocator/allocator_shim_default_dispatch_to_glibc.cc" ] + } + if (is_win) { +@@ -1826,7 +1834,7 @@ jumbo_component("base") { + ] + } + +- if (is_linux || is_chromeos || is_android) { ++ if ((is_linux && !is_haiku) || is_chromeos || is_android) { + sources += [ + "allocator/partition_allocator/spinning_futex_linux.cc", + "allocator/partition_allocator/spinning_futex_linux.h", +@@ -1982,6 +1990,36 @@ jumbo_component("base") { + } + } + ++ if (is_haiku) { ++ sources -= [ ++ "process/memory_linux.cc", ++ "process/process_handle_linux.cc", ++ "process/process_iterator_linux.cc", ++ "process/process_metrics_linux.cc", ++ "files/file_path_watcher_linux.cc", ++ "files/file_util_linux.cc", ++ "system/sys_info_linux.cc", ++ "threading/platform_thread_linux.cc", ++ "debug/proc_maps_linux.cc", ++ "debug/proc_maps_linux.h", ++ ] ++# "memory/madv_free_discardable_memory_posix.cc", ++# "memory/madv_free_discardable_memory_posix.h", ++ sources += [ ++ "base_paths_haiku.cc", ++ "base_paths_haiku.h", ++ "files/file_path_watcher_stub.cc", ++ "process/memory_stubs.cc", ++ "process/process_handle_haiku.cc", ++ "process/process_iterator_haiku.cc", ++ "process/process_metrics_haiku.cc", ++ "threading/platform_thread_haiku.cc", ++ "system/sys_info_haiku.cc" ++ ] ++ ++ defines += [ "_BSD_SOURCE", "__USE_XOPEN2K8" ] ++ } ++ + # iOS + if (is_ios) { + sources -= [ +diff --git a/src/3rdparty/chromium/base/base_paths_haiku.cc b/src/3rdparty/chromium/base/base_paths_haiku.cc +new file mode 100644 +index 0000000..ca8aa43 +--- /dev/null ++++ b/src/3rdparty/chromium/base/base_paths_haiku.cc +@@ -0,0 +1,21 @@ ++// Copyright 2017 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/base_paths.h" ++ ++#include ++ ++#include "base/base_paths_haiku.h" ++#include "base/command_line.h" ++#include "base/files/file_util.h" ++#include "base/path_service.h" ++#include "base/process/process.h" ++ ++namespace base { ++ ++bool PathProviderHaiku(int key, FilePath* result) { ++ return false; ++} ++ ++} // namespace base +diff --git a/src/3rdparty/chromium/base/base_paths_haiku.h b/src/3rdparty/chromium/base/base_paths_haiku.h +new file mode 100644 +index 0000000..d30b52a +--- /dev/null ++++ b/src/3rdparty/chromium/base/base_paths_haiku.h +@@ -0,0 +1,26 @@ ++// Copyright (c) 2018 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. ++ ++#ifndef BASE_BASE_PATHS_HAIKU_H_ ++#define BASE_BASE_PATHS_HAIKU_H_ ++ ++#include "base/base_export.h" ++#include "base/files/file_path.h" ++ ++namespace base { ++ ++// These can be used with the PathService to access various special ++// directories and files. ++enum { ++ PATH_HAIKU_START = 1200, ++ ++ // Path to the directory which contains application user data. ++ DIR_APP_DATA, ++ ++ PATH_HAIKU_END, ++}; ++ ++} // namespace base ++ ++#endif // BASE_BASE_PATHS_HAIKU_H_ +diff --git a/src/3rdparty/chromium/base/base_switches.cc b/src/3rdparty/chromium/base/base_switches.cc +index 8c8563e..4b73087 100644 +--- a/src/3rdparty/chromium/base/base_switches.cc ++++ b/src/3rdparty/chromium/base/base_switches.cc +@@ -117,7 +117,7 @@ const char kDisableHighResTimer[] = "disable-highres-timer"; + const char kDisableUsbKeyboardDetect[] = "disable-usb-keyboard-detect"; + #endif + +-#if defined(OS_LINUX) && !defined(OS_CHROMEOS) && !BUILDFLAG(IS_LACROS) ++#if (defined(OS_LINUX) || defined(OS_HAIKU)) && !defined(OS_CHROMEOS) && !BUILDFLAG(IS_LACROS) + // The /dev/shm partition is too small in certain VM environments, causing + // Chrome to fail or crash (see http://crbug.com/715363). Use this flag to + // work-around this issue (a temporary directory will always be used to create +diff --git a/src/3rdparty/chromium/base/base_switches.h b/src/3rdparty/chromium/base/base_switches.h +index ce6d2db..b885653 100644 +--- a/src/3rdparty/chromium/base/base_switches.h ++++ b/src/3rdparty/chromium/base/base_switches.h +@@ -39,7 +39,7 @@ extern const char kDisableHighResTimer[]; + extern const char kDisableUsbKeyboardDetect[]; + #endif + +-#if defined(OS_LINUX) && !defined(OS_CHROMEOS) && !BUILDFLAG(IS_LACROS) ++#if (defined(OS_LINUX) || defined(OS_HAIKU)) && !defined(OS_CHROMEOS) && !BUILDFLAG(IS_LACROS) + extern const char kDisableDevShmUsage[]; + #endif + +diff --git a/src/3rdparty/chromium/base/cpu.cc b/src/3rdparty/chromium/base/cpu.cc +index 2a5b803..9312918 100644 +--- a/src/3rdparty/chromium/base/cpu.cc ++++ b/src/3rdparty/chromium/base/cpu.cc +@@ -17,7 +17,7 @@ + #include "base/stl_util.h" + + #if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || \ +- defined(OS_AIX) ++ defined(OS_AIX) || defined(OS_HAIKU) + #include "base/containers/flat_set.h" + #include "base/files/file_util.h" + #include "base/no_destructor.h" +diff --git a/src/3rdparty/chromium/base/cpu.h b/src/3rdparty/chromium/base/cpu.h +index 2e2d29a..0f3b681 100644 +--- a/src/3rdparty/chromium/base/cpu.h ++++ b/src/3rdparty/chromium/base/cpu.h +@@ -74,7 +74,7 @@ class BASE_EXPORT CPU final { + const std::string& cpu_brand() const { return cpu_brand_; } + + #if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || \ +- defined(OS_AIX) ++ defined(OS_AIX) || defined(OS_HAIKU) + enum class CoreType { + kUnknown = 0, + kOther, +@@ -125,7 +125,7 @@ class BASE_EXPORT CPU final { + using CoreIdleTimes = std::vector; + static bool GetCumulativeCoreIdleTimes(CoreIdleTimes&); + #endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || +- // defined(OS_AIX) ++ // defined(OS_AIX) || defined(OS_HAIKU) + + private: + // Query the processor for CPUID information. +diff --git a/src/3rdparty/chromium/base/debug/elf_reader.cc b/src/3rdparty/chromium/base/debug/elf_reader.cc +index 0389c44..8bc5fb2 100644 +--- a/src/3rdparty/chromium/base/debug/elf_reader.cc ++++ b/src/3rdparty/chromium/base/debug/elf_reader.cc +@@ -8,6 +8,12 @@ + #include + #include + ++#if defined(OS_HAIKU) ++/* Build ID bits as generated by ld --build-id. ++ The descriptor consists of any nonzero number of bytes. */ ++#define NT_GNU_BUILD_ID 3 ++#endif ++ + #include "base/bits.h" + #include "base/containers/span.h" + #include "base/hash/sha1.h" +diff --git a/src/3rdparty/chromium/base/debug/stack_trace.cc b/src/3rdparty/chromium/base/debug/stack_trace.cc +index f5e2dbb..f01db79 100644 +--- a/src/3rdparty/chromium/base/debug/stack_trace.cc ++++ b/src/3rdparty/chromium/base/debug/stack_trace.cc +@@ -225,7 +225,7 @@ std::string StackTrace::ToString() const { + } + std::string StackTrace::ToStringWithPrefix(const char* prefix_string) const { + std::stringstream stream; +-#if !defined(__UCLIBC__) && !defined(_AIX) ++#if !defined(__UCLIBC__) && !defined(_AIX) && !defined(OS_HAIKU) + OutputToStreamWithPrefix(&stream, prefix_string); + #endif + return stream.str(); +diff --git a/src/3rdparty/chromium/base/debug/stack_trace_posix.cc b/src/3rdparty/chromium/base/debug/stack_trace_posix.cc +index 6a1531e..61f1fcf 100644 +--- a/src/3rdparty/chromium/base/debug/stack_trace_posix.cc ++++ b/src/3rdparty/chromium/base/debug/stack_trace_posix.cc +@@ -27,7 +27,7 @@ + #if !defined(USE_SYMBOLIZE) + #include + #endif +-#if !defined(__UCLIBC__) && !defined(_AIX) ++#if !defined(__UCLIBC__) && !defined(_AIX) && !defined(OS_HAIKU) + #include + #endif + +@@ -35,7 +35,7 @@ + #include + #endif + +-#if defined(OS_LINUX) || defined(OS_CHROMEOS) ++#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU) + #include "base/debug/proc_maps_linux.h" + #endif + +@@ -88,7 +88,7 @@ void DemangleSymbols(std::string* text) { + // Note: code in this function is NOT async-signal safe (std::string uses + // malloc internally). + +-#if !defined(__UCLIBC__) && !defined(_AIX) ++#if !defined(__UCLIBC__) && !defined(_AIX) && !defined(OS_HAIKU) + std::string::size_type search_from = 0; + while (search_from < text->size()) { + // Look for the start of a mangled symbol, from search_from. +@@ -135,7 +135,7 @@ class BacktraceOutputHandler { + virtual ~BacktraceOutputHandler() = default; + }; + +-#if !defined(__UCLIBC__) && !defined(_AIX) ++#if !defined(__UCLIBC__) && !defined(_AIX) && !defined(OS_HAIKU) + void OutputPointer(void* pointer, BacktraceOutputHandler* handler) { + // This should be more than enough to store a 64-bit number in hex: + // 16 hex digits + 1 for null-terminator. +@@ -834,7 +834,7 @@ size_t CollectStackTrace(void** trace, size_t count) { + // NOTE: This code MUST be async-signal safe (it's used by in-process + // stack dumping signal handler). NO malloc or stdio is allowed here. + +-#if !defined(__UCLIBC__) && !defined(_AIX) ++#if !defined(__UCLIBC__) && !defined(_AIX) && !defined(OS_HAIKU) + // Though the backtrace API man page does not list any possible negative + // return values, we take no chance. + return base::saturated_cast(backtrace(trace, count)); +@@ -847,13 +847,13 @@ void StackTrace::PrintWithPrefix(const char* prefix_string) const { + // NOTE: This code MUST be async-signal safe (it's used by in-process + // stack dumping signal handler). NO malloc or stdio is allowed here. + +-#if !defined(__UCLIBC__) && !defined(_AIX) ++#if !defined(__UCLIBC__) && !defined(_AIX) && !defined(OS_HAIKU) + PrintBacktraceOutputHandler handler; + ProcessBacktrace(trace_, count_, prefix_string, &handler); + #endif + } + +-#if !defined(__UCLIBC__) && !defined(_AIX) ++#if !defined(__UCLIBC__) && !defined(_AIX) && !defined(OS_HAIKU) + void StackTrace::OutputToStreamWithPrefix(std::ostream* os, + const char* prefix_string) const { + StreamBacktraceOutputHandler handler(os); +diff --git a/src/3rdparty/chromium/base/files/file.h b/src/3rdparty/chromium/base/files/file.h +index 2743d1f..871ef43 100644 +--- a/src/3rdparty/chromium/base/files/file.h ++++ b/src/3rdparty/chromium/base/files/file.h +@@ -25,7 +25,8 @@ + namespace base { + + #if defined(OS_BSD) || defined(OS_APPLE) || defined(OS_NACL) || \ +- defined(OS_FUCHSIA) || (defined(OS_ANDROID) && __ANDROID_API__ < 21) ++ defined(OS_FUCHSIA) || (defined(OS_ANDROID) && __ANDROID_API__ < 21) || \ ++ defined(OS_HAIKU) + typedef struct stat stat_wrapper_t; + #elif defined(OS_POSIX) + typedef struct stat64 stat_wrapper_t; +diff --git a/src/3rdparty/chromium/base/files/file_posix.cc b/src/3rdparty/chromium/base/files/file_posix.cc +index b69d2e6..a521ef0 100644 +--- a/src/3rdparty/chromium/base/files/file_posix.cc ++++ b/src/3rdparty/chromium/base/files/file_posix.cc +@@ -584,7 +584,8 @@ File::Error File::GetLastFileError() { + } + + #if defined(OS_BSD) || defined(OS_APPLE) || defined(OS_NACL) || \ +- defined(OS_FUCHSIA) || (defined(OS_ANDROID) && __ANDROID_API__ < 21) ++ defined(OS_FUCHSIA) || (defined(OS_ANDROID) && __ANDROID_API__ < 21) || \ ++ defined(OS_HAIKU) + int File::Stat(const char* path, stat_wrapper_t* sb) { + ScopedBlockingCall scoped_blocking_call(FROM_HERE, BlockingType::MAY_BLOCK); + return stat(path, sb); +diff --git a/src/3rdparty/chromium/base/files/file_util.h b/src/3rdparty/chromium/base/files/file_util.h +index df0f0bd..618b712 100644 +--- a/src/3rdparty/chromium/base/files/file_util.h ++++ b/src/3rdparty/chromium/base/files/file_util.h +@@ -278,14 +278,14 @@ BASE_EXPORT bool SetPosixFilePermissions(const FilePath& path, int mode); + BASE_EXPORT bool ExecutableExistsInPath(Environment* env, + const FilePath::StringType& executable); + +-#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_AIX) ++#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_AIX) || defined(OS_HAIKU) + // Determine if files under a given |path| can be mapped and then mprotect'd + // PROT_EXEC. This depends on the mount options used for |path|, which vary + // among different Linux distributions and possibly local configuration. It also + // depends on details of kernel--ChromeOS uses the noexec option for /dev/shm + // but its kernel allows mprotect with PROT_EXEC anyway. + BASE_EXPORT bool IsPathExecutable(const FilePath& path); +-#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_AIX) ++#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_AIX) || defined(OS_HAIKU) + + #endif // OS_POSIX + +@@ -592,7 +592,7 @@ BASE_EXPORT bool VerifyPathControlledByAdmin(const base::FilePath& path); + // the directory |path|, in the number of FilePath::CharType, or -1 on failure. + BASE_EXPORT int GetMaximumPathComponentLength(const base::FilePath& path); + +-#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_AIX) ++#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_AIX) || defined(OS_HAIKU) + // Broad categories of file systems as returned by statfs() on Linux. + enum FileSystemType { + FILE_SYSTEM_UNKNOWN, // statfs failed. +diff --git a/src/3rdparty/chromium/base/files/file_util_posix.cc b/src/3rdparty/chromium/base/files/file_util_posix.cc +index d74cf2b..1eb07ae 100644 +--- a/src/3rdparty/chromium/base/files/file_util_posix.cc ++++ b/src/3rdparty/chromium/base/files/file_util_posix.cc +@@ -951,6 +951,10 @@ bool AllocateFileRegion(File* file, int64_t offset, size_t size) { + if (HANDLE_EINTR(fallocate(file->GetPlatformFile(), 0, offset, size)) != -1) + return true; + DPLOG(ERROR) << "fallocate"; ++#elif defined(OS_HAIKU) ++ if (HANDLE_EINTR(posix_fallocate(file->GetPlatformFile(), offset, size)) != -1) ++ return true; ++ DPLOG(ERROR) << "posix_fallocate"; + #elif defined(OS_APPLE) + // MacOS doesn't support fallocate even though their new APFS filesystem + // does support sparse files. It does, however, have the functionality +@@ -1118,7 +1122,7 @@ int GetMaximumPathComponentLength(const FilePath& path) { + #if !defined(OS_ANDROID) + // This is implemented in file_util_android.cc for that platform. + bool GetShmemTempDir(bool executable, FilePath* path) { +-#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_AIX) ++#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_AIX) || defined(OS_HAIKU) + bool disable_dev_shm = false; + #if !defined(OS_CHROMEOS) && !BUILDFLAG(IS_LACROS) + disable_dev_shm = CommandLine::ForCurrentProcess()->HasSwitch( +@@ -1127,14 +1131,22 @@ bool GetShmemTempDir(bool executable, FilePath* path) { + bool use_dev_shm = true; + if (executable) { + static const bool s_dev_shm_executable = ++#if defined(OS_HAIKU) ++ IsPathExecutable(FilePath("/var/shared_memory")); ++#else + IsPathExecutable(FilePath("/dev/shm")); ++#endif + use_dev_shm = s_dev_shm_executable; + } + if (use_dev_shm && !disable_dev_shm) { ++#if defined(OS_HAIKU) ++ *path = FilePath("/var/shared_memory"); ++#else + *path = FilePath("/dev/shm"); ++#endif + return true; + } +-#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_AIX) ++#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_AIX) || defined(OS_HAIKU) + return GetTempDir(path); + } + #endif // !defined(OS_ANDROID) +@@ -1172,7 +1184,7 @@ PrefetchResult PreReadFile(const FilePath& file_path, + // posix_fadvise() is only available in the Android NDK in API 21+. Older + // versions may have the required kernel support, but don't have enough usage + // to justify backporting. +-#if defined(OS_LINUX) || defined(OS_CHROMEOS) || \ ++#if defined(OS_LINUX) || defined(OS_HAIKU) || defined(OS_CHROMEOS) || \ + (defined(OS_ANDROID) && __ANDROID_API__ >= 21) + File file(file_path, File::FLAG_OPEN | File::FLAG_READ); + if (!file.IsValid()) +@@ -1208,7 +1220,7 @@ PrefetchResult PreReadFile(const FilePath& file_path, + return internal::PreReadFileSlow(file_path, max_bytes) + ? PrefetchResult{PrefetchResultCode::kSlowSuccess} + : PrefetchResult{PrefetchResultCode::kSlowFailed}; +-#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || (defined(OS_ANDROID) && ++#endif // defined(OS_LINUX) || defined(OS_HAIKU) || defined(OS_CHROMEOS) || (defined(OS_ANDROID) && + // __ANDROID_API__ >= 21) + } + +@@ -1243,7 +1255,7 @@ bool MoveUnsafe(const FilePath& from_path, const FilePath& to_path) { + + #endif // !defined(OS_NACL_NONSFI) + +-#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_AIX) ++#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_AIX) || defined(OS_HAIKU) + BASE_EXPORT bool IsPathExecutable(const FilePath& path) { + bool result = false; + FilePath tmp_file_path; +@@ -1264,6 +1276,6 @@ BASE_EXPORT bool IsPathExecutable(const FilePath& path) { + } + return result; + } +-#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_AIX) ++#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_AIX) || defined(OS_HAIKU) + + } // namespace base +diff --git a/src/3rdparty/chromium/base/files/scoped_file.cc b/src/3rdparty/chromium/base/files/scoped_file.cc +index a2e1e6b..50226cf 100644 +--- a/src/3rdparty/chromium/base/files/scoped_file.cc ++++ b/src/3rdparty/chromium/base/files/scoped_file.cc +@@ -29,7 +29,7 @@ void ScopedFDCloseTraits::Free(int fd) { + // It's especially problematic on Linux with the setuid sandbox, where + // a single open directory would bypass the entire security model. + int ret = IGNORE_EINTR(close(fd)); +- ++#if !defined(OS_HAIKU) + #if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_APPLE) || \ + defined(OS_FUCHSIA) || defined(OS_ANDROID) + // NB: Some file descriptors can return errors from close() e.g. network +@@ -41,6 +41,7 @@ void ScopedFDCloseTraits::Free(int fd) { + #endif + + PCHECK(0 == ret); ++#endif + } + + #endif // OS_POSIX || OS_FUCHSIA +diff --git a/src/3rdparty/chromium/base/linux_util.cc b/src/3rdparty/chromium/base/linux_util.cc +index 8dac7c7..3b429fe 100644 +--- a/src/3rdparty/chromium/base/linux_util.cc ++++ b/src/3rdparty/chromium/base/linux_util.cc +@@ -25,6 +25,7 @@ + #include "base/strings/string_split.h" + #include "base/strings/string_tokenizer.h" + #include "base/strings/string_util.h" ++#include "base/logging.h" + #include "build/build_config.h" + + namespace base { +diff --git a/src/3rdparty/chromium/base/logging.cc b/src/3rdparty/chromium/base/logging.cc +index b5cf2c4..4efc27d 100644 +--- a/src/3rdparty/chromium/base/logging.cc ++++ b/src/3rdparty/chromium/base/logging.cc +@@ -549,7 +549,7 @@ LogMessage::LogMessage(const char* file, int line, const char* condition) + LogMessage::~LogMessage() { + size_t stack_start = stream_.tellp(); + #if !defined(OFFICIAL_BUILD) && !defined(OS_NACL) && !defined(__UCLIBC__) && \ +- !defined(OS_AIX) ++ !defined(OS_AIX) && !defined(OS_HAIKU) + if (severity_ == LOG_FATAL && !base::debug::BeingDebugged()) { + // Include a stack trace on a fatal, unless a debugger is attached. + base::debug::StackTrace stack_trace; +diff --git a/src/3rdparty/chromium/base/memory/discardable_shared_memory.cc b/src/3rdparty/chromium/base/memory/discardable_shared_memory.cc +index c885b30..4aa6229 100644 +--- a/src/3rdparty/chromium/base/memory/discardable_shared_memory.cc ++++ b/src/3rdparty/chromium/base/memory/discardable_shared_memory.cc +@@ -407,6 +407,8 @@ bool DiscardableSharedMemory::Purge(Time current_time) { + // reusable bit, which allows both Activity Monitor and memory-infra to + // correctly track the pages. + #define MADV_PURGE_ARGUMENT MADV_FREE_REUSABLE ++#elif defined(OS_HAIKU) ++#define MADV_PURGE_ARGUMENT POSIX_MADV_DONTNEED + #else + #define MADV_PURGE_ARGUMENT MADV_FREE + #endif +diff --git a/src/3rdparty/chromium/base/memory/madv_free_discardable_memory_posix.cc b/src/3rdparty/chromium/base/memory/madv_free_discardable_memory_posix.cc +index 3cc1c8c..105ebeb 100644 +--- a/src/3rdparty/chromium/base/memory/madv_free_discardable_memory_posix.cc ++++ b/src/3rdparty/chromium/base/memory/madv_free_discardable_memory_posix.cc +@@ -302,6 +302,7 @@ bool MadvFreeDiscardableMemoryPosix::IsResident() const { + std::vector vec(allocated_pages_); + #endif + ++#if !defined(OS_HAIKU) + int retval = + mincore(data_, allocated_pages_ * base::GetPageSize(), vec.data()); + DPCHECK(retval == 0 || errno == EAGAIN); +@@ -310,6 +311,7 @@ bool MadvFreeDiscardableMemoryPosix::IsResident() const { + if (!(vec[i] & 1)) + return false; + } ++#endif + return true; + } + +diff --git a/src/3rdparty/chromium/base/memory/platform_shared_memory_region.h b/src/3rdparty/chromium/base/memory/platform_shared_memory_region.h +index 9b67c0e..6447162 100644 +--- a/src/3rdparty/chromium/base/memory/platform_shared_memory_region.h ++++ b/src/3rdparty/chromium/base/memory/platform_shared_memory_region.h +@@ -27,7 +27,7 @@ + #include "base/files/scoped_file.h" + #endif + +-#if defined(OS_LINUX) || defined(OS_CHROMEOS) ++#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU) + namespace content { + class SandboxIPCHandler; + } +@@ -120,7 +120,7 @@ class BASE_EXPORT PlatformSharedMemoryRegion { + kMaxValue = GET_SHMEM_TEMP_DIR_FAILURE + }; + +-#if defined(OS_LINUX) || defined(OS_CHROMEOS) ++#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU) + // Structure to limit access to executable region creation. + struct ExecutableRegion { + private: +@@ -264,7 +264,7 @@ class BASE_EXPORT PlatformSharedMemoryRegion { + CheckPlatformHandlePermissionsCorrespondToMode); + static PlatformSharedMemoryRegion Create(Mode mode, + size_t size +-#if defined(OS_LINUX) || defined(OS_CHROMEOS) ++#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU) + , + bool executable = false + #endif +diff --git a/src/3rdparty/chromium/base/memory/platform_shared_memory_region_posix.cc b/src/3rdparty/chromium/base/memory/platform_shared_memory_region_posix.cc +index f62a7d6..cabf383 100644 +--- a/src/3rdparty/chromium/base/memory/platform_shared_memory_region_posix.cc ++++ b/src/3rdparty/chromium/base/memory/platform_shared_memory_region_posix.cc +@@ -70,7 +70,7 @@ FDPair ScopedFDPair::get() const { + return {fd.get(), readonly_fd.get()}; + } + +-#if defined(OS_LINUX) || defined(OS_CHROMEOS) ++#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU) + // static + ScopedFD PlatformSharedMemoryRegion::ExecutableRegion::CreateFD(size_t size) { + PlatformSharedMemoryRegion region = +@@ -79,7 +79,7 @@ ScopedFD PlatformSharedMemoryRegion::ExecutableRegion::CreateFD(size_t size) { + return region.PassPlatformHandle().fd; + return ScopedFD(); + } +-#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) ++#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU) + + // static + PlatformSharedMemoryRegion PlatformSharedMemoryRegion::Take( +@@ -204,7 +204,7 @@ bool PlatformSharedMemoryRegion::MapAtInternal(off_t offset, + // static + PlatformSharedMemoryRegion PlatformSharedMemoryRegion::Create(Mode mode, + size_t size +-#if defined(OS_LINUX) || defined(OS_CHROMEOS) ++#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU) + , + bool executable + #endif +@@ -233,7 +233,7 @@ PlatformSharedMemoryRegion PlatformSharedMemoryRegion::Create(Mode mode, + // flag. + FilePath directory; + if (!GetShmemTempDir( +-#if defined(OS_LINUX) || defined(OS_CHROMEOS) ++#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU) + executable, + #else + false /* executable */, +@@ -308,7 +308,7 @@ bool PlatformSharedMemoryRegion::CheckPlatformHandlePermissionsCorrespondToMode( + PlatformHandle handle, + Mode mode, + size_t size) { +-#if !defined(OS_NACL) ++#if !defined(OS_NACL) && !defined(OS_HAIKU) + if (!CheckFDAccessMode(handle.fd, + mode == Mode::kReadOnly ? O_RDONLY : O_RDWR)) { + return false; +diff --git a/src/3rdparty/chromium/base/message_loop/message_pump_for_ui.h b/src/3rdparty/chromium/base/message_loop/message_pump_for_ui.h +index 1eb7da0..2843510 100644 +--- a/src/3rdparty/chromium/base/message_loop/message_pump_for_ui.h ++++ b/src/3rdparty/chromium/base/message_loop/message_pump_for_ui.h +@@ -20,7 +20,7 @@ + // No MessagePumpForUI, see below. + #elif defined(USE_GLIB) + #include "base/message_loop/message_pump_glib.h" +-#elif defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) ++#elif defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) || defined(OS_HAIKU) + #include "base/message_loop/message_pump_libevent.h" + #elif defined(OS_FUCHSIA) + #include "base/message_loop/message_pump_fuchsia.h" +@@ -44,7 +44,7 @@ using MessagePumpForUI = MessagePump; + // TODO(abarth): Figure out if we need this. + #elif defined(USE_GLIB) + using MessagePumpForUI = MessagePumpGlib; +-#elif defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) ++#elif defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) || defined(OS_HAIKU) + using MessagePumpForUI = MessagePumpLibevent; + #elif defined(OS_FUCHSIA) + using MessagePumpForUI = MessagePumpFuchsia; +diff --git a/src/3rdparty/chromium/base/path_service.cc b/src/3rdparty/chromium/base/path_service.cc +index 4750944..3ed2519 100644 +--- a/src/3rdparty/chromium/base/path_service.cc ++++ b/src/3rdparty/chromium/base/path_service.cc +@@ -31,6 +31,8 @@ bool PathProviderMac(int key, FilePath* result); + bool PathProviderAndroid(int key, FilePath* result); + #elif defined(OS_FUCHSIA) + bool PathProviderFuchsia(int key, FilePath* result); ++#elif defined(OS_HAIKU) ++bool PathProviderHaiku(int key, FilePath* result); + #elif defined(OS_POSIX) + // PathProviderPosix is the default path provider on POSIX OSes other than + // Mac and Android. +@@ -103,8 +105,16 @@ Provider base_provider_fuchsia = {PathProviderFuchsia, &base_provider, + true}; + #endif + ++#if defined(OS_HAIKU) ++Provider base_provider_haiku = {PathProviderHaiku, &base_provider, ++#ifndef NDEBUG ++ 0, 0, ++#endif ++ true}; ++#endif ++ + #if defined(OS_POSIX) && !defined(OS_APPLE) && !defined(OS_ANDROID) && \ +- !defined(OS_FUCHSIA) ++ !defined(OS_FUCHSIA) && !defined(OS_HAIKU) + Provider base_provider_posix = { + PathProviderPosix, + &base_provider, +@@ -133,6 +143,8 @@ struct PathData { + providers = &base_provider_android; + #elif defined(OS_FUCHSIA) + providers = &base_provider_fuchsia; ++#elif defined(OS_HAIKU) ++ providers = &base_provider_haiku; + #elif defined(OS_POSIX) + providers = &base_provider_posix; + #endif +diff --git a/src/3rdparty/chromium/base/posix/can_lower_nice_to.cc b/src/3rdparty/chromium/base/posix/can_lower_nice_to.cc +index b1686dc..dc9661f 100644 +--- a/src/3rdparty/chromium/base/posix/can_lower_nice_to.cc ++++ b/src/3rdparty/chromium/base/posix/can_lower_nice_to.cc +@@ -31,6 +31,9 @@ bool CanLowerNiceTo(int nice_value) { + if (geteuid() == 0) + return true; + ++#if defined(OS_HAIKU) ++ return false; ++#else + // 2. Skip checking the CAP_SYS_NICE permission because it would require + // libcap.so. + +@@ -54,6 +57,7 @@ bool CanLowerNiceTo(int nice_value) { + // And lowering niceness to |nice_value| is allowed if it is greater than or + // equal to the limit: + return nice_value >= lowest_nice_allowed; ++#endif + } + + } // namespace internal +diff --git a/src/3rdparty/chromium/base/posix/unix_domain_socket.cc b/src/3rdparty/chromium/base/posix/unix_domain_socket.cc +index e4d052d..25da15c 100644 +--- a/src/3rdparty/chromium/base/posix/unix_domain_socket.cc ++++ b/src/3rdparty/chromium/base/posix/unix_domain_socket.cc +@@ -57,7 +57,7 @@ bool CreateSocketPair(ScopedFD* one, ScopedFD* two) { + + // static + bool UnixDomainSocket::EnableReceiveProcessId(int fd) { +-#if !defined(OS_APPLE) ++#if !defined(OS_APPLE) && !defined(OS_HAIKU) + const int enable = 1; + return setsockopt(fd, SOL_SOCKET, SO_PASSCRED, &enable, sizeof(enable)) == 0; + #else +@@ -148,11 +148,11 @@ ssize_t UnixDomainSocket::RecvMsgWithFlags(int fd, + + const size_t kControlBufferSize = + CMSG_SPACE(sizeof(int) * kMaxFileDescriptors) +-#if !defined(OS_NACL_NONSFI) && !defined(OS_APPLE) ++#if !defined(OS_NACL_NONSFI) && !defined(OS_APPLE) && !defined(OS_HAIKU) + // The PNaCl toolchain for Non-SFI binary build and macOS do not support + // ucred. macOS supports xucred, but this structure is insufficient. + + CMSG_SPACE(sizeof(struct ucred)) +-#endif // !defined(OS_NACL_NONSFI) && !defined(OS_APPLE) ++#endif // !defined(OS_NACL_NONSFI) && !defined(OS_APPLE) && !defined(OS_HAIKU) + ; + char control_buffer[kControlBufferSize]; + msg.msg_control = control_buffer; +@@ -176,7 +176,7 @@ ssize_t UnixDomainSocket::RecvMsgWithFlags(int fd, + wire_fds = reinterpret_cast(CMSG_DATA(cmsg)); + wire_fds_len = payload_len / sizeof(int); + } +-#if !defined(OS_NACL_NONSFI) && !defined(OS_APPLE) ++#if !defined(OS_NACL_NONSFI) && !defined(OS_APPLE) && !defined(OS_HAIKU) + // The PNaCl toolchain for Non-SFI binary build and macOS do not support + // SCM_CREDENTIALS. + if (cmsg->cmsg_level == SOL_SOCKET && +@@ -185,7 +185,7 @@ ssize_t UnixDomainSocket::RecvMsgWithFlags(int fd, + DCHECK_EQ(pid, -1); + pid = reinterpret_cast(CMSG_DATA(cmsg))->pid; + } +-#endif // !defined(OS_NACL_NONSFI) && !defined(OS_APPLE) ++#endif // !defined(OS_NACL_NONSFI) && !defined(OS_APPLE) && !defined(OS_HAIKU) + } + } + +diff --git a/src/3rdparty/chromium/base/process/kill.h b/src/3rdparty/chromium/base/process/kill.h +index a7d23bd..f7082d5 100644 +--- a/src/3rdparty/chromium/base/process/kill.h ++++ b/src/3rdparty/chromium/base/process/kill.h +@@ -113,7 +113,7 @@ BASE_EXPORT TerminationStatus GetTerminationStatus(ProcessHandle handle, + BASE_EXPORT TerminationStatus GetKnownDeadTerminationStatus( + ProcessHandle handle, int* exit_code); + +-#if defined(OS_LINUX) || defined(OS_CHROMEOS) ++#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU) + // Spawns a thread to wait asynchronously for the child |process| to exit + // and then reaps it. + BASE_EXPORT void EnsureProcessGetsReaped(Process process); +diff --git a/src/3rdparty/chromium/base/process/kill_posix.cc b/src/3rdparty/chromium/base/process/kill_posix.cc +index 0fa6edb..eadf830 100644 +--- a/src/3rdparty/chromium/base/process/kill_posix.cc ++++ b/src/3rdparty/chromium/base/process/kill_posix.cc +@@ -160,7 +160,7 @@ void EnsureProcessTerminated(Process process) { + 0, new BackgroundReaper(std::move(process), TimeDelta::FromSeconds(2))); + } + +-#if defined(OS_LINUX) || defined(OS_CHROMEOS) ++#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU) + void EnsureProcessGetsReaped(Process process) { + DCHECK(!process.is_current()); + +diff --git a/src/3rdparty/chromium/base/process/launch.cc b/src/3rdparty/chromium/base/process/launch.cc +index a643828..9845344 100644 +--- a/src/3rdparty/chromium/base/process/launch.cc ++++ b/src/3rdparty/chromium/base/process/launch.cc +@@ -15,7 +15,7 @@ LaunchOptions::~LaunchOptions() = default; + + LaunchOptions LaunchOptionsForTest() { + LaunchOptions options; +-#if defined(OS_LINUX) || defined(OS_CHROMEOS) ++#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU) + // To prevent accidental privilege sharing to an untrusted child, processes + // are started with PR_SET_NO_NEW_PRIVS. Do not set that here, since this + // new child will be used for testing only. +diff --git a/src/3rdparty/chromium/base/process/launch.h b/src/3rdparty/chromium/base/process/launch.h +index 6cf6eac..486b793 100644 +--- a/src/3rdparty/chromium/base/process/launch.h ++++ b/src/3rdparty/chromium/base/process/launch.h +@@ -180,7 +180,7 @@ struct BASE_EXPORT LaunchOptions { + bool clear_environment = false; + #endif // OS_WIN || OS_POSIX || OS_FUCHSIA + +-#if defined(OS_LINUX) || defined(OS_CHROMEOS) ++#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU) + // If non-zero, start the process using clone(), using flags as provided. + // Unlike in clone, clone_flags may not contain a custom termination signal + // that is sent to the parent when the child dies. The termination signal will +@@ -193,7 +193,7 @@ struct BASE_EXPORT LaunchOptions { + + // Sets parent process death signal to SIGKILL. + bool kill_on_parent_death = false; +-#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) ++#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU) + + #if defined(OS_MAC) + // Mach ports that will be accessible to the child process. These are not +@@ -408,7 +408,7 @@ BASE_EXPORT void RaiseProcessToHighPriority(); + // binary. This should not be called in production/released code. + BASE_EXPORT LaunchOptions LaunchOptionsForTest(); + +-#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_NACL_NONSFI) ++#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_NACL_NONSFI) || defined(OS_HAIKU) + // A wrapper for clone with fork-like behavior, meaning that it returns the + // child's pid in the parent and 0 in the child. |flags|, |ptid|, and |ctid| are + // as in the clone system call (the CLONE_VM flag is not supported). +diff --git a/src/3rdparty/chromium/base/process/launch_posix.cc b/src/3rdparty/chromium/base/process/launch_posix.cc +index a8b1f0b..bb8718a 100644 +--- a/src/3rdparty/chromium/base/process/launch_posix.cc ++++ b/src/3rdparty/chromium/base/process/launch_posix.cc +@@ -14,7 +14,9 @@ + #include + #include + #include ++#if !defined(OS_HAIKU) + #include ++#endif + #include + #include + #include +@@ -221,7 +223,7 @@ static const char kFDDir[] = "/proc/self/fd"; + void CloseSuperfluousFds(const base::InjectiveMultimap& saved_mapping) { + // DANGER: no calls to malloc or locks are allowed from now on: + // http://crbug.com/36678 +- ++#if !defined(OS_HAIKU) + // Get the maximum number of FDs possible. + size_t max_fds = GetMaxFds(); + +@@ -276,6 +278,7 @@ void CloseSuperfluousFds(const base::InjectiveMultimap& saved_mapping) { + int ret = IGNORE_EINTR(close(fd)); + DPCHECK(ret == 0); + } ++ #endif + } + + Process LaunchProcess(const CommandLine& cmdline, +diff --git a/src/3rdparty/chromium/base/process/memory.cc b/src/3rdparty/chromium/base/process/memory.cc +index 4454e32..83a0723 100644 +--- a/src/3rdparty/chromium/base/process/memory.cc ++++ b/src/3rdparty/chromium/base/process/memory.cc +@@ -55,7 +55,7 @@ NOINLINE void OnNoMemoryInternal(size_t size) { + } // namespace internal + + // Defined in memory_win.cc for Windows. +-#if !defined(OS_WIN) ++#if !defined(OS_WIN) && !defined(OS_HAIKU) + + namespace { + +@@ -74,7 +74,7 @@ void TerminateBecauseOutOfMemory(size_t size) { + #endif // !defined(OS_WIN) + + // Defined in memory_mac.mm for Mac. +-#if !defined(OS_APPLE) ++#if !defined(OS_APPLE) && !defined(OS_HAIKU) + + bool UncheckedCalloc(size_t num_items, size_t size, void** result) { + const size_t alloc_size = num_items * size; +diff --git a/src/3rdparty/chromium/base/process/memory.h b/src/3rdparty/chromium/base/process/memory.h +index 2d313ed..eb7b17a 100644 +--- a/src/3rdparty/chromium/base/process/memory.h ++++ b/src/3rdparty/chromium/base/process/memory.h +@@ -25,7 +25,7 @@ BASE_EXPORT void EnableTerminationOnOutOfMemory(); + BASE_EXPORT void TerminateBecauseOutOfMemory(size_t size); + + #if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || \ +- defined(OS_AIX) ++ defined(OS_AIX) || defined(OS_HAIKU) + BASE_EXPORT extern size_t g_oom_size; + + // The maximum allowed value for the OOM score. +diff --git a/src/3rdparty/chromium/base/process/process_handle.h b/src/3rdparty/chromium/base/process/process_handle.h +index 3640351..d7e185a 100644 +--- a/src/3rdparty/chromium/base/process/process_handle.h ++++ b/src/3rdparty/chromium/base/process/process_handle.h +@@ -103,7 +103,7 @@ BASE_EXPORT ProcessId GetCurrentProcId(); + // processes may be reused. + BASE_EXPORT UniqueProcId GetUniqueIdForProcess(); + +-#if defined(OS_LINUX) || defined(OS_CHROMEOS) ++#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU) + // When a process is started in a different PID namespace from the browser + // process, this function must be called with the process's PID in the browser's + // PID namespace in order to initialize its unique ID. Not thread safe. +diff --git a/src/3rdparty/chromium/base/process/process_handle_haiku.cc b/src/3rdparty/chromium/base/process/process_handle_haiku.cc +new file mode 100644 +index 0000000..bc17cab +--- /dev/null ++++ b/src/3rdparty/chromium/base/process/process_handle_haiku.cc +@@ -0,0 +1,24 @@ ++// Copyright (c) 2013 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/logging.h" ++#include "base/process/process_handle.h" ++ ++#include "base/files/file_util.h" ++ ++#define PARENT_ID 3 ++extern "C" pid_t _kern_process_info(pid_t, int); ++ ++namespace base { ++ ++ProcessId GetParentProcessId(ProcessHandle process) { ++ return _kern_process_info(process, PARENT_ID); ++} ++ ++FilePath GetProcessExecutablePath(ProcessHandle process) { ++ NOTIMPLEMENTED(); ++ return FilePath(); ++} ++ ++} // namespace base +diff --git a/src/3rdparty/chromium/base/process/process_iterator_haiku.cc b/src/3rdparty/chromium/base/process/process_iterator_haiku.cc +new file mode 100644 +index 0000000..6d411ba +--- /dev/null ++++ b/src/3rdparty/chromium/base/process/process_iterator_haiku.cc +@@ -0,0 +1,26 @@ ++// Copyright 2017 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/process_iterator.h" ++ ++namespace base { ++ ++ProcessIterator::ProcessIterator(const ProcessFilter* filter) { ++ // TODO(fuchsia): There's no Fuchsia API to iterate processes currently. ++ NOTREACHED(); ++} ++ ++ProcessIterator::~ProcessIterator() {} ++ ++bool ProcessIterator::CheckForNextProcess() { ++ // TODO(fuchsia): There's no Fuchsia API to iterate processes currently. ++ return false; ++} ++ ++bool NamedProcessIterator::IncludeEntry() { ++ // TODO(fuchsia): There's no Fuchsia API to iterate processes currently. ++ return false; ++} ++ ++} // namespace base +diff --git a/src/3rdparty/chromium/base/process/process_metrics.h b/src/3rdparty/chromium/base/process/process_metrics.h +index bbf88c5..def2511 100644 +--- a/src/3rdparty/chromium/base/process/process_metrics.h ++++ b/src/3rdparty/chromium/base/process/process_metrics.h +@@ -47,7 +47,7 @@ namespace base { + // Full declaration is in process_metrics_iocounters.h. + struct IoCounters; + +-#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) ++#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || defined(OS_HAIKU) + // Minor and major page fault counts since the process creation. + // Both counts are process-wide, and exclude child processes. + // +@@ -57,7 +57,7 @@ struct PageFaultCounts { + int64_t minor; + int64_t major; + }; +-#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) ++#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || defined(OS_HAIKU) + + // Convert a POSIX timeval to microseconds. + BASE_EXPORT int64_t TimeValToMicroseconds(const struct timeval& tv); +@@ -98,7 +98,7 @@ class BASE_EXPORT ProcessMetrics { + // convenience wrapper for CreateProcessMetrics(). + static std::unique_ptr CreateCurrentProcessMetrics(); + +-#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) ++#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || defined(OS_HAIKU) + // Resident Set Size is a Linux/Android specific memory concept. Do not + // attempt to extend this to other platforms. + BASE_EXPORT size_t GetResidentSetSize() const; +@@ -125,7 +125,7 @@ class BASE_EXPORT ProcessMetrics { + TimeDelta GetCumulativeCPUUsage(); + + #if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || \ +- defined(OS_AIX) ++ defined(OS_AIX) || defined(OS_HAIKU) + // Emits the cumulative CPU usage for all currently active threads since they + // were started into the output parameter (replacing its current contents). + // Threads that have already terminated will not be reported. Thus, the sum of +@@ -160,7 +160,7 @@ class BASE_EXPORT ProcessMetrics { + PlatformThreadId tid, + TimeInStatePerThread& time_in_state_per_thread); + #endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || +- // defined(OS_AIX) ++ // defined(OS_AIX) || defined(OS_HAIKU) + + // Returns the number of average idle cpu wakeups per second since the last + // call. +@@ -216,14 +216,14 @@ class BASE_EXPORT ProcessMetrics { + int GetOpenFdSoftLimit() const; + #endif // defined(OS_POSIX) + +-#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) ++#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || defined(OS_HAIKU) + // Bytes of swap as reported by /proc/[pid]/status. + uint64_t GetVmSwapBytes() const; + + // Minor and major page fault count as reported by /proc/[pid]/stat. + // Returns true for success. + bool GetPageFaultCounts(PageFaultCounts* counts) const; +-#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) ++#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || defined(OS_HAIKU) + + // Returns total memory usage of malloc. + size_t GetMallocUsage(); +@@ -236,7 +236,7 @@ class BASE_EXPORT ProcessMetrics { + #endif // !defined(OS_MAC) + + #if defined(OS_APPLE) || defined(OS_LINUX) || defined(OS_CHROMEOS) || \ +- defined(OS_AIX) ++ defined(OS_AIX) || defined(OS_HAIKU) + int CalculateIdleWakeupsPerSecond(uint64_t absolute_idle_wakeups); + #endif + #if defined(OS_APPLE) +@@ -247,10 +247,10 @@ class BASE_EXPORT ProcessMetrics { + #endif + + #if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || \ +- defined(OS_AIX) ++ defined(OS_AIX) || defined(OS_HAIKU) + CPU::CoreType GetCoreType(int core_index); + #endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || +- // defined(OS_AIX) ++ // defined(OS_AIX) || defined(OS_HAIKU) + + #if defined(OS_WIN) + win::ScopedHandle process_; +@@ -272,7 +272,7 @@ class BASE_EXPORT ProcessMetrics { + uint64_t last_cumulative_disk_usage_ = 0; + + #if defined(OS_APPLE) || defined(OS_LINUX) || defined(OS_CHROMEOS) || \ +- defined(OS_AIX) ++ defined(OS_AIX) || defined(OS_HAIKU) + // Same thing for idle wakeups. + TimeTicks last_idle_wakeups_time_; + uint64_t last_absolute_idle_wakeups_; +@@ -325,7 +325,7 @@ BASE_EXPORT void IncreaseFdLimitTo(unsigned int max_descriptors); + + #if defined(OS_WIN) || defined(OS_APPLE) || defined(OS_LINUX) || \ + defined(OS_CHROMEOS) || defined(OS_ANDROID) || defined(OS_AIX) || \ +- defined(OS_FUCHSIA) ++ defined(OS_FUCHSIA) || defined(OS_HAIKU) + // Data about system-wide memory consumption. Values are in KB. Available on + // Windows, Mac, Linux, Android and Chrome OS. + // +@@ -359,7 +359,7 @@ struct BASE_EXPORT SystemMemoryInfoKB { + #endif + + #if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || \ +- defined(OS_AIX) ++ defined(OS_AIX) || defined(OS_HAIKU) + // This provides an estimate of available memory as described here: + // https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=34e431b0ae398fc54ea69ff85ec700722c9da773 + // NOTE: this is ONLY valid in kernels 3.14 and up. Its value will always +@@ -374,7 +374,7 @@ struct BASE_EXPORT SystemMemoryInfoKB { + #endif + + #if defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_CHROMEOS) || \ +- defined(OS_AIX) || defined(OS_FUCHSIA) ++ defined(OS_AIX) || defined(OS_FUCHSIA) || defined(OS_HAIKU) + int buffers = 0; + int cached = 0; + int active_anon = 0; +@@ -384,7 +384,7 @@ struct BASE_EXPORT SystemMemoryInfoKB { + int dirty = 0; + int reclaimable = 0; + #endif // defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_CHROMEOS) || +- // defined(OS_AIX) defined(OS_FUCHSIA) ++ // defined(OS_AIX) defined(OS_FUCHSIA) || defined(OS_HAIKU) + + #if defined(OS_CHROMEOS) || BUILDFLAG(IS_LACROS) + int shmem = 0; +@@ -408,10 +408,10 @@ BASE_EXPORT bool GetSystemMemoryInfo(SystemMemoryInfoKB* meminfo); + + #endif // defined(OS_WIN) || defined(OS_APPLE) || defined(OS_LINUX) || + // defined(OS_CHROMEOS) defined(OS_ANDROID) || defined(OS_AIX) || +- // defined(OS_FUCHSIA) ++ // defined(OS_FUCHSIA) || defined(OS_HAIKU) + + #if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || \ +- defined(OS_AIX) ++ defined(OS_AIX) || defined(OS_HAIKU) + // Parse the data found in /proc//stat and return the sum of the + // CPU-related ticks. Returns -1 on parse error. + // Exposed for testing. +@@ -486,7 +486,7 @@ BASE_EXPORT bool GetSystemDiskInfo(SystemDiskInfo* diskinfo); + BASE_EXPORT TimeDelta GetUserCpuTimeSinceBoot(); + + #endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || +- // defined(OS_AIX) ++ // defined(OS_AIX) || defined(OS_HAIKU) + + #if defined(OS_CHROMEOS) || BUILDFLAG(IS_LACROS) + // Data from files in directory /sys/block/zram0 about ZRAM usage. +@@ -597,7 +597,7 @@ class BASE_EXPORT SystemMetrics { + FRIEND_TEST_ALL_PREFIXES(SystemMetricsTest, SystemMetrics); + + size_t committed_memory_; +-#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) ++#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || defined(OS_HAIKU) + SystemMemoryInfoKB memory_info_; + VmStatInfo vmstat_info_; + SystemDiskInfo disk_info_; +diff --git a/src/3rdparty/chromium/base/process/process_metrics_haiku.cc b/src/3rdparty/chromium/base/process/process_metrics_haiku.cc +new file mode 100644 +index 0000000..2a73cc1 +--- /dev/null ++++ b/src/3rdparty/chromium/base/process/process_metrics_haiku.cc +@@ -0,0 +1,43 @@ ++// Copyright 2017 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/process_metrics.h" ++ ++namespace base { ++ ++size_t GetSystemCommitCharge() { ++ // Not available, doesn't seem likely that it will be (for the whole system). ++ NOTIMPLEMENTED(); ++ return 0; ++} ++ ++// static ++std::unique_ptr ProcessMetrics::CreateProcessMetrics( ++ ProcessHandle process) { ++ NOTIMPLEMENTED(); // TODO(fuchsia): https://crbug.com/706592. ++ return nullptr; ++} ++ ++size_t ProcessMetrics::GetResidentSetSize() const { ++ NOTIMPLEMENTED(); // TODO(fuchsia): https://crbug.com/706592. ++ return 0; ++} ++ ++TimeDelta ProcessMetrics::GetCumulativeCPUUsage() { ++ NOTIMPLEMENTED(); // TODO(fuchsia): https://crbug.com/706592. ++ return TimeDelta(); ++} ++ ++bool GetSystemMemoryInfo(SystemMemoryInfoKB* meminfo) { ++ NOTIMPLEMENTED(); // TODO(fuchsia): https://crbug.com/706592. ++ return false; ++} ++ ++uint64_t ProcessMetrics::GetVmSwapBytes() const { ++ NOTIMPLEMENTED(); // TODO(fuchsia): https://crbug.com/706592. ++ return 0; ++} ++ ++ ++} // namespace base +diff --git a/src/3rdparty/chromium/base/process/process_metrics_posix.cc b/src/3rdparty/chromium/base/process/process_metrics_posix.cc +index 9d12c42..d29e675 100644 +--- a/src/3rdparty/chromium/base/process/process_metrics_posix.cc ++++ b/src/3rdparty/chromium/base/process/process_metrics_posix.cc +@@ -53,6 +53,8 @@ static const rlim_t kSystemDefaultMaxFds = 256; + static const rlim_t kSystemDefaultMaxFds = 1024; + #elif defined(OS_AIX) + static const rlim_t kSystemDefaultMaxFds = 8192; ++#elif defined(OS_HAIKU) ++static const rlim_t kSystemDefaultMaxFds = 4096; + #endif + + size_t GetMaxFds() { +@@ -126,7 +128,7 @@ size_t ProcessMetrics::GetMallocUsage() { + #else + return minfo.hblkhd + minfo.arena; + #endif +-#elif defined(OS_FUCHSIA) ++#elif defined(OS_FUCHSIA) || defined(OS_HAIKU) + // TODO(fuchsia): Not currently exposed. https://crbug.com/735087. + return 0; + #endif +diff --git a/src/3rdparty/chromium/base/process/process_posix.cc b/src/3rdparty/chromium/base/process/process_posix.cc +index fc771b3..4c34d41 100644 +--- a/src/3rdparty/chromium/base/process/process_posix.cc ++++ b/src/3rdparty/chromium/base/process/process_posix.cc +@@ -268,13 +268,13 @@ Process Process::DeprecatedGetProcessFromHandle(ProcessHandle handle) { + } + + #if !defined(OS_LINUX) && !defined(OS_CHROMEOS) && !defined(OS_MAC) && \ +- !defined(OS_AIX) ++ !defined(OS_AIX) && !defined(OS_HAIKU) + // static + bool Process::CanBackgroundProcesses() { + return false; + } + #endif // !defined(OS_LINUX) && !defined(OS_CHROMEOS) && !defined(OS_MAC) && +- // !defined(OS_AIX) ++ // !defined(OS_AIX) && !defined(OS_HAIKU) + + // static + void Process::TerminateCurrentProcessImmediately(int exit_code) { +@@ -365,7 +365,7 @@ bool Process::WaitForExitWithTimeout(TimeDelta timeout, int* exit_code) const { + void Process::Exited(int exit_code) const {} + + #if !defined(OS_LINUX) && !defined(OS_CHROMEOS) && !defined(OS_MAC) && \ +- !defined(OS_AIX) ++ !defined(OS_AIX) && !defined(OS_HAIKU) + bool Process::IsProcessBackgrounded() const { + // See SetProcessBackgrounded(). + DCHECK(IsValid()); +@@ -380,7 +380,7 @@ bool Process::SetProcessBackgrounded(bool value) { + return false; + } + #endif // !defined(OS_LINUX) && !defined(OS_CHROMEOS) && !defined(OS_MAC) && +- // !defined(OS_AIX) ++ // !defined(OS_AIX) && !defined(OS_HAIKU) + + int Process::GetPriority() const { + DCHECK(IsValid()); +diff --git a/src/3rdparty/chromium/base/profiler/module_cache_posix.cc b/src/3rdparty/chromium/base/profiler/module_cache_posix.cc +index 310ab39..6e0f72c 100644 +--- a/src/3rdparty/chromium/base/profiler/module_cache_posix.cc ++++ b/src/3rdparty/chromium/base/profiler/module_cache_posix.cc +@@ -6,6 +6,11 @@ + + #include + #include ++#ifdef __HAIKU__ ++#define PF_X 0x1 ++#define PF_W 0x2 ++#define PF_R 0x4 ++#endif + + #include "base/debug/elf_reader.h" + #include "build/build_config.h" +diff --git a/src/3rdparty/chromium/base/system/sys_info.h b/src/3rdparty/chromium/base/system/sys_info.h +index eee730e..3f36569 100644 +--- a/src/3rdparty/chromium/base/system/sys_info.h ++++ b/src/3rdparty/chromium/base/system/sys_info.h +@@ -212,7 +212,7 @@ class BASE_EXPORT SysInfo { + static HardwareInfo GetHardwareInfoSync(); + + #if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || \ +- defined(OS_AIX) ++ defined(OS_AIX) || defined(OS_HAIKU) + static int64_t AmountOfAvailablePhysicalMemory( + const SystemMemoryInfoKB& meminfo); + #endif +diff --git a/src/3rdparty/chromium/base/system/sys_info_haiku.cc b/src/3rdparty/chromium/base/system/sys_info_haiku.cc +new file mode 100644 +index 0000000..e4cf2f0 +--- /dev/null ++++ b/src/3rdparty/chromium/base/system/sys_info_haiku.cc +@@ -0,0 +1,35 @@ ++// Copyright 2018 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/system/sys_info.h" ++ ++#include "base/notreached.h" ++ ++#include ++ ++namespace base { ++ ++// static ++int64_t SysInfo::AmountOfPhysicalMemoryImpl() { ++ system_info systemInfo; ++ get_system_info(&systemInfo); ++ return static_cast(systemInfo.max_pages * B_PAGE_SIZE + 0.5f); ++} ++ ++// static ++int64_t SysInfo::AmountOfAvailablePhysicalMemoryImpl() { ++ system_info systemInfo; ++ get_system_info(&systemInfo); ++ return static_cast((systemInfo.max_pages - systemInfo.used_pages) ++ * B_PAGE_SIZE + 0.5f); ++} ++ ++// static ++std::string SysInfo::CPUModelName() { ++ system_info systemInfo; ++ NOTIMPLEMENTED(); ++ return std::string(); ++} ++ ++} // namespace base +diff --git a/src/3rdparty/chromium/base/third_party/libevent/BUILD.gn b/src/3rdparty/chromium/base/third_party/libevent/BUILD.gn +index 3628030..2e1bd65 100644 +--- a/src/3rdparty/chromium/base/third_party/libevent/BUILD.gn ++++ b/src/3rdparty/chromium/base/third_party/libevent/BUILD.gn +@@ -48,7 +48,7 @@ static_library("bundled_libevent") { + "mac/event-config.h", + ] + include_dirs = [ "mac" ] +- } else if (is_linux || is_chromeos) { ++ } else if ((is_linux && !is_haiku) || is_chromeos) { + sources += [ + "epoll.c", + "linux/config.h", +@@ -78,6 +78,13 @@ static_library("bundled_libevent") { + "nacl_nonsfi/signal_stub.c", + ] + include_dirs = [ "nacl_nonsfi" ] ++ } else if (is_haiku) { ++ sources += [ ++ "haiku/config.h", ++ "haiku/event-config.h", ++ ] ++ include_dirs = [ "haiku", "compat" ] ++ libs = [ "network" ] + } + + configs -= [ "//build/config/compiler:chromium_code" ] +diff --git a/src/3rdparty/chromium/base/third_party/libevent/event-config.h b/src/3rdparty/chromium/base/third_party/libevent/event-config.h +index bbd23f1..f01bea2 100644 +--- a/src/3rdparty/chromium/base/third_party/libevent/event-config.h ++++ b/src/3rdparty/chromium/base/third_party/libevent/event-config.h +@@ -19,6 +19,8 @@ + #include "base/third_party/libevent/solaris/event-config.h" + #elif defined(_AIX) + #include "base/third_party/libevent/aix/event-config.h" ++#elif defined(__HAIKU__) ++#include "base/third_party/libevent/haiku/event-config.h" + #else + #error generate event-config.h for your platform + #endif +diff --git a/src/3rdparty/chromium/base/third_party/libevent/haiku/config.h b/src/3rdparty/chromium/base/third_party/libevent/haiku/config.h +new file mode 100644 +index 0000000..5990ae7 +--- /dev/null ++++ b/src/3rdparty/chromium/base/third_party/libevent/haiku/config.h +@@ -0,0 +1,272 @@ ++/* config.h. Generated from config.h.in by configure. */ ++/* config.h.in. Generated from configure.in by autoheader. */ ++ ++/* Define if clock_gettime is available in libc */ ++#define DNS_USE_CPU_CLOCK_FOR_ID 1 ++ ++/* Define is no secure id variant is available */ ++/* #undef DNS_USE_GETTIMEOFDAY_FOR_ID */ ++ ++/* Define to 1 if you have the `clock_gettime' function. */ ++#define HAVE_CLOCK_GETTIME 1 ++ ++/* Define if /dev/poll is available */ ++/* #undef HAVE_DEVPOLL */ ++ ++/* Define to 1 if you have the header file. */ ++#define HAVE_DLFCN_H 1 ++ ++/* Define if your system supports the epoll system calls */ ++/* #undef HAVE_EPOLL */ ++ ++/* Define to 1 if you have the `epoll_ctl' function. */ ++/* #undef HAVE_EPOLL_CTL */ ++ ++/* Define if your system supports event ports */ ++/* #undef HAVE_EVENT_PORTS */ ++ ++/* Define to 1 if you have the `fcntl' function. */ ++#define HAVE_FCNTL 1 ++ ++/* Define to 1 if you have the header file. */ ++#define HAVE_FCNTL_H 1 ++ ++/* Define to 1 if the system has the type `fd_mask'. */ ++/* #undef HAVE_FD_MASK */ ++ ++/* Define to 1 if you have the `getaddrinfo' function. */ ++#define HAVE_GETADDRINFO 1 ++ ++/* Define to 1 if you have the `getegid' function. */ ++#define HAVE_GETEGID 1 ++ ++/* Define to 1 if you have the `geteuid' function. */ ++#define HAVE_GETEUID 1 ++ ++/* Define to 1 if you have the `getnameinfo' function. */ ++#define HAVE_GETNAMEINFO 1 ++ ++/* Define to 1 if you have the `gettimeofday' function. */ ++#define HAVE_GETTIMEOFDAY 1 ++ ++/* Define to 1 if you have the `inet_ntop' function. */ ++#define HAVE_INET_NTOP 1 ++ ++/* Define to 1 if you have the header file. */ ++#define HAVE_INTTYPES_H 1 ++ ++/* Define to 1 if you have the `issetugid' function. */ ++/* #undef HAVE_ISSETUGID */ ++ ++/* Define to 1 if you have the `kqueue' function. */ ++/* #undef HAVE_KQUEUE */ ++ ++/* Define to 1 if you have the `nsl' library (-lnsl). */ ++/* #undef HAVE_LIBNSL */ ++ ++/* Define to 1 if you have the `resolv' library (-lresolv). */ ++/* #undef HAVE_LIBRESOLV */ ++ ++/* Define to 1 if you have the `rt' library (-lrt). */ ++/* #undef HAVE_LIBRT */ ++ ++/* Define to 1 if you have the header file. */ ++#define HAVE_MEMORY_H 1 ++ ++/* Define to 1 if you have the header file. */ ++/* #undef HAVE_NETINET_IN6_H */ ++ ++/* Define to 1 if you have the `poll' function. */ ++#define HAVE_POLL 1 ++ ++/* Define to 1 if you have the header file. */ ++#define HAVE_POLL_H 1 ++ ++/* Define to 1 if you have the `port_create' function. */ ++/* #undef HAVE_PORT_CREATE */ ++ ++/* Define to 1 if you have the header file. */ ++/* #undef HAVE_PORT_H */ ++ ++/* Define to 1 if you have the `select' function. */ ++#define HAVE_SELECT 1 ++ ++/* Define if F_SETFD is defined in */ ++#define HAVE_SETFD 1 ++ ++/* Define to 1 if you have the `sigaction' function. */ ++#define HAVE_SIGACTION 1 ++ ++/* Define to 1 if you have the `signal' function. */ ++#define HAVE_SIGNAL 1 ++ ++/* Define to 1 if you have the header file. */ ++#define HAVE_SIGNAL_H 1 ++ ++/* Define to 1 if you have the header file. */ ++#define HAVE_STDARG_H 1 ++ ++/* Define to 1 if you have the header file. */ ++#define HAVE_STDINT_H 1 ++ ++/* Define to 1 if you have the header file. */ ++#define HAVE_STDLIB_H 1 ++ ++/* Define to 1 if you have the header file. */ ++#define HAVE_STRINGS_H 1 ++ ++/* Define to 1 if you have the header file. */ ++#define HAVE_STRING_H 1 ++ ++/* Define to 1 if you have the `strlcpy' function. */ ++#define HAVE_STRLCPY 1 ++ ++/* Define to 1 if you have the `strsep' function. */ ++#define HAVE_STRSEP 1 ++ ++/* Define to 1 if you have the `strtok_r' function. */ ++#define HAVE_STRTOK_R 1 ++ ++/* Define to 1 if you have the `strtoll' function. */ ++#define HAVE_STRTOLL 1 ++ ++/* Define to 1 if the system has the type `struct in6_addr'. */ ++#define HAVE_STRUCT_IN6_ADDR 1 ++ ++/* Define to 1 if you have the header file. */ ++/* #undef HAVE_SYS_DEVPOLL_H */ ++ ++/* Define to 1 if you have the header file. */ ++/* #undef HAVE_SYS_EPOLL_H */ ++ ++/* Define to 1 if you have the header file. */ ++/* #undef HAVE_SYS_EVENT_H */ ++ ++/* Define to 1 if you have the header file. */ ++#define HAVE_SYS_IOCTL_H 1 ++ ++/* Define to 1 if you have the header file. */ ++#define HAVE_SYS_PARAM_H 1 ++ ++/* Define to 1 if you have the header file. */ ++#define HAVE_SYS_QUEUE_H 1 ++ ++/* Define to 1 if you have the header file. */ ++#define HAVE_SYS_SELECT_H 1 ++ ++/* Define to 1 if you have the header file. */ ++#define HAVE_SYS_SOCKET_H 1 ++ ++/* Define to 1 if you have the header file. */ ++#define HAVE_SYS_STAT_H 1 ++ ++/* Define to 1 if you have the header file. */ ++#define HAVE_SYS_TIME_H 1 ++ ++/* Define to 1 if you have the header file. */ ++#define HAVE_SYS_TYPES_H 1 ++ ++/* Define if TAILQ_FOREACH is defined in */ ++/* #undef HAVE_TAILQFOREACH */ ++ ++/* Define if timeradd is defined in */ ++#define HAVE_TIMERADD 1 ++ ++/* Define if timerclear is defined in */ ++#define HAVE_TIMERCLEAR 1 ++ ++/* Define if timercmp is defined in */ ++#define HAVE_TIMERCMP 1 ++ ++/* Define if timerisset is defined in */ ++#define HAVE_TIMERISSET 1 ++ ++/* Define to 1 if the system has the type `uint16_t'. */ ++#define HAVE_UINT16_T 1 ++ ++/* Define to 1 if the system has the type `uint32_t'. */ ++#define HAVE_UINT32_T 1 ++ ++/* Define to 1 if the system has the type `uint64_t'. */ ++#define HAVE_UINT64_T 1 ++ ++/* Define to 1 if the system has the type `uint8_t'. */ ++#define HAVE_UINT8_T 1 ++ ++/* Define to 1 if you have the header file. */ ++#define HAVE_UNISTD_H 1 ++ ++/* Define to 1 if you have the `vasprintf' function. */ ++#define HAVE_VASPRINTF 1 ++ ++/* Define if kqueue works correctly with pipes */ ++/* #undef HAVE_WORKING_KQUEUE */ ++ ++/* Define to the sub-directory where libtool stores uninstalled libraries. */ ++#define LT_OBJDIR ".libs/" ++ ++/* Numeric representation of the version */ ++#define NUMERIC_VERSION 0x01040e00 ++ ++/* Name of package */ ++#define PACKAGE "libevent" ++ ++/* Define to the address where bug reports for this package should be sent. */ ++#define PACKAGE_BUGREPORT "" ++ ++/* Define to the full name of this package. */ ++#define PACKAGE_NAME "" ++ ++/* Define to the full name and version of this package. */ ++#define PACKAGE_STRING "" ++ ++/* Define to the one symbol short name of this package. */ ++#define PACKAGE_TARNAME "" ++ ++/* Define to the home page for this package. */ ++#define PACKAGE_URL "" ++ ++/* Define to the version of this package. */ ++#define PACKAGE_VERSION "" ++ ++/* The size of `int', as computed by sizeof. */ ++#define SIZEOF_INT 4 ++ ++/* The size of `long', as computed by sizeof. */ ++#define SIZEOF_LONG 8 ++ ++/* The size of `long long', as computed by sizeof. */ ++#define SIZEOF_LONG_LONG 8 ++ ++/* The size of `short', as computed by sizeof. */ ++#define SIZEOF_SHORT 2 ++ ++/* Define to 1 if you have the ANSI C header files. */ ++#define STDC_HEADERS 1 ++ ++/* Define to 1 if you can safely include both and . */ ++#define TIME_WITH_SYS_TIME 1 ++ ++/* Version number of package */ ++#define VERSION "1.4.14b-stable" ++ ++/* Define to appropriate substitue if compiler doesnt have __func__ */ ++/* #undef __func__ */ ++ ++/* Define to empty if `const' does not conform to ANSI C. */ ++/* #undef const */ ++ ++/* Define to `__inline__' or `__inline' if that's what the C compiler ++ calls it, or to nothing if 'inline' is not supported under any name. */ ++#ifndef __cplusplus ++/* #undef inline */ ++#endif ++ ++/* Define to `int' if does not define. */ ++/* #undef pid_t */ ++ ++/* Define to `unsigned int' if does not define. */ ++/* #undef size_t */ ++ ++/* Define to unsigned int if you dont have it */ ++/* #undef socklen_t */ +diff --git a/src/3rdparty/chromium/base/third_party/libevent/haiku/event-config.h b/src/3rdparty/chromium/base/third_party/libevent/haiku/event-config.h +new file mode 100644 +index 0000000..0a77f14 +--- /dev/null ++++ b/src/3rdparty/chromium/base/third_party/libevent/haiku/event-config.h +@@ -0,0 +1,280 @@ ++/* event-config.h ++ * Generated by autoconf; post-processed by libevent. ++ * Do not edit this file. ++ * Do not rely on macros in this file existing in later versions. ++ */ ++#ifndef _EVENT_CONFIG_H_ ++#define _EVENT_CONFIG_H_ ++/* config.h. Generated from config.h.in by configure. */ ++/* config.h.in. Generated from configure.in by autoheader. */ ++ ++/* Define if clock_gettime is available in libc */ ++#define _EVENT_DNS_USE_CPU_CLOCK_FOR_ID 1 ++ ++/* Define is no secure id variant is available */ ++/* #undef _EVENT_DNS_USE_GETTIMEOFDAY_FOR_ID */ ++ ++/* Define to 1 if you have the `clock_gettime' function. */ ++#define _EVENT_HAVE_CLOCK_GETTIME 1 ++ ++/* Define if /dev/poll is available */ ++/* #undef _EVENT_HAVE_DEVPOLL */ ++ ++/* Define to 1 if you have the header file. */ ++#define _EVENT_HAVE_DLFCN_H 1 ++ ++/* Define if your system supports the epoll system calls */ ++/* #undef _EVENT_HAVE_EPOLL */ ++ ++/* Define to 1 if you have the `epoll_ctl' function. */ ++/* #undef _EVENT_HAVE_EPOLL_CTL */ ++ ++/* Define if your system supports event ports */ ++/* #undef _EVENT_HAVE_EVENT_PORTS */ ++ ++/* Define to 1 if you have the `fcntl' function. */ ++#define _EVENT_HAVE_FCNTL 1 ++ ++/* Define to 1 if you have the header file. */ ++#define _EVENT_HAVE_FCNTL_H 1 ++ ++/* Define to 1 if the system has the type `fd_mask'. */ ++#define _EVENT_HAVE_FD_MASK ++ ++/* Define to 1 if you have the `getaddrinfo' function. */ ++#define _EVENT_HAVE_GETADDRINFO 1 ++ ++/* Define to 1 if you have the `getegid' function. */ ++#define _EVENT_HAVE_GETEGID 1 ++ ++/* Define to 1 if you have the `geteuid' function. */ ++#define _EVENT_HAVE_GETEUID 1 ++ ++/* Define to 1 if you have the `getnameinfo' function. */ ++#define _EVENT_HAVE_GETNAMEINFO 1 ++ ++/* Define to 1 if you have the `gettimeofday' function. */ ++#define _EVENT_HAVE_GETTIMEOFDAY 1 ++ ++/* Define to 1 if you have the `inet_ntop' function. */ ++#define _EVENT_HAVE_INET_NTOP 1 ++ ++/* Define to 1 if you have the header file. */ ++#define _EVENT_HAVE_INTTYPES_H 1 ++ ++/* Define to 1 if you have the `issetugid' function. */ ++/* #undef _EVENT_HAVE_ISSETUGID */ ++ ++/* Define to 1 if you have the `kqueue' function. */ ++/* #undef _EVENT_HAVE_KQUEUE */ ++ ++/* Define to 1 if you have the `nsl' library (-lnsl). */ ++/* #undef _EVENT_HAVE_LIBNSL */ ++ ++/* Define to 1 if you have the `resolv' library (-lresolv). */ ++/* #undef _EVENT_HAVE_LIBRESOLV */ ++ ++/* Define to 1 if you have the `rt' library (-lrt). */ ++/* #undef _EVENT_HAVE_LIBRT */ ++ ++/* Define to 1 if you have the header file. */ ++#define _EVENT_HAVE_MEMORY_H 1 ++ ++/* Define to 1 if you have the header file. */ ++/* #undef _EVENT_HAVE_NETINET_IN6_H */ ++ ++/* Define to 1 if you have the `poll' function. */ ++#define _EVENT_HAVE_POLL 1 ++ ++/* Define to 1 if you have the header file. */ ++#define _EVENT_HAVE_POLL_H 1 ++ ++/* Define to 1 if you have the `port_create' function. */ ++/* #undef _EVENT_HAVE_PORT_CREATE */ ++ ++/* Define to 1 if you have the header file. */ ++/* #undef _EVENT_HAVE_PORT_H */ ++ ++/* Define to 1 if you have the `select' function. */ ++#define _EVENT_HAVE_SELECT 1 ++ ++/* Define if F_SETFD is defined in */ ++#define _EVENT_HAVE_SETFD 1 ++ ++/* Define to 1 if you have the `sigaction' function. */ ++#define _EVENT_HAVE_SIGACTION 1 ++ ++/* Define to 1 if you have the `signal' function. */ ++#define _EVENT_HAVE_SIGNAL 1 ++ ++/* Define to 1 if you have the header file. */ ++#define _EVENT_HAVE_SIGNAL_H 1 ++ ++/* Define to 1 if you have the header file. */ ++#define _EVENT_HAVE_STDARG_H 1 ++ ++/* Define to 1 if you have the header file. */ ++#define _EVENT_HAVE_STDINT_H 1 ++ ++/* Define to 1 if you have the header file. */ ++#define _EVENT_HAVE_STDLIB_H 1 ++ ++/* Define to 1 if you have the header file. */ ++#define _EVENT_HAVE_STRINGS_H 1 ++ ++/* Define to 1 if you have the header file. */ ++#define _EVENT_HAVE_STRING_H 1 ++ ++/* Define to 1 if you have the `strlcpy' function. */ ++#define _EVENT_HAVE_STRLCPY 1 ++ ++/* Define to 1 if you have the `strsep' function. */ ++/* #undef _EVENT_HAVE_STRSEP */ ++ ++/* Define to 1 if you have the `strtok_r' function. */ ++#define _EVENT_HAVE_STRTOK_R 1 ++ ++/* Define to 1 if you have the `strtoll' function. */ ++#define _EVENT_HAVE_STRTOLL 1 ++ ++/* Define to 1 if the system has the type `struct in6_addr'. */ ++#define _EVENT_HAVE_STRUCT_IN6_ADDR 1 ++ ++/* Define to 1 if you have the header file. */ ++/* #undef _EVENT_HAVE_SYS_DEVPOLL_H */ ++ ++/* Define to 1 if you have the header file. */ ++/* #undef _EVENT_HAVE_SYS_EPOLL_H */ ++ ++/* Define to 1 if you have the header file. */ ++/* #undef _EVENT_HAVE_SYS_EVENT_H */ ++ ++/* Define to 1 if you have the header file. */ ++#define _EVENT_HAVE_SYS_IOCTL_H 1 ++ ++/* Define to 1 if you have the header file. */ ++#define _EVENT_HAVE_SYS_PARAM_H 1 ++ ++/* Define to 1 if you have the header file. */ ++#define _EVENT_HAVE_SYS_QUEUE_H 1 ++ ++/* Define to 1 if you have the header file. */ ++#define _EVENT_HAVE_SYS_SELECT_H 1 ++ ++/* Define to 1 if you have the header file. */ ++#define _EVENT_HAVE_SYS_SOCKET_H 1 ++ ++/* Define to 1 if you have the header file. */ ++#define _EVENT_HAVE_SYS_STAT_H 1 ++ ++/* Define to 1 if you have the header file. */ ++#define _EVENT_HAVE_SYS_TIME_H 1 ++ ++/* Define to 1 if you have the header file. */ ++#define _EVENT_HAVE_SYS_TYPES_H 1 ++ ++/* Define if TAILQ_FOREACH is defined in */ ++/* #undef _EVENT_HAVE_TAILQFOREACH */ ++ ++/* Define if timeradd is defined in */ ++#define _EVENT_HAVE_TIMERADD 1 ++ ++/* Define if timerclear is defined in */ ++#define _EVENT_HAVE_TIMERCLEAR 1 ++ ++/* Define if timercmp is defined in */ ++#define _EVENT_HAVE_TIMERCMP 1 ++ ++/* Define if timerisset is defined in */ ++#define _EVENT_HAVE_TIMERISSET 1 ++ ++/* Define to 1 if the system has the type `uint16_t'. */ ++#define _EVENT_HAVE_UINT16_T 1 ++ ++/* Define to 1 if the system has the type `uint32_t'. */ ++#define _EVENT_HAVE_UINT32_T 1 ++ ++/* Define to 1 if the system has the type `uint64_t'. */ ++#define _EVENT_HAVE_UINT64_T 1 ++ ++/* Define to 1 if the system has the type `uint8_t'. */ ++#define _EVENT_HAVE_UINT8_T 1 ++ ++/* Define to 1 if you have the header file. */ ++#define _EVENT_HAVE_UNISTD_H 1 ++ ++/* Define to 1 if you have the `vasprintf' function. */ ++#define _EVENT_HAVE_VASPRINTF 1 ++ ++/* Define if kqueue works correctly with pipes */ ++/* #undef _EVENT_HAVE_WORKING_KQUEUE */ ++ ++/* Define to the sub-directory where libtool stores uninstalled libraries. */ ++#define _EVENT_LT_OBJDIR ".libs/" ++ ++/* Numeric representation of the version */ ++#define _EVENT_NUMERIC_VERSION 0x01040e00 ++ ++/* Name of package */ ++#define _EVENT_PACKAGE "libevent" ++ ++/* Define to the address where bug reports for this package should be sent. */ ++#define _EVENT_PACKAGE_BUGREPORT "" ++ ++/* Define to the full name of this package. */ ++#define _EVENT_PACKAGE_NAME "" ++ ++/* Define to the full name and version of this package. */ ++#define _EVENT_PACKAGE_STRING "" ++ ++/* Define to the one symbol short name of this package. */ ++#define _EVENT_PACKAGE_TARNAME "" ++ ++/* Define to the home page for this package. */ ++#define _EVENT_PACKAGE_URL "" ++ ++/* Define to the version of this package. */ ++#define _EVENT_PACKAGE_VERSION "" ++ ++/* The size of `int', as computed by sizeof. */ ++#define _EVENT_SIZEOF_INT 4 ++ ++/* The size of `long', as computed by sizeof. */ ++#define _EVENT_SIZEOF_LONG 8 ++ ++/* The size of `long long', as computed by sizeof. */ ++#define _EVENT_SIZEOF_LONG_LONG 8 ++ ++/* The size of `short', as computed by sizeof. */ ++#define _EVENT_SIZEOF_SHORT 2 ++ ++/* Define to 1 if you have the ANSI C header files. */ ++#define _EVENT_STDC_HEADERS 1 ++ ++/* Define to 1 if you can safely include both and . */ ++#define _EVENT_TIME_WITH_SYS_TIME 1 ++ ++/* Version number of package */ ++#define _EVENT_VERSION "1.4.14b-stable" ++ ++/* Define to appropriate substitue if compiler doesnt have __func__ */ ++/* #undef _EVENT___func__ */ ++ ++/* Define to empty if `const' does not conform to ANSI C. */ ++/* #undef _EVENT_const */ ++ ++/* Define to `__inline__' or `__inline' if that's what the C compiler ++ calls it, or to nothing if 'inline' is not supported under any name. */ ++#ifndef _EVENT___cplusplus ++/* #undef _EVENT_inline */ ++#endif ++ ++/* Define to `int' if does not define. */ ++/* #undef _EVENT_pid_t */ ++ ++/* Define to `unsigned int' if does not define. */ ++/* #undef _EVENT_size_t */ ++ ++/* Define to unsigned int if you dont have it */ ++/* #undef _EVENT_socklen_t */ ++#endif +diff --git a/src/3rdparty/chromium/base/threading/platform_thread.h b/src/3rdparty/chromium/base/threading/platform_thread.h +index 76e53d3..465542c 100644 +--- a/src/3rdparty/chromium/base/threading/platform_thread.h ++++ b/src/3rdparty/chromium/base/threading/platform_thread.h +@@ -230,7 +230,7 @@ class BASE_EXPORT PlatformThread { + // Returns a realtime period provided by |delegate|. + static TimeDelta GetRealtimePeriod(Delegate* delegate); + +-#if defined(OS_LINUX) || defined(OS_CHROMEOS) ++#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU) + // Toggles a specific thread's priority at runtime. This can be used to + // change the priority of a thread in a different process and will fail + // if the calling process does not have proper permissions. The +diff --git a/src/3rdparty/chromium/base/threading/platform_thread_haiku.cc b/src/3rdparty/chromium/base/threading/platform_thread_haiku.cc +new file mode 100644 +index 0000000..6bfe285 +--- /dev/null ++++ b/src/3rdparty/chromium/base/threading/platform_thread_haiku.cc +@@ -0,0 +1,79 @@ ++// Copyright 2018 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/threading/platform_thread.h" ++ ++#include ++#include ++ ++#include "base/threading/platform_thread_internal_posix.h" ++#include "base/threading/thread_id_name_manager.h" ++ ++namespace base { ++ ++namespace internal { ++ ++const ThreadPriorityToNiceValuePair kThreadPriorityToNiceValueMap[4] = { ++ {ThreadPriority::BACKGROUND, 10}, ++ {ThreadPriority::NORMAL, 0}, ++ {ThreadPriority::DISPLAY, -8}, ++ {ThreadPriority::REALTIME_AUDIO, -10}, ++}; ++ ++Optional CanIncreaseCurrentThreadPriorityForPlatform( ++ ThreadPriority priority) { ++ return base::nullopt; ++} ++ ++bool SetCurrentThreadPriorityForPlatform(ThreadPriority priority) { ++ sched_param prio = {0}; ++ prio.sched_priority = ThreadPriorityToNiceValue(priority); ++ return pthread_setschedparam(pthread_self(), SCHED_OTHER, &prio) == 0; ++} ++ ++Optional GetCurrentThreadPriorityForPlatform() { ++ int maybe_sched_rr = 0; ++ struct sched_param maybe_realtime_prio = {0}; ++ if (pthread_getschedparam(pthread_self(), &maybe_sched_rr, ++ &maybe_realtime_prio) == 0 && ++ maybe_sched_rr == SCHED_RR && ++ maybe_realtime_prio.sched_priority >= 100) { ++ return base::make_optional(ThreadPriority::REALTIME_AUDIO); ++ } ++ return base::nullopt; ++} ++ ++} // namespace internal ++ ++ ++// static ++void PlatformThread::SetThreadPriority(PlatformThreadId process_id, ++ PlatformThreadId thread_id, ++ ThreadPriority priority) { ++ // Changing current main threads' priority is not permitted in favor of ++ // security, this interface is restricted to change only non-main thread ++ // priority. ++ CHECK_NE(thread_id, process_id); ++ ++ const int nice_setting = internal::ThreadPriorityToNiceValue(priority); ++ if (setpriority(PRIO_PROCESS, thread_id, nice_setting)) { ++ DVPLOG(1) << "Failed to set nice value of thread (" << thread_id << ") to " ++ << nice_setting; ++ } ++} ++ ++void InitThreading() {} ++ ++void TerminateOnThread() {} ++ ++size_t GetDefaultThreadStackSize(const pthread_attr_t& attributes) { ++ return 0; ++} ++ ++// static ++void PlatformThread::SetName(const std::string& name) { ++ ++} ++ ++} // namespace base +diff --git a/src/3rdparty/chromium/base/threading/platform_thread_linux.cc b/src/3rdparty/chromium/base/threading/platform_thread_linux.cc +index c1a705e..146a7d9 100644 +--- a/src/3rdparty/chromium/base/threading/platform_thread_linux.cc ++++ b/src/3rdparty/chromium/base/threading/platform_thread_linux.cc +@@ -24,7 +24,9 @@ + + #if !defined(OS_NACL) && !defined(OS_AIX) + #include ++#if !defined(OS_HAIKU) + #include ++#endif + #include + #include + #include +@@ -264,7 +266,7 @@ const ThreadPriorityToNiceValuePair kThreadPriorityToNiceValueMap[4] = { + + Optional CanIncreaseCurrentThreadPriorityForPlatform( + ThreadPriority priority) { +-#if !defined(OS_NACL) ++#if !defined(OS_NACL) && !defined(OS_HAIKU) + // A non-zero soft-limit on RLIMIT_RTPRIO is required to be allowed to invoke + // pthread_setschedparam in SetCurrentThreadPriorityForPlatform(). + struct rlimit rlim; +@@ -314,7 +316,7 @@ Optional GetCurrentThreadPriorityForPlatform() { + void PlatformThread::SetName(const std::string& name) { + ThreadIdNameManager::GetInstance()->SetName(name); + +-#if !defined(OS_NACL) && !defined(OS_AIX) ++#if !defined(OS_NACL) && !defined(OS_AIX) && !defined(OS_HAIKU) + // On linux we can get the thread names to show up in the debugger by setting + // the process name for the LWP. We don't want to do this for the main + // thread because that would rename the process, causing tools like killall +diff --git a/src/3rdparty/chromium/base/threading/platform_thread_posix.cc b/src/3rdparty/chromium/base/threading/platform_thread_posix.cc +index 550454c..9d57348 100644 +--- a/src/3rdparty/chromium/base/threading/platform_thread_posix.cc ++++ b/src/3rdparty/chromium/base/threading/platform_thread_posix.cc +@@ -66,7 +66,7 @@ void* ThreadFunc(void* params) { + if (!thread_params->joinable) + base::ThreadRestrictions::SetSingletonAllowed(false); + +-#if !defined(OS_NACL) ++#if !defined(OS_NACL) && !defined(OS_HAIKU) + + #if defined(OS_APPLE) + PlatformThread::SetCurrentThreadRealtimePeriodValue( +@@ -309,7 +309,7 @@ bool PlatformThread::CanIncreaseThreadPriority(ThreadPriority priority) { + + // static + void PlatformThread::SetCurrentThreadPriorityImpl(ThreadPriority priority) { +-#if defined(OS_NACL) ++#if defined(OS_NACL) || defined(OS_HAIKU) + NOTIMPLEMENTED(); + #else + if (internal::SetCurrentThreadPriorityForPlatform(priority)) +@@ -331,7 +331,7 @@ void PlatformThread::SetCurrentThreadPriorityImpl(ThreadPriority priority) { + + // static + ThreadPriority PlatformThread::GetCurrentThreadPriority() { +-#if defined(OS_NACL) ++#if defined(OS_NACL) || defined(OS_HAIKU) + NOTIMPLEMENTED(); + return ThreadPriority::NORMAL; + #else +diff --git a/src/3rdparty/chromium/base/trace_event/malloc_dump_provider.cc b/src/3rdparty/chromium/base/trace_event/malloc_dump_provider.cc +index c327f48..1b90c08 100644 +--- a/src/3rdparty/chromium/base/trace_event/malloc_dump_provider.cc ++++ b/src/3rdparty/chromium/base/trace_event/malloc_dump_provider.cc +@@ -130,7 +130,7 @@ bool MallocDumpProvider::OnMemoryDump(const MemoryDumpArgs& args, + allocated_objects_size = main_heap_info.allocated_size; + allocated_objects_count = main_heap_info.block_count; + } +-#elif defined(OS_FUCHSIA) ++#elif defined(OS_FUCHSIA) || defined(OS_HAIKU) + // TODO(fuchsia): Port, see https://crbug.com/706592. + #else + struct mallinfo info = mallinfo(); +diff --git a/src/3rdparty/chromium/base/trace_event/process_memory_dump.cc b/src/3rdparty/chromium/base/trace_event/process_memory_dump.cc +index b757168..95c2088 100644 +--- a/src/3rdparty/chromium/base/trace_event/process_memory_dump.cc ++++ b/src/3rdparty/chromium/base/trace_event/process_memory_dump.cc +@@ -117,7 +117,7 @@ size_t ProcessMemoryDump::CountResidentBytes(void* start_address, + + for (size_t i = 0; i < page_count; i++) + resident_page_count += vec[i].VirtualAttributes.Valid; +-#elif defined(OS_FUCHSIA) ++#elif defined(OS_FUCHSIA) || defined(OS_HAIKU) + // TODO(fuchsia): Port, see https://crbug.com/706592. + ALLOW_UNUSED_LOCAL(chunk_start); + ALLOW_UNUSED_LOCAL(page_count); +diff --git a/src/3rdparty/chromium/build/build_config.h b/src/3rdparty/chromium/build/build_config.h +index 2c3e81e..f0e1ded 100644 +--- a/src/3rdparty/chromium/build/build_config.h ++++ b/src/3rdparty/chromium/build/build_config.h +@@ -86,6 +86,8 @@ + #define OS_AIX 1 + #elif defined(__asmjs__) || defined(__wasm__) + #define OS_ASMJS 1 ++#elif defined(__HAIKU__) ++#define OS_HAIKU 1 + #else + #error Please add support for your platform in build/build_config.h + #endif +@@ -108,7 +110,7 @@ + defined(OS_FREEBSD) || defined(OS_IOS) || defined(OS_LINUX) || \ + defined(OS_CHROMEOS) || defined(OS_MAC) || defined(OS_NACL) || \ + defined(OS_NETBSD) || defined(OS_OPENBSD) || defined(OS_QNX) || \ +- defined(OS_SOLARIS) ++ defined(OS_SOLARIS) || defined(OS_HAIKU) + #define OS_POSIX 1 + #endif + +diff --git a/src/3rdparty/chromium/build/config/BUILD.gn b/src/3rdparty/chromium/build/config/BUILD.gn +index f88c691..df87c89 100644 +--- a/src/3rdparty/chromium/build/config/BUILD.gn ++++ b/src/3rdparty/chromium/build/config/BUILD.gn +@@ -233,7 +233,7 @@ config("default_libs") { + "CoreText.framework", + "Foundation.framework", + ] +- } else if (is_linux || is_chromeos) { ++ } else if ((is_linux && !is_haiku) || is_chromeos) { + libs = [ + "dl", + "pthread", +diff --git a/src/3rdparty/chromium/build/config/BUILDCONFIG.gn b/src/3rdparty/chromium/build/config/BUILDCONFIG.gn +index 3815dd6..2dc0602 100644 +--- a/src/3rdparty/chromium/build/config/BUILDCONFIG.gn ++++ b/src/3rdparty/chromium/build/config/BUILDCONFIG.gn +@@ -131,13 +131,13 @@ declare_args() { + is_official_build = false + + # Whether we're a traditional desktop unix. +- is_desktop_linux = current_os == "linux" ++ is_desktop_linux = current_os == "linux" || current_os == "haiku" + + # Set to true when compiling with the Clang compiler. +- is_clang = current_os != "linux" || ++ is_clang = current_os != "haiku" && (current_os != "linux" || + (current_cpu != "s390x" && current_cpu != "s390" && + current_cpu != "ppc64" && current_cpu != "ppc" && +- current_cpu != "mips" && current_cpu != "mips64") ++ current_cpu != "mips" && current_cpu != "mips64")) + + # Allows the path to a custom target toolchain to be injected as a single + # argument, and set as the default toolchain. +@@ -191,8 +191,8 @@ if (host_toolchain == "") { + # TODO(dpranke): Add some sort of assert here that verifies that + # no toolchain omitted host_toolchain from its toolchain_args(). + +- if (host_os == "linux") { +- if (target_os != "linux") { ++ if (host_os == "linux" || host_os == "haiku") { ++ if (target_os != "linux" && target_os != "haiku") { + host_toolchain = "//build/toolchain/linux:clang_$host_cpu" + } else if (is_clang) { + host_toolchain = "//build/toolchain/linux:clang_$host_cpu" +@@ -218,6 +218,8 @@ if (host_toolchain == "") { + } + } else if (host_os == "aix") { + host_toolchain = "//build/toolchain/aix:$host_cpu" ++ } else if (host_os == "haiku") { ++ host_toolchain = "//build/toolchain/haiku:$host_cpu" + } else { + assert(false, "Unsupported host_os: $host_os") + } +@@ -229,7 +231,7 @@ if (target_os == "android") { + assert(host_os == "linux" || host_os == "mac", + "Android builds are only supported on Linux and Mac hosts.") + _default_toolchain = "//build/toolchain/android:android_clang_$target_cpu" +-} else if (target_os == "chromeos" || target_os == "linux") { ++} else if (target_os == "chromeos" || target_os == "linux" || target_os == "haiku") { + # See comments in build/toolchain/cros/BUILD.gn about board compiles. + if (is_clang) { + _default_toolchain = "//build/toolchain/linux:clang_$target_cpu" +@@ -293,10 +295,11 @@ is_android = current_os == "android" + is_chromeos = current_os == "chromeos" + is_fuchsia = current_os == "fuchsia" + is_ios = current_os == "ios" +-is_linux = current_os == "linux" ++is_linux = current_os == "linux" || current_os == "haiku" + is_mac = current_os == "mac" + is_nacl = current_os == "nacl" + is_win = current_os == "win" || current_os == "winuwp" ++is_haiku = current_os == "haiku" + + is_apple = is_ios || is_mac + is_posix = !is_win && !is_fuchsia +diff --git a/src/3rdparty/chromium/build/config/compiler/BUILD.gn b/src/3rdparty/chromium/build/config/compiler/BUILD.gn +index b511a58..49f2a71 100644 +--- a/src/3rdparty/chromium/build/config/compiler/BUILD.gn ++++ b/src/3rdparty/chromium/build/config/compiler/BUILD.gn +@@ -256,6 +256,8 @@ config("compiler") { + configs += [ "//build/config/fuchsia:compiler" ] + } else if (current_os == "aix") { + configs += [ "//build/config/aix:compiler" ] ++ } else if (is_haiku) { ++ configs += [ "//build/config/haiku:compiler" ] + } + + configs += [ +@@ -290,7 +292,7 @@ config("compiler") { + # The x86 toolchain currently has problems with stack-protector. + if (is_android && current_cpu == "x86") { + cflags += [ "-fno-stack-protector" ] +- } else if (current_os != "aix") { ++ } else if (current_os != "aix" && current_os != "haiku") { + # Not available on aix. + cflags += [ "-fstack-protector" ] + } +@@ -459,7 +461,7 @@ config("compiler") { + ldflags += [ "-Wl,--icf=all" ] + } + +- if (is_linux || is_chromeos) { ++ if ((is_linux && !is_haiku) || is_chromeos) { + cflags += [ "-pthread" ] + # Do not use the -pthread ldflag here since it becomes a no-op + # when using -nodefaultlibs, which would cause an unused argument +@@ -1262,6 +1264,8 @@ config("runtime_library") { + configs += [ "//build/config/mac:runtime_library" ] + } else if (is_android) { + configs += [ "//build/config/android:runtime_library" ] ++ } else if (is_haiku) { ++ configs += [ "//build/config/haiku:runtime_library" ] + } + + if (is_component_build) { +@@ -1507,7 +1511,9 @@ config("default_warnings") { + cflags_cc += [ "-Wno-subobject-linkage" ] + cflags_cc += [ "-Wno-invalid-offsetof" ] + cflags_cc += [ "-Wno-return-type" ] +- cflags_cc += [ "-Wno-deprecated-copy" ] ++ if (!is_haiku) { ++ cflags_cc += [ "-Wno-deprecated-copy" ] ++ } + } + } + +@@ -1780,7 +1786,7 @@ config("no_rtti") { + # (de)allocate memory on a different heap, which would spell trouble if pointers + # to heap-allocated memory are passed over shared library boundaries. + config("export_dynamic") { +- if (is_desktop_linux || export_libcxxabi_from_executables) { ++ if (is_desktop_linux && !is_haiku || export_libcxxabi_from_executables) { + ldflags = [ "-rdynamic" ] + } + } +diff --git a/src/3rdparty/chromium/build/config/crypto.gni b/src/3rdparty/chromium/build/config/crypto.gni +index 093c353..74a776f 100644 +--- a/src/3rdparty/chromium/build/config/crypto.gni ++++ b/src/3rdparty/chromium/build/config/crypto.gni +@@ -13,5 +13,5 @@ + + declare_args() { + # True if NSS is used for certificate handling. +- use_nss_certs = is_linux || is_chromeos ++ use_nss_certs = is_linux || is_chromeos || is_haiku + } +diff --git a/src/3rdparty/chromium/build/config/features.gni b/src/3rdparty/chromium/build/config/features.gni +index 95c766f..24b7d16 100644 +--- a/src/3rdparty/chromium/build/config/features.gni ++++ b/src/3rdparty/chromium/build/config/features.gni +@@ -26,11 +26,11 @@ declare_args() { + proprietary_codecs = is_chrome_branded || is_chromecast + + # libudev usage. This currently only affects the content layer. +- use_udev = (is_linux || is_chromeos) && !is_chromecast ++ use_udev = (is_linux || is_chromeos) && !is_chromecast && !is_haiku + +- use_dbus = (is_linux || is_chromeos) && !is_chromecast ++ use_dbus = (is_linux || is_chromeos) && !is_chromecast && !is_haiku + +- use_gio = is_linux && !is_chromeos && !is_chromecast ++ use_gio = is_linux && !is_chromeos && !is_chromecast && !is_haiku + + use_qt = false + } +diff --git a/src/3rdparty/chromium/build/config/gcc/BUILD.gn b/src/3rdparty/chromium/build/config/gcc/BUILD.gn +index 154b259..d917146 100644 +--- a/src/3rdparty/chromium/build/config/gcc/BUILD.gn ++++ b/src/3rdparty/chromium/build/config/gcc/BUILD.gn +@@ -91,7 +91,10 @@ if (is_component_build && !is_android) { + # Settings for executables. + config("executable_config") { + configs = executable_and_shared_library_configs_ +- ldflags = [ "-pie" ] ++ ldflags = [] ++ if (!is_haiku) { ++ ldflags += [ "-pie" ] ++ } + if (is_android) { + ldflags += [ + "-Bdynamic", +diff --git a/src/3rdparty/chromium/build/config/haiku/BUILD.gn b/src/3rdparty/chromium/build/config/haiku/BUILD.gn +new file mode 100644 +index 0000000..95fed9d +--- /dev/null ++++ b/src/3rdparty/chromium/build/config/haiku/BUILD.gn +@@ -0,0 +1,37 @@ ++# Copyright (c) 2013 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. ++ ++import("//build/config/c++/c++.gni") ++import("//build/config/linux/pkg_config.gni") ++import("//build/config/ui.gni") ++ ++# This is included by reference in the //build/config/compiler config that ++# is applied to all targets. It is here to separate out the logic that is ++# Linux-only. This is not applied to Android, but is applied to ChromeOS. ++config("compiler") { ++} ++ ++# This is included by reference in the //build/config/compiler:runtime_library ++# config that is applied to all targets. It is here to separate out the logic ++# that is Linux-only. Please see that target for advice on what should go in ++# :runtime_library vs. :compiler. ++config("runtime_library") { ++ libs = [ "be" ] ++} ++ ++if (use_glib) { ++ pkg_config("glib") { ++ packages = [ ++ "glib-2.0", ++ "gmodule-2.0", ++ "gobject-2.0", ++ "gthread-2.0", ++ ] ++ defines = [ ++ "GLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_40", ++ "GLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_40", ++ ] ++ } ++} ++ +diff --git a/src/3rdparty/chromium/build/config/linux/pkg-config.py b/src/3rdparty/chromium/build/config/linux/pkg-config.py +index 5adf70c..520e970 100755 +--- a/src/3rdparty/chromium/build/config/linux/pkg-config.py ++++ b/src/3rdparty/chromium/build/config/linux/pkg-config.py +@@ -109,7 +109,7 @@ def main(): + # If this is run on non-Linux platforms, just return nothing and indicate + # success. This allows us to "kind of emulate" a Linux build from other + # platforms. +- if "linux" not in sys.platform: ++ if "linux" not in sys.platform and "haiku" not in sys.platform: + print("[[],[],[],[],[]]") + return 0 + +diff --git a/src/3rdparty/chromium/build/config/logging.gni b/src/3rdparty/chromium/build/config/logging.gni +index b0ae9e8..7c4a0bc 100644 +--- a/src/3rdparty/chromium/build/config/logging.gni ++++ b/src/3rdparty/chromium/build/config/logging.gni +@@ -6,5 +6,5 @@ import("//build/config/dcheck_always_on.gni") + + declare_args() { + # Use LogErrorNotReached() for NOTREACHED(). +- enable_log_error_not_reached = is_chromeos && !(is_debug || dcheck_always_on) ++ enable_log_error_not_reached = is_haiku || is_chromeos && !(is_debug || dcheck_always_on) + } +diff --git a/src/3rdparty/chromium/build/config/ui.gni b/src/3rdparty/chromium/build/config/ui.gni +index a67d5a4..3ed9b6f 100644 +--- a/src/3rdparty/chromium/build/config/ui.gni ++++ b/src/3rdparty/chromium/build/config/ui.gni +@@ -35,7 +35,7 @@ declare_args() { + + # Indicates if Aura is enabled. Aura is a low-level windowing library, sort + # of a replacement for GDI or GTK. +- use_aura = is_win || is_linux || is_chromeos || is_fuchsia ++ use_aura = is_win || is_linux || is_chromeos || is_fuchsia || is_haiku + } + + declare_args() { +diff --git a/src/3rdparty/chromium/build/toolchain/haiku/BUILD.gn b/src/3rdparty/chromium/build/toolchain/haiku/BUILD.gn +new file mode 100644 +index 0000000..2e3d230 +--- /dev/null ++++ b/src/3rdparty/chromium/build/toolchain/haiku/BUILD.gn +@@ -0,0 +1,54 @@ ++# Copyright 2013 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. ++ ++import("//build/config/sysroot.gni") ++import("//build/toolchain/gcc_toolchain.gni") ++ ++gcc_toolchain("x86") { ++ cc = "gcc" ++ cxx = "g++" ++ ++ readelf = "readelf" ++ nm = "nm" ++ ar = "ar" ++ ld = cxx ++ ++ # Output linker map files for binary size analysis. ++ enable_linker_map = true ++ ++ toolchain_args = { ++ current_cpu = "x86" ++ current_os = "haiku" ++ is_clang = false ++ } ++} ++ ++clang_toolchain("clang_x64") { ++ # Output linker map files for binary size analysis. ++ enable_linker_map = true ++ ++ toolchain_args = { ++ current_cpu = "x64" ++ current_os = "haiku" ++ } ++} ++ ++gcc_toolchain("x64") { ++ cc = "gcc" ++ cxx = "g++" ++ ++ readelf = "readelf" ++ nm = "nm" ++ ar = "ar" ++ ld = cxx ++ ++ # Output linker map files for binary size analysis. ++ enable_linker_map = true ++ ++ toolchain_args = { ++ current_cpu = "x64" ++ current_os = "haiku" ++ is_clang = false ++ } ++} +diff --git a/src/3rdparty/chromium/chrome/browser/BUILD.gn b/src/3rdparty/chromium/chrome/browser/BUILD.gn +index 8b31283..7b306fc 100644 +--- a/src/3rdparty/chromium/chrome/browser/BUILD.gn ++++ b/src/3rdparty/chromium/chrome/browser/BUILD.gn +@@ -4938,7 +4938,7 @@ static_library("browser") { + ] + } + +- if (is_posix && !is_mac) { ++ if (is_posix && !is_mac && !is_haiku) { + # TODO(crbug.com / 753619): Enable crash reporting on Fuchsia. + sources += [ + "//chrome/app/chrome_crash_reporter_client.cc", +diff --git a/src/3rdparty/chromium/chrome/browser/media/webrtc/webrtc_event_log_uploader.cc b/src/3rdparty/chromium/chrome/browser/media/webrtc/webrtc_event_log_uploader.cc +index 59cc5e1..7ede6cd 100644 +--- a/src/3rdparty/chromium/chrome/browser/media/webrtc/webrtc_event_log_uploader.cc ++++ b/src/3rdparty/chromium/chrome/browser/media/webrtc/webrtc_event_log_uploader.cc +@@ -42,6 +42,8 @@ const char kProduct[] = "Chrome_Mac"; + const char kProduct[] = "Chrome_ChromeOS"; + #elif defined(OS_LINUX) + const char kProduct[] = "Chrome_Linux"; ++#elif defined(OS_HAIKU) ++const char kProduct[] = "Chrome_Haiku"; + #elif defined(OS_ANDROID) + const char kProduct[] = "Chrome_Android"; + #else +diff --git a/src/3rdparty/chromium/chrome/browser/media/webrtc/webrtc_log_uploader.cc b/src/3rdparty/chromium/chrome/browser/media/webrtc/webrtc_log_uploader.cc +index a96250c..9cc616d 100644 +--- a/src/3rdparty/chromium/chrome/browser/media/webrtc/webrtc_log_uploader.cc ++++ b/src/3rdparty/chromium/chrome/browser/media/webrtc/webrtc_log_uploader.cc +@@ -359,6 +359,8 @@ void WebRtcLogUploader::SetupMultipart( + const char product[] = "Chrome_Android"; + #elif defined(OS_CHROMEOS) + const char product[] = "Chrome_ChromeOS"; ++#elif defined(OS_HAIKU) ++ const char product[] = "Chrome_Haiku"; + #else + #error Platform not supported. + #endif +diff --git a/src/3rdparty/chromium/chrome/browser/media/webrtc/webrtc_logging_controller.cc b/src/3rdparty/chromium/chrome/browser/media/webrtc/webrtc_logging_controller.cc +index 2e29002..b67a659 100644 +--- a/src/3rdparty/chromium/chrome/browser/media/webrtc/webrtc_logging_controller.cc ++++ b/src/3rdparty/chromium/chrome/browser/media/webrtc/webrtc_logging_controller.cc +@@ -23,10 +23,10 @@ + #include "content/public/browser/browser_context.h" + #include "content/public/browser/render_process_host.h" + +-#if defined(OS_LINUX) || defined(OS_CHROMEOS) ++#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU) + #include "content/public/browser/child_process_security_policy.h" + #include "storage/browser/file_system/isolated_context.h" +-#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) ++#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU)s + + using webrtc_event_logging::WebRtcEventLogManager; + +@@ -273,7 +273,7 @@ void WebRtcLoggingController::StartEventLogging( + web_app_id, callback); + } + +-#if defined(OS_LINUX) || defined(OS_CHROMEOS) ++#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU) + void WebRtcLoggingController::GetLogsDirectory( + LogsDirectoryCallback callback, + LogsDirectoryErrorCallback error_callback) { +@@ -319,7 +319,7 @@ void WebRtcLoggingController::GrantLogsDirectoryAccess( + FROM_HERE, + base::BindOnce(std::move(callback), file_system.id(), registered_name)); + } +-#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) ++#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU) + + void WebRtcLoggingController::OnRtpPacket( + std::unique_ptr packet_header, +diff --git a/src/3rdparty/chromium/chrome/browser/media/webrtc/webrtc_logging_controller.h b/src/3rdparty/chromium/chrome/browser/media/webrtc/webrtc_logging_controller.h +index cb235c9..1106677 100644 +--- a/src/3rdparty/chromium/chrome/browser/media/webrtc/webrtc_logging_controller.h ++++ b/src/3rdparty/chromium/chrome/browser/media/webrtc/webrtc_logging_controller.h +@@ -133,13 +133,13 @@ class WebRtcLoggingController + size_t web_app_id, + const StartEventLoggingCallback& callback); + +-#if defined(OS_LINUX) || defined(OS_CHROMEOS) ++#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU) + // Ensures that the WebRTC Logs directory exists and then grants render + // process access to the 'WebRTC Logs' directory, and invokes |callback| with + // the ids necessary to create a DirectoryEntry object. + void GetLogsDirectory(LogsDirectoryCallback callback, + LogsDirectoryErrorCallback error_callback); +-#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) ++#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU) + + // chrome::mojom::WebRtcLoggingClient methods: + void OnAddMessages( +@@ -192,7 +192,7 @@ class WebRtcLoggingController + bool success, + const std::string& error_message); + +-#if defined(OS_LINUX) || defined(OS_CHROMEOS) ++#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU) + // Grants the render process access to the 'WebRTC Logs' directory, and + // invokes |callback| with the ids necessary to create a DirectoryEntry + // object. If the |logs_path| couldn't be created or found, |error_callback| +@@ -200,7 +200,7 @@ class WebRtcLoggingController + void GrantLogsDirectoryAccess(LogsDirectoryCallback callback, + LogsDirectoryErrorCallback error_callback, + const base::FilePath& logs_path); +-#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) ++#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU) + + static base::FilePath GetLogDirectoryAndEnsureExists( + const base::FilePath& browser_context_directory_path); +diff --git a/src/3rdparty/chromium/chrome/common/webui_url_constants.cc b/src/3rdparty/chromium/chrome/common/webui_url_constants.cc +index 2584f68..25a04b6 100644 +--- a/src/3rdparty/chromium/chrome/common/webui_url_constants.cc ++++ b/src/3rdparty/chromium/chrome/common/webui_url_constants.cc +@@ -341,7 +341,7 @@ bool IsSystemWebUIHost(base::StringPiece host) { + #endif // defined(OS_CHROMEOS) + + #if defined(OS_WIN) || defined(OS_MAC) || defined(OS_LINUX) || \ +- defined(OS_CHROMEOS) ++ defined(OS_CHROMEOS) || defined(OS_HAIKU) + const char kChromeUIDiscardsHost[] = "discards"; + const char kChromeUIDiscardsURL[] = "chrome://discards/"; + const char kChromeUIHatsHost[] = "hats"; +@@ -363,17 +363,17 @@ const char kChromeUILinuxProxyConfigHost[] = "linux-proxy-config"; + #endif + + #if defined(OS_WIN) || defined(OS_LINUX) || defined(OS_CHROMEOS) || \ +- defined(OS_ANDROID) ++ defined(OS_ANDROID) || defined(OS_HAIKU) + const char kChromeUISandboxHost[] = "sandbox"; + #endif + + #if defined(OS_WIN) || defined(OS_MAC) || \ +- (defined(OS_LINUX) && !defined(OS_CHROMEOS)) ++ (defined(OS_LINUX) && !defined(OS_CHROMEOS)) || defined(OS_HAIKU) + const char kChromeUIBrowserSwitchHost[] = "browser-switch"; + const char kChromeUIBrowserSwitchURL[] = "chrome://browser-switch/"; + #endif + +-#if ((defined(OS_LINUX) || defined(OS_CHROMEOS)) && defined(TOOLKIT_VIEWS)) || \ ++#if ((defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU)) && defined(TOOLKIT_VIEWS)) || \ + defined(USE_AURA) + const char kChromeUITabModalConfirmDialogHost[] = "tab-modal-confirm-dialog"; + #endif +diff --git a/src/3rdparty/chromium/chrome/common/webui_url_constants.h b/src/3rdparty/chromium/chrome/common/webui_url_constants.h +index a72ca75..585a062 100644 +--- a/src/3rdparty/chromium/chrome/common/webui_url_constants.h ++++ b/src/3rdparty/chromium/chrome/common/webui_url_constants.h +@@ -292,7 +292,7 @@ bool IsSystemWebUIHost(base::StringPiece host); + #endif // defined(OS_CHROMEOS) + + #if defined(OS_WIN) || defined(OS_MAC) || defined(OS_LINUX) || \ +- defined(OS_CHROMEOS) ++ defined(OS_CHROMEOS) || defined(OS_HAIKU) + extern const char kChromeUIDiscardsHost[]; + extern const char kChromeUIDiscardsURL[]; + extern const char kChromeUIHatsHost[]; +@@ -312,17 +312,17 @@ extern const char kChromeUILinuxProxyConfigHost[]; + #endif + + #if defined(OS_WIN) || defined(OS_LINUX) || defined(OS_CHROMEOS) || \ +- defined(OS_ANDROID) ++ defined(OS_ANDROID) || defined(OS_HAIKU) + extern const char kChromeUISandboxHost[]; + #endif + + #if defined(OS_WIN) || defined(OS_MAC) || \ +- (defined(OS_LINUX) && !defined(OS_CHROMEOS)) ++ (defined(OS_LINUX) && !defined(OS_CHROMEOS)) || defined(OS_HAIKU) + extern const char kChromeUIBrowserSwitchHost[]; + extern const char kChromeUIBrowserSwitchURL[]; + #endif + +-#if ((defined(OS_LINUX) || defined(OS_CHROMEOS)) && defined(TOOLKIT_VIEWS)) || \ ++#if ((defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU)) && defined(TOOLKIT_VIEWS)) || \ + defined(USE_AURA) + extern const char kChromeUITabModalConfirmDialogHost[]; + #endif +diff --git a/src/3rdparty/chromium/chrome/test/BUILD.gn b/src/3rdparty/chromium/chrome/test/BUILD.gn +index 1a369fa..3c53323 100644 +--- a/src/3rdparty/chromium/chrome/test/BUILD.gn ++++ b/src/3rdparty/chromium/chrome/test/BUILD.gn +@@ -6606,7 +6606,7 @@ test("chrome_app_unittests") { + "//components/safe_browsing:buildflags", + "//pdf:pdf_ppapi", + ] +- if (!is_fuchsia) { ++ if (!is_fuchsia && !is_haiku) { + # TODO(crbug.com/753619): Enable crash reporting on Fuchsia. + deps += [ "//third_party/breakpad:client" ] + } +diff --git a/src/3rdparty/chromium/components/BUILD.gn b/src/3rdparty/chromium/components/BUILD.gn +index 830a35c..2f15af0 100644 +--- a/src/3rdparty/chromium/components/BUILD.gn ++++ b/src/3rdparty/chromium/components/BUILD.gn +@@ -312,7 +312,7 @@ test("components_unittests") { + ] + } + +- if (!is_fuchsia) { # !iOS and !Fuchsia ++ if (!is_fuchsia && !is_haiku) { # !iOS and !Fuchsia + deps += [ + "//components/crash/content/browser:unit_tests", + "//components/crash/content/browser/error_reporting:unit_tests", +diff --git a/src/3rdparty/chromium/components/crash/content/browser/BUILD.gn b/src/3rdparty/chromium/components/crash/content/browser/BUILD.gn +index efc8041..35aab55 100644 +--- a/src/3rdparty/chromium/components/crash/content/browser/BUILD.gn ++++ b/src/3rdparty/chromium/components/crash/content/browser/BUILD.gn +@@ -14,7 +14,7 @@ import("//build/config/deprecated_default_sources_assignment_filter.gni") + set_sources_assignment_filter(deprecated_default_sources_assignment_filter) + + # TODO(crbug.com/753619): Enable crash reporting on Fuchsia. +-assert(!is_fuchsia) ++assert(!is_fuchsia && !is_haiku) + + source_set("browser") { + sources = [ +@@ -35,7 +35,7 @@ source_set("browser") { + "//content/public/common", + ] + +- if (is_linux || is_chromeos || is_android) { ++ if ((is_linux && !is_haiku) || is_chromeos || is_android) { + set_sources_assignment_filter([]) + + # Want this file on both Linux and Android. +@@ -49,13 +49,13 @@ source_set("browser") { + deps += [ "//third_party/crashpad/crashpad/client" ] + } + +- if (!is_android) { ++ if (!is_android && !is_haiku) { + deps += [ "//third_party/breakpad:client" ] + } + + # This is not in the GYP build but this target includes breakpad client + # headers, so add the dependency here. +- if ((is_posix && !is_ios) || is_fuchsia) { ++ if ((is_posix && !is_ios && !is_haiku) || is_fuchsia) { + configs += [ "//third_party/breakpad:client_config" ] + public_configs = [ "//third_party/breakpad:client_config" ] + } +diff --git a/src/3rdparty/chromium/components/crash/core/common/BUILD.gn b/src/3rdparty/chromium/components/crash/core/common/BUILD.gn +index 6dbaaea..e0ca272 100644 +--- a/src/3rdparty/chromium/components/crash/core/common/BUILD.gn ++++ b/src/3rdparty/chromium/components/crash/core/common/BUILD.gn +@@ -7,7 +7,7 @@ import("//components/gwp_asan/buildflags/buildflags.gni") + + declare_args() { + # If set to true, this will stub out and disable the entire crash key system. +- use_crash_key_stubs = is_fuchsia ++ use_crash_key_stubs = is_fuchsia || is_haiku + } + + group("common") { +@@ -108,7 +108,9 @@ target(crash_key_target_type, "crash_key_lib") { + ] + } + +- deps += [ "//third_party/breakpad:client" ] ++ if (!is_haiku) { ++ deps += [ "//third_party/breakpad:client" ] ++ } + if (use_combined_annotations) { + public_deps += [ "//third_party/crashpad/crashpad/client" ] + } +@@ -184,7 +186,7 @@ source_set("unit_tests") { + sources += [ "crash_key_breakpad_ios_unittest.cc" ] + deps += [ "//third_party/breakpad:client" ] + include_dirs = [ "//third_party/breakpad/breakpad/src/" ] +- } else if (!is_mac && !is_win && !is_fuchsia && !is_android) { ++ } else if (!is_mac && !is_win && !is_fuchsia && !is_android && !is_haiku) { + include_dirs = [ "//third_party/breakpad/breakpad/src/" ] + sources += [ "crash_key_breakpad_unittest.cc" ] + } +diff --git a/src/3rdparty/chromium/components/metrics/BUILD.gn b/src/3rdparty/chromium/components/metrics/BUILD.gn +index dd63573..93cdccc 100644 +--- a/src/3rdparty/chromium/components/metrics/BUILD.gn ++++ b/src/3rdparty/chromium/components/metrics/BUILD.gn +@@ -190,6 +190,9 @@ jumbo_static_library("metrics") { + if (is_fuchsia) { + sources += [ "drive_metrics_provider_fuchsia.cc" ] + } ++ if (is_haiku) { ++ sources -= [ "drive_metrics_provider_linux.cc" ] ++ } + } + + if (is_android) { +diff --git a/src/3rdparty/chromium/components/os_crypt/os_crypt.h b/src/3rdparty/chromium/components/os_crypt/os_crypt.h +index a061ca2..8cc834e 100644 +--- a/src/3rdparty/chromium/components/os_crypt/os_crypt.h ++++ b/src/3rdparty/chromium/components/os_crypt/os_crypt.h +@@ -15,7 +15,7 @@ + #include "base/strings/string16.h" + #include "build/build_config.h" + +-#if defined(OS_LINUX) && !defined(OS_CHROMEOS) ++#if defined(OS_LINUX) && !defined(OS_CHROMEOS) || defined(OS_HAIKU) + class KeyStorageLinux; + #endif // defined(OS_LINUX) && !defined(OS_CHROMEOS) + +@@ -34,13 +34,13 @@ struct Config; + // true for Linux, if a password management tool is available. + class OSCrypt { + public: +-#if defined(OS_LINUX) && !defined(OS_CHROMEOS) ++#if defined(OS_LINUX) && !defined(OS_CHROMEOS) || defined(OS_HAIKU) + // Set the configuration of OSCrypt. + static COMPONENT_EXPORT(OS_CRYPT) void SetConfig( + std::unique_ptr config); + #endif // defined(OS_LINUX) && !defined(OS_CHROMEOS) + +-#if defined(OS_APPLE) || (defined(OS_LINUX) && !defined(OS_CHROMEOS)) ++#if defined(OS_APPLE) || (defined(OS_LINUX) && !defined(OS_CHROMEOS)) || defined(OS_HAIKU) + // On Linux returns true iff the real secret key (not hardcoded one) is + // available. On MacOS returns true if Keychain is available (for mock + // Keychain it returns true if not using locked Keychain, false if using +@@ -131,7 +131,7 @@ class OSCrypt { + DISALLOW_IMPLICIT_CONSTRUCTORS(OSCrypt); + }; + +-#if defined(OS_LINUX) && !defined(OS_CHROMEOS) ++#if defined(OS_LINUX) && !defined(OS_CHROMEOS) || defined(OS_HAIKU) + // For unit testing purposes, inject methods to be used. + // |get_key_storage_mock| provides the desired |KeyStorage| implementation. + // If the provider returns |nullptr|, a hardcoded password will be used. +diff --git a/src/3rdparty/chromium/components/os_crypt/os_crypt_unittest.cc b/src/3rdparty/chromium/components/os_crypt/os_crypt_unittest.cc +index 44bb54c..04b97dc 100644 +--- a/src/3rdparty/chromium/components/os_crypt/os_crypt_unittest.cc ++++ b/src/3rdparty/chromium/components/os_crypt/os_crypt_unittest.cc +@@ -18,7 +18,7 @@ + #include "components/os_crypt/os_crypt_mocker.h" + #include "testing/gtest/include/gtest/gtest.h" + +-#if defined(OS_LINUX) && !defined(OS_CHROMEOS) ++#if defined(OS_LINUX) && !defined(OS_CHROMEOS) || defined(OS_HAIKU) + #include "components/os_crypt/os_crypt_mocker_linux.h" + #endif + +diff --git a/src/3rdparty/chromium/components/system_media_controls/linux/buildflags/buildflags.gni b/src/3rdparty/chromium/components/system_media_controls/linux/buildflags/buildflags.gni +index cc386df..3f6de76 100644 +--- a/src/3rdparty/chromium/components/system_media_controls/linux/buildflags/buildflags.gni ++++ b/src/3rdparty/chromium/components/system_media_controls/linux/buildflags/buildflags.gni +@@ -7,5 +7,5 @@ import("//build/config/features.gni") + declare_args() { + # Enables Chromium implementation of the MPRIS D-Bus interface for controlling + # media playback. See ../README.md for details. +- use_mpris = is_desktop_linux && use_dbus ++ use_mpris = is_desktop_linux && use_dbus && !is_haiku + } +diff --git a/src/3rdparty/chromium/components/variations/client_filterable_state.cc b/src/3rdparty/chromium/components/variations/client_filterable_state.cc +index 42c57b4..f3846e2 100644 +--- a/src/3rdparty/chromium/components/variations/client_filterable_state.cc ++++ b/src/3rdparty/chromium/components/variations/client_filterable_state.cc +@@ -25,7 +25,7 @@ Study::Platform ClientFilterableState::GetCurrentPlatform() { + return Study::PLATFORM_ANDROID; + #elif defined(OS_FUCHSIA) + return Study::PLATFORM_FUCHSIA; +-#elif defined(OS_LINUX) || defined(OS_BSD) || defined(OS_SOLARIS) ++#elif defined(OS_LINUX) || defined(OS_BSD) || defined(OS_SOLARIS) || defined(OS_HAIKU) + // Default BSD and SOLARIS to Linux to not break those builds, although these + // platforms are not officially supported by Chrome. + return Study::PLATFORM_LINUX; +diff --git a/src/3rdparty/chromium/content/app/content_main_runner_impl.cc b/src/3rdparty/chromium/content/app/content_main_runner_impl.cc +index a8c7d44..fdfc614 100644 +--- a/src/3rdparty/chromium/content/app/content_main_runner_impl.cc ++++ b/src/3rdparty/chromium/content/app/content_main_runner_impl.cc +@@ -461,7 +461,9 @@ int RunZygote(ContentMainDelegate* delegate) { + }; + + std::vector> zygote_fork_delegates; ++#if defined(OS_LINUX) + delegate->ZygoteStarting(&zygote_fork_delegates); ++#endif + media::InitializeMediaLibrary(); + + #if defined(OS_LINUX) || defined(OS_CHROMEOS) +@@ -473,7 +475,9 @@ int RunZygote(ContentMainDelegate* delegate) { + return 1; + } + ++#if defined(OS_LINUX) + delegate->ZygoteForked(); ++#endif + + // Zygote::HandleForkRequest may have reallocated the command + // line so update it here with the new version. +diff --git a/src/3rdparty/chromium/content/browser/BUILD.gn b/src/3rdparty/chromium/content/browser/BUILD.gn +index 1466f33..e9e1d56 100644 +--- a/src/3rdparty/chromium/content/browser/BUILD.gn ++++ b/src/3rdparty/chromium/content/browser/BUILD.gn +@@ -2067,7 +2067,7 @@ jumbo_static_library("browser") { + deps += [ "//ui/events" ] + } + +- if (is_linux || is_chromeos) { ++ if (is_linux || is_chromeos || is_haiku) { + sources += [ + "font_access/font_enumeration_cache_fontconfig.cc", + "font_access/font_enumeration_cache_fontconfig.h", +diff --git a/src/3rdparty/chromium/content/browser/child_process_launcher_helper_linux.cc b/src/3rdparty/chromium/content/browser/child_process_launcher_helper_linux.cc +index f3d40b6..16c5cc1 100644 +--- a/src/3rdparty/chromium/content/browser/child_process_launcher_helper_linux.cc ++++ b/src/3rdparty/chromium/content/browser/child_process_launcher_helper_linux.cc +@@ -19,7 +19,9 @@ + #include "content/public/common/result_codes.h" + #include "content/public/common/sandboxed_process_launcher_delegate.h" + #include "content/public/common/zygote/sandbox_support_linux.h" ++#if !defined(OS_HAIKU) + #include "content/public/common/zygote/zygote_handle.h" ++#endif + #include "sandbox/policy/linux/sandbox_linux.h" + + namespace content { +@@ -50,10 +52,12 @@ bool ChildProcessLauncherHelper::BeforeLaunchOnLauncherThread( + options->fds_to_remap = files_to_register.GetMappingWithIDAdjustment( + base::GlobalDescriptors::kBaseDescriptor); + ++#if !defined(OS_HAIKU) + if (GetProcessType() == switches::kRendererProcess) { + const int sandbox_fd = SandboxHostLinux::GetInstance()->GetChildSocket(); + options->fds_to_remap.push_back(std::make_pair(sandbox_fd, GetSandboxFD())); + } ++#endif + + options->environment = delegate_->GetEnvironment(); + +@@ -68,6 +72,7 @@ ChildProcessLauncherHelper::LaunchProcessOnLauncherThread( + int* launch_result) { + *is_synchronous_launch = true; + ++#if !defined(OS_HAIKU) + ZygoteHandle zygote_handle = + base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kNoZygote) + ? nullptr +@@ -81,7 +86,6 @@ ChildProcessLauncherHelper::LaunchProcessOnLauncherThread( + GetProcessType()); + *launch_result = LAUNCH_RESULT_SUCCESS; + +-#if !defined(OS_OPENBSD) + if (handle) { + // It could be a renderer process or an utility process. + int oom_score = content::kMiscOomScore; +@@ -90,13 +94,13 @@ ChildProcessLauncherHelper::LaunchProcessOnLauncherThread( + oom_score = content::kLowestRendererOomScore; + ZygoteHostImpl::GetInstance()->AdjustRendererOOMScore(handle, oom_score); + } +-#endif + + Process process; + process.process = base::Process(handle); + process.zygote = zygote_handle; + return process; + } ++#endif + + Process process; + process.process = base::LaunchProcess(*command_line(), options); +@@ -114,10 +118,14 @@ ChildProcessTerminationInfo ChildProcessLauncherHelper::GetTerminationInfo( + const ChildProcessLauncherHelper::Process& process, + bool known_dead) { + ChildProcessTerminationInfo info; ++#if !defined(OS_HAIKU) + if (process.zygote) { + info.status = process.zygote->GetTerminationStatus( + process.process.Handle(), known_dead, &info.exit_code); + } else if (known_dead) { ++#else ++ if (known_dead) { ++#endif + info.status = base::GetKnownDeadTerminationStatus(process.process.Handle(), + &info.exit_code); + } else { +@@ -141,13 +149,17 @@ void ChildProcessLauncherHelper::ForceNormalProcessTerminationSync( + DCHECK(CurrentlyOnProcessLauncherTaskRunner()); + process.process.Terminate(RESULT_CODE_NORMAL_EXIT, false); + // On POSIX, we must additionally reap the child. ++#if !defined(OS_HAIKU) + if (process.zygote) { + // If the renderer was created via a zygote, we have to proxy the reaping + // through the zygote process. + process.zygote->EnsureProcessTerminated(process.process.Handle()); + } else { ++#endif + base::EnsureProcessTerminated(std::move(process.process)); ++#if !defined(OS_HAIKU) + } ++#endif + } + + void ChildProcessLauncherHelper::SetProcessPriorityOnLauncherThread( +diff --git a/src/3rdparty/chromium/content/browser/compositor/viz_process_transport_factory.cc b/src/3rdparty/chromium/content/browser/compositor/viz_process_transport_factory.cc +index 4d64a50..a105c69 100644 +--- a/src/3rdparty/chromium/content/browser/compositor/viz_process_transport_factory.cc ++++ b/src/3rdparty/chromium/content/browser/compositor/viz_process_transport_factory.cc +@@ -108,7 +108,7 @@ class HostDisplayClient : public viz::HostDisplayClient { + HostDisplayClient& operator=(const HostDisplayClient&) = delete; + + // viz::HostDisplayClient: +-#if defined(OS_LINUX) && !defined(OS_CHROMEOS) ++#if defined(OS_LINUX) && !defined(OS_CHROMEOS) || defined(OS_HAIKU) + void DidCompleteSwapWithNewSize(const gfx::Size& size) override { + compositor_->OnCompleteSwapWithNewSize(size); + } +diff --git a/src/3rdparty/chromium/content/browser/gpu/gpu_process_host.cc b/src/3rdparty/chromium/content/browser/gpu/gpu_process_host.cc +index eec6c13..90fe57e 100644 +--- a/src/3rdparty/chromium/content/browser/gpu/gpu_process_host.cc ++++ b/src/3rdparty/chromium/content/browser/gpu/gpu_process_host.cc +@@ -226,7 +226,7 @@ static const char* const kSwitchNames[] = { + sandbox::policy::switches::kGpuSandboxFailuresFatal, + sandbox::policy::switches::kDisableGpuSandbox, + sandbox::policy::switches::kNoSandbox, +-#if defined(OS_LINUX) && !defined(OS_CHROMEOS) && !BUILDFLAG(IS_LACROS) ++#if (defined(OS_LINUX) || defined(OS_HAIKU)) && !defined(OS_CHROMEOS) && !BUILDFLAG(IS_LACROS) + switches::kDisableDevShmUsage, + #endif + #if defined(OS_WIN) +diff --git a/src/3rdparty/chromium/content/browser/memory/swap_metrics_driver_impl_linux.cc b/src/3rdparty/chromium/content/browser/memory/swap_metrics_driver_impl_linux.cc +index 1b04510..6754828 100644 +--- a/src/3rdparty/chromium/content/browser/memory/swap_metrics_driver_impl_linux.cc ++++ b/src/3rdparty/chromium/content/browser/memory/swap_metrics_driver_impl_linux.cc +@@ -43,6 +43,7 @@ SwapMetricsDriverImplLinux::~SwapMetricsDriverImplLinux() = default; + + SwapMetricsDriver::SwapMetricsUpdateResult + SwapMetricsDriverImplLinux::UpdateMetricsInternal(base::TimeDelta interval) { ++#if !defined(OS_HAIKU) + base::VmStatInfo vmstat; + if (!base::GetVmStatInfo(&vmstat)) { + return SwapMetricsDriver::SwapMetricsUpdateResult::kSwapMetricsUpdateFailed; +@@ -61,6 +62,9 @@ SwapMetricsDriverImplLinux::UpdateMetricsInternal(base::TimeDelta interval) { + delegate_->OnSwapOutCount(out_counts, interval); + + return SwapMetricsDriver::SwapMetricsUpdateResult::kSwapMetricsUpdateSuccess; ++#else ++ return SwapMetricsDriver::SwapMetricsUpdateResult::kSwapMetricsUpdateFailed; ++#endif + } + + } // namespace content +diff --git a/src/3rdparty/chromium/content/browser/renderer_host/render_message_filter.cc b/src/3rdparty/chromium/content/browser/renderer_host/render_message_filter.cc +index 758ed53..b481c29 100644 +--- a/src/3rdparty/chromium/content/browser/renderer_host/render_message_filter.cc ++++ b/src/3rdparty/chromium/content/browser/renderer_host/render_message_filter.cc +@@ -70,7 +70,7 @@ + #if defined(OS_MAC) + #include "ui/accelerated_widget_mac/window_resize_helper_mac.h" + #endif +-#if defined(OS_LINUX) || defined(OS_CHROMEOS) ++#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU) + #include "base/linux_util.h" + #include "base/threading/platform_thread.h" + #endif +@@ -117,7 +117,7 @@ void RenderMessageFilter::GenerateRoutingID( + std::move(callback).Run(render_widget_helper_->GetNextRoutingID()); + } + +-#if defined(OS_LINUX) || defined(OS_CHROMEOS) ++#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU) + void RenderMessageFilter::SetThreadPriorityOnFileThread( + base::PlatformThreadId ns_tid, + base::ThreadPriority priority) { +@@ -138,7 +138,7 @@ void RenderMessageFilter::SetThreadPriorityOnFileThread( + } + #endif + +-#if defined(OS_LINUX) || defined(OS_CHROMEOS) ++#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU) + void RenderMessageFilter::SetThreadPriority(int32_t ns_tid, + base::ThreadPriority priority) { + constexpr base::TaskTraits kTraits = { +diff --git a/src/3rdparty/chromium/content/browser/renderer_host/render_message_filter.h b/src/3rdparty/chromium/content/browser/renderer_host/render_message_filter.h +index 0528188..d6ed752 100644 +--- a/src/3rdparty/chromium/content/browser/renderer_host/render_message_filter.h ++++ b/src/3rdparty/chromium/content/browser/renderer_host/render_message_filter.h +@@ -79,14 +79,14 @@ class CONTENT_EXPORT RenderMessageFilter + // mojom::RenderMessageFilter: + void GenerateRoutingID(GenerateRoutingIDCallback routing_id) override; + void HasGpuProcess(HasGpuProcessCallback callback) override; +-#if defined(OS_LINUX) || defined(OS_CHROMEOS) ++#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU) + void SetThreadPriority(int32_t ns_tid, + base::ThreadPriority priority) override; + #endif + + void OnResolveProxy(const GURL& url, IPC::Message* reply_msg); + +-#if defined(OS_LINUX) || defined(OS_CHROMEOS) ++#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU) + void SetThreadPriorityOnFileThread(base::PlatformThreadId ns_tid, + base::ThreadPriority priority); + #endif +diff --git a/src/3rdparty/chromium/content/browser/renderer_host/render_process_host_impl.cc b/src/3rdparty/chromium/content/browser/renderer_host/render_process_host_impl.cc +index 5c19edf..f007384 100644 +--- a/src/3rdparty/chromium/content/browser/renderer_host/render_process_host_impl.cc ++++ b/src/3rdparty/chromium/content/browser/renderer_host/render_process_host_impl.cc +@@ -234,7 +234,7 @@ + #include "third_party/blink/public/mojom/android_font_lookup/android_font_lookup.mojom.h" + #endif + +-#if defined(OS_LINUX) || defined(OS_CHROMEOS) ++#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU) + #include + #include + +@@ -1325,7 +1325,7 @@ void RenderProcessHostImpl::IOThreadHostImpl::BindHostReceiver(mojo::GenericPend + return; + } + +-#if defined(OS_LINUX) || defined(OS_CHROMEOS) ++#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU) + if (auto font_receiver = receiver.As()) { + ConnectToFontService(std::move(font_receiver)); + return; +@@ -1751,7 +1751,7 @@ bool RenderProcessHostImpl::Init() { + renderer_prefix = + browser_command_line.GetSwitchValueNative(switches::kRendererCmdPrefix); + +-#if defined(OS_LINUX) || defined(OS_CHROMEOS) ++#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU) + int flags = renderer_prefix.empty() ? ChildProcessHost::CHILD_ALLOW_SELF + : ChildProcessHost::CHILD_NORMAL; + #elif defined(OS_MAC) +@@ -3320,7 +3320,7 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer( + switches::kDisableInProcessStackTraces, + sandbox::policy::switches::kDisableSeccompFilterSandbox, + sandbox::policy::switches::kNoSandbox, +-#if defined(OS_LINUX) && !defined(OS_CHROMEOS) && !BUILDFLAG(IS_LACROS) ++#if (defined(OS_LINUX) || defined(OS_HAIKU)) && !defined(OS_CHROMEOS) && !BUILDFLAG(IS_LACROS) + switches::kDisableDevShmUsage, + #endif + #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && !defined(OS_ANDROID) +diff --git a/src/3rdparty/chromium/content/browser/renderer_host/render_process_host_impl.h b/src/3rdparty/chromium/content/browser/renderer_host/render_process_host_impl.h +index dd0774b..57dbbb1 100644 +--- a/src/3rdparty/chromium/content/browser/renderer_host/render_process_host_impl.h ++++ b/src/3rdparty/chromium/content/browser/renderer_host/render_process_host_impl.h +@@ -477,10 +477,10 @@ class CONTENT_EXPORT RenderProcessHostImpl + is_for_guests_only_ = is_for_guests_only; + } + +-#if defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MAC) ++#if defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MAC) && !defined(OS_HAIKU) + // Launch the zygote early in the browser startup. + static void EarlyZygoteLaunch(); +-#endif // defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MAC) ++#endif // defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MAC) && !defined(OS_HAIKU) + + // Called when a video capture stream or an audio stream is added or removed + // and used to determine if the process should be backgrounded or not. +diff --git a/src/3rdparty/chromium/content/browser/utility_process_host.cc b/src/3rdparty/chromium/content/browser/utility_process_host.cc +index 09c7b69..0af6eba 100644 +--- a/src/3rdparty/chromium/content/browser/utility_process_host.cc ++++ b/src/3rdparty/chromium/content/browser/utility_process_host.cc +@@ -230,7 +230,7 @@ bool UtilityProcessHost::StartProcess() { + network::switches::kNetLogCaptureMode, + network::switches::kExplicitlyAllowedPorts, + sandbox::policy::switches::kNoSandbox, +-#if defined(OS_LINUX) && !defined(OS_CHROMEOS) && !BUILDFLAG(IS_LACROS) ++#if (defined(OS_LINUX) || defined(OS_HAIKU)) && !defined(OS_CHROMEOS) && !BUILDFLAG(IS_LACROS) + switches::kDisableDevShmUsage, + #endif + #if defined(OS_MAC) +diff --git a/src/3rdparty/chromium/content/child/BUILD.gn b/src/3rdparty/chromium/content/child/BUILD.gn +index cdaf2b2..a914951 100644 +--- a/src/3rdparty/chromium/content/child/BUILD.gn ++++ b/src/3rdparty/chromium/content/child/BUILD.gn +@@ -155,6 +155,11 @@ target(link_target_type, "child") { + "//components/services/font/public/cpp", + "//components/services/font/public/mojom", + ] ++ if (!is_haiku) { ++ deps += [ ++ "//services/service_manager/zygote", ++ ] ++ } + } + + if (is_win) { +diff --git a/src/3rdparty/chromium/content/common/common_sandbox_support_linux.cc b/src/3rdparty/chromium/content/common/common_sandbox_support_linux.cc +index 507c355..c4f32af 100644 +--- a/src/3rdparty/chromium/content/common/common_sandbox_support_linux.cc ++++ b/src/3rdparty/chromium/content/common/common_sandbox_support_linux.cc +@@ -5,6 +5,7 @@ + #include "content/public/common/common_sandbox_support_linux.h" + + #include ++#include + + #include + #include +diff --git a/src/3rdparty/chromium/content/common/set_process_title.cc b/src/3rdparty/chromium/content/common/set_process_title.cc +index 8b829a4..c813423 100644 +--- a/src/3rdparty/chromium/content/common/set_process_title.cc ++++ b/src/3rdparty/chromium/content/common/set_process_title.cc +@@ -44,7 +44,7 @@ namespace content { + + // TODO(jrg): Find out if setproctitle or equivalent is available on Android. + #if defined(OS_POSIX) && !defined(OS_MAC) && !defined(OS_SOLARIS) && \ +- !defined(OS_ANDROID) && !defined(OS_FUCHSIA) ++ !defined(OS_ANDROID) && !defined(OS_FUCHSIA) && !defined(OS_HAIKU) + + void SetProcessTitleFromCommandLine(const char** main_argv) { + // Build a single string which consists of all the arguments separated +diff --git a/src/3rdparty/chromium/content/gpu/BUILD.gn b/src/3rdparty/chromium/content/gpu/BUILD.gn +index 2c2c1e8..bc93e0a 100644 +--- a/src/3rdparty/chromium/content/gpu/BUILD.gn ++++ b/src/3rdparty/chromium/content/gpu/BUILD.gn +@@ -132,7 +132,7 @@ target(link_target_type, "gpu_sources") { + + # Use DRI on desktop Linux builds. + if (current_cpu != "s390x" && current_cpu != "ppc64" && is_desktop_linux && +- (!is_chromecast || is_cast_desktop_build) && !use_qt) { ++ (!is_chromecast || is_cast_desktop_build) && !use_qt && !is_haiku) { + configs += [ "//build/config/linux/dri" ] + } + } +diff --git a/src/3rdparty/chromium/content/gpu/gpu_sandbox_hook_linux.cc b/src/3rdparty/chromium/content/gpu/gpu_sandbox_hook_linux.cc +index eb69d52..aac94fa 100644 +--- a/src/3rdparty/chromium/content/gpu/gpu_sandbox_hook_linux.cc ++++ b/src/3rdparty/chromium/content/gpu/gpu_sandbox_hook_linux.cc +@@ -98,8 +98,9 @@ static const char kLibV4lEncPluginPath[] = + "/usr/lib/libv4l/plugins/libv4l-encplugin.so"; + #endif + +-constexpr int dlopen_flag = RTLD_NOW | RTLD_GLOBAL | RTLD_NODELETE; ++constexpr int dlopen_flag = RTLD_NOW | RTLD_GLOBAL; + ++#if !defined(OS_HAIKU) + void AddV4L2GpuPermissions( + std::vector* permissions, + const sandbox::policy::SandboxSeccompBPF::Options& options) { +@@ -414,12 +415,14 @@ void LoadV4L2Libraries( + } + + void LoadChromecastV4L2Libraries() { ++#if !defined(OS_HAIKU) + for (const char* path : kAllowedChromecastPaths) { + const std::string library_path(std::string(path) + + std::string("libvpcodec.so")); + if (dlopen(library_path.c_str(), dlopen_flag)) + break; + } ++#endif + } + + bool LoadLibrariesForGpu( +@@ -440,6 +443,7 @@ bool LoadLibrariesForGpu( + } + return true; + } ++#endif + + sandbox::syscall_broker::BrokerCommandSet CommandSetForGPU( + const sandbox::policy::SandboxLinux::Options& options) { +@@ -466,6 +470,7 @@ bool BrokerProcessPreSandboxHook( + } // namespace + + bool GpuProcessPreSandboxHook(sandbox::policy::SandboxLinux::Options options) { ++#if !defined(OS_HAIKU) + sandbox::policy::SandboxLinux::GetInstance()->StartBrokerProcess( + CommandSetForGPU(options), FilePermissionsForGpu(options), + base::BindOnce(BrokerProcessPreSandboxHook), options); +@@ -477,6 +482,7 @@ bool GpuProcessPreSandboxHook(sandbox::policy::SandboxLinux::Options options) { + + errno = 0; + return true; ++#endif + } + + } // namespace content +diff --git a/src/3rdparty/chromium/content/public/common/child_process_host.h b/src/3rdparty/chromium/content/public/common/child_process_host.h +index f7c4add..795419d 100644 +--- a/src/3rdparty/chromium/content/public/common/child_process_host.h ++++ b/src/3rdparty/chromium/content/public/common/child_process_host.h +@@ -81,7 +81,7 @@ class CONTENT_EXPORT ChildProcessHost : public IPC::Sender { + // No special behavior requested. + CHILD_NORMAL = 0, + +-#if defined(OS_LINUX) || defined(OS_CHROMEOS) ++#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU) + // Indicates that the child execed after forking may be execced from + // /proc/self/exe rather than using the "real" app path. This prevents + // autoupdate from confusing us if it changes the file out from under us. +diff --git a/src/3rdparty/chromium/content/public/common/zygote/features.gni b/src/3rdparty/chromium/content/public/common/zygote/features.gni +index c7580b3..ae0c131 100644 +--- a/src/3rdparty/chromium/content/public/common/zygote/features.gni ++++ b/src/3rdparty/chromium/content/public/common/zygote/features.gni +@@ -2,4 +2,4 @@ + # Use of this source code is governed by a BSD-style license that can be + # found in the LICENSE file. + +-use_zygote_handle = is_posix && !is_android && !is_mac ++use_zygote_handle = is_posix && !is_android && !is_mac && !is_haiku +diff --git a/src/3rdparty/chromium/content/renderer/render_process_impl.cc b/src/3rdparty/chromium/content/renderer/render_process_impl.cc +index ab0a696..566d324 100644 +--- a/src/3rdparty/chromium/content/renderer/render_process_impl.cc ++++ b/src/3rdparty/chromium/content/renderer/render_process_impl.cc +@@ -44,7 +44,7 @@ + #if defined(OS_WIN) + #include "base/win/win_util.h" + #endif +-#if (defined(OS_LINUX) || defined(OS_CHROMEOS)) && defined(ARCH_CPU_X86_64) ++#if (defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU)) && defined(ARCH_CPU_X86_64) + #include "v8/include/v8-wasm-trap-handler-posix.h" + #endif + namespace { +@@ -177,7 +177,7 @@ RenderProcessImpl::RenderProcessImpl() + + SetV8FlagIfNotFeature(features::kWebAssemblyTrapHandler, + "--no-wasm-trap-handler"); +-#if (defined(OS_LINUX) || defined(OS_CHROMEOS)) && defined(ARCH_CPU_X86_64) ++#if (defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU)) && defined(ARCH_CPU_X86_64) + if (base::FeatureList::IsEnabled(features::kWebAssemblyTrapHandler)) { + base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); + if (!command_line->HasSwitch(switches::kDisableInProcessStackTraces)) { +diff --git a/src/3rdparty/chromium/content/renderer/render_thread_impl.cc b/src/3rdparty/chromium/content/renderer/render_thread_impl.cc +index 6f2c8c5..04da65b 100644 +--- a/src/3rdparty/chromium/content/renderer/render_thread_impl.cc ++++ b/src/3rdparty/chromium/content/renderer/render_thread_impl.cc +@@ -715,7 +715,7 @@ void RenderThreadImpl::Init() { + DCHECK(parsed_num_raster_threads) << string_value; + DCHECK_GT(num_raster_threads, 0); + +-#if defined(OS_LINUX) || defined(OS_CHROMEOS) ++#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU) + categorized_worker_pool_->SetBackgroundingCallback( + main_thread_scheduler_->DefaultTaskRunner(), + base::BindOnce( +@@ -738,7 +738,7 @@ void RenderThreadImpl::Init() { + base::DiscardableMemoryAllocator::SetInstance( + discardable_memory_allocator_.get()); + +-#if defined(OS_LINUX) || defined(OS_CHROMEOS) ++#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU) + if (base::FeatureList::IsEnabled( + blink::features::kBlinkCompositorUseDisplayThreadPriority)) { + render_message_filter()->SetThreadPriority( +diff --git a/src/3rdparty/chromium/content/renderer/renderer_blink_platform_impl.cc b/src/3rdparty/chromium/content/renderer/renderer_blink_platform_impl.cc +index 119e70d..7c056d3 100644 +--- a/src/3rdparty/chromium/content/renderer/renderer_blink_platform_impl.cc ++++ b/src/3rdparty/chromium/content/renderer/renderer_blink_platform_impl.cc +@@ -97,7 +97,7 @@ + + #if defined(OS_MAC) + #include "content/child/child_process_sandbox_support_impl_mac.h" +-#elif defined(OS_LINUX) || defined(OS_CHROMEOS) ++#elif defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU) + #include "content/child/child_process_sandbox_support_impl_linux.h" + #endif + +@@ -169,7 +169,7 @@ RendererBlinkPlatformImpl::RendererBlinkPlatformImpl( + main_thread_scheduler_(main_thread_scheduler) { + // RenderThread may not exist in some tests. + if (RenderThreadImpl::current()) { +-#if defined(OS_LINUX) || defined(OS_CHROMEOS) ++#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU) + mojo::PendingRemote font_service; + RenderThreadImpl::current()->BindHostReceiver( + font_service.InitWithNewPipeAndPassReceiver()); +@@ -179,7 +179,7 @@ RendererBlinkPlatformImpl::RendererBlinkPlatformImpl( + #endif + } + +-#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_MAC) ++#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_MAC) || defined(OS_HAIKU) + if (sandboxEnabled()) { + #if defined(OS_MAC) + sandbox_support_ = std::make_unique(); +@@ -232,7 +232,7 @@ RendererBlinkPlatformImpl::WrapSharedURLLoaderFactory( + + void RendererBlinkPlatformImpl::SetDisplayThreadPriority( + base::PlatformThreadId thread_id) { +-#if defined(OS_LINUX) || defined(OS_CHROMEOS) ++#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU) + if (RenderThreadImpl* render_thread = RenderThreadImpl::current()) { + render_thread->render_message_filter()->SetThreadPriority( + thread_id, base::ThreadPriority::DISPLAY); +@@ -245,7 +245,7 @@ blink::BlameContext* RendererBlinkPlatformImpl::GetTopLevelBlameContext() { + } + + blink::WebSandboxSupport* RendererBlinkPlatformImpl::GetSandboxSupport() { +-#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_MAC) ++#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_MAC) || defined(OS_HAIKU) + return sandbox_support_.get(); + #else + // These platforms do not require sandbox support. +diff --git a/src/3rdparty/chromium/content/renderer/renderer_blink_platform_impl.h b/src/3rdparty/chromium/content/renderer/renderer_blink_platform_impl.h +index 823ae98..2ddf57f 100644 +--- a/src/3rdparty/chromium/content/renderer/renderer_blink_platform_impl.h ++++ b/src/3rdparty/chromium/content/renderer/renderer_blink_platform_impl.h +@@ -30,7 +30,7 @@ + #include "third_party/blink/public/mojom/cache_storage/cache_storage.mojom.h" + #include "third_party/blink/public/mojom/loader/code_cache.mojom.h" + +-#if defined(OS_LINUX) || defined(OS_CHROMEOS) ++#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU) + #include "components/services/font/public/cpp/font_loader.h" // nogncheck + #include "third_party/skia/include/core/SkRefCnt.h" // nogncheck + #endif +@@ -224,7 +224,7 @@ class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl { + // Return the mojo interface for making CodeCache calls. + blink::mojom::CodeCacheHost& GetCodeCacheHost(); + +-#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_MAC) ++#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_MAC) || defined(OS_HAIKU) + std::unique_ptr sandbox_support_; + #endif + +@@ -245,7 +245,7 @@ class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl { + mojo::PendingRemote code_cache_host_remote_; + mojo::SharedRemote code_cache_host_; + +-#if defined(OS_LINUX) || defined(OS_CHROMEOS) ++#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU) + sk_sp font_loader_; + #endif + +diff --git a/src/3rdparty/chromium/content/renderer/renderer_main_platform_delegate_linux.cc b/src/3rdparty/chromium/content/renderer/renderer_main_platform_delegate_linux.cc +index e97f908..3bfc65b 100644 +--- a/src/3rdparty/chromium/content/renderer/renderer_main_platform_delegate_linux.cc ++++ b/src/3rdparty/chromium/content/renderer/renderer_main_platform_delegate_linux.cc +@@ -30,6 +30,7 @@ void RendererMainPlatformDelegate::PlatformUninitialize() { + } + + bool RendererMainPlatformDelegate::EnableSandbox() { ++#if !defined(OS_HAIKU) + // The setuid sandbox is started in the zygote process: zygote_main_linux.cc + // https://chromium.googlesource.com/chromium/src/+/master/docs/linux/suid_sandbox.md + // +@@ -66,6 +67,7 @@ bool RendererMainPlatformDelegate::EnableSandbox() { + } + #endif // __x86_64__ + ++#endif + return true; + } + +diff --git a/src/3rdparty/chromium/content/shell/BUILD.gn b/src/3rdparty/chromium/content/shell/BUILD.gn +index 56c0e8b..f7a0c95 100644 +--- a/src/3rdparty/chromium/content/shell/BUILD.gn ++++ b/src/3rdparty/chromium/content/shell/BUILD.gn +@@ -94,7 +94,7 @@ static_library("content_shell_app") { + "//content/web_test:web_test_renderer", + ] + } +- if (!is_fuchsia) { ++ if (!is_fuchsia && !is_haiku) { + deps += [ + "//components/crash/core/app", + "//components/crash/core/app:test_support", +@@ -259,6 +259,12 @@ static_library("content_shell_lib") { + "//components/crash/core/app", + ] + } ++ if (is_haiku) { ++ deps -= [ ++ "//components/crash/content/browser", ++ "//components/crash/core/app", ++ ] ++ } + + if (enable_plugins) { + sources += [ +@@ -791,7 +797,7 @@ group("content_shell_crash_test") { + mac_bin_path + "otool", + ] + } +- if (is_posix) { ++ if (is_posix && !is_haiku) { + data += [ + "//components/crash/content/tools/generate_breakpad_symbols.py", + "//components/crash/content/tools/dmp2minidump.py", +@@ -800,7 +806,7 @@ group("content_shell_crash_test") { + if (is_win) { + data_deps += [ "//build/win:copy_cdb_to_output" ] + } +- if (is_posix) { ++ if (is_posix && !is_haiku) { + data_deps += [ + "//third_party/breakpad:dump_syms", + "//third_party/breakpad:minidump_stackwalk", +diff --git a/src/3rdparty/chromium/content/utility/BUILD.gn b/src/3rdparty/chromium/content/utility/BUILD.gn +index 69b834c..d94d0f0 100644 +--- a/src/3rdparty/chromium/content/utility/BUILD.gn ++++ b/src/3rdparty/chromium/content/utility/BUILD.gn +@@ -85,7 +85,7 @@ jumbo_source_set("utility") { + deps += [ "//services/proxy_resolver:lib" ] + } + +- if ((is_linux || is_chromeos) && !use_qt) { ++ if ((is_linux || is_chromeos) && !use_qt && !is_haiku) { + deps += [ "//content/utility/speech:speech_recognition_sandbox_hook" ] + } + +diff --git a/src/3rdparty/chromium/content/utility/utility_blink_platform_with_sandbox_support_impl.cc b/src/3rdparty/chromium/content/utility/utility_blink_platform_with_sandbox_support_impl.cc +index f61fcf8..0f123ab 100644 +--- a/src/3rdparty/chromium/content/utility/utility_blink_platform_with_sandbox_support_impl.cc ++++ b/src/3rdparty/chromium/content/utility/utility_blink_platform_with_sandbox_support_impl.cc +@@ -9,7 +9,7 @@ + + #if defined(OS_MAC) + #include "content/child/child_process_sandbox_support_impl_mac.h" +-#elif defined(OS_LINUX) || defined(OS_CHROMEOS) ++#elif defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU) + #include "content/child/child_process_sandbox_support_impl_linux.h" + #endif + +@@ -17,7 +17,7 @@ namespace content { + + UtilityBlinkPlatformWithSandboxSupportImpl:: + UtilityBlinkPlatformWithSandboxSupportImpl() { +-#if defined(OS_LINUX) || defined(OS_CHROMEOS) ++#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU) + mojo::PendingRemote font_service; + UtilityThread::Get()->BindHostReceiver( + font_service.InitWithNewPipeAndPassReceiver()); +@@ -34,7 +34,7 @@ UtilityBlinkPlatformWithSandboxSupportImpl:: + + blink::WebSandboxSupport* + UtilityBlinkPlatformWithSandboxSupportImpl::GetSandboxSupport() { +-#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_MAC) ++#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_MAC) || defined(OS_HAIKU) + return sandbox_support_.get(); + #else + return nullptr; +diff --git a/src/3rdparty/chromium/content/utility/utility_blink_platform_with_sandbox_support_impl.h b/src/3rdparty/chromium/content/utility/utility_blink_platform_with_sandbox_support_impl.h +index fcba9fe..e07bc53 100644 +--- a/src/3rdparty/chromium/content/utility/utility_blink_platform_with_sandbox_support_impl.h ++++ b/src/3rdparty/chromium/content/utility/utility_blink_platform_with_sandbox_support_impl.h +@@ -11,7 +11,7 @@ + #include "build/build_config.h" + #include "third_party/blink/public/platform/platform.h" + +-#if defined(OS_LINUX) || defined(OS_CHROMEOS) ++#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU) + #include "components/services/font/public/cpp/font_loader.h" // nogncheck + #include "third_party/skia/include/core/SkRefCnt.h" // nogncheck + #endif +@@ -33,10 +33,10 @@ class UtilityBlinkPlatformWithSandboxSupportImpl : public blink::Platform { + blink::WebSandboxSupport* GetSandboxSupport() override; + + private: +-#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_MAC) ++#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_MAC) || defined(OS_HAIKU) + std::unique_ptr sandbox_support_; + #endif +-#if defined(OS_LINUX) || defined(OS_CHROMEOS) ++#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU) + sk_sp font_loader_; + #endif + +diff --git a/src/3rdparty/chromium/content/zygote/zygote_main_linux.cc b/src/3rdparty/chromium/content/zygote/zygote_main_linux.cc +index bbffdd4..5f3b018 100644 +--- a/src/3rdparty/chromium/content/zygote/zygote_main_linux.cc ++++ b/src/3rdparty/chromium/content/zygote/zygote_main_linux.cc +@@ -11,7 +11,9 @@ + #include + #include + #include ++#if !defined(OS_HAIKU) + #include ++#endif + #include + #include + #include +@@ -99,6 +101,7 @@ static bool CreateInitProcessReaper( + // created through the setuid sandbox. + static bool EnterSuidSandbox(sandbox::SetuidSandboxClient* setuid_sandbox, + base::OnceClosure post_fork_parent_callback) { ++#if !defined(OS_HAIKU) + DCHECK(setuid_sandbox); + DCHECK(setuid_sandbox->IsSuidSandboxChild()); + +@@ -131,6 +134,9 @@ static bool EnterSuidSandbox(sandbox::SetuidSandboxClient* setuid_sandbox, + + CHECK(sandbox::policy::SandboxDebugHandling::SetDumpableStatusAndHandlers()); + return true; ++#else ++ return false; ++#endif + } + + static void DropAllCapabilities(int proc_fd) { +@@ -178,6 +184,7 @@ static void EnterLayerOneSandbox(sandbox::policy::SandboxLinux* linux_sandbox, + + bool ZygoteMain( + std::vector> fork_delegates) { ++#if !defined(OS_HAIKU) + sandbox::SetAmZygoteOrRenderer(true, GetSandboxFD()); + + auto* linux_sandbox = sandbox::policy::SandboxLinux::GetInstance(); +@@ -243,6 +250,9 @@ bool ZygoteMain( + + // This function call can return multiple times, once per fork(). + return zygote.ProcessRequests(); ++#else ++ return false; ++#endif + } + + } // namespace content +diff --git a/src/3rdparty/chromium/device/bluetooth/BUILD.gn b/src/3rdparty/chromium/device/bluetooth/BUILD.gn +index 5f7d3f3..6e37cde 100644 +--- a/src/3rdparty/chromium/device/bluetooth/BUILD.gn ++++ b/src/3rdparty/chromium/device/bluetooth/BUILD.gn +@@ -295,7 +295,7 @@ component("bluetooth") { + ] + } + +- if (is_chromeos || is_linux) { ++ if (is_chromeos || is_linux && !is_haiku) { + if (use_dbus && is_chromeos) { + # This crap uses ChromeOS specific system API + sources += [ +diff --git a/src/3rdparty/chromium/device/gamepad/gamepad_provider.cc b/src/3rdparty/chromium/device/gamepad/gamepad_provider.cc +index ecc5837..4aa6a6ff 100644 +--- a/src/3rdparty/chromium/device/gamepad/gamepad_provider.cc ++++ b/src/3rdparty/chromium/device/gamepad/gamepad_provider.cc +@@ -149,7 +149,7 @@ void GamepadProvider::Initialize(std::unique_ptr fetcher) { + + if (!polling_thread_) + polling_thread_.reset(new base::Thread("Gamepad polling thread")); +-#if defined(OS_LINUX) || defined(OS_CHROMEOS) ++#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU) + // On Linux, the data fetcher needs to watch file descriptors, so the message + // loop needs to be a libevent loop. + const base::MessagePumpType kMessageLoopType = base::MessagePumpType::IO; +diff --git a/src/3rdparty/chromium/device/gamepad/hid_writer_linux.cc b/src/3rdparty/chromium/device/gamepad/hid_writer_linux.cc +index eb87897..77d4180 100644 +--- a/src/3rdparty/chromium/device/gamepad/hid_writer_linux.cc ++++ b/src/3rdparty/chromium/device/gamepad/hid_writer_linux.cc +@@ -4,6 +4,8 @@ + + #include "device/gamepad/hid_writer_linux.h" + ++#include ++ + #include "base/posix/eintr_wrapper.h" + + namespace device { +diff --git a/src/3rdparty/chromium/gpu/command_buffer/common/gpu_memory_buffer_support.cc b/src/3rdparty/chromium/gpu/command_buffer/common/gpu_memory_buffer_support.cc +index 388de9f..dc8efe6 100644 +--- a/src/3rdparty/chromium/gpu/command_buffer/common/gpu_memory_buffer_support.cc ++++ b/src/3rdparty/chromium/gpu/command_buffer/common/gpu_memory_buffer_support.cc +@@ -57,7 +57,7 @@ uint32_t GetPlatformSpecificTextureTarget() { + return macos_specific_texture_target; + #elif defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_CHROMEOS) + return GL_TEXTURE_EXTERNAL_OES; +-#elif defined(OS_WIN) || defined(OS_FUCHSIA) ++#elif defined(OS_WIN) || defined(OS_FUCHSIA) || defined(OS_HAIKU) + return GL_TEXTURE_2D; + #elif defined(OS_NACL) + NOTREACHED(); +@@ -85,7 +85,7 @@ GPU_EXPORT uint32_t GetBufferTextureTarget(gfx::BufferUsage usage, + + GPU_EXPORT bool NativeBufferNeedsPlatformSpecificTextureTarget( + gfx::BufferFormat format) { +-#if defined(USE_OZONE) || defined(OS_LINUX) || defined(OS_CHROMEOS) ++#if defined(USE_OZONE) || defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU) + // Always use GL_TEXTURE_2D as the target for RGB textures. + // https://crbug.com/916728 + if (format == gfx::BufferFormat::R_8 || format == gfx::BufferFormat::RG_88 || +diff --git a/src/3rdparty/chromium/gpu/config/gpu_test_config.cc b/src/3rdparty/chromium/gpu/config/gpu_test_config.cc +index 49219e4..c7e860d 100644 +--- a/src/3rdparty/chromium/gpu/config/gpu_test_config.cc ++++ b/src/3rdparty/chromium/gpu/config/gpu_test_config.cc +@@ -27,7 +27,7 @@ namespace { + GPUTestConfig::OS GetCurrentOS() { + #if defined(OS_CHROMEOS) + return GPUTestConfig::kOsChromeOS; +-#elif defined(OS_LINUX) || defined(OS_OPENBSD) ++#elif defined(OS_LINUX) || defined(OS_HAIKU) + return GPUTestConfig::kOsLinux; + #elif defined(OS_WIN) + int32_t major_version = 0; +diff --git a/src/3rdparty/chromium/gpu/ipc/common/gpu_memory_buffer_support.cc b/src/3rdparty/chromium/gpu/ipc/common/gpu_memory_buffer_support.cc +index 19c1f56..82ef91b 100644 +--- a/src/3rdparty/chromium/gpu/ipc/common/gpu_memory_buffer_support.cc ++++ b/src/3rdparty/chromium/gpu/ipc/common/gpu_memory_buffer_support.cc +@@ -16,7 +16,7 @@ + #include "gpu/ipc/common/gpu_memory_buffer_impl_io_surface.h" + #endif + +-#if defined(OS_LINUX) || defined(OS_CHROMEOS) ++#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU) + #include "ui/gfx/client_native_pixmap_factory.h" + #include "ui/gfx/linux/client_native_pixmap_factory_dmabuf.h" + #endif +@@ -26,7 +26,7 @@ + #include "ui/ozone/public/ozone_platform.h" + #endif + +-#if defined(USE_OZONE) || defined(OS_LINUX) || defined(OS_CHROMEOS) ++#if defined(USE_OZONE) || defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU) + #include "gpu/ipc/common/gpu_memory_buffer_impl_native_pixmap.h" + #endif + +diff --git a/src/3rdparty/chromium/gpu/ipc/common/surface_handle.h b/src/3rdparty/chromium/gpu/ipc/common/surface_handle.h +index 64c4e12..b30c372 100644 +--- a/src/3rdparty/chromium/gpu/ipc/common/surface_handle.h ++++ b/src/3rdparty/chromium/gpu/ipc/common/surface_handle.h +@@ -11,7 +11,7 @@ + + #if (defined(OS_MAC) || defined(OS_WIN) || defined(USE_X11) || \ + defined(USE_OZONE)) && \ +- !defined(OS_NACL) ++ !defined(OS_NACL) && !defined(OS_HAIKU) + #include "ui/gfx/native_widget_types.h" + #define GPU_SURFACE_HANDLE_IS_ACCELERATED_WINDOW + #endif +@@ -33,7 +33,8 @@ namespace gpu { + #if defined(GPU_SURFACE_HANDLE_IS_ACCELERATED_WINDOW) + using SurfaceHandle = gfx::AcceleratedWidget; + constexpr SurfaceHandle kNullSurfaceHandle = gfx::kNullAcceleratedWidget; +-#elif defined(OS_ANDROID) || defined(OS_NACL) || defined(OS_FUCHSIA) ++#elif defined(OS_ANDROID) || defined(OS_NACL) || defined(OS_FUCHSIA) || \ ++ defined(OS_HAIKU) + using SurfaceHandle = int32_t; + constexpr SurfaceHandle kNullSurfaceHandle = 0; + #else +diff --git a/src/3rdparty/chromium/gpu/vulkan/features.gni b/src/3rdparty/chromium/gpu/vulkan/features.gni +index 7a98011..74a043d 100644 +--- a/src/3rdparty/chromium/gpu/vulkan/features.gni ++++ b/src/3rdparty/chromium/gpu/vulkan/features.gni +@@ -8,7 +8,7 @@ import("//build/config/ui.gni") + # For details see declare_args() in build/config/BUILDCONFIG.gn. + declare_args() { + # Enable experimental vulkan backend. +- enable_vulkan = is_linux || is_chromeos || is_android || is_fuchsia || is_win ++ enable_vulkan = (is_linux && !is_haiku) || is_chromeos || is_android || is_fuchsia || is_win + + # Enable swiftshader vulkan. Disabling it can save build time, however + # --use-vulkan=swiftshader and some tests which use swiftshader vulkan will +diff --git a/src/3rdparty/chromium/headless/BUILD.gn b/src/3rdparty/chromium/headless/BUILD.gn +index d2ab76a..fb3cfde 100644 +--- a/src/3rdparty/chromium/headless/BUILD.gn ++++ b/src/3rdparty/chromium/headless/BUILD.gn +@@ -275,7 +275,7 @@ source_set("headless_shared_sources") { + sources += generated_devtools_api + sources += get_target_outputs(":protocol_sources") + +- if (!is_fuchsia) { ++ if (!is_fuchsia && !is_haiku) { + sources += [ + "lib/headless_crash_reporter_client.cc", + "lib/headless_crash_reporter_client.h", +@@ -295,7 +295,7 @@ source_set("headless_shared_sources") { + "//url", + ] + +- if (!is_fuchsia) { ++ if (!is_fuchsia && !is_haiku) { + deps += [ "//components/crash/content/browser" ] + } + if (is_component_build && is_win) { +@@ -448,7 +448,7 @@ component("headless_non_renderer") { + "//v8", + ] + +- if (!is_fuchsia) { ++ if (!is_fuchsia && !is_haiku) { + deps += [ "//components/crash/content/browser" ] + } + if (is_win) { +@@ -732,7 +732,7 @@ static_library("headless_shell_lib") { + public_deps += [ ":headless_non_renderer" ] + } + +- if (!is_fuchsia) { ++ if (!is_fuchsia && !is_haiku) { + deps += [ "//components/crash/content/browser" ] + } + +diff --git a/src/3rdparty/chromium/ipc/ipc_channel.h b/src/3rdparty/chromium/ipc/ipc_channel.h +index 72e130e..4704cbc 100644 +--- a/src/3rdparty/chromium/ipc/ipc_channel.h ++++ b/src/3rdparty/chromium/ipc/ipc_channel.h +@@ -245,7 +245,7 @@ class COMPONENT_EXPORT(IPC) Channel : public Sender { + static std::string GenerateUniqueRandomChannelID(); + #endif + +-#if defined(OS_LINUX) || defined(OS_CHROMEOS) ++#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU) + // Sandboxed processes live in a PID namespace, so when sending the IPC hello + // message from client to server we need to send the PID from the global + // PID namespace. +diff --git a/src/3rdparty/chromium/ipc/ipc_channel_common.cc b/src/3rdparty/chromium/ipc/ipc_channel_common.cc +index 8990eee..db4cac4 100644 +--- a/src/3rdparty/chromium/ipc/ipc_channel_common.cc ++++ b/src/3rdparty/chromium/ipc/ipc_channel_common.cc +@@ -10,7 +10,7 @@ + + namespace IPC { + +-#if defined(OS_LINUX) || defined(OS_CHROMEOS) ++#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU) + + namespace { + int g_global_pid = 0; +@@ -26,7 +26,7 @@ int Channel::GetGlobalPid() { + return g_global_pid; + } + +-#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) ++#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU) + + // static + std::unique_ptr Channel::CreateClient( +diff --git a/src/3rdparty/chromium/ipc/ipc_channel_mojo.cc b/src/3rdparty/chromium/ipc/ipc_channel_mojo.cc +index 798172a..74bb4d1 100644 +--- a/src/3rdparty/chromium/ipc/ipc_channel_mojo.cc ++++ b/src/3rdparty/chromium/ipc/ipc_channel_mojo.cc +@@ -74,10 +74,10 @@ class MojoChannelFactory : public ChannelFactory { + }; + + base::ProcessId GetSelfPID() { +-#if defined(OS_LINUX) || defined(OS_CHROMEOS) ++#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU) + if (int global_pid = Channel::GetGlobalPid()) + return global_pid; +-#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) ++#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU) + #if defined(OS_NACL) + return -1; + #else +diff --git a/src/3rdparty/chromium/ipc/ipc_message_utils.cc b/src/3rdparty/chromium/ipc/ipc_message_utils.cc +index 54d49ec..46c9dea 100644 +--- a/src/3rdparty/chromium/ipc/ipc_message_utils.cc ++++ b/src/3rdparty/chromium/ipc/ipc_message_utils.cc +@@ -357,7 +357,7 @@ void ParamTraits::Log(const param_type& p, std::string* l) { + } + + #if defined(OS_WIN) || defined(OS_LINUX) || defined(OS_CHROMEOS) || \ +- defined(OS_FUCHSIA) || (defined(OS_ANDROID) && defined(ARCH_CPU_64_BITS)) ++ defined(OS_FUCHSIA) || defined(OS_HAIKU) || (defined(OS_ANDROID) && defined(ARCH_CPU_64_BITS)) + void ParamTraits::Log(const param_type& p, std::string* l) { + l->append(base::NumberToString(p)); + } +diff --git a/src/3rdparty/chromium/ipc/ipc_message_utils.h b/src/3rdparty/chromium/ipc/ipc_message_utils.h +index ad2596a..97f6415 100644 +--- a/src/3rdparty/chromium/ipc/ipc_message_utils.h ++++ b/src/3rdparty/chromium/ipc/ipc_message_utils.h +@@ -210,7 +210,7 @@ struct ParamTraits { + // Since we want to support Android 32<>64 bit IPC, as long as we don't have + // these traits for 32 bit ARM then that'll catch any errors. + #if defined(OS_WIN) || defined(OS_LINUX) || defined(OS_CHROMEOS) || \ +- defined(OS_FUCHSIA) || (defined(OS_ANDROID) && defined(ARCH_CPU_64_BITS)) ++ defined(OS_FUCHSIA) || defined(OS_HAIKU) || (defined(OS_ANDROID) && defined(ARCH_CPU_64_BITS)) + template <> + struct ParamTraits { + typedef long param_type; +diff --git a/src/3rdparty/chromium/media/audio/BUILD.gn b/src/3rdparty/chromium/media/audio/BUILD.gn +index 63dce70..12b1c1c 100644 +--- a/src/3rdparty/chromium/media/audio/BUILD.gn ++++ b/src/3rdparty/chromium/media/audio/BUILD.gn +@@ -234,7 +234,7 @@ source_set("audio") { + ] + } + +- if (is_linux || is_chromeos) { ++ if ((is_linux && !is_haiku) || is_chromeos) { + sources += [ "linux/audio_manager_linux.cc" ] + } + +@@ -312,6 +312,21 @@ source_set("audio") { + ] + } + ++ if (is_haiku) { ++ sources += [ ++ "haiku/audio_input_stream_haiku.cc", ++ "haiku/audio_input_stream_haiku.h", ++ "haiku/audio_manager_haiku.cc", ++ "haiku/audio_manager_haiku.h", ++ "haiku/audio_output_stream_haiku.cc", ++ "haiku/audio_output_stream_haiku.h", ++ ] ++ libs += [ ++ "be", ++ "media", ++ ] ++ } ++ + if (enable_webrtc) { + sources += [ + "audio_input_stream_data_interceptor.cc", +diff --git a/src/3rdparty/chromium/media/audio/haiku/audio_input_stream_haiku.cc b/src/3rdparty/chromium/media/audio/haiku/audio_input_stream_haiku.cc +new file mode 100644 +index 0000000..944023f +--- /dev/null ++++ b/src/3rdparty/chromium/media/audio/haiku/audio_input_stream_haiku.cc +@@ -0,0 +1,309 @@ ++// Copyright 2021 Gerasim Troeglazov. All rights reserved. ++// Use of this source code is governed by a BSD-style license that can be ++// found in the LICENSE file. ++ ++#include "media/audio/haiku/audio_input_stream_haiku.h" ++ ++#include "base/logging.h" ++#include "media/audio/audio_device_description.h" ++#include "media/audio/haiku/audio_manager_haiku.h" ++ ++namespace media { ++ ++const int kNumberOfBlocksBufferInFifo = 2; ++ ++HaikuAudioRecorder::HaikuAudioRecorder(const char *node_name) ++ : node_name_(node_name) { ++ if (node_name == NULL) { ++ node_name_.SetTo("QtWebEngine"); ++ app_info appInfo; ++ if (be_app->GetAppInfo(&appInfo) == B_OK) { ++ BPath path(&appInfo.ref); ++ node_name_.SetTo(path.Leaf()); ++ } ++ } ++ status_t error; ++ media_roster_ = BMediaRoster::Roster(&error); ++ if (error == B_OK) ++ is_inited_ = true; ++} ++ ++HaikuAudioRecorder::~HaikuAudioRecorder() { ++ Close(); ++} ++ ++bool HaikuAudioRecorder::SetCallbacks(BMediaRecorder::ProcessFunc record_func, ++ BMediaRecorder::NotifyFunc notify_func, void* cookie) { ++ if (recorder_->SetHooks(record_func, notify_func, cookie) < B_OK) { ++ recorder_->SetHooks(NULL, NULL, NULL); ++ return false; ++ } ++ return true; ++} ++ ++bool HaikuAudioRecorder::Open() { ++ if (!is_inited_ || is_opened_) ++ return false; ++ ++ status_t error; ++ ++ error = media_roster_->GetAudioInput(&audio_input_node_); ++ if (error < B_OK) ++ return false; ++ ++ error = media_roster_->GetAudioMixer(&audio_mixer_node_); ++ if (error < B_OK) ++ return false; ++ ++ recorder_ = new BMediaRecorder(node_name_, B_MEDIA_RAW_AUDIO); ++ if (recorder_->InitCheck() < B_OK) { ++ delete recorder_; ++ recorder_ = nullptr; ++ return false; ++ } ++ ++ media_format output_format; ++ output_format.type = B_MEDIA_RAW_AUDIO; ++ output_format.u.raw_audio = media_raw_audio_format::wildcard; ++ recorder_->SetAcceptedFormat(output_format); ++ ++ const int maxInputCount = 64; ++ dormant_node_info dni[maxInputCount]; ++ ++ int32 real_count = maxInputCount; ++ ++ error = media_roster_->GetDormantNodes(dni, &real_count, 0, &output_format, ++ 0, B_BUFFER_PRODUCER | B_PHYSICAL_INPUT); ++ if (real_count > maxInputCount) ++ real_count = maxInputCount; ++ char selected_name[B_MEDIA_NAME_LENGTH] = "Default input"; ++ ++ for (int i = 0; i < real_count; i++) { ++ media_node_id ni[12]; ++ int32 ni_count = 12; ++ error = media_roster_->GetInstancesFor(dni[i].addon, dni[i].flavor_id, ni, &ni_count); ++ if (error == B_OK) { ++ for (int j = 0; j < ni_count; j++) { ++ if (ni[j] == audio_input_node_.node) { ++ strcpy(selected_name, dni[i].name); ++ break; ++ } ++ } ++ } ++ } ++ ++ if (!recorder_->IsConnected()) { ++ int32 count = 0; ++ error = media_roster_->GetFreeOutputsFor(audio_input_node_, ++ &audio_output_, 1, &count, B_MEDIA_RAW_AUDIO); ++ if (error < B_OK || count < 1) { ++ delete recorder_; ++ recorder_ = nullptr; ++ return false; ++ } ++ ++ record_format_.u.raw_audio = audio_output_.format.u.raw_audio; ++ } else { ++ record_format_.u.raw_audio = recorder_->AcceptedFormat().u.raw_audio; ++ } ++ ++ record_format_.type = B_MEDIA_RAW_AUDIO; ++ ++ is_opened_ = true; ++ ++ return true; ++} ++ ++void HaikuAudioRecorder::Close() { ++ if (!is_opened_) ++ return; ++ is_opened_ = false; ++ ++ if (is_recording_) ++ Stop(); ++ ++ if (recorder_) ++ delete recorder_; ++ ++ recorder_ = nullptr; ++} ++ ++void HaikuAudioRecorder::Start() { ++ if (recorder_ == NULL || !is_inited_ || is_recording_) ++ return; ++ ++ if (!recorder_->IsConnected()) { ++ if (recorder_->Connect(audio_input_node_, &audio_output_, &record_format_) < B_OK) { ++ recorder_->SetHooks(NULL, NULL, NULL); ++ return; ++ } ++ } ++ ++ is_recording_ = true; ++ recorder_->Start(); ++} ++ ++void HaikuAudioRecorder::Stop() { ++ is_recording_ = false; ++ ++ if (recorder_->IsConnected()) ++ recorder_->Disconnect(); ++ ++ recorder_->Stop(); ++} ++ ++base::TimeDelta HaikuAudioRecorder::Latency() { ++ bigtime_t latency; ++ if (media_roster_->GetLatencyFor(audio_input_node_, &latency) == B_OK && is_recording_) ++ return base::TimeDelta::FromMicroseconds(latency); ++ return base::TimeDelta::FromMicroseconds(0); ++} ++ ++SampleFormat HaikuAudioRecorder::Format() { ++ SampleFormat sample_format = kUnknownSampleFormat; ++ ++ switch(record_format_.u.raw_audio.format) { ++ case media_raw_audio_format::B_AUDIO_UCHAR: ++ sample_format = kSampleFormatU8; ++ break; ++ case media_raw_audio_format::B_AUDIO_SHORT: ++ sample_format = kSampleFormatS16; ++ break; ++ case media_raw_audio_format::B_AUDIO_INT: ++ sample_format = kSampleFormatS32; ++ break; ++ case media_raw_audio_format::B_AUDIO_FLOAT: ++ sample_format = kSampleFormatF32; ++ break; ++ } ++ return sample_format; ++} ++ ++ChannelLayout HaikuAudioRecorder::Channels() { ++ ChannelLayout layout = CHANNEL_LAYOUT_UNSUPPORTED; ++ ++ switch(record_format_.u.raw_audio.channel_count) { ++ case 1: ++ layout = CHANNEL_LAYOUT_MONO; ++ break; ++ case 2: ++ layout = CHANNEL_LAYOUT_STEREO; ++ break; ++ } ++ ++ return layout; ++} ++ ++ ++AudioInputStreamHaiku::AudioInputStreamHaiku( ++ AudioManagerHaiku* manager, ++ const AudioParameters& parameters) ++ : manager_(manager), ++ parameters_(parameters), ++ recorder_(new HaikuAudioRecorder()), ++ callback_(nullptr), ++ fifo_(parameters.channels(), ++ parameters.frames_per_buffer(), ++ kNumberOfBlocksBufferInFifo), ++ audio_bus_(media::AudioBus::Create(parameters)) { ++} ++ ++AudioInputStreamHaiku::~AudioInputStreamHaiku() { ++ delete recorder_; ++} ++ ++bool AudioInputStreamHaiku::Open() { ++ return recorder_->Open(); ++} ++ ++void AudioInputStreamHaiku::Start(AudioInputCallback* callback) { ++ callback_ = callback; ++ if (!recorder_->IsOpened() || recorder_->IsRecording()) ++ return; ++ ++ if (!recorder_->SetCallbacks(_read_callback, NULL, this)) { ++ recorder_->Close(); ++ return; ++ } ++ ++ StartAgc(); ++ recorder_->Start(); ++} ++ ++void AudioInputStreamHaiku::Stop() { ++ StopAgc(); ++ recorder_->Stop(); ++ fifo_.Clear(); ++} ++ ++void AudioInputStreamHaiku::Close() { ++ recorder_->Close(); ++ manager_->ReleaseInputStream(this); ++} ++ ++double AudioInputStreamHaiku::GetMaxVolume() { ++ return 1.0; ++} ++ ++void AudioInputStreamHaiku::SetVolume(double volume) { ++ UpdateAgcVolume(); ++} ++ ++double AudioInputStreamHaiku::GetVolume() { ++ return 1.0; ++} ++ ++bool AudioInputStreamHaiku::SetAutomaticGainControl(bool enabled) { ++ return false; ++} ++ ++bool AudioInputStreamHaiku::GetAutomaticGainControl() { ++ return false; ++} ++ ++bool AudioInputStreamHaiku::IsMuted() { ++ return false; ++} ++ ++void AudioInputStreamHaiku::SetOutputDeviceForAec( ++ const std::string& output_device_id) { ++} ++ ++void AudioInputStreamHaiku::ReadCallback(void* buffer, size_t size, ++ const media_format &format) noexcept ++{ ++ double normalized_volume = 0.0; ++ GetAgcVolume(&normalized_volume); ++ ++ SampleFormat sample_format = recorder_->Format(); ++ ++ base::TimeTicks capture_time = ++ base::TimeTicks::Now() - (recorder_->Latency() + ++ AudioTimestampHelper::FramesToTime(fifo_.GetAvailableFrames(), ++ parameters_.sample_rate())); ++ ++ const int number_of_frames = size / parameters_.GetBytesPerFrame(sample_format); ++ ++ if (number_of_frames > fifo_.GetUnfilledFrames()) { ++ const int increase_blocks_of_buffer = ++ static_cast((number_of_frames - fifo_.GetUnfilledFrames()) / ++ parameters_.frames_per_buffer()) + 1; ++ fifo_.IncreaseCapacity(increase_blocks_of_buffer); ++ } ++ ++ fifo_.Push(buffer, number_of_frames, SampleFormatToBytesPerChannel(sample_format)); ++ ++ while (fifo_.available_blocks()) { ++ const AudioBus* audio_bus = fifo_.Consume(); ++ ++ callback_->OnData(audio_bus, capture_time, normalized_volume); ++ ++ capture_time += AudioTimestampHelper::FramesToTime(audio_bus->frames(), ++ parameters_.sample_rate()); ++ ++ if (fifo_.available_blocks()) ++ base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(5)); ++ } ++} ++ ++} // namespace media +diff --git a/src/3rdparty/chromium/media/audio/haiku/audio_input_stream_haiku.h b/src/3rdparty/chromium/media/audio/haiku/audio_input_stream_haiku.h +new file mode 100644 +index 0000000..2cd96dc +--- /dev/null ++++ b/src/3rdparty/chromium/media/audio/haiku/audio_input_stream_haiku.h +@@ -0,0 +1,112 @@ ++// Copyright 2021 Gerasim Troeglazov. All rights reserved. ++// Use of this source code is governed by a BSD-style license that can be ++// found in the LICENSE file. ++ ++#ifndef MEDIA_AUDIO_HAIKU_AUDIO_INPUT_STREAM_HAIKU_H_ ++#define MEDIA_AUDIO_HAIKU_AUDIO_INPUT_STREAM_HAIKU_H_ ++ ++#include "media/audio/audio_io.h" ++#include "media/audio/agc_audio_stream.h" ++#include "media/base/audio_block_fifo.h" ++#include "media/base/audio_parameters.h" ++#include "media/base/audio_timestamp_helper.h" ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++namespace media { ++ ++class AudioManagerHaiku; ++ ++class HaikuAudioRecorder { ++public: ++ HaikuAudioRecorder(const char *node_name = NULL); ++ ~HaikuAudioRecorder(); ++ ++ bool SetCallbacks(BMediaRecorder::ProcessFunc recordFunc = NULL, ++ BMediaRecorder::NotifyFunc notifyFunc = NULL, ++ void* cookie = NULL); ++ ++ bool Open(); ++ void Close(); ++ void Start(); ++ void Stop(); ++ ++ base::TimeDelta Latency(); ++ BMediaRoster *MediaRoster() { return media_roster_; } ++ ++ SampleFormat Format(); ++ ChannelLayout Channels(); ++ int SampleRate() { return static_cast(record_format_.u.raw_audio.frame_rate); } ++ ++ bool IsOpened() { return is_opened_; } ++ bool IsRecording() { return is_recording_; } ++ bool InitCheck() { return is_inited_; } ++ ++private: ++ BString node_name_; ++ ++ BMediaRoster *media_roster_{0u}; ++ BMediaRecorder *recorder_{0u}; ++ ++ media_format record_format_; ++ media_node audio_input_node_; ++ media_node audio_mixer_node_; ++ media_output audio_output_; ++ ++ bool is_inited_{false}; ++ bool is_opened_{false}; ++ bool is_recording_{false}; ++}; ++ ++ ++class AudioInputStreamHaiku : public AgcAudioStream { ++ public: ++ AudioInputStreamHaiku(AudioManagerHaiku* manager, ++ const AudioParameters& parameters); ++ ~AudioInputStreamHaiku() override; ++ ++ bool Open() override; ++ void Start(AudioInputCallback* callback) override; ++ void Stop() override; ++ void Close() override; ++ double GetMaxVolume() override; ++ void SetVolume(double volume) override; ++ double GetVolume() override; ++ bool SetAutomaticGainControl(bool enabled) override; ++ bool GetAutomaticGainControl() override; ++ bool IsMuted() override; ++ void SetOutputDeviceForAec(const std::string& output_device_id) override; ++ ++ void ReadCallback(void* data, size_t size, const media_format &format) noexcept; ++ ++ private: ++ static void _read_callback(void* cookie, bigtime_t, void* data, size_t size, const media_format &format) noexcept { ++ return static_cast(cookie)->ReadCallback(data, size, format); ++ } ++ ++ AudioManagerHaiku* const manager_; ++ AudioParameters parameters_; ++ HaikuAudioRecorder* recorder_; ++ AudioInputCallback* callback_; ++ AudioBlockFifo fifo_; ++ ++ std::unique_ptr audio_bus_; ++ ++ DISALLOW_COPY_AND_ASSIGN(AudioInputStreamHaiku); ++}; ++ ++} // namespace media ++ ++#endif // MEDIA_AUDIO_HAIKU_AUDIO_INPUT_STREAM_HAIKU_H_ +diff --git a/src/3rdparty/chromium/media/audio/haiku/audio_manager_haiku.cc b/src/3rdparty/chromium/media/audio/haiku/audio_manager_haiku.cc +new file mode 100644 +index 0000000..186319c +--- /dev/null ++++ b/src/3rdparty/chromium/media/audio/haiku/audio_manager_haiku.cc +@@ -0,0 +1,103 @@ ++// Copyright 2021 Gerasim Troeglazov. All rights reserved. ++// Use of this source code is governed by a BSD-style license that can be ++// found in the LICENSE file. ++ ++#include "media/audio/haiku/audio_manager_haiku.h" ++ ++#include ++ ++#include "media/audio/haiku/audio_input_stream_haiku.h" ++#include "media/audio/haiku/audio_output_stream_haiku.h" ++ ++namespace media { ++ ++AudioManagerHaiku::AudioManagerHaiku( ++ std::unique_ptr audio_thread, ++ AudioLogFactory* audio_log_factory) ++ : AudioManagerBase(std::move(audio_thread), audio_log_factory) {} ++ ++AudioManagerHaiku::~AudioManagerHaiku() = default; ++ ++bool AudioManagerHaiku::HasAudioOutputDevices() { ++ return true; ++} ++ ++bool AudioManagerHaiku::HasAudioInputDevices() { ++ return true; ++} ++ ++void AudioManagerHaiku::GetAudioInputDeviceNames( ++ AudioDeviceNames* device_names) { ++ *device_names = {AudioDeviceName::CreateDefault()}; ++} ++ ++void AudioManagerHaiku::GetAudioOutputDeviceNames( ++ AudioDeviceNames* device_names) { ++ *device_names = {AudioDeviceName::CreateDefault()}; ++} ++ ++AudioParameters AudioManagerHaiku::GetInputStreamParameters( ++ const std::string& device_id) { ++ HaikuAudioRecorder recorder; ++ if (recorder.Open()) { ++ AudioParameters params(AudioParameters::AUDIO_PCM_LOW_LATENCY, ++ recorder.Channels(), recorder.SampleRate(), ++ recorder.SampleRate() / 100); ++ params.set_effects(AudioParameters::NO_EFFECTS); ++ return params; ++ } ++ ++ return AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY, ++ CHANNEL_LAYOUT_STEREO, 48000, 480); ++} ++ ++AudioParameters AudioManagerHaiku::GetPreferredOutputStreamParameters( ++ const std::string& output_device_id, ++ const AudioParameters& input_params) { ++ return AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY, ++ CHANNEL_LAYOUT_STEREO, 48000, 480); ++} ++ ++const char* AudioManagerHaiku::GetName() { ++ return "Haiku"; ++} ++ ++AudioOutputStream* AudioManagerHaiku::MakeLinearOutputStream( ++ const AudioParameters& params, ++ const LogCallback& log_callback) { ++ DCHECK_EQ(AudioParameters::AUDIO_PCM_LINEAR, params.format()); ++ return new AudioOutputStreamHaiku(this, params); ++} ++ ++AudioOutputStream* AudioManagerHaiku::MakeLowLatencyOutputStream( ++ const AudioParameters& params, ++ const std::string& device_id, ++ const LogCallback& log_callback) { ++ DCHECK_EQ(AudioParameters::AUDIO_PCM_LOW_LATENCY, params.format()); ++ return new AudioOutputStreamHaiku(this, params); ++} ++ ++AudioInputStream* AudioManagerHaiku::MakeLinearInputStream( ++ const AudioParameters& params, ++ const std::string& device_id, ++ const LogCallback& log_callback) { ++ DCHECK_EQ(AudioParameters::AUDIO_PCM_LINEAR, params.format()); ++ return new AudioInputStreamHaiku(this, params); ++} ++ ++AudioInputStream* AudioManagerHaiku::MakeLowLatencyInputStream( ++ const AudioParameters& params, ++ const std::string& device_id, ++ const LogCallback& log_callback) { ++ DCHECK_EQ(AudioParameters::AUDIO_PCM_LOW_LATENCY, params.format()); ++ return new AudioInputStreamHaiku(this, params); ++} ++ ++std::unique_ptr CreateAudioManager( ++ std::unique_ptr audio_thread, ++ AudioLogFactory* audio_log_factory) { ++ return std::make_unique(std::move(audio_thread), ++ audio_log_factory); ++} ++ ++} // namespace media +diff --git a/src/3rdparty/chromium/media/audio/haiku/audio_manager_haiku.h b/src/3rdparty/chromium/media/audio/haiku/audio_manager_haiku.h +new file mode 100644 +index 0000000..2a3eba9 +--- /dev/null ++++ b/src/3rdparty/chromium/media/audio/haiku/audio_manager_haiku.h +@@ -0,0 +1,55 @@ ++// Copyright 2021 Gerasim Troeglazov. All rights reserved. ++// Use of this source code is governed by a BSD-style license that can be ++// found in the LICENSE file. ++ ++#ifndef MEDIA_AUDIO_HAIKU_AUDIO_MANAGER_HAIKU_H_ ++#define MEDIA_AUDIO_HAIKU_AUDIO_MANAGER_HAIKU_H_ ++ ++#include "media/audio/audio_manager_base.h" ++ ++namespace media { ++ ++class AudioManagerHaiku : public AudioManagerBase { ++ public: ++ AudioManagerHaiku(std::unique_ptr audio_thread, ++ AudioLogFactory* audio_log_factory); ++ ~AudioManagerHaiku() override; ++ ++ // Implementation of AudioManager. ++ bool HasAudioOutputDevices() override; ++ bool HasAudioInputDevices() override; ++ void GetAudioInputDeviceNames(AudioDeviceNames* device_names) override; ++ void GetAudioOutputDeviceNames(AudioDeviceNames* device_names) override; ++ AudioParameters GetInputStreamParameters( ++ const std::string& device_id) override; ++ const char* GetName() override; ++ ++ // Implementation of AudioManagerBase. ++ AudioOutputStream* MakeLinearOutputStream( ++ const AudioParameters& params, ++ const LogCallback& log_callback) override; ++ AudioOutputStream* MakeLowLatencyOutputStream( ++ const AudioParameters& params, ++ const std::string& device_id, ++ const LogCallback& log_callback) override; ++ AudioInputStream* MakeLinearInputStream( ++ const AudioParameters& params, ++ const std::string& device_id, ++ const LogCallback& log_callback) override; ++ AudioInputStream* MakeLowLatencyInputStream( ++ const AudioParameters& params, ++ const std::string& device_id, ++ const LogCallback& log_callback) override; ++ ++ protected: ++ AudioParameters GetPreferredOutputStreamParameters( ++ const std::string& output_device_id, ++ const AudioParameters& input_params) override; ++ ++ private: ++ DISALLOW_COPY_AND_ASSIGN(AudioManagerHaiku); ++}; ++ ++} // namespace media ++ ++#endif // MEDIA_AUDIO_HAIKU_AUDIO_MANAGER_HAIKU_H_ +diff --git a/src/3rdparty/chromium/media/audio/haiku/audio_output_stream_haiku.cc b/src/3rdparty/chromium/media/audio/haiku/audio_output_stream_haiku.cc +new file mode 100644 +index 0000000..c4e3c97 +--- /dev/null ++++ b/src/3rdparty/chromium/media/audio/haiku/audio_output_stream_haiku.cc +@@ -0,0 +1,94 @@ ++// Copyright 2021 Gerasim Troeglazov. All rights reserved. ++// Use of this source code is governed by a BSD-style license that can be ++// found in the LICENSE file. ++ ++#include "media/audio/haiku/audio_output_stream_haiku.h" ++ ++#include "base/bind.h" ++#include "base/memory/writable_shared_memory_region.h" ++#include "media/audio/haiku/audio_manager_haiku.h" ++#include "media/base/audio_sample_types.h" ++#include "media/base/audio_timestamp_helper.h" ++ ++namespace media { ++ ++AudioOutputStreamHaiku::AudioOutputStreamHaiku( ++ AudioManagerHaiku* manager, ++ const AudioParameters& parameters) ++ : manager_(manager), ++ parameters_(parameters), ++ player_(NULL), ++ audio_bus_(AudioBus::Create(parameters)) { ++ process_name_.SetTo("QtWebEngine"); ++ app_info appInfo; ++ if (be_app->GetAppInfo(&appInfo) == B_OK) { ++ BPath path(&appInfo.ref); ++ process_name_.SetTo(path.Leaf()); ++ } ++} ++ ++AudioOutputStreamHaiku::~AudioOutputStreamHaiku() {} ++ ++bool AudioOutputStreamHaiku::Open() { ++ media_raw_audio_format format; ++ format = { ++ parameters_.sample_rate(), ++ parameters_.channels(), ++ media_raw_audio_format::B_AUDIO_FLOAT, ++ B_MEDIA_LITTLE_ENDIAN, ++ parameters_.GetBytesPerBuffer(kSampleFormatF32) ++ }; ++ ++ player_ = new BSoundPlayer(&format, process_name_.String(), audio_callback, ++ NULL, static_cast(this)); ++ ++ return true; ++} ++ ++void AudioOutputStreamHaiku::Start(AudioSourceCallback* callback) { ++ DCHECK(!callback_); ++ callback_ = callback; ++ ++ player_->Start(); ++ player_->SetHasData(true); ++} ++ ++void AudioOutputStreamHaiku::Stop() { ++ callback_ = nullptr; ++ ++ player_->SetHasData(false); ++ player_->Stop(); ++} ++ ++void AudioOutputStreamHaiku::Flush() {} ++ ++void AudioOutputStreamHaiku::SetVolume(double volume) { ++ DCHECK(0.0 <= volume && volume <= 1.0) << volume; ++ player_->SetVolume(volume); ++} ++ ++void AudioOutputStreamHaiku::GetVolume(double* volume) { ++ *volume = player_->Volume(); ++} ++ ++void AudioOutputStreamHaiku::Close() { ++ Stop(); ++ ++ delete player_; ++ ++ manager_->ReleaseOutputStream(this); ++} ++ ++void AudioOutputStreamHaiku::AudioCallback(void *stream, size_t len) noexcept ++{ ++ int frames_filled = callback_->OnMoreData(base::TimeDelta::FromMicroseconds(0), base::TimeTicks::Now(), 0, audio_bus_.get()); ++ if (frames_filled <= 0) { ++ memset(stream, 0, len); ++ return; ++ } ++ ++ audio_bus_->ToInterleaved( ++ frames_filled, reinterpret_cast(stream)); ++} ++ ++} // namespace media +diff --git a/src/3rdparty/chromium/media/audio/haiku/audio_output_stream_haiku.h b/src/3rdparty/chromium/media/audio/haiku/audio_output_stream_haiku.h +new file mode 100644 +index 0000000..0e97029 +--- /dev/null ++++ b/src/3rdparty/chromium/media/audio/haiku/audio_output_stream_haiku.h +@@ -0,0 +1,64 @@ ++// Copyright 2021 Gerasim Troeglazov. All rights reserved. ++// Use of this source code is governed by a BSD-style license that can be ++// found in the LICENSE file. ++ ++#ifndef MEDIA_AUDIO_HAIKU_AUDIO_OUTPUT_STREAM_HAIKU_H_ ++#define MEDIA_AUDIO_HAIKU_AUDIO_OUTPUT_STREAM_HAIKU_H_ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "base/memory/shared_memory_mapping.h" ++#include "base/optional.h" ++#include "base/timer/timer.h" ++#include "media/audio/audio_io.h" ++#include "media/base/audio_parameters.h" ++ ++namespace media { ++ ++class AudioManagerHaiku; ++ ++class AudioOutputStreamHaiku : public AudioOutputStream { ++ public: ++ // Caller must ensure that manager outlives the stream. ++ AudioOutputStreamHaiku(AudioManagerHaiku* manager, ++ const AudioParameters& parameters); ++ ++ // AudioOutputStream interface. ++ bool Open() override; ++ void Start(AudioSourceCallback* callback) override; ++ void Stop() override; ++ void Flush() override; ++ void SetVolume(double volume) override; ++ void GetVolume(double* volume) override; ++ void Close() override; ++ ++ private: ++ ~AudioOutputStreamHaiku() override; ++ ++ AudioManagerHaiku* manager_; ++ AudioParameters parameters_; ++ ++ BSoundPlayer *player_; ++ BString process_name_; ++ ++ std::unique_ptr audio_bus_; ++ ++ void AudioCallback(void *stream, size_t len) noexcept; ++ static void audio_callback(void *cookie, void *buffer, size_t len, const media_raw_audio_format &) noexcept { ++ static_cast(cookie)->AudioCallback(buffer, len); ++ } ++ ++ AudioSourceCallback* callback_ = nullptr; ++ ++ DISALLOW_COPY_AND_ASSIGN(AudioOutputStreamHaiku); ++}; ++ ++} // namespace media ++ ++#endif // MEDIA_AUDIO_HAIKU_AUDIO_OUTPUT_STREAM_HAIKU_H_ +diff --git a/src/3rdparty/chromium/media/base/scopedfd_helper.h b/src/3rdparty/chromium/media/base/scopedfd_helper.h +index 5cc8086..295586e 100644 +--- a/src/3rdparty/chromium/media/base/scopedfd_helper.h ++++ b/src/3rdparty/chromium/media/base/scopedfd_helper.h +@@ -14,14 +14,14 @@ namespace media { + // since the only current user is V4L2 we are limiting the scope to OS_LINUX so + // the binary size does not inflate on non-using systems. Feel free to adapt + // this and BUILD.gn as our needs evolve. +-#if defined(OS_LINUX) || defined(OS_CHROMEOS) ++#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU) + + // Return a new vector containing duplicates of |fds|, or PCHECKs in case of an + // error. + MEDIA_EXPORT std::vector DuplicateFDs( + const std::vector& fds); + +-#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) ++#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU) + + } // namespace media + +diff --git a/src/3rdparty/chromium/media/capture/BUILD.gn b/src/3rdparty/chromium/media/capture/BUILD.gn +index c9986f3..ad19c64 100644 +--- a/src/3rdparty/chromium/media/capture/BUILD.gn ++++ b/src/3rdparty/chromium/media/capture/BUILD.gn +@@ -250,7 +250,7 @@ jumbo_component("capture_lib") { + # This includes the case of ChromeOS + # TODO: As we move to separately version Chrome from ChromeOS, we may need to split + # these sources into linux, chromeos, and common. +- if (is_linux || is_chromeos) { ++ if ((is_linux && !is_haiku) || is_chromeos) { + sources += [ + "video/linux/camera_config_chromeos.cc", + "video/linux/camera_config_chromeos.h", +@@ -345,6 +345,20 @@ jumbo_component("capture_lib") { + "//third_party/libyuv", + ] + } ++ ++ if (is_haiku) { ++ sources += [ ++ "video/haiku/video_capture_device_factory_haiku.cc", ++ "video/haiku/video_capture_device_factory_haiku.h", ++ "video/haiku/video_capture_device_consumer_haiku.cc", ++ "video/haiku/video_capture_device_consumer_haiku.h", ++ "video/haiku/video_capture_device_haiku.cc", ++ "video/haiku/video_capture_device_haiku.h", ++ ] ++ libs = [ ++ "media", ++ ] ++ } + } + + source_set("test_support") { +diff --git a/src/3rdparty/chromium/media/capture/video/create_video_capture_device_factory.cc b/src/3rdparty/chromium/media/capture/video/create_video_capture_device_factory.cc +index 8d0f977..5d6e232 100644 +--- a/src/3rdparty/chromium/media/capture/video/create_video_capture_device_factory.cc ++++ b/src/3rdparty/chromium/media/capture/video/create_video_capture_device_factory.cc +@@ -25,6 +25,8 @@ + #include "media/capture/video/android/video_capture_device_factory_android.h" + #elif defined(OS_FUCHSIA) + #include "media/capture/video/fuchsia/video_capture_device_factory_fuchsia.h" ++#elif defined(OS_HAIKU) ++#include "media/capture/video/haiku/video_capture_device_factory_haiku.h" + #endif + + namespace media { +@@ -94,6 +96,8 @@ CreatePlatformSpecificVideoCaptureDeviceFactory( + return std::make_unique(); + #elif defined(OS_FUCHSIA) + return std::make_unique(); ++#elif defined(OS_HAIKU) ++ return std::make_unique(); + #else + NOTIMPLEMENTED(); + return nullptr; +diff --git a/src/3rdparty/chromium/media/capture/video/fake_video_capture_device_factory.cc b/src/3rdparty/chromium/media/capture/video/fake_video_capture_device_factory.cc +index b96840f..6233375 100644 +--- a/src/3rdparty/chromium/media/capture/video/fake_video_capture_device_factory.cc ++++ b/src/3rdparty/chromium/media/capture/video/fake_video_capture_device_factory.cc +@@ -218,6 +218,8 @@ void FakeVideoCaptureDeviceFactory::GetDevicesInfo( + VideoCaptureApi::ANDROID_API2_LEGACY; + #elif defined(OS_FUCHSIA) + VideoCaptureApi::FUCHSIA_CAMERA3; ++#elif defined(OS_HAIKU) ++ VideoCaptureApi::HAIKU_MEDIAKIT; + #else + #error Unsupported platform + #endif +diff --git a/src/3rdparty/chromium/media/capture/video/file_video_capture_device_factory.cc b/src/3rdparty/chromium/media/capture/video/file_video_capture_device_factory.cc +index d899c50..9417271 100644 +--- a/src/3rdparty/chromium/media/capture/video/file_video_capture_device_factory.cc ++++ b/src/3rdparty/chromium/media/capture/video/file_video_capture_device_factory.cc +@@ -54,6 +54,8 @@ void FileVideoCaptureDeviceFactory::GetDevicesInfo( + VideoCaptureApi::MACOSX_AVFOUNDATION; + #elif defined(OS_LINUX) || defined(OS_CHROMEOS) + VideoCaptureApi::LINUX_V4L2_SINGLE_PLANE; ++#elif defined(OS_HAIKU) ++ VideoCaptureApi::HAIKU_MEDIAKIT; + #else + VideoCaptureApi::UNKNOWN; + #endif +diff --git a/src/3rdparty/chromium/media/capture/video/haiku/video_capture_device_consumer_haiku.cc b/src/3rdparty/chromium/media/capture/video/haiku/video_capture_device_consumer_haiku.cc +new file mode 100644 +index 0000000..8419d99 +--- /dev/null ++++ b/src/3rdparty/chromium/media/capture/video/haiku/video_capture_device_consumer_haiku.cc +@@ -0,0 +1,485 @@ ++// Copyright 2021-2023 Gerasim Troeglazov. All rights reserved. ++// Use of this source code is governed by a BSD-style license that can be ++// found in the LICENSE file. ++ ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "video_capture_device_consumer_haiku.h" ++ ++namespace media { ++ ++VideoConsumer::VideoConsumer(const char* name, BMediaAddOn* addon, ++ const uint32 internal_id) ++ : BMediaNode(name), ++ BMediaEventLooper(), ++ BBufferConsumer(B_MEDIA_RAW_VIDEO), ++ fInternalID(internal_id), ++ fAddOn(addon), ++ fConnectionActive(false), ++ fMyLatency(3000), ++ fOurBuffers(false), ++ fBuffers(NULL), ++ fLastBufferIndex(-1) ++{ ++ printf("VideoConsumer::VideoConsumer\n"); ++ AddNodeKind(B_PHYSICAL_OUTPUT); ++ SetEventLatency(0); ++ ++ for (uint32 i = 0; i < kBufferCount; i++) { ++ fBitmap[i] = NULL; ++ fBufferMap[i] = NULL; ++ } ++ ++ SetPriority(B_DISPLAY_PRIORITY); ++} ++ ++ ++VideoConsumer::~VideoConsumer() ++{ ++ Quit(); ++ DeleteBuffers(); ++} ++ ++ ++void ++VideoConsumer::SetClient(std::unique_ptr client) ++{ ++ printf("VideoConsumer::SetClient\n"); ++ client_ = std::move(client); ++} ++ ++ ++BMediaAddOn* ++VideoConsumer::AddOn(int32* cookie) const ++{ ++ *cookie = fInternalID; ++ return fAddOn; ++} ++ ++ ++void ++VideoConsumer::NodeRegistered() ++{ ++ printf("VideoConsumer::NodeRegistered\n"); ++ fIn.destination.port = ControlPort(); ++ fIn.destination.id = 0; ++ fIn.source = media_source::null; ++ fIn.format.type = B_MEDIA_RAW_VIDEO; ++ // wild cards yet ++ fIn.format.u.raw_video = media_raw_video_format::wildcard; ++ fIn.format.u.raw_video.interlace = 1; ++ fIn.format.u.raw_video.display.format = B_NO_COLOR_SPACE; ++ fIn.format.u.raw_video.display.bytes_per_row = 0; ++ fIn.format.u.raw_video.display.line_width = 0; ++ fIn.format.u.raw_video.display.line_count = 0; ++ printf("VideoConsumer::NodeRegistered: Run\n"); ++ //Run(); ++} ++ ++ ++status_t ++VideoConsumer::RequestCompleted(const media_request_info& info) ++{ ++ switch(info.what) { ++ case media_request_info::B_SET_OUTPUT_BUFFERS_FOR: ++ if (info.status != B_OK) ++ fprintf(stderr, "VideoConsumer::RequestCompleted: Not using our buffers!\n"); ++ break; ++ default: ++ break; ++ } ++ return B_OK; ++} ++ ++ ++status_t ++VideoConsumer::HandleMessage(int32 message, const void* data, size_t size) ++{ ++ return B_OK; ++} ++ ++ ++void ++VideoConsumer::BufferReceived(BBuffer* buffer) ++{ ++ if (RunState() == B_STOPPED) { ++ buffer->Recycle(); ++ return; ++ } ++ media_timed_event event(buffer->Header()->start_time, ++ BTimedEventQueue::B_HANDLE_BUFFER, buffer, ++ BTimedEventQueue::B_RECYCLE_BUFFER); ++ EventQueue()->AddEvent(event); ++} ++ ++ ++void ++VideoConsumer::ProducerDataStatus(const media_destination& forWhom, ++ int32 status, bigtime_t atMediaTime) ++{ ++ if (forWhom != fIn.destination) ++ return; ++} ++ ++ ++status_t ++VideoConsumer::CreateBuffers(const media_format& format) ++{ ++ DeleteBuffers(); ++ ++ status_t status = B_OK; ++ ++ uint32 width = format.u.raw_video.display.line_width; ++ uint32 height = format.u.raw_video.display.line_count; ++ color_space colorSpace = format.u.raw_video.display.format; ++ ++ fBuffers = new BBufferGroup(); ++ status = fBuffers->InitCheck(); ++ if (B_OK != status) ++ return status; ++ ++ BRect bounds(0, 0, width - 1, height - 1); ++ for (uint32 i = 0; i < kBufferCount; i++) { ++ uint32 bitmapFlags = 0; ++ bitmapFlags = B_BITMAP_IS_LOCKED; ++ ++ fBitmap[i] = new BBitmap(bounds, bitmapFlags, colorSpace); ++ status = fBitmap[i]->InitCheck(); ++ if (status >= B_OK) { ++ buffer_clone_info info; ++ ++ uint8* bits = (uint8*)fBitmap[i]->Bits(); ++ info.area = area_for(bits); ++ area_info bitmapAreaInfo; ++ status = get_area_info(info.area, &bitmapAreaInfo); ++ if (status != B_OK) { ++ fprintf(stderr, "VideoConsumer::CreateBuffers() - " ++ "get_area_info(): %s\n", strerror(status)); ++ return status; ++ } ++ ++ info.offset = bits - (uint8*)bitmapAreaInfo.address; ++ info.size = (size_t)fBitmap[i]->BitsLength(); ++ info.flags = 0; ++ info.buffer = 0; ++ ++ BBuffer* buffer = NULL; ++ if ((status = fBuffers->AddBuffer(info, &buffer)) != B_OK) { ++ fprintf(stderr, "VideoConsumer::CreateBuffers - ERROR ADDING BUFFER " ++ "TO GROUP (%" B_PRId32 "): %s\n", i, strerror(status)); ++ return status; ++ } ++ fBufferMap[i] = buffer; ++ } else { ++ fprintf(stderr, "VideoConsumer::CreateBuffers - ERROR CREATING VIDEO RING " ++ "BUFFER (Index %" B_PRId32 " Width %" B_PRId32 " Height %" ++ B_PRId32 " Colorspace %d: %s\n", i, width, height, colorSpace, ++ strerror(status)); ++ return status; ++ } ++ } ++ ++ return status; ++} ++ ++ ++void ++VideoConsumer::DeleteBuffers() ++{ ++ if (fBuffers) { ++ fTargetLock.Lock(); ++ if (fLastBufferIndex >= 0) { ++ fLastBufferIndex = -1; ++ } ++ fTargetLock.Unlock(); ++ ++ delete fBuffers; ++ fBuffers = NULL; ++ ++ for (uint32 i = 0; i < kBufferCount; i++) { ++ snooze(20000); ++ delete fBitmap[i]; ++ fBitmap[i] = NULL; ++ } ++ } ++} ++ ++ ++status_t ++VideoConsumer::Connected(const media_source& producer, ++ const media_destination& where, const media_format& format, ++ media_input* outInput) ++{ ++ fIn.source = producer; ++ fIn.format = format; ++ fIn.node = Node(); ++ sprintf(fIn.name, "Video Consumer"); ++ *outInput = fIn; ++ ++ uint32 userData = 0; ++ int32 changeTag = 1; ++ status_t ret = CreateBuffers(format); ++ if (ret == B_OK) { ++ ret = SetOutputBuffersFor(producer, fIn.destination, ++ fBuffers, &userData, &changeTag, true); ++ if (ret != B_OK) ++ fprintf(stderr, "SetOutputBuffersFor() failed: %s\n", strerror(ret)); ++ ++ fIn.format.u.raw_video.display.bytes_per_row ++ = fBitmap[0]->BytesPerRow(); ++ } else { ++ fprintf(stderr, "VideoConsumer::Connected - COULDN'T CREATE BUFFERS\n"); ++ return ret; ++ } ++ ++ *outInput = fIn; ++ fConnectionActive = true; ++ ++ return B_OK; ++} ++ ++ ++void ++VideoConsumer::Disconnected(const media_source& producer, ++ const media_destination& where) ++{ ++ if (where != fIn.destination || producer != fIn.source) ++ return; ++ ++ int32 changeTag = 0; ++ SetOutputBuffersFor(producer, fIn.destination, NULL, NULL, &changeTag, ++ false); ++ if (fOurBuffers) { ++ status_t reclaimError = fBuffers->ReclaimAllBuffers(); ++ if (reclaimError != B_OK) { ++ fprintf(stderr, "VideoConsumer::Disconnected() - Failed to " ++ "reclaim our buffers: %s\n", strerror(reclaimError)); ++ } ++ } ++ // disconnect the connection ++ fIn.source = media_source::null; ++ fConnectionActive = false; ++ ++ _UnsetTargetBuffer(); ++} ++ ++ ++status_t ++VideoConsumer::AcceptFormat(const media_destination& dest, media_format* format) ++{ ++ if (dest != fIn.destination) { ++ fprintf(stderr, "VideoConsumer::AcceptFormat - BAD DESTINATION\n"); ++ return B_MEDIA_BAD_DESTINATION; ++ } ++ ++ if (format->type == B_MEDIA_NO_TYPE) ++ format->type = B_MEDIA_RAW_VIDEO; ++ ++ if (format->type != B_MEDIA_RAW_VIDEO) { ++ fprintf(stderr, "VideoConsumer::AcceptFormat - BAD FORMAT\n"); ++ return B_MEDIA_BAD_FORMAT; ++ } ++ ++ if (format->u.raw_video.display.format ++ != media_raw_video_format::wildcard.display.format) { ++ uint32 flags = 0; ++ bool supported = bitmaps_support_space( ++ format->u.raw_video.display.format, &flags); ++ ++ if (!supported) { ++ fprintf(stderr, "AcceptFormat - unsupported color space for BBitmaps !\n"); ++ return B_MEDIA_BAD_FORMAT; ++ } ++ if (flags & B_VIEWS_SUPPORT_DRAW_BITMAP == 0) { ++ fprintf(stderr, "AcceptFormat - BViews cannot draw bitmaps in given colorspace !\n"); ++ return B_MEDIA_BAD_FORMAT; ++ } ++ } ++ ++ return B_OK; ++} ++ ++ ++status_t ++VideoConsumer::GetNextInput(int32* cookie, media_input* outInput) ++{ ++ if (*cookie < 1) { ++ fIn.node = Node(); ++ fIn.destination.id = *cookie; ++ sprintf(fIn.name, "Video Consumer"); ++ *outInput = fIn; ++ (*cookie)++; ++ return B_OK; ++ } ++ return B_MEDIA_BAD_DESTINATION; ++} ++ ++ ++void ++VideoConsumer::DisposeInputCookie(int32 /*cookie*/) ++{ ++} ++ ++ ++status_t ++VideoConsumer::GetLatencyFor(const media_destination& whom, ++ bigtime_t* _latency, media_node_id* _timeSource) ++{ ++ if (whom != fIn.destination) ++ return B_MEDIA_BAD_DESTINATION; ++ ++ *_latency = fMyLatency; ++ *_timeSource = TimeSource()->ID(); ++ return B_OK; ++} ++ ++ ++status_t ++VideoConsumer::FormatChanged(const media_source& producer, ++ const media_destination& consumer, int32 fromChangeCount, ++ const media_format& format) ++{ ++ if (consumer != fIn.destination) ++ return B_MEDIA_BAD_DESTINATION; ++ ++ if (producer != fIn.source) ++ return B_MEDIA_BAD_SOURCE; ++ ++ fIn.format = format; ++ ++ return CreateBuffers(format); ++} ++ ++ ++void ++VideoConsumer::HandleEvent(const media_timed_event* event, bigtime_t lateness, ++ bool realTimeEvent) ++{ ++ switch (event->type) { ++ case BTimedEventQueue::B_START: ++ _SetPerformanceTimeBase(event->event_time); ++ break; ++ case BTimedEventQueue::B_WARP: ++ case BTimedEventQueue::B_SEEK: ++ _SetPerformanceTimeBase(event->bigdata); ++ break; ++ case BTimedEventQueue::B_STOP: ++ EventQueue()->FlushEvents(event->event_time, BTimedEventQueue::B_ALWAYS, ++ true, BTimedEventQueue::B_HANDLE_BUFFER); ++ _UnsetTargetBuffer(); ++ break; ++ case BTimedEventQueue::B_HANDLE_BUFFER: ++ _HandleBuffer(static_cast(event->pointer)); ++ break; ++ default: ++ fprintf(stderr, "VideoConsumer::HandleEvent - BAD EVENT\n"); ++ break; ++ } ++} ++ ++ ++void ++VideoConsumer::_SetPerformanceTimeBase(bigtime_t performanceTime) ++{ ++ fPerformanceTimeBase = performanceTime; ++} ++ ++ ++void ++VideoConsumer::_HandleBuffer(BBuffer* buffer) ++{ ++ if (RunState() != B_STARTED || !fConnectionActive) { ++ buffer->Recycle(); ++ return; ++ } ++ ++ uint32 index = 0; ++ fOurBuffers = true; ++ while (index < kBufferCount) { ++ if (buffer->ID() == fBufferMap[index]->ID()) ++ break; ++ else ++ index++; ++ } ++ if (index == kBufferCount) { ++ fOurBuffers = false; ++ index = (fLastBufferIndex + 1) % kBufferCount; ++ } ++ ++ bool recycle = true; ++ bigtime_t now = TimeSource()->Now(); ++ ++ if (!fOurBuffers) { ++ memcpy(fBitmap[index]->Bits(), buffer->Data(), ++ fBitmap[index]->BitsLength()); ++ } ++ ++ bigtime_t tooEarly = buffer->Header()->start_time - now; ++ if (tooEarly > 3000) ++ snooze(tooEarly); ++ ++ fTargetLock.Lock(); ++ ++// VideoCaptureCapability frameInfo; ++// frameInfo.width = fBitmap[index]->Bounds().Width() + 1; ++// frameInfo.height = fBitmap[index]->Bounds().Height() + 1; ++// frameInfo.videoType = VideoType::kARGB; ++ ++// fVideoCapture->IncomingFrame((unsigned char*)fBitmap[index]->Bits(), ++// fBitmap[index]->BitsLength(), frameInfo); ++ ++ if (client_) { ++ const int64_t absolute_micro = ++ buffer->Header()->start_time / base::Time::kNanosecondsPerMicrosecond; ++ const base::TimeDelta capture_time = ++ base::TimeDelta::FromMicroseconds(absolute_micro); ++ ++ const base::TimeTicks current_time = base::TimeTicks::Now(); ++ ++ media::VideoCaptureFormat kSupportedFormat(gfx::Size(640, 480), ++ 25.0f, media::PIXEL_FORMAT_ARGB); ++ ++ client_->OnIncomingCapturedData( ++ (unsigned char*)fBitmap[index]->Bits(), fBitmap[index]->BitsLength(), kSupportedFormat, gfx::ColorSpace(), 0, ++ false /* flip_y */, current_time, capture_time); ++ } ++ ++ if (fOurBuffers) { ++ if (fLastBufferIndex >= 0) ++ fBufferMap[fLastBufferIndex]->Recycle(); ++ recycle = false; ++ } ++ fLastBufferIndex = index; ++ ++ fTargetLock.Unlock(); ++ ++ if (recycle) ++ buffer->Recycle(); ++} ++ ++ ++void ++VideoConsumer::_UnsetTargetBuffer() ++{ ++ fTargetLock.Lock(); ++ if (fLastBufferIndex >= 0) { ++ if (fOurBuffers) ++ fBufferMap[fLastBufferIndex]->Recycle(); ++ fLastBufferIndex = -1; ++ } ++ fTargetLock.Unlock(); ++} ++ ++} //namespace media +diff --git a/src/3rdparty/chromium/media/capture/video/haiku/video_capture_device_consumer_haiku.h b/src/3rdparty/chromium/media/capture/video/haiku/video_capture_device_consumer_haiku.h +new file mode 100644 +index 0000000..45cff12 +--- /dev/null ++++ b/src/3rdparty/chromium/media/capture/video/haiku/video_capture_device_consumer_haiku.h +@@ -0,0 +1,117 @@ ++// Copyright 2021-2023 Gerasim Troeglazov. All rights reserved. ++// Use of this source code is governed by a BSD-style license that can be ++// found in the LICENSE file. ++ ++#ifndef MEDIA_CAPTURE_VIDEO_HAIKU_VIDEO_CAPTURE_DEVICE_CONSUMER_HAIKU_H_ ++#define MEDIA_CAPTURE_VIDEO_HAIKU_VIDEO_CAPTURE_DEVICE_CONSUMER_HAIKU_H_ ++ ++#include "base/macros.h" ++#include "media/capture/capture_export.h" ++#include "media/capture/video/video_capture_device.h" ++#include "video_capture_device_haiku.h" ++ ++#include ++#include ++#include ++ ++class BBitmap; ++ ++namespace media { ++ ++static const unsigned int kBufferCount = 4; ++ ++ ++class VideoConsumer : public BMediaEventLooper, public BBufferConsumer { ++public: ++ VideoConsumer( ++ const char* name, ++ BMediaAddOn* addon, ++ const uint32 internal_id); ++ ~VideoConsumer(); ++public: ++ void SetClient(std::unique_ptr client); ++ // BMediaNode interface ++public: ++ virtual BMediaAddOn* AddOn(int32* cookie) const; ++ ++protected: ++ virtual void NodeRegistered(); ++ virtual status_t RequestCompleted( ++ const media_request_info& info); ++ ++ virtual status_t HandleMessage(int32 message, const void* data, ++ size_t size); ++ ++ // BMediaEventLooper interface ++protected: ++ virtual void HandleEvent(const media_timed_event* event, ++ bigtime_t lateness, bool realTimeEvent); ++ ++ // BBufferConsumer interface ++public: ++ virtual status_t AcceptFormat(const media_destination& dest, ++ media_format* format); ++ virtual status_t GetNextInput(int32* cookie, ++ media_input* _input); ++ ++ virtual void DisposeInputCookie(int32 cookie); ++ ++protected: ++ virtual void BufferReceived(BBuffer* buffer); ++ ++private: ++ virtual void ProducerDataStatus( ++ const media_destination& forWhom, ++ int32 status, ++ bigtime_t atMediaTime); ++ virtual status_t GetLatencyFor( ++ const media_destination& forWhom, ++ bigtime_t* outLatency, ++ media_node_id* outId); ++ virtual status_t Connected(const media_source& producer, ++ const media_destination& where, ++ const media_format& withFormat, ++ media_input* outInput); ++ virtual void Disconnected(const media_source& producer, ++ const media_destination& where); ++ virtual status_t FormatChanged(const media_source& producer, ++ const media_destination& consumer, ++ int32 from_change_count, ++ const media_format& format); ++ ++ // VideoConsumer ++public: ++ status_t CreateBuffers( ++ const media_format& withFormat); ++ ++ void DeleteBuffers(); ++ ++private: ++ void _SetPerformanceTimeBase( ++ bigtime_t performanceTime); ++ void _HandleBuffer(BBuffer* buffer); ++ void _UnsetTargetBuffer(); ++ ++private: ++ int32 fInternalID; ++ BMediaAddOn* fAddOn; ++ ++ bool fConnectionActive; ++ media_input fIn; ++ bigtime_t fMyLatency; ++ bigtime_t fPerformanceTimeBase; ++ ++ BBitmap* fBitmap[kBufferCount]; ++ bool fOurBuffers; ++ BBufferGroup* fBuffers; ++ BBuffer* fBufferMap[kBufferCount]; ++ ++ BLocker fTargetLock; ++ int32 fLastBufferIndex; ++ ++ std::unique_ptr client_; ++}; ++ ++} // namespace media ++ ++#endif // MEDIA_CAPTURE_VIDEO_HAIKU_VIDEO_CAPTURE_DEVICE_CONSUMER_HAIKU_H_ +diff --git a/src/3rdparty/chromium/media/capture/video/haiku/video_capture_device_factory_haiku.cc b/src/3rdparty/chromium/media/capture/video/haiku/video_capture_device_factory_haiku.cc +new file mode 100644 +index 0000000..9df67fe +--- /dev/null ++++ b/src/3rdparty/chromium/media/capture/video/haiku/video_capture_device_factory_haiku.cc +@@ -0,0 +1,96 @@ ++// Copyright 2021-2023 Gerasim Troeglazov. 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/check_op.h" ++#include "base/location.h" ++#include "base/logging.h" ++#include "base/strings/string_number_conversions.h" ++#include "base/threading/thread_task_runner_handle.h" ++#include "base/time/time.h" ++ ++#include "media/capture/video/haiku/video_capture_device_factory_haiku.h" ++#include "media/capture/video/haiku/video_capture_device_haiku.h" ++ ++namespace media { ++ ++VideoCaptureDeviceFactoryHaiku::VideoCaptureDeviceFactoryHaiku() { ++} ++ ++VideoCaptureDeviceFactoryHaiku::~VideoCaptureDeviceFactoryHaiku() { ++} ++ ++std::unique_ptr ++VideoCaptureDeviceFactoryHaiku::CreateDevice( ++ const VideoCaptureDeviceDescriptor& device_descriptor) { ++ int id; ++ if (!base::StringToInt(device_descriptor.device_id, &id)) ++ return std::unique_ptr(); ++ ++ std::unique_ptr video_capture_device( ++ new VideoCaptureDeviceHaiku(device_descriptor)); ++ ++ return std::move(video_capture_device); ++} ++ ++void VideoCaptureDeviceFactoryHaiku::GetDevicesInfo( ++ GetDevicesInfoCallback callback) { ++ status_t err = B_OK; ++ ++ int32_t countDevices = 0; ++ ++ media_output videoOutput; ++ ++ dormant_node_info dni[30]; ++ int32 ioCount = 30; ++ media_format out; ++ out.type = B_MEDIA_RAW_VIDEO; ++ err = BMediaRoster::Roster()->GetDormantNodes(dni, &ioCount, 0, &out, 0, B_BUFFER_PRODUCER); ++ if (err < B_OK) ++ return; ++ ++ err = B_ERROR; ++ ++ std::vector devices_info; ++ ++ for (int ix=0; ixGetInstancesFor( ++ dni[ix].addon, dni[ix].flavor_id, &running)) && (running > -1)) { ++ media_node node; ++ BMediaRoster::CurrentRoster()->GetNodeFor(running, &node); ++ int32 count = 1; ++ BMediaRoster::CurrentRoster()->GetAllOutputsFor(node, &videoOutput, 1, &count); ++ BMediaRoster::CurrentRoster()->ReleaseNode(node); ++ if (count > 0) { ++ VideoCaptureControlSupport control_support; ++ control_support.pan = false; ++ control_support.tilt = false; ++ control_support.zoom = false; ++ ++ VideoCaptureDeviceInfo device_info(VideoCaptureDeviceDescriptor( ++ videoOutput.name, std::to_string(videoOutput.node.node), "", ++ VideoCaptureApi::HAIKU_MEDIAKIT, control_support, ++ VideoCaptureTransportType::OTHER_TRANSPORT, ++ VideoFacingMode::MEDIA_VIDEO_FACING_NONE)); ++ ++ media::VideoCaptureFormat kSupportedFormat(gfx::Size(640, 480), ++ 8.0f, media::PIXEL_FORMAT_ARGB); ++ ++ device_info.supported_formats.push_back(kSupportedFormat); ++ ++ devices_info.emplace_back(std::move(device_info)); ++ ++ countDevices++; ++ } ++ BMediaRoster::CurrentRoster()->ReleaseNode(node); ++ } ++ } ++ ++ std::move(callback).Run(std::move(devices_info)); ++} ++ ++void VideoCaptureDeviceFactoryHaiku::Initialize() { ++} ++ ++} // namespace media +diff --git a/src/3rdparty/chromium/media/capture/video/haiku/video_capture_device_factory_haiku.h b/src/3rdparty/chromium/media/capture/video/haiku/video_capture_device_factory_haiku.h +new file mode 100644 +index 0000000..1560e74 +--- /dev/null ++++ b/src/3rdparty/chromium/media/capture/video/haiku/video_capture_device_factory_haiku.h +@@ -0,0 +1,44 @@ ++// Copyright 2021-2023 Gerasim Troeglazov. All rights reserved. ++// Use of this source code is governed by a BSD-style license that can be ++// found in the LICENSE file. ++ ++#ifndef MEDIA_CAPTURE_VIDEO_HAIKU_VIDEO_CAPTURE_DEVICE_FACTORY_HAIKU_H_ ++#define MEDIA_CAPTURE_VIDEO_HAIKU_VIDEO_CAPTURE_DEVICE_FACTORY_HAIKU_H_ ++ ++#include ++#include ++ ++#include "base/containers/small_map.h" ++#include "base/optional.h" ++#include "media/capture/video/video_capture_device_factory.h" ++ ++namespace media { ++ ++class CAPTURE_EXPORT VideoCaptureDeviceFactoryHaiku ++ : public VideoCaptureDeviceFactory { ++ public: ++ VideoCaptureDeviceFactoryHaiku(); ++ ~VideoCaptureDeviceFactoryHaiku() override; ++ ++ VideoCaptureDeviceFactoryHaiku(const VideoCaptureDeviceFactoryHaiku&) = ++ delete; ++ VideoCaptureDeviceFactoryHaiku& operator=( ++ const VideoCaptureDeviceFactoryHaiku&) = delete; ++ ++ // VideoCaptureDeviceFactory implementation. ++ std::unique_ptr CreateDevice( ++ const VideoCaptureDeviceDescriptor& device_descriptor) override; ++ void GetDevicesInfo(GetDevicesInfoCallback callback) override; ++ ++ private: ++ // Helper class used to fetch per-device information. ++ class DeviceConfigFetcher; ++ ++ void Initialize(); ++ ++ base::WeakPtrFactory weak_factory_{this}; ++}; ++ ++} // namespace media ++ ++#endif // MEDIA_CAPTURE_VIDEO_HAIKU_VIDEO_CAPTURE_DEVICE_FACTORY_HAIKU_H_ +diff --git a/src/3rdparty/chromium/media/capture/video/haiku/video_capture_device_haiku.cc b/src/3rdparty/chromium/media/capture/video/haiku/video_capture_device_haiku.cc +new file mode 100644 +index 0000000..8502fb2 +--- /dev/null ++++ b/src/3rdparty/chromium/media/capture/video/haiku/video_capture_device_haiku.cc +@@ -0,0 +1,59 @@ ++// Copyright 2021-2023 Gerasim Troeglazov. All rights reserved. ++// Use of this source code is governed by a BSD-style license that can be ++// found in the LICENSE file. ++ ++#include "media/capture/video/haiku/video_capture_device_haiku.h" ++ ++#include "base/strings/stringprintf.h" ++#include "base/time/time.h" ++#include "media/base/video_types.h" ++#include "third_party/libyuv/include/libyuv/convert.h" ++#include "third_party/libyuv/include/libyuv/video_common.h" ++#include "ui/gfx/buffer_format_util.h" ++ ++#include ++ ++namespace media { ++ ++namespace { ++ ++VideoCaptureDeviceHaiku::VideoCaptureDeviceHaiku( ++ const media::VideoCaptureDeviceDescriptor& device_descriptor) ++ : device_descriptor_(device_descriptor) ++ , frame_thread_("HaikuCaptureThread") { ++} ++ ++VideoCaptureDeviceHaiku::~VideoCaptureDeviceHaiku() { ++ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); ++ DCHECK(!frame_thread_.IsRunning()); ++ frame_thread_.Stop(); ++} ++ ++void VideoCaptureDeviceHaiku::AllocateAndStart( ++ const VideoCaptureParams& params, ++ std::unique_ptr client) { ++ client_ = std::move(client); ++ ++ if (frame_thread_.IsRunning()) ++ return; // Wrong state. ++ ++ frame_thread_.Start(); ++ ++ should_quit_frame_production_loop_.UnsafeResetForTesting(); ++ frame_thread_.task_runner()->PostTask( ++ FROM_HERE, ++ base::BindOnce(&VideoCaptureDeviceHaiku::RunFrameProductionLoop, ++ base::Unretained(this))); ++ ++} ++ ++void VideoCaptureDeviceHaiku::StopAndDeAllocate() { ++ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); ++ should_quit_frame_production_loop_.Set(); ++ frame_thread_.Stop(); ++ client_.reset(); ++} ++ ++} ++ ++} // namespace media +diff --git a/src/3rdparty/chromium/media/capture/video/haiku/video_capture_device_haiku.h b/src/3rdparty/chromium/media/capture/video/haiku/video_capture_device_haiku.h +new file mode 100644 +index 0000000..a78bf16 +--- /dev/null ++++ b/src/3rdparty/chromium/media/capture/video/haiku/video_capture_device_haiku.h +@@ -0,0 +1,109 @@ ++// Copyright 2021-2023 Gerasim Troeglazov. All rights reserved. ++// Use of this source code is governed by a BSD-style license that can be ++// found in the LICENSE file. ++ ++#ifndef MEDIA_CAPTURE_VIDEO_HAIKU_VIDEO_CAPTURE_DEVICE_HAIKU_H_ ++#define MEDIA_CAPTURE_VIDEO_HAIKU_VIDEO_CAPTURE_DEVICE_HAIKU_H_ ++ ++#include ++ ++#include ++ ++#include "media/capture/video/haiku/video_capture_device_consumer_haiku.h" ++ ++#include "base/macros.h" ++#include "base/memory/weak_ptr.h" ++#include "base/synchronization/lock.h" ++#include "base/synchronization/waitable_event.h" ++#include "base/threading/thread.h" ++#include "base/threading/thread_checker.h" ++#include "base/time/time.h" ++#include "media/capture/capture_export.h" ++#include "media/capture/video/video_capture_device.h" ++ ++namespace media { ++ ++namespace { ++ ++class CAPTURE_EXPORT VideoCaptureDeviceHaiku : public VideoCaptureDevice { ++ public: ++ explicit VideoCaptureDeviceHaiku(const media::VideoCaptureDeviceDescriptor& device_descriptor); ++ ~VideoCaptureDeviceHaiku() override; ++ ++ VideoCaptureDeviceHaiku(const VideoCaptureDeviceHaiku&) = delete; ++ VideoCaptureDeviceHaiku& operator=(const VideoCaptureDeviceHaiku&) = ++ delete; ++ ++ // VideoCaptureDevice implementation. ++ void AllocateAndStart(const VideoCaptureParams& params, ++ std::unique_ptr client) final; ++ void StopAndDeAllocate() final; ++ ++ private: ++ ++ unsigned char buff[640*480*4]; ++ ++ void RunFrameProductionLoop() { ++ int n=0; ++ while (!should_quit_frame_production_loop_.IsSet()) { ++ ++ if (client_) { ++ printf("RunFrameProductionLoop %d\n", n++); ++ ++ unsigned char *ptr = buff; ++ for(int y=0;y<480;y++) ++ for(int x=0;x<640;x++) { ++ *ptr++ = (x*y) % 256; ++ *ptr++ = (x+y) % 256; ++ *ptr++ = (x*y*n) % 256; ++ *ptr++ = 0; ++ } ++ ++ const base::TimeDelta capture_time = base::TimeDelta::FromMicroseconds(1000); ++ ++ const base::TimeTicks current_time = base::TimeTicks::Now(); ++ ++ media::VideoCaptureFormat capture_format_; ++ ++ capture_format_.frame_size.SetSize(640, 480); ++ capture_format_.frame_rate = 8.0f; ++ capture_format_.pixel_format = media::PIXEL_FORMAT_ARGB; ++ ++ client_->OnIncomingCapturedData( ++ buff, 640*480*4, capture_format_, gfx::ColorSpace(), 0, ++ false, current_time, capture_time); ++ } ++ base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(1000/8)); ++ } ++ } ++ ++ base::TimeTicks start_time_; ++ ++ bool started_ = false; ++ ++ size_t frames_received_ = 0; ++ ++ //std::unique_ptr client_; ++ ++ const media::VideoCaptureDeviceDescriptor device_descriptor_; ++ std::unique_ptr client_; ++ ++ BMediaRoster *fMediaRoster; ++ VideoConsumer *fVideoConsumer; ++ BTimeSource* timeSource; ++ media_node fProducerNode; ++ media_node fConsumerNode; ++ media_input videoInput; ++ media_output videoOutput; ++ ++ base::Thread frame_thread_; ++ base::AtomicFlag should_quit_frame_production_loop_; ++ ++ THREAD_CHECKER(thread_checker_); ++}; ++ ++} ++ ++} // namespace media ++ ++#endif // MEDIA_CAPTURE_VIDEO_HAIKU_VIDEO_CAPTURE_DEVICE_HAIKU_H_ +diff --git a/src/3rdparty/chromium/media/capture/video/video_capture_device_descriptor.cc b/src/3rdparty/chromium/media/capture/video/video_capture_device_descriptor.cc +index e044b4e..d5a0700 100644 +--- a/src/3rdparty/chromium/media/capture/video/video_capture_device_descriptor.cc ++++ b/src/3rdparty/chromium/media/capture/video/video_capture_device_descriptor.cc +@@ -95,6 +95,8 @@ const char* VideoCaptureDeviceDescriptor::GetCaptureApiTypeString() const { + return "Camera API2 Limited"; + case VideoCaptureApi::FUCHSIA_CAMERA3: + return "fuchsia.camera3 API"; ++ case VideoCaptureApi::HAIKU_MEDIAKIT: ++ return "Haiku MediaKit"; + case VideoCaptureApi::VIRTUAL_DEVICE: + return "Virtual Device"; + case VideoCaptureApi::UNKNOWN: +diff --git a/src/3rdparty/chromium/media/capture/video/video_capture_device_descriptor.h b/src/3rdparty/chromium/media/capture/video/video_capture_device_descriptor.h +index f73d893..1548d95 100644 +--- a/src/3rdparty/chromium/media/capture/video/video_capture_device_descriptor.h ++++ b/src/3rdparty/chromium/media/capture/video/video_capture_device_descriptor.h +@@ -28,6 +28,7 @@ enum class VideoCaptureApi { + ANDROID_API2_FULL, + ANDROID_API2_LIMITED, + FUCHSIA_CAMERA3, ++ HAIKU_MEDIAKIT, + VIRTUAL_DEVICE, + UNKNOWN + }; +diff --git a/src/3rdparty/chromium/media/filters/audio_file_reader.cc b/src/3rdparty/chromium/media/filters/audio_file_reader.cc +index cb81d92..bd73908 100644 +--- a/src/3rdparty/chromium/media/filters/audio_file_reader.cc ++++ b/src/3rdparty/chromium/media/filters/audio_file_reader.cc +@@ -85,7 +85,7 @@ bool AudioFileReader::OpenDemuxer() { + } + + bool AudioFileReader::OpenDecoder() { +- AVCodec* codec = avcodec_find_decoder(codec_context_->codec_id); ++ const AVCodec* codec = avcodec_find_decoder(codec_context_->codec_id); + if (codec) { + // MP3 decodes to S16P which we don't support, tell it to use S16 instead. + if (codec_context_->sample_fmt == AV_SAMPLE_FMT_S16P) +diff --git a/src/3rdparty/chromium/net/BUILD.gn b/src/3rdparty/chromium/net/BUILD.gn +index c399590..b01504d 100644 +--- a/src/3rdparty/chromium/net/BUILD.gn ++++ b/src/3rdparty/chromium/net/BUILD.gn +@@ -99,7 +99,7 @@ net_configs = [ + "//build/config/compiler:wexit_time_destructors", + ] + +-if (is_linux || is_chromeos) { ++if ((is_linux && !is_haiku) || is_chromeos) { + net_configs += [ "//build/config/linux:libresolv" ] + } + +@@ -1261,6 +1261,16 @@ component("net") { + ] + } + ++ if (is_haiku) { ++ sources -= [ ++ "base/address_tracker_linux.cc", ++ "base/address_tracker_linux.h", ++ "base/network_change_notifier_linux.cc", ++ "base/network_change_notifier_linux.h", ++ "base/network_interfaces_linux.cc", ++ ] ++ } ++ + if (is_mac) { + sources += [ + "base/network_notification_thread_mac.cc", +@@ -1397,7 +1407,7 @@ component("net") { + } + } + +- if (is_android || is_chromeos) { ++ if (is_android || is_chromeos || is_haiku) { + sources += [ + "base/network_change_notifier_posix.cc", + "base/network_change_notifier_posix.h", +@@ -1430,7 +1440,7 @@ component("net") { + } + + # Use getifaddrs() on POSIX platforms, except Linux. +- if (is_posix && !is_linux && !is_chromeos) { ++ if (is_posix && (!is_linux || is_haiku) && !is_chromeos) { + sources += [ + "base/network_interfaces_getifaddrs.cc", + "base/network_interfaces_getifaddrs.h", +diff --git a/src/3rdparty/chromium/net/base/address_tracker_linux.cc b/src/3rdparty/chromium/net/base/address_tracker_linux.cc +index 2daccb4..8796a77 100644 +--- a/src/3rdparty/chromium/net/base/address_tracker_linux.cc ++++ b/src/3rdparty/chromium/net/base/address_tracker_linux.cc +@@ -5,7 +5,9 @@ + #include "net/base/address_tracker_linux.h" + + #include ++#ifndef OS_HAIKU + #include ++#endif + #include + #include + #include +@@ -190,6 +192,7 @@ void AddressTrackerLinux::Init() { + DCHECK_LT(base::android::BuildInfo::GetInstance()->sdk_int(), + base::android::SDK_VERSION_P); + #endif ++#if !defined(OS_HAIKU) + netlink_fd_.reset(socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE)); + if (!netlink_fd_.is_valid()) { + PLOG(ERROR) << "Could not create NETLINK socket"; +@@ -274,6 +277,7 @@ void AddressTrackerLinux::Init() { + base::BindRepeating(&AddressTrackerLinux::OnFileCanReadWithoutBlocking, + base::Unretained(this))); + } ++#endif + } + + void AddressTrackerLinux::AbortAndForceOnline() { +@@ -361,6 +365,7 @@ void AddressTrackerLinux::HandleMessage(const char* buffer, + bool* address_changed, + bool* link_changed, + bool* tunnel_changed) { ++#if !defined(OS_HAIKU) + DCHECK(buffer); + // Note that NLMSG_NEXT decrements |length| to reflect the number of bytes + // remaining in |buffer|. +@@ -473,6 +478,10 @@ void AddressTrackerLinux::HandleMessage(const char* buffer, + break; + } + } ++#else ++ NOTIMPLEMENTED(); ++ AbortAndForceOnline(); ++#endif + } + + void AddressTrackerLinux::OnFileCanReadWithoutBlocking() { +@@ -500,31 +509,7 @@ bool AddressTrackerLinux::IsTunnelInterfaceName(const char* name) { + } + + void AddressTrackerLinux::UpdateCurrentConnectionType() { +- AddressTrackerLinux::AddressMap address_map = GetAddressMap(); +- std::unordered_set online_links = GetOnlineLinks(); +- +- // Strip out tunnel interfaces from online_links +- for (auto it = online_links.cbegin(); it != online_links.cend();) { +- if (IsTunnelInterface(*it)) { +- it = online_links.erase(it); +- } else { +- ++it; +- } +- } +- +- NetworkInterfaceList networks; +- NetworkChangeNotifier::ConnectionType type = +- NetworkChangeNotifier::CONNECTION_NONE; +- if (GetNetworkListImpl(&networks, 0, online_links, address_map, +- get_interface_name_)) { +- type = NetworkChangeNotifier::ConnectionTypeFromInterfaceList(networks); +- } else { +- type = online_links.empty() ? NetworkChangeNotifier::CONNECTION_NONE +- : NetworkChangeNotifier::CONNECTION_UNKNOWN; +- } +- +- AddressTrackerAutoLock lock(*this, connection_type_lock_); +- current_connection_type_ = type; ++ NOTIMPLEMENTED(); + } + + int AddressTrackerLinux::GetThreadsWaitingForConnectionTypeInitForTesting() { +diff --git a/src/3rdparty/chromium/net/base/address_tracker_linux.h b/src/3rdparty/chromium/net/base/address_tracker_linux.h +index a18450d..45cf157 100644 +--- a/src/3rdparty/chromium/net/base/address_tracker_linux.h ++++ b/src/3rdparty/chromium/net/base/address_tracker_linux.h +@@ -7,9 +7,6 @@ + + #include // Needed to include netlink. + // Mask superfluous definition of |struct net|. This is fixed in Linux 2.6.38. +-#define net net_kernel +-#include +-#undef net + #include + + #include +diff --git a/src/3rdparty/chromium/net/base/net_errors_posix.cc b/src/3rdparty/chromium/net/base/net_errors_posix.cc +index 2e4fd24..21d4211 100644 +--- a/src/3rdparty/chromium/net/base/net_errors_posix.cc ++++ b/src/3rdparty/chromium/net/base/net_errors_posix.cc +@@ -107,8 +107,10 @@ Error MapSystemError(logging::SystemErrorCode os_error) { + return ERR_ACCESS_DENIED; + case ETXTBSY: // Text file busy. + return ERR_ACCESS_DENIED; ++#if !defined(OS_HAIKU) + case EUSERS: // Too many users. + return ERR_INSUFFICIENT_RESOURCES; ++#endif + case EMFILE: // Too many open files. + return ERR_INSUFFICIENT_RESOURCES; + case ENOPROTOOPT: // Protocol option not supported. +diff --git a/src/3rdparty/chromium/net/base/network_interfaces_getifaddrs.cc b/src/3rdparty/chromium/net/base/network_interfaces_getifaddrs.cc +index a848dec..10a3925 100644 +--- a/src/3rdparty/chromium/net/base/network_interfaces_getifaddrs.cc ++++ b/src/3rdparty/chromium/net/base/network_interfaces_getifaddrs.cc +@@ -30,6 +30,10 @@ + #include + #endif // !OS_IOS + ++#if defined(OS_HAIKU) ++#define IFF_RUNNING IFF_LINK ++#endif ++ + #if defined(OS_ANDROID) + #include "base/android/build_info.h" + // Declare getifaddrs() and freeifaddrs() weakly as they're only available +diff --git a/src/3rdparty/chromium/net/cert/cert_verifier.cc b/src/3rdparty/chromium/net/cert/cert_verifier.cc +index 6504721..e151f7e 100644 +--- a/src/3rdparty/chromium/net/cert/cert_verifier.cc ++++ b/src/3rdparty/chromium/net/cert/cert_verifier.cc +@@ -87,7 +87,7 @@ std::unique_ptr CertVerifier::CreateDefaultWithoutCaching( + return std::unique_ptr(); + #else + scoped_refptr verify_proc; +-#if defined(OS_FUCHSIA) || defined(OS_LINUX) || defined(OS_CHROMEOS) ++#if defined(OS_FUCHSIA) || defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU) + verify_proc = + CertVerifyProc::CreateBuiltinVerifyProc(std::move(cert_net_fetcher)); + #elif BUILDFLAG(BUILTIN_CERT_VERIFIER_FEATURE_SUPPORTED) +diff --git a/src/3rdparty/chromium/net/cert/cert_verify_proc.cc b/src/3rdparty/chromium/net/cert/cert_verify_proc.cc +index 10cd48b..7350662 100644 +--- a/src/3rdparty/chromium/net/cert/cert_verify_proc.cc ++++ b/src/3rdparty/chromium/net/cert/cert_verify_proc.cc +@@ -493,7 +493,7 @@ base::Value CertVerifyParams(X509Certificate* cert, + + } // namespace + +-#if !(defined(OS_FUCHSIA) || defined(OS_LINUX) || defined(OS_CHROMEOS)) ++#if !(defined(OS_FUCHSIA) || defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU)) + // static + scoped_refptr CertVerifyProc::CreateSystemVerifyProc( + scoped_refptr cert_net_fetcher) { +diff --git a/src/3rdparty/chromium/net/cert/test_root_certs.h b/src/3rdparty/chromium/net/cert/test_root_certs.h +index 836f29f..c475e76 100644 +--- a/src/3rdparty/chromium/net/cert/test_root_certs.h ++++ b/src/3rdparty/chromium/net/cert/test_root_certs.h +@@ -75,7 +75,7 @@ class NET_EXPORT TestRootCerts { + // engine is appropriate. The caller is responsible for freeing the + // returned HCERTCHAINENGINE. + HCERTCHAINENGINE GetChainEngine() const; +-#elif defined(OS_FUCHSIA) || defined(OS_LINUX) || defined(OS_CHROMEOS) ++#elif defined(OS_FUCHSIA) || defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU) + TrustStore* test_trust_store() { return &test_trust_store_; } + #endif + +@@ -93,12 +93,12 @@ class NET_EXPORT TestRootCerts { + #elif defined(OS_APPLE) + base::ScopedCFTypeRef temporary_roots_; + TrustStoreInMemory test_trust_store_; +-#elif defined(OS_FUCHSIA) || defined(OS_LINUX) || defined(OS_CHROMEOS) ++#elif defined(OS_FUCHSIA) || defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU) + TrustStoreInMemory test_trust_store_; + #endif + + #if defined(OS_WIN) || defined(OS_ANDROID) || defined(OS_FUCHSIA) || \ +- defined(OS_LINUX) || defined(OS_CHROMEOS) ++ defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU) + // True if there are no temporarily trusted root certificates. + bool empty_ = true; + #endif +diff --git a/src/3rdparty/chromium/net/proxy_resolution/proxy_config_service_linux.cc b/src/3rdparty/chromium/net/proxy_resolution/proxy_config_service_linux.cc +index c11685f..6990a4c 100644 +--- a/src/3rdparty/chromium/net/proxy_resolution/proxy_config_service_linux.cc ++++ b/src/3rdparty/chromium/net/proxy_resolution/proxy_config_service_linux.cc +@@ -6,7 +6,9 @@ + + #include + #include ++#if !defined(OS_HAIKU) + #include ++#endif + #include + + #include +@@ -511,6 +513,7 @@ int StringToIntOrDefault(base::StringPiece value, int default_value) { + return default_value; + } + ++#if !defined(OS_HAIKU) + // This is the KDE version that reads kioslaverc and simulates gsettings. + // Doing this allows the main Delegate code, as well as the unit tests + // for it, to stay the same - and the settings map fairly well besides. +@@ -1001,6 +1004,7 @@ class SettingGetterImplKDE : public ProxyConfigServiceLinux::SettingGetter { + + DISALLOW_COPY_AND_ASSIGN(SettingGetterImplKDE); + }; ++#endif + + } // namespace + +@@ -1215,7 +1219,9 @@ ProxyConfigServiceLinux::Delegate::Delegate( + case base::nix::DESKTOP_ENVIRONMENT_KDE3: + case base::nix::DESKTOP_ENVIRONMENT_KDE4: + case base::nix::DESKTOP_ENVIRONMENT_KDE5: ++#if !defined(OS_HAIKU) + setting_getter_.reset(new SettingGetterImplKDE(env_var_getter_.get())); ++#endif + break; + case base::nix::DESKTOP_ENVIRONMENT_XFCE: + case base::nix::DESKTOP_ENVIRONMENT_OTHER: +diff --git a/src/3rdparty/chromium/net/socket/udp_socket_posix.cc b/src/3rdparty/chromium/net/socket/udp_socket_posix.cc +index 7126556..046a6ad 100644 +--- a/src/3rdparty/chromium/net/socket/udp_socket_posix.cc ++++ b/src/3rdparty/chromium/net/socket/udp_socket_posix.cc +@@ -51,6 +51,12 @@ + #include "base/strings/utf_string_conversions.h" + #endif // defined(OS_ANDROID) + ++#if defined(OS_HAIKU) ++#include ++#define IPV6_TCLASS 61 ++#define IP_DEFAULT_MULTICAST_TTL 1 ++#endif ++ + #if defined(OS_MAC) + // This was needed to debug crbug.com/640281. + // TODO(zhongyi): Remove once the bug is resolved. +@@ -70,6 +76,37 @@ const int kActivityMonitorMinimumSamplesForThroughputEstimate = 2; + const base::TimeDelta kActivityMonitorMsThreshold = + base::TimeDelta::FromMilliseconds(100); + ++#if defined(OS_HAIKU) ++// When enabling multicast using setsockopt(IP_MULTICAST_IF) MacOS ++// requires passing IPv4 address instead of interface index. This function ++// resolves IPv4 address by interface index. The |address| is returned in ++// network order. ++int GetIPv4AddressFromIndex(int socket, uint32_t index, uint32_t* address) { ++ if (!index) { ++ *address = htonl(INADDR_ANY); ++ return OK; ++ } ++ ++ sockaddr_in* result = nullptr; ++ ++ ifreq ifr; ++ ifr.ifr_addr.sa_family = AF_INET; ++ if (!if_indextoname(index, ifr.ifr_name)) ++ return MapSystemError(errno); ++ int rv = ioctl(socket, SIOCGIFADDR, &ifr); ++ if (rv == -1) ++ return MapSystemError(errno); ++ result = reinterpret_cast(&ifr.ifr_addr); ++ ++ if (!result) ++ return ERR_ADDRESS_INVALID; ++ ++ *address = result->sin_addr.s_addr; ++ return OK; ++} ++ ++#endif // defined(OS_HAIKU) ++ + #if defined(OS_MAC) + + // On OSX the file descriptor is guarded to detect the cause of +@@ -622,13 +659,13 @@ int UDPSocketPosix::SetDoNotFragment() { + } + + void UDPSocketPosix::SetMsgConfirm(bool confirm) { +-#if !defined(OS_APPLE) ++#if !defined(OS_APPLE) && !defined(OS_HAIKU) + if (confirm) { + sendto_flags_ |= MSG_CONFIRM; + } else { + sendto_flags_ &= ~MSG_CONFIRM; + } +-#endif // !defined(OS_APPLE) ++#endif // !defined(OS_APPLE) && !defined(OS_HAIKU) + } + + int UDPSocketPosix::AllowAddressReuse() { +@@ -913,9 +950,17 @@ int UDPSocketPosix::SetMulticastOptions() { + if (multicast_interface_ != 0) { + switch (addr_family_) { + case AF_INET: { ++#if defined(OS_HAIKU) ++ ip_mreq mreq = {}; ++ int error = GetIPv4AddressFromIndex(socket_, multicast_interface_, ++ &mreq.imr_interface.s_addr); ++ if (error != OK) ++ return error; ++#else // defined(OS_HAIKU) + ip_mreqn mreq = {}; + mreq.imr_ifindex = multicast_interface_; + mreq.imr_address.s_addr = htonl(INADDR_ANY); ++#endif // defined(OS_HAIKU) + int rv = setsockopt(socket_, IPPROTO_IP, IP_MULTICAST_IF, + reinterpret_cast(&mreq), sizeof(mreq)); + if (rv) +@@ -978,9 +1023,18 @@ int UDPSocketPosix::JoinGroup(const IPAddress& group_address) const { + case IPAddress::kIPv4AddressSize: { + if (addr_family_ != AF_INET) + return ERR_ADDRESS_INVALID; ++ ++#if defined(OS_HAIKU) ++ ip_mreq mreq = {}; ++ int error = GetIPv4AddressFromIndex(socket_, multicast_interface_, ++ &mreq.imr_interface.s_addr); ++ if (error != OK) ++ return error; ++#else + ip_mreqn mreq = {}; + mreq.imr_ifindex = multicast_interface_; + mreq.imr_address.s_addr = htonl(INADDR_ANY); ++#endif // !defined(OS_HAIKU) + memcpy(&mreq.imr_multiaddr, group_address.bytes().data(), + IPAddress::kIPv4AddressSize); + int rv = setsockopt(socket_, IPPROTO_IP, IP_ADD_MEMBERSHIP, +@@ -1018,9 +1072,18 @@ int UDPSocketPosix::LeaveGroup(const IPAddress& group_address) const { + case IPAddress::kIPv4AddressSize: { + if (addr_family_ != AF_INET) + return ERR_ADDRESS_INVALID; ++ ++#if defined(OS_HAIKU) ++ ip_mreq mreq = {}; ++ int error = GetIPv4AddressFromIndex(socket_, multicast_interface_, ++ &mreq.imr_interface.s_addr); ++ if (error != OK) ++ return error; ++#else + ip_mreqn mreq = {}; + mreq.imr_ifindex = multicast_interface_; + mreq.imr_address.s_addr = INADDR_ANY; ++#endif + memcpy(&mreq.imr_multiaddr, group_address.bytes().data(), + IPAddress::kIPv4AddressSize); + int rv = setsockopt(socket_, IPPROTO_IP, IP_DROP_MEMBERSHIP, +diff --git a/src/3rdparty/chromium/net/socket/unix_domain_server_socket_posix.cc b/src/3rdparty/chromium/net/socket/unix_domain_server_socket_posix.cc +index 8b2e29b..353f2d1 100644 +--- a/src/3rdparty/chromium/net/socket/unix_domain_server_socket_posix.cc ++++ b/src/3rdparty/chromium/net/socket/unix_domain_server_socket_posix.cc +@@ -34,7 +34,7 @@ UnixDomainServerSocket::~UnixDomainServerSocket() = default; + bool UnixDomainServerSocket::GetPeerCredentials(SocketDescriptor socket, + Credentials* credentials) { + #if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || \ +- defined(OS_FUCHSIA) ++ defined(OS_FUCHSIA) || defined(OS_HAIKU) + struct ucred user_cred; + socklen_t len = sizeof(user_cred); + if (getsockopt(socket, SOL_SOCKET, SO_PEERCRED, &user_cred, &len) < 0) +diff --git a/src/3rdparty/chromium/net/socket/unix_domain_server_socket_posix.h b/src/3rdparty/chromium/net/socket/unix_domain_server_socket_posix.h +index 9da6bc0..340b861 100644 +--- a/src/3rdparty/chromium/net/socket/unix_domain_server_socket_posix.h ++++ b/src/3rdparty/chromium/net/socket/unix_domain_server_socket_posix.h +@@ -30,7 +30,7 @@ class NET_EXPORT UnixDomainServerSocket : public ServerSocket { + // Credentials of a peer process connected to the socket. + struct NET_EXPORT Credentials { + #if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || \ +- defined(OS_FUCHSIA) ++ defined(OS_FUCHSIA) || defined(OS_HAIKU) + // Linux and Fuchsia provide more information about the connected peer + // than Windows/OS X. It's useful for permission-based authorization on + // Android. +diff --git a/src/3rdparty/chromium/net/tools/cert_verify_tool/cert_verify_tool.cc b/src/3rdparty/chromium/net/tools/cert_verify_tool/cert_verify_tool.cc +index 88f5ee4..c0d5f71 100644 +--- a/src/3rdparty/chromium/net/tools/cert_verify_tool/cert_verify_tool.cc ++++ b/src/3rdparty/chromium/net/tools/cert_verify_tool/cert_verify_tool.cc +@@ -29,7 +29,7 @@ + #include "net/url_request/url_request_context_builder.h" + #include "net/url_request/url_request_context_getter.h" + +-#if defined(OS_LINUX) || defined(OS_CHROMEOS) ++#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU) + #include "net/proxy_resolution/proxy_config.h" + #include "net/proxy_resolution/proxy_config_service_fixed.h" + #endif +@@ -46,7 +46,7 @@ void SetUpOnNetworkThread( + base::WaitableEvent* initialization_complete_event) { + net::URLRequestContextBuilder url_request_context_builder; + url_request_context_builder.set_user_agent(GetUserAgent()); +-#if defined(OS_LINUX) || defined(OS_CHROMEOS) ++#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU) + // On Linux, use a fixed ProxyConfigService, since the default one + // depends on glib. + // +diff --git a/src/3rdparty/chromium/sandbox/features.gni b/src/3rdparty/chromium/sandbox/features.gni +index db30ae6..68985ed 100644 +--- a/src/3rdparty/chromium/sandbox/features.gni ++++ b/src/3rdparty/chromium/sandbox/features.gni +@@ -8,7 +8,7 @@ import("//build/config/nacl/config.gni") + # currently. + # Do not disable seccomp_bpf anywhere without talking to + # security@chromium.org! +-use_seccomp_bpf = (is_linux || is_chromeos || is_android) && ++use_seccomp_bpf = (is_linux || is_chromeos || is_android) && !is_haiku && + (current_cpu == "x86" || current_cpu == "x64" || + current_cpu == "arm" || current_cpu == "arm64" || + current_cpu == "mipsel" || current_cpu == "mips64el") +diff --git a/src/3rdparty/chromium/sandbox/linux/BUILD.gn b/src/3rdparty/chromium/sandbox/linux/BUILD.gn +index 1d080c0..2015d06 100644 +--- a/src/3rdparty/chromium/sandbox/linux/BUILD.gn ++++ b/src/3rdparty/chromium/sandbox/linux/BUILD.gn +@@ -19,12 +19,12 @@ import("//build/config/deprecated_default_sources_assignment_filter.gni") + set_sources_assignment_filter(deprecated_default_sources_assignment_filter) + + declare_args() { +- compile_suid_client = is_linux || is_chromeos ++ compile_suid_client = (is_linux && !is_haiku) || is_chromeos + +- compile_credentials = is_linux || is_chromeos ++ compile_credentials = (is_linux && !is_haiku) || is_chromeos + + # On Android, use plain GTest. +- use_base_test_suite = is_linux || is_chromeos ++ use_base_test_suite = (is_linux && !is_haiku) || is_chromeos + } + + if (is_nacl_nonsfi) { +@@ -386,14 +386,17 @@ component("sandbox_services") { + public_deps += [ ":sandbox_services_headers" ] + } + +- if (is_nacl_nonsfi) { +- cflags = [ "-fgnu-inline-asm" ] +- ++ if (is_nacl_nonsfi || is_haiku) { ++ if (is_nacl_nonsfi) { ++ cflags = [ "-fgnu-inline-asm" ] ++ } + sources -= [ + "services/init_process_reaper.cc", + "services/init_process_reaper.h", + "services/scoped_process.cc", + "services/scoped_process.h", ++ "services/syscall_wrappers.cc", ++ "services/syscall_wrappers.h", + "services/yama.cc", + "services/yama.h", + "syscall_broker/broker_channel.cc", +@@ -417,6 +420,10 @@ component("sandbox_services") { + "syscall_broker/syscall_dispatcher.cc", + "syscall_broker/syscall_dispatcher.h", + ] ++ sources += [ ++ "services/libc_interceptor.cc", ++ "services/libc_interceptor.h", ++ ] + } else if (!is_android) { + sources += [ + "services/libc_interceptor.cc", +diff --git a/src/3rdparty/chromium/sandbox/linux/services/libc_interceptor.cc b/src/3rdparty/chromium/sandbox/linux/services/libc_interceptor.cc +index 7c73b7e..91f79f5 100644 +--- a/src/3rdparty/chromium/sandbox/linux/services/libc_interceptor.cc ++++ b/src/3rdparty/chromium/sandbox/linux/services/libc_interceptor.cc +@@ -11,7 +11,9 @@ + #include + #include + #include ++#if !defined(OS_HAIKU) + #include ++#endif + #include + #include + #include +@@ -93,7 +95,7 @@ bool ReadTimeStruct(base::PickleIterator* iter, + } else { + base::AutoLock lock(g_timezones_lock.Get()); + auto ret_pair = g_timezones.Get().insert(timezone); +- output->tm_zone = ret_pair.first->c_str(); ++ output->tm_zone = (char*)ret_pair.first->c_str(); + } + + return true; +diff --git a/src/3rdparty/chromium/sandbox/policy/BUILD.gn b/src/3rdparty/chromium/sandbox/policy/BUILD.gn +index ccb1bd1..db1fa75 100644 +--- a/src/3rdparty/chromium/sandbox/policy/BUILD.gn ++++ b/src/3rdparty/chromium/sandbox/policy/BUILD.gn +@@ -27,7 +27,7 @@ component("policy") { + "//sandbox:common", + ] + public_deps = [] +- if (is_linux || is_chromeos) { ++ if ((is_linux || is_chromeos) && !is_haiku) { + sources += [ + "linux/bpf_audio_policy_linux.cc", + "linux/bpf_audio_policy_linux.h", +diff --git a/src/3rdparty/chromium/sandbox/policy/switches.cc b/src/3rdparty/chromium/sandbox/policy/switches.cc +index 3afb876..2c8efbe 100644 +--- a/src/3rdparty/chromium/sandbox/policy/switches.cc ++++ b/src/3rdparty/chromium/sandbox/policy/switches.cc +@@ -81,7 +81,7 @@ const char kGpuSandboxFailuresFatal[] = "gpu-sandbox-failures-fatal"; + // Meant to be used as a browser-level switch for testing purposes only. + const char kNoSandbox[] = "no-sandbox"; + +-#if defined(OS_LINUX) || defined(OS_CHROMEOS) ++#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU) + // Instructs the zygote to launch without a sandbox. Processes forked from this + // type of zygote will apply their own custom sandboxes later. + const char kNoZygoteSandbox[] = "no-zygote-sandbox"; +diff --git a/src/3rdparty/chromium/sandbox/policy/switches.h b/src/3rdparty/chromium/sandbox/policy/switches.h +index e096e96..6d25e2c 100644 +--- a/src/3rdparty/chromium/sandbox/policy/switches.h ++++ b/src/3rdparty/chromium/sandbox/policy/switches.h +@@ -53,7 +53,7 @@ SANDBOX_POLICY_EXPORT extern const char kDisableSetuidSandbox[]; + SANDBOX_POLICY_EXPORT extern const char kGpuSandboxAllowSysVShm[]; + SANDBOX_POLICY_EXPORT extern const char kGpuSandboxFailuresFatal[]; + SANDBOX_POLICY_EXPORT extern const char kNoSandbox[]; +-#if defined(OS_LINUX) || defined(OS_CHROMEOS) ++#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU) + SANDBOX_POLICY_EXPORT extern const char kNoZygoteSandbox[]; + #endif + #if defined(OS_WIN) +diff --git a/src/3rdparty/chromium/services/audio/BUILD.gn b/src/3rdparty/chromium/services/audio/BUILD.gn +index 84b197a..865fca1 100644 +--- a/src/3rdparty/chromium/services/audio/BUILD.gn ++++ b/src/3rdparty/chromium/services/audio/BUILD.gn +@@ -73,7 +73,7 @@ source_set("audio") { + "//services/audio/public/mojom", + ] + +- if (is_linux || is_chromeos) { ++ if ((is_linux && !is_haiku) || is_chromeos) { + sources += [ + "audio_sandbox_hook_linux.cc", + "audio_sandbox_hook_linux.h", +diff --git a/src/3rdparty/chromium/services/device/geolocation/location_arbitrator.cc b/src/3rdparty/chromium/services/device/geolocation/location_arbitrator.cc +index 7da9b47..fd4d3ca 100644 +--- a/src/3rdparty/chromium/services/device/geolocation/location_arbitrator.cc ++++ b/src/3rdparty/chromium/services/device/geolocation/location_arbitrator.cc +@@ -159,7 +159,7 @@ LocationArbitrator::NewNetworkLocationProvider( + + std::unique_ptr + LocationArbitrator::NewSystemLocationProvider() { +-#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_FUCHSIA) ++#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_FUCHSIA) || defined(OS_HAIKU) + return nullptr; + #else + return device::NewSystemLocationProvider(); +diff --git a/src/3rdparty/chromium/services/device/usb/BUILD.gn b/src/3rdparty/chromium/services/device/usb/BUILD.gn +index f2d4524..50bb41c 100644 +--- a/src/3rdparty/chromium/services/device/usb/BUILD.gn ++++ b/src/3rdparty/chromium/services/device/usb/BUILD.gn +@@ -125,7 +125,7 @@ static_library("usb") { + deps += [ "//third_party/re2" ] + } + +- if (is_android || is_chromeos || is_linux) { ++ if ((is_android || is_chromeos || is_linux) && !is_haiku) { + sources += [ + "usb_device_handle_usbfs.cc", + "usb_device_handle_usbfs.h", +diff --git a/src/3rdparty/chromium/services/network/BUILD.gn b/src/3rdparty/chromium/services/network/BUILD.gn +index da00765..691c791 100644 +--- a/src/3rdparty/chromium/services/network/BUILD.gn ++++ b/src/3rdparty/chromium/services/network/BUILD.gn +@@ -268,6 +268,11 @@ jumbo_component("network_service") { + "//sandbox/policy", + ] + } ++ if (is_haiku) { ++ deps -= [ ++ "//sandbox/linux:sandbox_services", ++ ] ++ } + + if (is_android) { + deps += [ +diff --git a/src/3rdparty/chromium/services/network/network_context.cc b/src/3rdparty/chromium/services/network/network_context.cc +index 035ee94..7b57b5d 100644 +--- a/src/3rdparty/chromium/services/network/network_context.cc ++++ b/src/3rdparty/chromium/services/network/network_context.cc +@@ -1932,7 +1932,7 @@ URLRequestContextOwner NetworkContext::MakeURLRequestContext( + + net::CookieCryptoDelegate* crypto_delegate = nullptr; + if (params_->enable_encrypted_cookies) { +-#if defined(OS_LINUX) && !defined(OS_CHROMEOS) && !BUILDFLAG(IS_CHROMECAST) ++#if (defined(OS_LINUX) || defined(OS_HAIKU)) && !defined(OS_CHROMEOS) && !BUILDFLAG(IS_CHROMECAST) + DCHECK(network_service_->os_crypt_config_set()) + << "NetworkService::SetCryptConfig must be called before creating a " + "NetworkContext with encrypted cookies."; +diff --git a/src/3rdparty/chromium/services/network/network_sandbox_hook_linux.cc b/src/3rdparty/chromium/services/network/network_sandbox_hook_linux.cc +index feb61a7..0a1950f 100644 +--- a/src/3rdparty/chromium/services/network/network_sandbox_hook_linux.cc ++++ b/src/3rdparty/chromium/services/network/network_sandbox_hook_linux.cc +@@ -14,6 +14,7 @@ using sandbox::syscall_broker::MakeBrokerCommandSet; + namespace network { + + bool NetworkPreSandboxHook(sandbox::policy::SandboxLinux::Options options) { ++#if !defined(OS_HAIKU) + auto* instance = sandbox::policy::SandboxLinux::GetInstance(); + + // TODO(tsepez): remove universal permission under filesytem root. +@@ -32,6 +33,7 @@ bool NetworkPreSandboxHook(sandbox::policy::SandboxLinux::Options options) { + sandbox::policy::SandboxLinux::PreSandboxHook(), options); + + instance->EngageNamespaceSandboxIfPossible(); ++#endif + return true; + } + +diff --git a/src/3rdparty/chromium/services/network/network_service.cc b/src/3rdparty/chromium/services/network/network_service.cc +index ed5edbf..0eb3727 100644 +--- a/src/3rdparty/chromium/services/network/network_service.cc ++++ b/src/3rdparty/chromium/services/network/network_service.cc +@@ -70,7 +70,7 @@ + #include "third_party/boringssl/src/include/openssl/cpu.h" + #endif + +-#if defined(OS_LINUX) && !defined(OS_CHROMEOS) && !BUILDFLAG(IS_CHROMECAST) ++#if (defined(OS_LINUX) || defined(OS_HAIKU)) && !defined(OS_CHROMEOS) && !BUILDFLAG(IS_CHROMECAST) + #include "components/os_crypt/key_storage_config_linux.h" + #endif + +@@ -670,7 +670,7 @@ void NetworkService::OnCertDBChanged() { + net::CertDatabase::GetInstance()->NotifyObserversCertDBChanged(); + } + +-#if defined(OS_LINUX) && !defined(OS_CHROMEOS) ++#if defined(OS_LINUX) && !defined(OS_CHROMEOS) || defined(OS_HAIKU) + void NetworkService::SetCryptConfig(mojom::CryptConfigPtr crypt_config) { + #if !BUILDFLAG(IS_CHROMECAST) && !defined(TOOLKIT_QT) + DCHECK(!os_crypt_config_set_); +diff --git a/src/3rdparty/chromium/services/network/network_service.h b/src/3rdparty/chromium/services/network/network_service.h +index 21b8da7..3f92e23 100644 +--- a/src/3rdparty/chromium/services/network/network_service.h ++++ b/src/3rdparty/chromium/services/network/network_service.h +@@ -196,7 +196,7 @@ class COMPONENT_EXPORT(NETWORK_SERVICE) NetworkService + base::span config, + mojom::NetworkService::UpdateLegacyTLSConfigCallback callback) override; + void OnCertDBChanged() override; +-#if defined(OS_LINUX) && !defined(OS_CHROMEOS) ++#if defined(OS_LINUX) && !defined(OS_CHROMEOS) || defined(OS_HAIKU) + void SetCryptConfig(mojom::CryptConfigPtr crypt_config) override; + #endif + #if defined(OS_WIN) || defined(OS_MAC) +diff --git a/src/3rdparty/chromium/services/resource_coordinator/public/cpp/memory_instrumentation/os_metrics.h b/src/3rdparty/chromium/services/resource_coordinator/public/cpp/memory_instrumentation/os_metrics.h +index 1fdd28f..2f2b0fa 100644 +--- a/src/3rdparty/chromium/services/resource_coordinator/public/cpp/memory_instrumentation/os_metrics.h ++++ b/src/3rdparty/chromium/services/resource_coordinator/public/cpp/memory_instrumentation/os_metrics.h +@@ -45,9 +45,9 @@ class COMPONENT_EXPORT( + mojom::RawOSMemDump*); + static std::vector GetProcessMemoryMaps(base::ProcessId); + +-#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) ++#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || defined(OS_HAIKU) + static void SetProcSmapsForTesting(FILE*); +-#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) ++#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || defined(OS_HAIKU) + + private: + FRIEND_TEST_ALL_PREFIXES(OSMetricsTest, ParseProcSmaps); +@@ -61,7 +61,7 @@ class COMPONENT_EXPORT( + static std::vector GetProcessModules(base::ProcessId); + #endif + +-#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) ++#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || defined(OS_HAIKU) + // Provides information on the dump state of resident pages. These values are + // written to logs. New enum values can be added, but existing enums must + // never be renumbered or deleted and reused. +@@ -96,7 +96,7 @@ class COMPONENT_EXPORT( + // TODO(chiniforooshan): move to /base/process/process_metrics_linux.cc after + // making sure that peak RSS is useful. + static size_t GetPeakResidentSetSize(base::ProcessId pid); +-#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) ++#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || defined(OS_HAIKU) + }; + + } // namespace memory_instrumentation +diff --git a/src/3rdparty/chromium/services/resource_coordinator/public/cpp/memory_instrumentation/os_metrics_linux.cc b/src/3rdparty/chromium/services/resource_coordinator/public/cpp/memory_instrumentation/os_metrics_linux.cc +index 9c329cb..e598c3d 100644 +--- a/src/3rdparty/chromium/services/resource_coordinator/public/cpp/memory_instrumentation/os_metrics_linux.cc ++++ b/src/3rdparty/chromium/services/resource_coordinator/public/cpp/memory_instrumentation/os_metrics_linux.cc +@@ -5,7 +5,6 @@ + #include + #include + #include +-#include + + #include + +@@ -27,8 +26,14 @@ + #include "build/build_config.h" + #include "services/resource_coordinator/public/cpp/memory_instrumentation/os_metrics.h" + ++#if !defined(OS_HAIKU) ++#include ++#endif ++ + // Symbol with virtual address of the start of ELF header of the current binary. ++#if !defined(OS_HAIKU) + extern char __ehdr_start; ++#endif + + namespace memory_instrumentation { + +@@ -91,6 +96,7 @@ struct ModuleData { + + ModuleData GetMainModuleData() { + ModuleData module_data; ++#if !defined(OS_HAIKU) + Dl_info dl_info; + if (dladdr(&__ehdr_start, &dl_info)) { + base::debug::ElfBuildIdBuffer build_id; +@@ -101,6 +107,7 @@ ModuleData GetMainModuleData() { + module_data.build_id = std::string(build_id, build_id_length); + } + } ++#endif + return module_data; + } + +@@ -148,14 +155,14 @@ bool ParseSmapsHeader(const char* header_line, + // Build ID is needed to symbolize heap profiles, and is generated only on + // official builds. Build ID is only added for the current library (chrome) + // since it is racy to read other libraries which can be unmapped any time. +-#if defined(OFFICIAL_BUILD) ++#if defined(OFFICIAL_BUILD) && !defined(OS_HAIKU) + if (!region->mapped_file.empty() && + base::StartsWith(main_module_data.path, region->mapped_file, + base::CompareCase::SENSITIVE) && + !main_module_data.build_id.empty()) { + region->module_debugid = main_module_data.build_id; + } +-#endif // defined(OFFICIAL_BUILD) ++#endif // defined(OFFICIAL_BUILD) && !defined(OS_HAIKU) + + return res; + } +@@ -238,6 +245,7 @@ uint32_t ReadLinuxProcSmapsFile(FILE* smaps_file, + class ScopedProcessSetDumpable { + public: + ScopedProcessSetDumpable() { ++#if !defined(OS_HAIKU) + int result = prctl(PR_GET_DUMPABLE, 0, 0, 0, 0); + if (result < 0) { + PLOG(ERROR) << "prctl"; +@@ -253,15 +261,20 @@ class ScopedProcessSetDumpable { + AvoidPrctlOnDestruction(); + } + } ++#else ++ was_dumpable_ = true; ++#endif + } + + ScopedProcessSetDumpable(const ScopedProcessSetDumpable&) = delete; + ScopedProcessSetDumpable& operator=(const ScopedProcessSetDumpable&) = delete; + + ~ScopedProcessSetDumpable() { ++#if !defined(OS_HAIKU) + if (!was_dumpable_) { + PCHECK(prctl(PR_SET_DUMPABLE, 0, 0, 0, 0) == 0) << "prctl"; + } ++#endif + } + + private: +@@ -284,6 +297,7 @@ bool OSMetrics::FillOSMemoryDump(base::ProcessId pid, + mojom::RawOSMemDump* dump) { + // TODO(chiniforooshan): There is no need to read both /statm and /status + // files. Refactor to get everything from /status using ProcessMetric. ++#if !defined(OS_HAIKU) + auto statm_file = GetProcPidDir(pid).Append("statm"); + auto autoclose = base::ScopedFD(open(statm_file.value().c_str(), O_RDONLY)); + int statm_fd = autoclose.get(); +@@ -298,7 +312,10 @@ bool OSMetrics::FillOSMemoryDump(base::ProcessId pid, + + if (!success) + return false; +- ++#else ++ uint64_t resident_pages = 0; ++ uint64_t shared_pages = 0; ++#endif + auto process_metrics = CreateProcessMetrics(pid); + + const static size_t page_size = base::GetPageSize(); +@@ -366,6 +383,10 @@ OSMetrics::MappedAndResidentPagesDumpState OSMetrics::GetMappedAndResidentPages( + const size_t start_address, + const size_t end_address, + std::vector* accessed_pages_bitmap) { ++#if defined(OS_HAIKU) ++ NOTIMPLEMENTED(); ++ return OSMetrics::MappedAndResidentPagesDumpState::kFailure; ++#else + const char* kPagemap = "/proc/self/pagemap"; + + base::ScopedFILE pagemap_file(fopen(kPagemap, "r")); +@@ -413,6 +434,7 @@ OSMetrics::MappedAndResidentPagesDumpState OSMetrics::GetMappedAndResidentPages( + } + } + return OSMetrics::MappedAndResidentPagesDumpState::kSuccess; ++#endif + } + + // static +diff --git a/src/3rdparty/chromium/services/service_manager/public/cpp/service_executable/BUILD.gn b/src/3rdparty/chromium/services/service_manager/public/cpp/service_executable/BUILD.gn +index 4c1c496..85897a8 100644 +--- a/src/3rdparty/chromium/services/service_manager/public/cpp/service_executable/BUILD.gn ++++ b/src/3rdparty/chromium/services/service_manager/public/cpp/service_executable/BUILD.gn +@@ -29,6 +29,12 @@ source_set("support") { + "//sandbox/linux:seccomp_bpf", + ] + } ++ if (is_haiku) { ++ deps -= [ ++ "//sandbox/linux:seccomp_bpf", ++ ] ++ } ++ + } + + source_set("switches") { +diff --git a/src/3rdparty/chromium/skia/ext/platform_canvas.h b/src/3rdparty/chromium/skia/ext/platform_canvas.h +index dd6d354..1269913 100644 +--- a/src/3rdparty/chromium/skia/ext/platform_canvas.h ++++ b/src/3rdparty/chromium/skia/ext/platform_canvas.h +@@ -58,7 +58,7 @@ SK_API HDC GetNativeDrawingContext(SkCanvas* canvas); + + #elif defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || \ + defined(__sun) || defined(ANDROID) || defined(__APPLE__) || \ +- defined(__Fuchsia__) ++ defined(__Fuchsia__) || defined(__HAIKU__) + // Construct a canvas from the given memory region. The memory is not cleared + // first. @data must be, at least, @height * StrideForWidth(@width) bytes. + SK_API std::unique_ptr CreatePlatformCanvasWithPixels( +diff --git a/src/3rdparty/chromium/third_party/abseil-cpp/absl/base/config.h b/src/3rdparty/chromium/third_party/abseil-cpp/absl/base/config.h +index 84fa893..62c0989 100644 +--- a/src/3rdparty/chromium/third_party/abseil-cpp/absl/base/config.h ++++ b/src/3rdparty/chromium/third_party/abseil-cpp/absl/base/config.h +@@ -377,7 +377,7 @@ static_assert(ABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != 'h' || + #elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || \ + defined(__ros__) || defined(__native_client__) || defined(__asmjs__) || \ + defined(__wasm__) || defined(__Fuchsia__) || defined(__sun) || \ +- defined(__ASYLO__) ++ defined(__ASYLO__) || defined(__HAIKU__) + #define ABSL_HAVE_MMAP 1 + #endif + +diff --git a/src/3rdparty/chromium/third_party/angle/BUILD.gn b/src/3rdparty/chromium/third_party/angle/BUILD.gn +index fb57176..6079c31 100644 +--- a/src/3rdparty/chromium/third_party/angle/BUILD.gn ++++ b/src/3rdparty/chromium/third_party/angle/BUILD.gn +@@ -272,8 +272,8 @@ config("angle_no_cfi_unrelated_cast") { + + angle_source_set("angle_system_utils") { + sources = angle_system_utils_sources +- if (is_linux || is_chromeos) { +- libs = [ "dl" ] ++ if ((is_linux && !is_haiku) || is_chromeos) { ++ libs = [ "dl15" ] + } + } + +diff --git a/src/3rdparty/chromium/third_party/angle/src/libANGLE/renderer/driver_utils.cpp b/src/3rdparty/chromium/third_party/angle/src/libANGLE/renderer/driver_utils.cpp +index 5db5784..035e011 100644 +--- a/src/3rdparty/chromium/third_party/angle/src/libANGLE/renderer/driver_utils.cpp ++++ b/src/3rdparty/chromium/third_party/angle/src/libANGLE/renderer/driver_utils.cpp +@@ -17,7 +17,7 @@ + # include + #endif + +-#if defined(ANGLE_PLATFORM_LINUX) ++#if defined(ANGLE_PLATFORM_POSIX) + # include + #endif + +@@ -207,7 +207,7 @@ OSVersion GetMacOSVersion() + } + #endif + +-#if defined(ANGLE_PLATFORM_LINUX) ++#if defined(ANGLE_PLATFORM_POSIX) + bool ParseLinuxOSVersion(const char *version, int *major, int *minor, int *patch) + { + errno = 0; // reset global error flag. +@@ -219,6 +219,13 @@ bool ParseLinuxOSVersion(const char *version, int *major, int *minor, int *patch + } + + *minor = static_cast(strtol(next + 1, &next, 10)); ++#ifdef __HAIKU__ ++ if (next == nullptr || *next != '.' || errno != 0) ++ { ++ return false; ++ } ++ *patch = 0; ++#else + if (next == nullptr || *next != '.' || errno != 0) + { + return false; +@@ -229,7 +236,7 @@ bool ParseLinuxOSVersion(const char *version, int *major, int *minor, int *patch + { + return false; + } +- ++#endif + return true; + } + #endif +diff --git a/src/3rdparty/chromium/third_party/angle/src/libANGLE/renderer/driver_utils.h b/src/3rdparty/chromium/third_party/angle/src/libANGLE/renderer/driver_utils.h +index 054a8a9..8b0ce4d 100644 +--- a/src/3rdparty/chromium/third_party/angle/src/libANGLE/renderer/driver_utils.h ++++ b/src/3rdparty/chromium/third_party/angle/src/libANGLE/renderer/driver_utils.h +@@ -145,7 +145,7 @@ inline bool IsWindows() + + inline bool IsLinux() + { +-#if defined(ANGLE_PLATFORM_LINUX) ++#if defined(ANGLE_PLATFORM_POSIX) + return true; + #else + return false; +diff --git a/src/3rdparty/chromium/third_party/angle/src/libANGLE/renderer/vulkan/DisplayVk_api.h b/src/3rdparty/chromium/third_party/angle/src/libANGLE/renderer/vulkan/DisplayVk_api.h +index 21e36a7..7565f55 100644 +--- a/src/3rdparty/chromium/third_party/angle/src/libANGLE/renderer/vulkan/DisplayVk_api.h ++++ b/src/3rdparty/chromium/third_party/angle/src/libANGLE/renderer/vulkan/DisplayVk_api.h +@@ -19,10 +19,10 @@ bool IsVulkanWin32DisplayAvailable(); + DisplayImpl *CreateVulkanWin32Display(const egl::DisplayState &state); + #endif // defined(ANGLE_PLATFORM_WINDOWS) + +-#if defined(ANGLE_PLATFORM_LINUX) ++#if defined(ANGLE_PLATFORM_POSIX) + bool IsVulkanXcbDisplayAvailable(); + DisplayImpl *CreateVulkanXcbDisplay(const egl::DisplayState &state); +-#endif // defined(ANGLE_PLATFORM_LINUX) ++#endif // defined(ANGLE_PLATFORM_POSIX) + + #if defined(ANGLE_PLATFORM_ANDROID) + bool IsVulkanAndroidDisplayAvailable(); +diff --git a/src/3rdparty/chromium/third_party/angle/third_party/vulkan-loader/src/loader/loader.c b/src/3rdparty/chromium/third_party/angle/third_party/vulkan-loader/src/loader/loader.c +index 4d8865e..589c674 100644 +--- a/src/3rdparty/chromium/third_party/angle/third_party/vulkan-loader/src/loader/loader.c ++++ b/src/3rdparty/chromium/third_party/angle/third_party/vulkan-loader/src/loader/loader.c +@@ -250,7 +250,7 @@ void *loader_device_heap_realloc(const struct loader_device *device, void *pMemo + } + + // Environment variables +-#if defined(__linux__) || defined(__APPLE__) ++#if defined(__linux__) || defined(__APPLE__) || defined(__HAIKU__) + + static inline bool IsHighIntegrity() { + return geteuid() != getuid() || getegid() != getgid(); +diff --git a/src/3rdparty/chromium/third_party/angle/third_party/vulkan-loader/src/loader/vk_loader_platform.h b/src/3rdparty/chromium/third_party/angle/third_party/vulkan-loader/src/loader/vk_loader_platform.h +index e227bf0..a7a03d8 100644 +--- a/src/3rdparty/chromium/third_party/angle/third_party/vulkan-loader/src/loader/vk_loader_platform.h ++++ b/src/3rdparty/chromium/third_party/angle/third_party/vulkan-loader/src/loader/vk_loader_platform.h +@@ -31,7 +31,7 @@ + #include "vulkan/vk_platform.h" + #include "vulkan/vk_sdk_platform.h" + +-#if defined(__linux__) || defined(__APPLE__) ++#if defined(__linux__) || defined(__APPLE__) || defined (__HAIKU__) + /* Linux-specific common code: */ + + // Headers: +diff --git a/src/3rdparty/chromium/third_party/blink/renderer/BUILD.gn b/src/3rdparty/chromium/third_party/blink/renderer/BUILD.gn +index d36c9cd..00a1ed7 100644 +--- a/src/3rdparty/chromium/third_party/blink/renderer/BUILD.gn ++++ b/src/3rdparty/chromium/third_party/blink/renderer/BUILD.gn +@@ -55,8 +55,8 @@ config("inside_blink") { + "-Wconversion", + "-Wno-float-conversion", + "-Wno-sign-conversion", +- "-Wno-implicit-float-conversion", +- "-Wno-implicit-int-conversion", ++# "-Wno-implicit-float-conversion", ++# "-Wno-implicit-int-conversion", + ] + + if (!is_chromeos || default_toolchain != "//build/toolchain/cros:target") { +diff --git a/src/3rdparty/chromium/third_party/blink/renderer/bindings/core/v8/v8_script_runner.cc b/src/3rdparty/chromium/third_party/blink/renderer/bindings/core/v8/v8_script_runner.cc +index ec7bcf3..f5f761a 100644 +--- a/src/3rdparty/chromium/third_party/blink/renderer/bindings/core/v8/v8_script_runner.cc ++++ b/src/3rdparty/chromium/third_party/blink/renderer/bindings/core/v8/v8_script_runner.cc +@@ -438,9 +438,11 @@ ScriptEvaluationResult V8ScriptRunner::CompileAndRunScript( + .ToLocal(&script)) { + maybe_result = + V8ScriptRunner::RunCompiledScript(isolate, script, execution_context); ++#ifndef Q_OS_HAIKU + probe::ProduceCompilationCache(probe::ToCoreProbeSink(execution_context), + source, script); + V8CodeCache::ProduceCache(isolate, script, source, produce_cache_options); ++#endif + } + + // TODO(crbug/1114601): Investigate whether to check CanContinue() in other +diff --git a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/style_format.py b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/style_format.py +index dc3493c..f37b40a 100644 +--- a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/style_format.py ++++ b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/style_format.py +@@ -29,6 +29,9 @@ def init(root_src_dir): + elif sys.platform.startswith(("cygwin", "win")): + platform = "win" + exe_suffix = ".exe" ++ elif sys.platform.startswith("haiku"): ++ platform = "haiku" ++ exe_suffix = "" + else: + assert False, "Unknown platform: {}".format(sys.platform) + buildtools_platform_dir = os.path.join(root_src_dir, "buildtools", +diff --git a/src/3rdparty/chromium/third_party/blink/renderer/controller/blink_initializer.cc b/src/3rdparty/chromium/third_party/blink/renderer/controller/blink_initializer.cc +index 0231bcf..dee9523 100644 +--- a/src/3rdparty/chromium/third_party/blink/renderer/controller/blink_initializer.cc ++++ b/src/3rdparty/chromium/third_party/blink/renderer/controller/blink_initializer.cc +@@ -68,11 +68,12 @@ + #include "third_party/blink/renderer/controller/oom_intervention_impl.h" + #endif + +-#if defined(OS_LINUX) || defined(OS_CHROMEOS) ++ ++#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU) + #include "third_party/blink/renderer/controller/memory_usage_monitor_posix.h" + #endif + +-#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || \ ++#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || defined(OS_HAIKU) || \ + defined(OS_MAC) || defined(OS_WIN) + #include "third_party/blink/renderer/controller/highest_pmf_reporter.h" + #include "third_party/blink/renderer/controller/user_level_memory_pressure_signal_generator.h" +@@ -154,7 +155,7 @@ void InitializeCommon(Platform* platform, mojo::BinderMap* binders) { + CrashMemoryMetricsReporterImpl::Instance(); + #endif + +-#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || \ ++#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || defined(OS_HAIKU) || \ + defined(OS_MAC) || defined(OS_WIN) + // Initialize UserLevelMemoryPressureSignalGenerator so it starts monitoring. + if (UserLevelMemoryPressureSignalGenerator::Enabled()) +@@ -212,7 +213,7 @@ void BlinkInitializer::RegisterInterfaces(mojo::BinderMap& binders) { + main_thread->GetTaskRunner()); + #endif + +-#if defined(OS_LINUX) || defined(OS_CHROMEOS) ++#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU) + binders.Add(ConvertToBaseRepeatingCallback( + CrossThreadBindRepeating(&MemoryUsageMonitorPosix::Bind)), + main_thread->GetTaskRunner()); +diff --git a/src/3rdparty/chromium/third_party/blink/renderer/controller/memory_usage_monitor_posix.cc b/src/3rdparty/chromium/third_party/blink/renderer/controller/memory_usage_monitor_posix.cc +index 27b6056..f437dea 100644 +--- a/src/3rdparty/chromium/third_party/blink/renderer/controller/memory_usage_monitor_posix.cc ++++ b/src/3rdparty/chromium/third_party/blink/renderer/controller/memory_usage_monitor_posix.cc +@@ -134,7 +134,7 @@ void MemoryUsageMonitorPosix::SetProcFiles(base::File statm_file, + status_fd_.reset(status_file.TakePlatformFile()); + } + +-#if defined(OS_LINUX) || defined(OS_CHROMEOS) ++#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU) + // static + void MemoryUsageMonitorPosix::Bind( + mojo::PendingReceiver receiver) { +diff --git a/src/3rdparty/chromium/third_party/blink/renderer/controller/memory_usage_monitor_posix.h b/src/3rdparty/chromium/third_party/blink/renderer/controller/memory_usage_monitor_posix.h +index 5e338d6..4165132 100644 +--- a/src/3rdparty/chromium/third_party/blink/renderer/controller/memory_usage_monitor_posix.h ++++ b/src/3rdparty/chromium/third_party/blink/renderer/controller/memory_usage_monitor_posix.h +@@ -12,7 +12,7 @@ + #include "third_party/blink/renderer/controller/controller_export.h" + #include "third_party/blink/renderer/controller/memory_usage_monitor.h" + +-#if defined(OS_LINUX) || defined(OS_CHROMEOS) ++#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU) + #include "third_party/blink/public/mojom/memory_usage_monitor_linux.mojom-blink.h" + #endif + +@@ -21,7 +21,7 @@ namespace blink { + // MemoryUsageMonitor implementation for Android and Linux. + class CONTROLLER_EXPORT MemoryUsageMonitorPosix + : public MemoryUsageMonitor +-#if defined(OS_LINUX) || defined(OS_CHROMEOS) ++#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU) + , + public mojom::blink::MemoryUsageMonitorLinux + #endif +@@ -29,7 +29,7 @@ class CONTROLLER_EXPORT MemoryUsageMonitorPosix + public: + MemoryUsageMonitorPosix() = default; + +-#if defined(OS_LINUX) || defined(OS_CHROMEOS) ++#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU) + static void Bind( + mojo::PendingReceiver receiver); + #endif +@@ -47,7 +47,7 @@ class CONTROLLER_EXPORT MemoryUsageMonitorPosix + uint64_t* vm_size, + uint64_t* vm_hwm_size); + +-#if defined(OS_LINUX) || defined(OS_CHROMEOS) ++#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU) + // mojom::MemoryUsageMonitorLinux implementations: + void SetProcFiles(base::File statm_file, base::File status_file) override; + #endif +@@ -65,7 +65,7 @@ class CONTROLLER_EXPORT MemoryUsageMonitorPosix + base::ScopedFD statm_fd_; + base::ScopedFD status_fd_; + +-#if defined(OS_LINUX) || defined(OS_CHROMEOS) ++#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU) + mojo::Receiver receiver_{this}; + #endif + }; +diff --git a/src/3rdparty/chromium/third_party/blink/renderer/core/editing/editing_behavior.cc b/src/3rdparty/chromium/third_party/blink/renderer/core/editing/editing_behavior.cc +index f1406f4..bf47396 100644 +--- a/src/3rdparty/chromium/third_party/blink/renderer/core/editing/editing_behavior.cc ++++ b/src/3rdparty/chromium/third_party/blink/renderer/core/editing/editing_behavior.cc +@@ -274,7 +274,7 @@ bool EditingBehavior::ShouldInsertCharacter(const KeyboardEvent& event) const { + // unexpected behaviour + if (ch < ' ') + return false; +-#if defined(OS_LINUX) || defined(OS_CHROMEOS) ++#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU) + // According to XKB map no keyboard combinations with ctrl key are mapped to + // printable characters, however we need the filter as the DomKey/text could + // contain printable characters. +diff --git a/src/3rdparty/chromium/third_party/blink/renderer/core/html/canvas/canvas_async_blob_creator.cc b/src/3rdparty/chromium/third_party/blink/renderer/core/html/canvas/canvas_async_blob_creator.cc +index 9b16d60..b98ca1a 100644 +--- a/src/3rdparty/chromium/third_party/blink/renderer/core/html/canvas/canvas_async_blob_creator.cc ++++ b/src/3rdparty/chromium/third_party/blink/renderer/core/html/canvas/canvas_async_blob_creator.cc +@@ -44,7 +44,7 @@ constexpr base::TimeDelta kEncodeRowSlackBeforeDeadline = + + /* The value is based on user statistics on Nov 2017. */ + #if (defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_MAC) || \ +- defined(OS_WIN)) ++ defined(OS_WIN)) || defined(OS_HAIKU) + const double kIdleTaskStartTimeoutDelayMs = 1000.0; + #else + const double kIdleTaskStartTimeoutDelayMs = 4000.0; // For ChromeOS, Mobile +diff --git a/src/3rdparty/chromium/third_party/blink/renderer/core/html/forms/internal_popup_menu.cc b/src/3rdparty/chromium/third_party/blink/renderer/core/html/forms/internal_popup_menu.cc +index 49400d6..3ea2e10 100644 +--- a/src/3rdparty/chromium/third_party/blink/renderer/core/html/forms/internal_popup_menu.cc ++++ b/src/3rdparty/chromium/third_party/blink/renderer/core/html/forms/internal_popup_menu.cc +@@ -155,7 +155,7 @@ class InternalPopupMenu::ItemIterationContext { + is_in_group_(false), + buffer_(buffer) { + DCHECK(buffer_); +-#if defined(OS_LINUX) || defined(OS_CHROMEOS) ++#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU) + // On other platforms, the