From 810e5832b3aaf5a834834584c1298fc24dd5bc40 Mon Sep 17 00:00:00 2001 From: Jerome Duval Date: Wed, 17 Nov 2021 20:51:14 +0100 Subject: [PATCH] qtwebengine: new recipe * runs Chromium 83.0.4103.122 under the hood. * based on patches from KapiX and FreeBSD. * includes fixes for gcc11 * no media support, even crashes then. * forced 1-job build for jumbo builds consuming memory. --- .../patches/qtwebengine-5.15.2.patchset | 10022 ++++++++++++++++ dev-qt/qtwebengine/qtwebengine-5.15.2.recipe | 174 + 2 files changed, 10196 insertions(+) create mode 100644 dev-qt/qtwebengine/patches/qtwebengine-5.15.2.patchset create mode 100644 dev-qt/qtwebengine/qtwebengine-5.15.2.recipe diff --git a/dev-qt/qtwebengine/patches/qtwebengine-5.15.2.patchset b/dev-qt/qtwebengine/patches/qtwebengine-5.15.2.patchset new file mode 100644 index 000000000..5900c1b3b --- /dev/null +++ b/dev-qt/qtwebengine/patches/qtwebengine-5.15.2.patchset @@ -0,0 +1,10022 @@ +From bac19a554984dc2be7c7173917835f0e488efa5a Mon Sep 17 00:00:00 2001 +From: Kacper Kasper +Date: Sat, 27 Apr 2019 01:09:57 +0200 +Subject: base builds & More fixes + + +diff --git a/.gitignore b/.gitignore +new file mode 100644 +index 0000000..0d20b64 +--- /dev/null ++++ b/.gitignore +@@ -0,0 +1 @@ ++*.pyc +diff --git a/mkspecs/features/functions.prf b/mkspecs/features/functions.prf +index d3ceb4c..6b36b3d 100644 +--- a/mkspecs/features/functions.prf ++++ b/mkspecs/features/functions.prf +@@ -93,6 +93,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) +diff --git a/src/3rdparty/chromium/BUILD.gn b/src/3rdparty/chromium/BUILD.gn +index 4e62734..d26fe54 100644 +--- a/src/3rdparty/chromium/BUILD.gn ++++ b/src/3rdparty/chromium/BUILD.gn +@@ -598,7 +598,7 @@ group("gn_all") { + "//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", +@@ -669,7 +669,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)" ] + } + +@@ -1398,6 +1398,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 8494caf..3b0bc84 100644 +--- a/src/3rdparty/chromium/base/BUILD.gn ++++ b/src/3rdparty/chromium/base/BUILD.gn +@@ -1674,6 +1674,22 @@ jumbo_component("base") { + public_deps += [ "//third_party/boringssl" ] + } + ++ if (is_haiku) { ++ sources -= [ "process/memory.cc" ] ++ sources += [ ++ "base_paths_haiku.cc", ++ "base_paths_haiku.h", ++ "process/memory_stubs.cc", ++ "process/process_handle_haiku.cc", ++ "process/process_iterator_haiku.cc", ++ "process/process_metrics_haiku.cc", ++ "threading/platform_thread_haiku.cc", ++ "sys_info_haiku.cc" ++ ] ++ ++ defines += [ "_BSD_SOURCE", "__USE_XOPEN2K8" ] ++ } ++ + # NaCl. + if (is_nacl) { + # Explicitly include the linux file. +diff --git a/src/3rdparty/chromium/base/allocator/partition_allocator/page_allocator_internals_posix.h b/src/3rdparty/chromium/base/allocator/partition_allocator/page_allocator_internals_posix.h +index 27fe5a9..13cdff2 100644 +--- a/src/3rdparty/chromium/base/allocator/partition_allocator/page_allocator_internals_posix.h ++++ b/src/3rdparty/chromium/base/allocator/partition_allocator/page_allocator_internals_posix.h +@@ -34,6 +34,11 @@ + #define MAP_ANONYMOUS MAP_ANON + #endif + ++#if defined(OS_HAIKU) ++#define madvise posix_madvise ++#define MADV_DONTNEED POSIX_MADV_DONTNEED ++#endif ++ + namespace base { + + namespace { +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/debug/stack_trace.cc b/src/3rdparty/chromium/base/debug/stack_trace.cc +index d8ca822..a6b3308 100644 +--- a/src/3rdparty/chromium/base/debug/stack_trace.cc ++++ b/src/3rdparty/chromium/base/debug/stack_trace.cc +@@ -233,7 +233,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 299feb6..92f7e41 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) && !defined(OS_HAIKU) + #include + #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 a5ba395..0b0f8d1 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_MACOSX) || 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 b925602..2e78ab0 100644 +--- a/src/3rdparty/chromium/base/files/file_posix.cc ++++ b/src/3rdparty/chromium/base/files/file_posix.cc +@@ -582,7 +582,8 @@ File::Error File::GetLastFileError() { + } + + #if defined(OS_BSD) || defined(OS_MACOSX) || 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/logging.cc b/src/3rdparty/chromium/base/logging.cc +index 608cc11..ac332ed 100644 +--- a/src/3rdparty/chromium/base/logging.cc ++++ b/src/3rdparty/chromium/base/logging.cc +@@ -622,7 +622,7 @@ LogMessage::LogMessage(const char* file, int line, LogSeverity severity, + 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 bee394a..8677bcc 100644 +--- a/src/3rdparty/chromium/base/memory/discardable_shared_memory.cc ++++ b/src/3rdparty/chromium/base/memory/discardable_shared_memory.cc +@@ -41,6 +41,11 @@ + #include "base/fuchsia/fuchsia_logging.h" + #endif + ++#if defined(OS_HAIKU) ++#define madvise posix_madvise ++#define MADV_DONTNEED POSIX_MADV_DONTNEED ++#endif ++ + namespace base { + namespace { + +@@ -403,6 +408,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/message_loop/message_pump_for_ui.h b/src/3rdparty/chromium/base/message_loop/message_pump_for_ui.h +index 6ee02b0..f3b8113 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 +@@ -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_BSD) ++#elif defined(OS_LINUX) || 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 cc29cab..7234d7a 100644 +--- a/src/3rdparty/chromium/base/path_service.cc ++++ b/src/3rdparty/chromium/base/path_service.cc +@@ -30,6 +30,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. +@@ -102,8 +104,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_MACOSX) && !defined(OS_ANDROID) && \ +- !defined(OS_FUCHSIA) ++ !defined(OS_FUCHSIA) && !defined(OS_HAIKU) + Provider base_provider_posix = { + PathProviderPosix, + &base_provider, +@@ -132,6 +142,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/unix_domain_socket.cc b/src/3rdparty/chromium/base/posix/unix_domain_socket.cc +index 7c087a5..3df3e65 100644 +--- a/src/3rdparty/chromium/base/posix/unix_domain_socket.cc ++++ b/src/3rdparty/chromium/base/posix/unix_domain_socket.cc +@@ -56,7 +56,7 @@ bool CreateSocketPair(ScopedFD* one, ScopedFD* two) { + + // static + bool UnixDomainSocket::EnableReceiveProcessId(int fd) { +-#if !defined(OS_MACOSX) ++#if !defined(OS_MACOSX) && !defined(OS_HAIKU) + const int enable = 1; + return setsockopt(fd, SOL_SOCKET, SO_PASSCRED, &enable, sizeof(enable)) == 0; + #else +@@ -147,11 +147,11 @@ ssize_t UnixDomainSocket::RecvMsgWithFlags(int fd, + + const size_t kControlBufferSize = + CMSG_SPACE(sizeof(int) * kMaxFileDescriptors) +-#if !defined(OS_NACL_NONSFI) && !defined(OS_MACOSX) ++#if !defined(OS_NACL_NONSFI) && !defined(OS_MACOSX) && !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 // OS_NACL_NONSFI or OS_MACOSX ++#endif // OS_NACL_NONSFI or OS_MACOSX or OS_HAIKU + ; + char control_buffer[kControlBufferSize]; + msg.msg_control = control_buffer; +@@ -175,7 +175,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_MACOSX) ++#if !defined(OS_NACL_NONSFI) && !defined(OS_MACOSX) && !defined(OS_HAIKU) + // The PNaCl toolchain for Non-SFI binary build and macOS do not support + // SCM_CREDENTIALS. + if (cmsg->cmsg_level == SOL_SOCKET && +@@ -184,7 +184,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_MACOSX) ++#endif // !defined(OS_NACL_NONSFI) && !defined(OS_MACOSX) && !defined(OS_HAIKU) + } + } + +diff --git a/src/3rdparty/chromium/base/process/launch_posix.cc b/src/3rdparty/chromium/base/process/launch_posix.cc +index 9b7573f..71e7a7a 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/process_handle_haiku.cc b/src/3rdparty/chromium/base/process/process_handle_haiku.cc +new file mode 100644 +index 0000000..3524147 +--- /dev/null ++++ b/src/3rdparty/chromium/base/process/process_handle_haiku.cc +@@ -0,0 +1,22 @@ ++// 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" ++ ++namespace base { ++ ++ProcessId GetParentProcessId(ProcessHandle process) { ++ NOTIMPLEMENTED(); ++ return -1; ++} ++ ++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 2b7cfe1..3f2301d 100644 +--- a/src/3rdparty/chromium/base/process/process_metrics.h ++++ b/src/3rdparty/chromium/base/process/process_metrics.h +@@ -272,7 +272,8 @@ BASE_EXPORT void IncreaseFdLimitTo(unsigned int max_descriptors); + #endif // defined(OS_POSIX) + + #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) || \ +- defined(OS_ANDROID) || defined(OS_AIX) || defined(OS_FUCHSIA) ++ defined(OS_ANDROID) || defined(OS_AIX) || 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. + // +@@ -320,7 +321,7 @@ struct BASE_EXPORT SystemMemoryInfoKB { + #endif + + #if defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_AIX) || \ +- defined(OS_FUCHSIA) ++ defined(OS_FUCHSIA) || defined(OS_HAIKU) + int buffers = 0; + int cached = 0; + int active_anon = 0; +@@ -330,7 +331,7 @@ struct BASE_EXPORT SystemMemoryInfoKB { + int dirty = 0; + int reclaimable = 0; + #endif // defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_AIX) || +- // defined(OS_FUCHSIA) ++ // defined(OS_FUCHSIA) || defined(OS_HAIKU) + + #if defined(OS_CHROMEOS) + int shmem = 0; +@@ -356,7 +357,8 @@ struct BASE_EXPORT SystemMemoryInfoKB { + BASE_EXPORT bool GetSystemMemoryInfo(SystemMemoryInfoKB* meminfo); + + #endif // defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) || +- // defined(OS_ANDROID) || defined(OS_AIX) || defined(OS_FUCHSIA) ++ // defined(OS_ANDROID) || defined(OS_AIX) || defined(OS_FUCHSIA) || ++ // defined(OS_HAIKU) + + #if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_AIX) + // Parse the data found in /proc//stat and return the sum of the +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..e2e7829 +--- /dev/null ++++ b/src/3rdparty/chromium/base/process/process_metrics_haiku.cc +@@ -0,0 +1,32 @@ ++// 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; ++} ++ ++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; ++} ++ ++} // 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 044bd8d..c0d1f32 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 = 8192; + #endif + + size_t GetMaxFds() { +diff --git a/src/3rdparty/chromium/base/sys_info_haiku.cc b/src/3rdparty/chromium/base/sys_info_haiku.cc +new file mode 100644 +index 0000000..e38fda1 +--- /dev/null ++++ b/src/3rdparty/chromium/base/sys_info_haiku.cc +@@ -0,0 +1,39 @@ ++// 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/sys_info.h" ++ ++#include "base/logging.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 / 1048576.0f) + 0.5f); ++} ++ ++// static ++int64_t SysInfo::AmountOfAvailablePhysicalMemoryImpl() { ++ // TODO(fuchsia): https://crbug.com/706592 This is not exposed. ++ NOTREACHED(); ++ return 0; ++} ++ ++// static ++int SysInfo::NumberOfProcessors() { ++ system_info systemInfo; ++ get_system_info(&systemInfo); ++ return static_cast(systemInfo.cpu_count); ++} ++ ++// static ++int64_t SysInfo::AmountOfVirtualMemory() { ++ return 0; ++} ++ ++} // 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 62e2128..8961acf 100644 +--- a/src/3rdparty/chromium/base/third_party/libevent/BUILD.gn ++++ b/src/3rdparty/chromium/base/third_party/libevent/BUILD.gn +@@ -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..aee0d1c +--- /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. */ ++/* #undef HAVE_STRSEP */ ++ ++/* 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_haiku.cc b/src/3rdparty/chromium/base/threading/platform_thread_haiku.cc +new file mode 100644 +index 0000000..fb46138 +--- /dev/null ++++ b/src/3rdparty/chromium/base/threading/platform_thread_haiku.cc +@@ -0,0 +1,55 @@ ++// 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}, ++}; ++ ++bool SetCurrentThreadPriorityForPlatform(ThreadPriority priority) { ++ sched_param prio = {0}; ++ prio.sched_priority = ThreadPriorityToNiceValue(priority); ++ return pthread_setschedparam(pthread_self(), SCHED_OTHER, &prio) == 0; ++} ++ ++bool GetCurrentThreadPriorityForPlatform(ThreadPriority* priority) { ++ sched_param prio = {0}; ++ int policy; ++ if (pthread_getschedparam(pthread_self(), &policy, &prio) != 0) { ++ return false; ++ } ++ *priority = NiceValueToThreadPriority(prio.sched_priority); ++ return true; ++} ++ ++} // namespace internal ++ ++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_posix.cc b/src/3rdparty/chromium/base/threading/platform_thread_posix.cc +index 335848e..5b48f67 100644 +--- a/src/3rdparty/chromium/base/threading/platform_thread_posix.cc ++++ b/src/3rdparty/chromium/base/threading/platform_thread_posix.cc +@@ -303,7 +303,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)) +@@ -325,7 +325,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 1bf34c9..16fb8f8 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 021e986..66840b7 100644 +--- a/src/3rdparty/chromium/base/trace_event/process_memory_dump.cc ++++ b/src/3rdparty/chromium/base/trace_event/process_memory_dump.cc +@@ -116,7 +116,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 d3cdd2d..8c6a31e 100644 +--- a/src/3rdparty/chromium/build/build_config.h ++++ b/src/3rdparty/chromium/build/build_config.h +@@ -65,6 +65,8 @@ + #define OS_AIX 1 + #elif defined(__asmjs__) || defined(__wasm__) + #define OS_ASMJS ++#elif defined(__HAIKU__) ++#define OS_HAIKU 1 + #else + #error Please add support for your platform in build/build_config.h + #endif +@@ -82,7 +84,7 @@ + #if defined(OS_AIX) || defined(OS_ANDROID) || defined(OS_ASMJS) || \ + defined(OS_FREEBSD) || defined(OS_LINUX) || defined(OS_MACOSX) || \ + defined(OS_NACL) || defined(OS_NETBSD) || defined(OS_OPENBSD) || \ +- defined(OS_QNX) || defined(OS_SOLARIS) ++ defined(OS_QNX) || defined(OS_SOLARIS) || defined(OS_HAIKU) + #define OS_POSIX 1 + #endif + +diff --git a/src/3rdparty/chromium/build/config/BUILDCONFIG.gn b/src/3rdparty/chromium/build/config/BUILDCONFIG.gn +index ff5443e..7059914 100644 +--- a/src/3rdparty/chromium/build/config/BUILDCONFIG.gn ++++ b/src/3rdparty/chromium/build/config/BUILDCONFIG.gn +@@ -134,10 +134,10 @@ declare_args() { + is_desktop_linux = current_os == "linux" + + # 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. +@@ -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") + } +@@ -236,6 +238,8 @@ if (target_os == "android") { + } else { + _default_toolchain = "//build/toolchain/linux:$target_cpu" + } ++} else if (target_os == "haiku") { ++ _default_toolchain = "//build/toolchain/haiku:$target_cpu" + } else if (target_os == "fuchsia") { + _default_toolchain = "//build/toolchain/fuchsia:$target_cpu" + } else if (target_os == "ios") { +@@ -297,6 +301,7 @@ is_linux = current_os == "chromeos" || current_os == "linux" + is_mac = current_os == "mac" + is_nacl = current_os == "nacl" + is_win = current_os == "win" || current_os == "winuwp" ++is_haiku = current_os == "haiku" + + is_posix = !is_win && !is_fuchsia + +@@ -387,6 +392,15 @@ if (!is_chromeos) { + "*\bchromeos/*", + ] + } ++if (!is_haiku) { ++ sources_assignment_filter += [ ++ "*_haiku.h", ++ "*_haiku.cc", ++ "*_haiku_unittest.h", ++ "*_haiku_unittest.cc", ++ "*\bhaiku/*", ++ ] ++} + + # DO NOT ADD MORE PATTERNS TO THIS LIST, see set_sources_assignment_filter call + # below. +diff --git a/src/3rdparty/chromium/build/config/compiler/BUILD.gn b/src/3rdparty/chromium/build/config/compiler/BUILD.gn +index ca81bd8..a87c58a 100644 +--- a/src/3rdparty/chromium/build/config/compiler/BUILD.gn ++++ b/src/3rdparty/chromium/build/config/compiler/BUILD.gn +@@ -272,6 +272,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 += [ +@@ -306,7 +308,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" ] + } +@@ -1252,6 +1254,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) { +diff --git a/src/3rdparty/chromium/build/config/crypto.gni b/src/3rdparty/chromium/build/config/crypto.gni +index a3d52de..2c07d3c 100644 +--- a/src/3rdparty/chromium/build/config/crypto.gni ++++ b/src/3rdparty/chromium/build/config/crypto.gni +@@ -12,4 +12,4 @@ + # to set up feature flags. + + # True if NSS is used for certificate handling. +-use_nss_certs = is_linux ++use_nss_certs = is_linux || is_haiku +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..a3bb107 +--- /dev/null ++++ b/src/3rdparty/chromium/build/config/haiku/BUILD.gn +@@ -0,0 +1,45 @@ ++# 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", ++ ] ++ } ++} ++ ++# Ensures all exported symbols are added to the dynamic symbol table. This is ++# necessary to expose Chrome's custom operator new() and operator delete() (and ++# other memory-related symbols) to libraries. Otherwise, they might ++# (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") { ++ ldflags = [ "-rdynamic" ] ++} +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/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 57369bb..a776e01 100644 +--- a/src/3rdparty/chromium/chrome/browser/BUILD.gn ++++ b/src/3rdparty/chromium/chrome/browser/BUILD.gn +@@ -4338,7 +4338,7 @@ jumbo_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/test/BUILD.gn b/src/3rdparty/chromium/chrome/test/BUILD.gn +index 7de749f..a69978f 100644 +--- a/src/3rdparty/chromium/chrome/test/BUILD.gn ++++ b/src/3rdparty/chromium/chrome/test/BUILD.gn +@@ -6144,7 +6144,7 @@ test("chrome_app_unittests") { + "//components/gwp_asan/buildflags", + "//components/safe_browsing:buildflags", + ] +- 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 21340d5..0b5a047 100644 +--- a/src/3rdparty/chromium/components/BUILD.gn ++++ b/src/3rdparty/chromium/components/BUILD.gn +@@ -396,6 +396,13 @@ test("components_unittests") { + deps += [ "//components/browser_watcher:unit_tests" ] + } + ++ if (is_haiku) { ++ deps -= [ ++ "//components/crash/content/browser:unit_tests", ++ "//components/data_reduction_proxy/content/browser:unit_tests", ++ ] ++ } ++ + if (enable_basic_printing) { + deps += [ + "//components/printing/browser: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 ce7bc78..40c3604 100644 +--- a/src/3rdparty/chromium/components/crash/content/browser/BUILD.gn ++++ b/src/3rdparty/chromium/components/crash/content/browser/BUILD.gn +@@ -7,7 +7,7 @@ if (is_android) { + } + + # TODO(crbug.com/753619): Enable crash reporting on Fuchsia. +-assert(!is_fuchsia) ++assert(!is_fuchsia && !is_haiku) + + source_set("browser") { + sources = [ +diff --git a/src/3rdparty/chromium/components/crash/core/common/BUILD.gn b/src/3rdparty/chromium/components/crash/core/common/BUILD.gn +index fe149ec..622b76d 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") { +diff --git a/src/3rdparty/chromium/components/variations/client_filterable_state.cc b/src/3rdparty/chromium/components/variations/client_filterable_state.cc +index f39123e..59fc47e 100644 +--- a/src/3rdparty/chromium/components/variations/client_filterable_state.cc ++++ b/src/3rdparty/chromium/components/variations/client_filterable_state.cc +@@ -22,7 +22,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 d9fec9c..7891d98 100644 +--- a/src/3rdparty/chromium/content/app/content_main_runner_impl.cc ++++ b/src/3rdparty/chromium/content/app/content_main_runner_impl.cc +@@ -469,7 +469,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) +@@ -481,7 +483,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/shell/BUILD.gn b/src/3rdparty/chromium/content/shell/BUILD.gn +index 2bdaf4f..e29b1e9 100644 +--- a/src/3rdparty/chromium/content/shell/BUILD.gn ++++ b/src/3rdparty/chromium/content/shell/BUILD.gn +@@ -366,6 +366,14 @@ static_library("content_shell_lib") { + ] + deps += [ "//third_party/fuchsia-sdk/sdk/fidl/fuchsia.ui.policy" ] + } ++ if (is_haiku) { ++ sources += [ "app/blink_test_platform_support_fuchsia.cc" ] ++ deps -= [ ++ "//components/crash/content/app", ++ "//components/crash/content/app:test_support", ++ "//components/crash/content/browser", ++ ] ++ } + + # Annoyingly, this target and web_test_support have circular includes. + allow_circular_includes_from = [ "//content/test:web_test_support" ] +@@ -959,7 +967,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/gpu/ipc/common/surface_handle.h b/src/3rdparty/chromium/gpu/ipc/common/surface_handle.h +index 391d754..e27ade4 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_MACOSX) || 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/headless/BUILD.gn b/src/3rdparty/chromium/headless/BUILD.gn +index 1ec913e..bf09d56 100644 +--- a/src/3rdparty/chromium/headless/BUILD.gn ++++ b/src/3rdparty/chromium/headless/BUILD.gn +@@ -598,7 +598,7 @@ test("headless_unittests") { + "//testing/gtest", + ] + +- if (!is_fuchsia) { ++ if (!is_fuchsia && !is_haiku) { + deps += [ "//components/crash/content/browser" ] + } + +@@ -682,7 +682,7 @@ test("headless_browsertests") { + "//ui/base/clipboard", + ] + +- if (!is_fuchsia) { ++ if (!is_fuchsia && !is_haiku) { + deps += [ "//components/crash/content/browser" ] + } + +diff --git a/src/3rdparty/chromium/ipc/ipc_message_utils.cc b/src/3rdparty/chromium/ipc/ipc_message_utils.cc +index 92e7ca6..2e6c2c0 100644 +--- a/src/3rdparty/chromium/ipc/ipc_message_utils.cc ++++ b/src/3rdparty/chromium/ipc/ipc_message_utils.cc +@@ -356,7 +356,7 @@ void ParamTraits::Log(const param_type& p, std::string* l) { + } + + #if defined(OS_WIN) || defined(OS_LINUX) || defined(OS_FUCHSIA) || \ +- (defined(OS_ANDROID) && defined(ARCH_CPU_64_BITS)) ++ 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 f8aa520..63f74a4 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_FUCHSIA) || \ +- (defined(OS_ANDROID) && defined(ARCH_CPU_64_BITS)) ++ defined(OS_HAIKU) || (defined(OS_ANDROID) && defined(ARCH_CPU_64_BITS)) + template <> + struct ParamTraits { + typedef long param_type; +diff --git a/src/3rdparty/chromium/skia/ext/platform_canvas.h b/src/3rdparty/chromium/skia/ext/platform_canvas.h +index c31e7c0..22bb97a 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/blink/renderer/platform/wtf/stack_util.cc b/src/3rdparty/chromium/third_party/blink/renderer/platform/wtf/stack_util.cc +index 1aaaa1c..2aa53fe 100644 +--- a/src/3rdparty/chromium/third_party/blink/renderer/platform/wtf/stack_util.cc ++++ b/src/3rdparty/chromium/third_party/blink/renderer/platform/wtf/stack_util.cc +@@ -13,6 +13,8 @@ + #include + #include + #include ++#elif defined(OS_HAIKU) ++#include + #elif defined(__GLIBC__) + extern "C" void* __libc_stack_end; // NOLINT + #endif +@@ -87,7 +89,7 @@ size_t GetUnderestimatedStackSize() { + #endif + } + return pthread_get_stacksize_np(pthread_self()); +-#elif defined(OS_WIN) && defined(COMPILER_MSVC) ++#elif defined(OS_HAIKU) || defined(OS_WIN) && defined(COMPILER_MSVC) + return Threading::ThreadStackSize(); + #else + #error "Stack frame size estimation not supported on this platform." +@@ -145,6 +147,10 @@ void* GetStackStart() { + ::GetCurrentThreadStackLimits(&lowLimit, &highLimit); + return reinterpret_cast(highLimit); + #endif ++#elif defined(OS_HAIKU) ++ thread_info threadInfo; ++ get_thread_info(find_thread(NULL), &threadInfo); ++ return threadInfo.stack_base; + #else + #error Unsupported getStackStart on this platform. + #endif +@@ -208,6 +214,17 @@ size_t ThreadStackSize() { + thread_stack_size -= 4 * 0x1000; + return thread_stack_size; + } ++#elif defined(OS_HAIKU) ++size_t ThreadStackSize() { ++ thread_info threadInfo; ++ get_thread_info(find_thread(NULL), &threadInfo); ++ uint8_t* stack_end = reinterpret_cast(threadInfo.stack_end); ++ uint8_t* stack_start = reinterpret_cast(threadInfo.stack_base); ++ CHECK(stack_start); ++ CHECK_GT(stack_start, stack_end); ++ size_t thread_stack_size = static_cast(stack_start - stack_end); ++ return thread_stack_size; ++} + #endif + + } // namespace internal +diff --git a/src/3rdparty/chromium/third_party/blink/renderer/platform/wtf/stack_util.h b/src/3rdparty/chromium/third_party/blink/renderer/platform/wtf/stack_util.h +index c9c423c..f03d604 100644 +--- a/src/3rdparty/chromium/third_party/blink/renderer/platform/wtf/stack_util.h ++++ b/src/3rdparty/chromium/third_party/blink/renderer/platform/wtf/stack_util.h +@@ -29,7 +29,7 @@ WTF_EXPORT extern uintptr_t g_main_thread_underestimated_stack_size; + + WTF_EXPORT void InitializeMainThreadStackEstimate(); + +-#if defined(OS_WIN) && defined(COMPILER_MSVC) ++#if defined(OS_HAIKU) || (defined(OS_WIN) && defined(COMPILER_MSVC)) + size_t ThreadStackSize(); + #endif + +diff --git a/src/3rdparty/chromium/third_party/khronos/EGL/eglplatform.h b/src/3rdparty/chromium/third_party/khronos/EGL/eglplatform.h +index cf2ce0c..3a3fe3b 100644 +--- a/src/3rdparty/chromium/third_party/khronos/EGL/eglplatform.h ++++ b/src/3rdparty/chromium/third_party/khronos/EGL/eglplatform.h +@@ -99,6 +99,13 @@ typedef intptr_t EGLNativeDisplayType; + typedef intptr_t EGLNativeWindowType; + typedef intptr_t EGLNativePixmapType; + ++#elif defined(__HAIKU__) ++ ++#include ++typedef void *EGLNativeDisplayType; ++typedef uintptr_t EGLNativePixmapType; ++typedef uintptr_t EGLNativeWindowType; ++ + #elif defined(__unix__) + + /* X11 (tentative) */ +diff --git a/src/3rdparty/chromium/third_party/libxml/BUILD.gn b/src/3rdparty/chromium/third_party/libxml/BUILD.gn +index f0fa89f..3b81625 100644 +--- a/src/3rdparty/chromium/third_party/libxml/BUILD.gn ++++ b/src/3rdparty/chromium/third_party/libxml/BUILD.gn +@@ -4,7 +4,7 @@ + + # Define an "os_include" variable that points at the OS-specific generated + # headers. These were generated by running the configure script offline. +-if (is_linux || is_android || is_nacl || is_fuchsia) { ++if (is_linux || is_android || is_nacl || is_fuchsia || is_haiku) { + os_include = "linux" + } else if (is_mac || is_ios) { + os_include = "mac" +diff --git a/src/3rdparty/chromium/third_party/skia/src/gpu/GrAutoLocaleSetter.h b/src/3rdparty/chromium/third_party/skia/src/gpu/GrAutoLocaleSetter.h +index aa24177..bbaeb81 100644 +--- a/src/3rdparty/chromium/third_party/skia/src/gpu/GrAutoLocaleSetter.h ++++ b/src/3rdparty/chromium/third_party/skia/src/gpu/GrAutoLocaleSetter.h +@@ -27,7 +27,7 @@ + #define HAVE_XLOCALE 0 + #endif + +-#if defined(SK_BUILD_FOR_ANDROID) || defined(__UCLIBC__) || defined(_NEWLIB_VERSION) ++#if defined(SK_BUILD_FOR_ANDROID) || defined(__UCLIBC__) || defined(_NEWLIB_VERSION) || defined(__HAIKU__) + #define HAVE_LOCALE_T 0 + #else + #define HAVE_LOCALE_T 1 +diff --git a/src/3rdparty/chromium/third_party/webrtc/BUILD.gn b/src/3rdparty/chromium/third_party/webrtc/BUILD.gn +index b3e7710..01082a0 100644 +--- a/src/3rdparty/chromium/third_party/webrtc/BUILD.gn ++++ b/src/3rdparty/chromium/third_party/webrtc/BUILD.gn +@@ -160,7 +160,7 @@ config("common_inherited_config") { + target_gen_dir, + ] + } +- if (is_posix || is_fuchsia) { ++ if (is_posix || is_fuchsia || is_haiku) { + defines += [ "WEBRTC_POSIX" ] + } + if (is_ios) { +@@ -178,6 +178,9 @@ config("common_inherited_config") { + if (is_fuchsia) { + defines += [ "WEBRTC_FUCHSIA" ] + } ++ if (is_haiku) { ++ defines += [ "WEBRTC_HAIKU", "_BSD_SOURCE" ] ++ } + if (is_win) { + defines += [ "WEBRTC_WIN" ] + } +diff --git a/src/3rdparty/chromium/third_party/webrtc/rtc_base/BUILD.gn b/src/3rdparty/chromium/third_party/webrtc/rtc_base/BUILD.gn +index 60dda76..ada4f72 100644 +--- a/src/3rdparty/chromium/third_party/webrtc/rtc_base/BUILD.gn ++++ b/src/3rdparty/chromium/third_party/webrtc/rtc_base/BUILD.gn +@@ -973,6 +973,10 @@ rtc_library("rtc_base") { + ] + } + ++ if (is_haiku) { ++ defines += [ "_BSD_SOURCE" ] ++ } ++ + if (is_nacl) { + public_deps += # no-presubmit-check TODO(webrtc:8603) + [ "//native_client_sdk/src/libraries/nacl_io" ] +diff --git a/src/3rdparty/chromium/third_party/webrtc/rtc_base/network.cc b/src/3rdparty/chromium/third_party/webrtc/rtc_base/network.cc +index ffa8f94..702c220 100644 +--- a/src/3rdparty/chromium/third_party/webrtc/rtc_base/network.cc ++++ b/src/3rdparty/chromium/third_party/webrtc/rtc_base/network.cc +@@ -12,6 +12,10 @@ + + #if defined(WEBRTC_POSIX) + #include ++#ifdef __HAIKU__ ++#include ++#define IFF_RUNNING IFF_LINK ++#endif + #endif // WEBRTC_POSIX + + #if defined(WEBRTC_WIN) +diff --git a/src/3rdparty/chromium/third_party/webrtc/rtc_base/platform_thread_types.cc b/src/3rdparty/chromium/third_party/webrtc/rtc_base/platform_thread_types.cc +index ed4a228..63312c8 100644 +--- a/src/3rdparty/chromium/third_party/webrtc/rtc_base/platform_thread_types.cc ++++ b/src/3rdparty/chromium/third_party/webrtc/rtc_base/platform_thread_types.cc +@@ -13,6 +13,8 @@ + #if defined(WEBRTC_LINUX) + #include + #include ++#elif defined(WEBRTC_HAIKU) ++#include + #endif + + namespace rtc { +@@ -27,6 +29,8 @@ PlatformThreadId CurrentThreadId() { + return gettid(); + #elif defined(WEBRTC_FUCHSIA) + return zx_thread_self(); ++#elif defined(WEBRTC_HAIKU) ++ return find_thread(NULL); + #elif defined(WEBRTC_LINUX) + return syscall(__NR_gettid); + #elif defined(__EMSCRIPTEN__) +@@ -81,6 +85,8 @@ void SetCurrentThreadName(const char* name) { + prctl(PR_SET_NAME, reinterpret_cast(name)); // NOLINT + #elif defined(WEBRTC_MAC) || defined(WEBRTC_IOS) + pthread_setname_np(name); ++#elif defined(WEBRTC_HAIKU) ++ rename_thread(find_thread(NULL), name); + #endif + } + +diff --git a/src/3rdparty/chromium/third_party/yasm/BUILD.gn b/src/3rdparty/chromium/third_party/yasm/BUILD.gn +index 93ecb0d..791d920 100644 +--- a/src/3rdparty/chromium/third_party/yasm/BUILD.gn ++++ b/src/3rdparty/chromium/third_party/yasm/BUILD.gn +@@ -85,6 +85,9 @@ if (current_toolchain == host_toolchain) { + if (is_posix || is_fuchsia) { + cflags = [ "-std=gnu99" ] + } ++ if (is_haiku) { ++ libs = [ "intl" ] ++ } + } + + executable("genmacro") { +diff --git a/src/3rdparty/chromium/third_party/yasm/source/config/haiku/config.h b/src/3rdparty/chromium/third_party/yasm/source/config/haiku/config.h +new file mode 100644 +index 0000000..21eb088 +--- /dev/null ++++ b/src/3rdparty/chromium/third_party/yasm/source/config/haiku/config.h +@@ -0,0 +1,173 @@ ++/* config.h. Generated from config.h.in by configure. */ ++/* config.h.in. Generated from configure.ac by autoheader. */ ++ ++/* Command name to run C preprocessor */ ++#define CPP_PROG "cc -E" ++ ++/* */ ++#define ENABLE_NLS 1 ++ ++/* Define to 1 if you have the `abort' function. */ ++#define HAVE_ABORT 1 ++ ++/* */ ++/* #undef HAVE_CATGETS */ ++ ++/* Define to 1 if you have the Mac OS X function CFLocaleCopyCurrent in the ++ CoreFoundation framework. */ ++/* #undef HAVE_CFLOCALECOPYCURRENT */ ++ ++/* Define to 1 if you have the Mac OS X function CFPreferencesCopyAppValue in ++ the CoreFoundation framework. */ ++/* #undef HAVE_CFPREFERENCESCOPYAPPVALUE */ ++ ++/* Define if the GNU dcgettext() function is already present or preinstalled. ++ */ ++#define HAVE_DCGETTEXT 1 ++ ++/* Define to 1 if you have the header file. */ ++/* #undef HAVE_DIRECT_H */ ++ ++/* Define to 1 if you have the `ftruncate' function. */ ++#define HAVE_FTRUNCATE 1 ++ ++/* Define to 1 if you have the `getcwd' function. */ ++#define HAVE_GETCWD 1 ++ ++/* */ ++#define HAVE_GETTEXT 1 ++ ++/* Define to 1 if you have the GNU C Library */ ++/* #undef HAVE_GNU_C_LIBRARY */ ++ ++/* Define if you have the iconv() function and it works. */ ++#define HAVE_ICONV 1 ++ ++/* Define to 1 if you have the header file. */ ++#define HAVE_INTTYPES_H 1 ++ ++/* */ ++/* #undef HAVE_LC_MESSAGES */ ++ ++/* Define to 1 if you have the header file. */ ++#define HAVE_LIBGEN_H 1 ++ ++/* Define to 1 if you have the header file. */ ++#define HAVE_MEMORY_H 1 ++ ++/* Define to 1 if you have the `mergesort' function. */ ++#define HAVE_MERGESORT 1 ++ ++/* Define to 1 if you have the `popen' function. */ ++#define HAVE_POPEN 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 ++ ++/* */ ++/* #undef HAVE_STPCPY */ ++ ++/* Define to 1 if you have the `strcasecmp' function. */ ++#define HAVE_STRCASECMP 1 ++ ++/* Define to 1 if you have the `strcmpi' function. */ ++/* #undef HAVE_STRCMPI */ ++ ++/* Define to 1 if you have the `stricmp' function. */ ++/* #undef HAVE_STRICMP */ ++ ++/* 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 `strncasecmp' function. */ ++#define HAVE_STRNCASECMP 1 ++ ++/* Define to 1 if you have the `strsep' function. */ ++/* #undef HAVE_STRSEP */ ++ ++/* 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_TYPES_H 1 ++ ++/* Define to 1 if you have the `toascii' function. */ ++#define HAVE_TOASCII 1 ++ ++/* Define to 1 if you have the header file. */ ++#define HAVE_UNISTD_H 1 ++ ++/* Define to 1 if you have the `vsnprintf' function. */ ++#define HAVE_VSNPRINTF 1 ++ ++/* Define to 1 if you have the `_stricmp' function. */ ++/* #undef HAVE__STRICMP */ ++ ++/* Name of package */ ++#define PACKAGE "yasm" ++ ++/* Define to the address where bug reports for this package should be sent. */ ++#define PACKAGE_BUGREPORT "bug-yasm@tortall.net" ++ ++/* Define to the full name of this package. */ ++#define PACKAGE_NAME "yasm" ++ ++/* Define to the full name and version of this package. */ ++#define PACKAGE_STRING "yasm 1.3.0" ++ ++/* Define to the one symbol short name of this package. */ ++#define PACKAGE_TARNAME "yasm" ++ ++/* Define to the home page for this package. */ ++#define PACKAGE_URL "" ++ ++/* Define to the version of this package. */ ++#define PACKAGE_VERSION "1.3.0" ++ ++/* Define to 1 if the C compiler supports function prototypes. */ ++#define PROTOTYPES 1 ++ ++/* The size of `char', as computed by sizeof. */ ++/* #undef SIZEOF_CHAR */ ++ ++/* The size of `int', as computed by sizeof. */ ++/* #undef SIZEOF_INT */ ++ ++/* The size of `long', as computed by sizeof. */ ++/* #undef SIZEOF_LONG */ ++ ++/* The size of `short', as computed by sizeof. */ ++/* #undef SIZEOF_SHORT */ ++ ++/* The size of `void*', as computed by sizeof. */ ++/* #undef SIZEOF_VOIDP */ ++ ++/* Define to 1 if you have the ANSI C header files. */ ++#define STDC_HEADERS 1 ++ ++/* Version number of package */ ++#define VERSION "1.3.0" ++ ++/* Define if using the dmalloc debugging malloc package */ ++/* #undef WITH_DMALLOC */ ++ ++/* Define like PROTOTYPES; this can be used by system headers. */ ++#define __PROTOTYPES 1 ++ ++/* 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 `unsigned int' if does not define. */ ++/* #undef size_t */ +diff --git a/src/3rdparty/chromium/third_party/yasm/source/config/haiku/libyasm-stdint.h b/src/3rdparty/chromium/third_party/yasm/source/config/haiku/libyasm-stdint.h +new file mode 100644 +index 0000000..5780da8 +--- /dev/null ++++ b/src/3rdparty/chromium/third_party/yasm/source/config/haiku/libyasm-stdint.h +@@ -0,0 +1,9 @@ ++#ifndef _YASM_LIBYASM_STDINT_H ++#define _YASM_LIBYASM_STDINT_H 1 ++#ifndef _GENERATED_STDINT_H ++#define _GENERATED_STDINT_H "yasm 1.3.0" ++/* generated using gcc */ ++#define _STDINT_HAVE_STDINT_H 1 ++#include ++#endif ++#endif +diff --git a/src/3rdparty/chromium/tools/grit/grit/node/base.py b/src/3rdparty/chromium/tools/grit/grit/node/base.py +index bec8f85..66b13fe 100644 +--- a/src/3rdparty/chromium/tools/grit/grit/node/base.py ++++ b/src/3rdparty/chromium/tools/grit/grit/node/base.py +@@ -485,9 +485,11 @@ class Node(object): + value = target_platform == 'ios' + elif name == 'is_bsd': + value = 'bsd' in target_platform ++ elif name == 'is_haiku': ++ value = target_platform.startswith('haiku') + elif name == 'is_posix': + value = (target_platform in ('darwin', 'linux2', 'linux3', 'sunos5', +- 'android', 'ios') ++ 'android', 'ios', 'haiku1') + or 'bsd' in target_platform) + + elif name == 'pp_ifdef': +diff --git a/src/3rdparty/chromium/ui/gfx/native_widget_types.h b/src/3rdparty/chromium/ui/gfx/native_widget_types.h +index 32929a7..554ffee 100644 +--- a/src/3rdparty/chromium/ui/gfx/native_widget_types.h ++++ b/src/3rdparty/chromium/ui/gfx/native_widget_types.h +@@ -192,6 +192,11 @@ typedef ui::WindowAndroid* NativeWindow; + typedef base::android::ScopedJavaGlobalRef NativeEvent; + constexpr NativeView kNullNativeView = nullptr; + constexpr NativeWindow kNullNativeWindow = nullptr; ++#elif defined(OS_HAIKU) // FIXME ++typedef void* NativeCursor; ++typedef void* NativeView; ++typedef void* NativeWindow; ++typedef void* NativeEvent; + #else + #error Unknown build environment. + #endif +@@ -246,6 +251,9 @@ constexpr AcceleratedWidget kNullAcceleratedWidget = 0; + #elif defined(OS_ANDROID) + typedef ANativeWindow* AcceleratedWidget; + constexpr AcceleratedWidget kNullAcceleratedWidget = 0; ++#elif defined(OS_HAIKU) ++typedef int32_t AcceleratedWidget; ++constexpr AcceleratedWidget kNullAcceleratedWidget = 0; + #elif defined(USE_OZONE) + typedef int32_t AcceleratedWidget; + constexpr AcceleratedWidget kNullAcceleratedWidget = 0; +diff --git a/src/3rdparty/chromium/ui/gl/BUILD.gn b/src/3rdparty/chromium/ui/gl/BUILD.gn +index adc9c08..6600f0c 100644 +--- a/src/3rdparty/chromium/ui/gl/BUILD.gn ++++ b/src/3rdparty/chromium/ui/gl/BUILD.gn +@@ -219,7 +219,7 @@ jumbo_component("gl") { + ] + } + +- if (is_posix && !is_fuchsia && !is_mac) { ++ if (is_posix && !is_fuchsia && !is_mac && !is_haiku) { + # Windows has USE_EGL but doesn't support base::FileDescriptor. + # libsync isn't supported or needed on MacOSX. + # Fuchsia is excluded due to a libsync dependency and because it's +diff --git a/src/3rdparty/chromium/ui/gl/features.gni b/src/3rdparty/chromium/ui/gl/features.gni +index a5710b6..b9cfe4e 100644 +--- a/src/3rdparty/chromium/ui/gl/features.gni ++++ b/src/3rdparty/chromium/ui/gl/features.gni +@@ -13,7 +13,7 @@ declare_args() { + + # Should EGL support be compiled? + # Can be overriden to test during bring up of EGL support on other platforms. +- use_egl = is_win || is_android || is_linux || is_fuchsia || is_mac ++ use_egl = is_win || is_android || is_linux || is_fuchsia || is_mac || is_haiku + + # Should Dawn support be compiled to back the WebGPU implementation? + # Also controls linking Dawn depedencies in such as SPIRV-Tools/SPIRV-Cross. +diff --git a/src/3rdparty/chromium/ui/gl/init/BUILD.gn b/src/3rdparty/chromium/ui/gl/init/BUILD.gn +index 921e567..abadb15 100644 +--- a/src/3rdparty/chromium/ui/gl/init/BUILD.gn ++++ b/src/3rdparty/chromium/ui/gl/init/BUILD.gn +@@ -71,5 +71,14 @@ jumbo_component("init") { + ] + + deps += [ "//ui/ozone" ] ++ } else if (is_haiku) { ++ sources += [ ++ "gl_factory_haiku.cc", ++ "gl_initializer_haiku.cc", ++ ] ++ deps += [ ++ "//ui/gl:gl_features", ++ ] ++ libs = [ "GL" ] + } + } +diff --git a/src/3rdparty/chromium/ui/gl/init/gl_factory_haiku.cc b/src/3rdparty/chromium/ui/gl/init/gl_factory_haiku.cc +new file mode 100644 +index 0000000..945e254 +--- /dev/null ++++ b/src/3rdparty/chromium/ui/gl/init/gl_factory_haiku.cc +@@ -0,0 +1,157 @@ ++// Copyright 2016 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 "ui/gl/init/gl_factory.h" ++ ++#include "base/trace_event/trace_event.h" ++#include "ui/gl/gl_context.h" ++#include "ui/gl/gl_context_egl.h" ++#include "ui/gl/gl_context_osmesa.h" ++#include "ui/gl/gl_context_stub.h" ++#include "ui/gl/gl_egl_api_implementation.h" ++#include "ui/gl/gl_implementation.h" ++#include "ui/gl/gl_share_group.h" ++#include "ui/gl/gl_surface.h" ++#include "ui/gl/gl_surface_egl.h" ++#include "ui/gl/gl_surface_osmesa.h" ++#include "ui/gl/gl_surface_stub.h" ++ ++namespace gl { ++namespace init { ++ ++std::vector GetAllowedGLImplementations() { ++ std::vector impls; ++ //impls.push_back(kGLImplementationDesktopGL); ++ impls.push_back(kGLImplementationEGLGLES2); ++ impls.push_back(kGLImplementationOSMesaGL); ++ impls.push_back(kGLImplementationSwiftShaderGL); ++ return impls; ++} ++ ++bool GetGLWindowSystemBindingInfo(GLWindowSystemBindingInfo* info) { ++ switch (GetGLImplementation()) { ++ case kGLImplementationDesktopGL: ++ case kGLImplementationEGLGLES2: ++ return GetGLWindowSystemBindingInfoEGL(info); ++ default: ++ return false; ++ } ++} ++ ++scoped_refptr CreateGLContext(GLShareGroup* share_group, ++ GLSurface* compatible_surface, ++ const GLContextAttribs& attribs) { ++ TRACE_EVENT0("gpu", "gl::init::CreateGLContext"); ++ switch (GetGLImplementation()) { ++ case kGLImplementationOSMesaGL: ++ return InitializeGLContext(new GLContextOSMesa(share_group), ++ compatible_surface, attribs); ++ case kGLImplementationDesktopGL: ++ case kGLImplementationSwiftShaderGL: ++ case kGLImplementationEGLGLES2: ++ return InitializeGLContext(new GLContextEGL(share_group), ++ compatible_surface, attribs); ++ case kGLImplementationMockGL: ++ return new GLContextStub(share_group); ++ case kGLImplementationStubGL: { ++ scoped_refptr stub_context = ++ new GLContextStub(share_group); ++ stub_context->SetUseStubApi(true); ++ return stub_context; ++ } ++ default: ++ NOTREACHED(); ++ return nullptr; ++ } ++} ++ ++#ifndef TOOLKIT_QT ++scoped_refptr CreateViewGLSurface(gfx::AcceleratedWidget window) { ++ TRACE_EVENT0("gpu", "gl::init::CreateViewGLSurface"); ++ switch (GetGLImplementation()) { ++ case kGLImplementationOSMesaGL: ++ return InitializeGLSurface(new GLSurfaceOSMesaX11(window)); ++ case kGLImplementationDesktopGL: ++ return InitializeGLSurface(new GLSurfaceGLXX11(window)); ++ case kGLImplementationSwiftShaderGL: ++ case kGLImplementationEGLGLES2: ++ DCHECK(window != gfx::kNullAcceleratedWidget); ++ return InitializeGLSurface(new NativeViewGLSurfaceEGLX11(window)); ++ case kGLImplementationMockGL: ++ case kGLImplementationStubGL: ++ return new GLSurfaceStub; ++ default: ++ NOTREACHED(); ++ return nullptr; ++ } ++} ++ ++scoped_refptr CreateOffscreenGLSurfaceWithFormat( ++ const gfx::Size& size, GLSurfaceFormat format) { ++ TRACE_EVENT0("gpu", "gl::init::CreateOffscreenGLSurface"); ++ switch (GetGLImplementation()) { ++ case kGLImplementationOSMesaGL: ++ format.SetDefaultPixelLayout(GLSurfaceFormat::PIXEL_LAYOUT_RGBA); ++ return InitializeGLSurfaceWithFormat( ++ new GLSurfaceOSMesa(format, size), format); ++ case kGLImplementationDesktopGL: ++ return InitializeGLSurfaceWithFormat( ++ new UnmappedNativeViewGLSurfaceGLX(size), format); ++ case kGLImplementationSwiftShaderGL: ++ case kGLImplementationEGLGLES2: ++ if (GLSurfaceEGL::IsEGLSurfacelessContextSupported() && ++ size.width() == 0 && size.height() == 0) { ++ return InitializeGLSurfaceWithFormat(new SurfacelessEGL(size), format); ++ } else { ++ return InitializeGLSurfaceWithFormat(new PbufferGLSurfaceEGL(size), ++ format); ++ } ++ case kGLImplementationMockGL: ++ case kGLImplementationStubGL: ++ return new GLSurfaceStub; ++ default: ++ NOTREACHED(); ++ return nullptr; ++ } ++} ++#endif ++ ++void SetDisabledExtensionsPlatform(const std::string& disabled_extensions) { ++ GLImplementation implementation = GetGLImplementation(); ++ DCHECK_NE(kGLImplementationNone, implementation); ++ switch (implementation) { ++ case kGLImplementationDesktopGL: ++ case kGLImplementationEGLGLES2: ++ SetDisabledExtensionsEGL(disabled_extensions); ++ break; ++ case kGLImplementationSwiftShaderGL: ++ case kGLImplementationOSMesaGL: ++ case kGLImplementationMockGL: ++ case kGLImplementationStubGL: ++ break; ++ default: ++ NOTREACHED(); ++ } ++} ++ ++bool InitializeExtensionSettingsOneOffPlatform() { ++ GLImplementation implementation = GetGLImplementation(); ++ DCHECK_NE(kGLImplementationNone, implementation); ++ switch (implementation) { ++ case kGLImplementationDesktopGL: ++ case kGLImplementationEGLGLES2: ++ return InitializeExtensionSettingsOneOffEGL(); ++ case kGLImplementationSwiftShaderGL: ++ case kGLImplementationOSMesaGL: ++ case kGLImplementationMockGL: ++ case kGLImplementationStubGL: ++ return true; ++ default: ++ NOTREACHED(); ++ return false; ++ } ++} ++ ++} // namespace init ++} // namespace gl +diff --git a/src/3rdparty/chromium/ui/gl/init/gl_initializer_haiku.cc b/src/3rdparty/chromium/ui/gl/init/gl_initializer_haiku.cc +new file mode 100644 +index 0000000..e828e50 +--- /dev/null ++++ b/src/3rdparty/chromium/ui/gl/init/gl_initializer_haiku.cc +@@ -0,0 +1,174 @@ ++// Copyright 2016 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 "ui/gl/init/gl_initializer.h" ++ ++#include "base/command_line.h" ++#include "base/logging.h" ++#include "base/path_service.h" ++#include "base/threading/thread_restrictions.h" ++#include "build/build_config.h" ++#include "ui/gfx/switches.h" ++#include "ui/gl/gl_bindings.h" ++#include "ui/gl/gl_egl_api_implementation.h" ++#include "ui/gl/gl_features.h" ++#include "ui/gl/gl_gl_api_implementation.h" ++#include "ui/gl/gl_implementation_osmesa.h" ++#include "ui/gl/gl_osmesa_api_implementation.h" ++#include "ui/gl/gl_surface_egl.h" ++#include "ui/gl/gl_switches.h" ++ ++namespace gl { ++namespace init { ++ ++namespace { ++ ++#if defined(OS_OPENBSD) || defined(OS_HAIKU) ++const char kGLLibraryName[] = "libGL.so"; ++#else ++const char kGLLibraryName[] = "libGL.so.1"; ++#endif ++ ++const char kGLESv2LibraryName[] = "libGLESv2.so.2"; ++const char kEGLLibraryName[] = "libEGL.so.1"; ++ ++const char kGLESv2ANGLELibraryName[] = "libGLESv2.so"; ++const char kEGLANGLELibraryName[] = "libEGL.so"; ++ ++#if BUILDFLAG(ENABLE_SWIFTSHADER) ++const char kGLESv2SwiftShaderLibraryName[] = "libGLESv2.so"; ++const char kEGLSwiftShaderLibraryName[] = "libEGL.so"; ++#endif ++ ++bool InitializeStaticEGLInternal(GLImplementation implementation) { ++ base::FilePath glesv2_path(kGLESv2LibraryName); ++ base::FilePath egl_path(kEGLLibraryName); ++ ++ const base::CommandLine* cmd = base::CommandLine::ForCurrentProcess(); ++ ++ if (implementation == kGLImplementationSwiftShaderGL) { ++#if BUILDFLAG(ENABLE_SWIFTSHADER) ++ base::FilePath module_path; ++ if (!base::PathService::Get(base::DIR_MODULE, &module_path)) ++ return false; ++ module_path = module_path.Append("swiftshader/"); ++ ++ glesv2_path = module_path.Append(kGLESv2SwiftShaderLibraryName); ++ egl_path = module_path.Append(kEGLSwiftShaderLibraryName); ++#else ++ return false; ++#endif ++ } else if (cmd->GetSwitchValueASCII(switches::kUseGL) == ++ kGLImplementationANGLEName) { ++ base::FilePath module_path; ++ if (!base::PathService::Get(base::DIR_MODULE, &module_path)) ++ return false; ++ ++ glesv2_path = module_path.Append(kGLESv2ANGLELibraryName); ++ egl_path = module_path.Append(kEGLANGLELibraryName); ++ } ++ ++ base::NativeLibrary gles_library = LoadLibraryAndPrintError(glesv2_path); ++ if (!gles_library) ++ return false; ++ base::NativeLibrary egl_library = LoadLibraryAndPrintError(egl_path); ++ if (!egl_library) { ++ base::UnloadNativeLibrary(gles_library); ++ return false; ++ } ++ ++ GLGetProcAddressProc get_proc_address = ++ reinterpret_cast( ++ base::GetFunctionPointerFromNativeLibrary(egl_library, ++ "eglGetProcAddress")); ++ if (!get_proc_address) { ++ LOG(ERROR) << "eglGetProcAddress not found."; ++ base::UnloadNativeLibrary(egl_library); ++ base::UnloadNativeLibrary(gles_library); ++ return false; ++ } ++ ++ SetGLGetProcAddressProc(get_proc_address); ++ AddGLNativeLibrary(egl_library); ++ AddGLNativeLibrary(gles_library); ++ SetGLImplementation(kGLImplementationEGLGLES2); ++ ++ InitializeStaticGLBindingsGL(); ++ InitializeStaticGLBindingsEGL(); ++ ++ return true; ++} ++ ++} // namespace ++ ++#if !defined(TOOLKIT_QT) ++bool InitializeGLOneOffPlatform() { ++ const base::CommandLine* command_line = ++ base::CommandLine::ForCurrentProcess(); ++ if (command_line->HasSwitch(switches::kHeadless) && ++ command_line->GetSwitchValueASCII(switches::kUseGL) == ++ kGLImplementationOSMesaName) ++ return true; ++ ++ switch (GetGLImplementation()) { ++ case kGLImplementationDesktopGL: ++ return true; ++ case kGLImplementationOSMesaGL: ++ return true; ++ case kGLImplementationSwiftShaderGL: ++ case kGLImplementationEGLGLES2: ++ /*if (!GLSurfaceEGL::InitializeOneOff(gfx::GetXDisplay())) { ++ LOG(ERROR) << "GLSurfaceEGL::InitializeOneOff failed."; ++ return false; ++ }*/ ++ return true; ++ default: ++ return true; ++ } ++} ++ ++#endif // !defined(TOOLKIT_QT) ++bool InitializeStaticGLBindings(GLImplementation implementation) { ++ // Prevent reinitialization with a different implementation. Once the gpu ++ // unit tests have initialized with kGLImplementationMock, we don't want to ++ // later switch to another GL implementation. ++ DCHECK_EQ(kGLImplementationNone, GetGLImplementation()); ++ ++ // Allow the main thread or another to initialize these bindings ++ // after instituting restrictions on I/O. Going forward they will ++ // likely be used in the browser process on most platforms. The ++ // one-time initialization cost is small, between 2 and 5 ms. ++ base::ThreadRestrictions::ScopedAllowIO allow_io; ++ ++ switch (implementation) { ++ case kGLImplementationOSMesaGL: ++ case kGLImplementationDesktopGL: ++ case kGLImplementationSwiftShaderGL: ++ case kGLImplementationEGLGLES2: ++ return InitializeStaticEGLInternal(implementation); ++ case kGLImplementationMockGL: ++ case kGLImplementationStubGL: ++ SetGLImplementation(implementation); ++ InitializeStaticGLBindingsGL(); ++ return true; ++ default: ++ NOTREACHED(); ++ } ++ ++ return false; ++} ++ ++void InitializeDebugGLBindings() { ++ InitializeDebugGLBindingsEGL(); ++ InitializeDebugGLBindingsGL(); ++} ++ ++void ShutdownGLPlatform() { ++ GLSurfaceEGL::ShutdownOneOff(); ++ ClearBindingsEGL(); ++ ClearBindingsGL(); ++} ++ ++} // namespace init ++} // namespace gl +diff --git a/src/3rdparty/chromium/v8/include/v8config.h b/src/3rdparty/chromium/v8/include/v8config.h +index 40d23c3..5333834 100644 +--- a/src/3rdparty/chromium/v8/include/v8config.h ++++ b/src/3rdparty/chromium/v8/include/v8config.h +@@ -120,6 +120,9 @@ + # define V8_OS_QNX 1 + #elif defined(_WIN32) + # define V8_OS_WIN 1 ++#elif defined(__HAIKU__) ++# define V8_OS_HAIKU 1 ++# define V8_OS_POSIX 1 + #endif + + // ----------------------------------------------------------------------------- +diff --git a/src/3rdparty/chromium/v8/src/base/export-template.h b/src/3rdparty/chromium/v8/src/base/export-template.h +index 861cfe4..4bf4281 100644 +--- a/src/3rdparty/chromium/v8/src/base/export-template.h ++++ b/src/3rdparty/chromium/v8/src/base/export-template.h +@@ -150,6 +150,7 @@ + #export) + #define EXPORT_TEMPLATE_TEST_DEFAULT_DEFAULT(...) true + #define EXPORT_TEMPLATE_TEST_MSVC_HACK_MSVC_HACK(...) true ++#define EXPORT_TEMPLATE_TEST_MSVC_HACK_DEFAULT(...) true + + EXPORT_TEMPLATE_TEST(DEFAULT, ); + EXPORT_TEMPLATE_TEST(DEFAULT, __attribute__((visibility("default")))); +@@ -159,5 +160,6 @@ EXPORT_TEMPLATE_TEST(DEFAULT, __declspec(dllimport)); + #undef EXPORT_TEMPLATE_TEST + #undef EXPORT_TEMPLATE_TEST_DEFAULT_DEFAULT + #undef EXPORT_TEMPLATE_TEST_MSVC_HACK_MSVC_HACK ++#undef EXPORT_TEMPLATE_TEST_MSVC_HACK_DEFAULT + + #endif // V8_BASE_EXPORT_TEMPLATE_H_ +diff --git a/src/3rdparty/chromium/v8/src/base/platform/platform-posix.cc b/src/3rdparty/chromium/v8/src/base/platform/platform-posix.cc +index 1e600c7..676e140 100644 +--- a/src/3rdparty/chromium/v8/src/base/platform/platform-posix.cc ++++ b/src/3rdparty/chromium/v8/src/base/platform/platform-posix.cc +@@ -61,7 +61,7 @@ + #include + #endif + +-#if !defined(_AIX) && !defined(V8_OS_FUCHSIA) ++#if !defined(_AIX) && !defined(V8_OS_FUCHSIA) && !defined(V8_OS_HAIKU) + #include + #endif + +@@ -77,6 +77,11 @@ extern int madvise(caddr_t, size_t, int); + #endif + #endif + ++#if defined(V8_OS_HAIKU) ++#define madvise posix_madvise ++#define MADV_DONTNEED POSIX_MADV_DONTNEED ++#endif ++ + #ifndef MADV_FREE + #define MADV_FREE MADV_DONTNEED + #endif +@@ -134,7 +139,7 @@ int GetProtectionFromMemoryPermission(OS::MemoryPermission access) { + int GetFlagsForMemoryPermission(OS::MemoryPermission access) { + int flags = MAP_PRIVATE | MAP_ANONYMOUS; + if (access == OS::MemoryPermission::kNoAccess) { +-#if !V8_OS_AIX && !V8_OS_FREEBSD && !V8_OS_QNX ++#if !V8_OS_AIX && !V8_OS_FREEBSD && !V8_OS_QNX && !V8_OS_HAIKU + flags |= MAP_NORESERVE; + #endif // !V8_OS_AIX && !V8_OS_FREEBSD && !V8_OS_QNX + #if V8_OS_QNX +diff --git a/src/3rdparty/chromium/v8/src/libsampler/sampler.cc b/src/3rdparty/chromium/v8/src/libsampler/sampler.cc +index e2091ce..c90a9c2 100644 +--- a/src/3rdparty/chromium/v8/src/libsampler/sampler.cc ++++ b/src/3rdparty/chromium/v8/src/libsampler/sampler.cc +@@ -12,7 +12,7 @@ + #include + #include + +-#if !V8_OS_QNX && !V8_OS_AIX ++#if !V8_OS_QNX && !V8_OS_AIX && !V8_OS_HAIKU + #include // NOLINT + #endif + +@@ -20,7 +20,7 @@ + #include + // OpenBSD doesn't have . ucontext_t lives in + // and is a typedef for struct sigcontext. There is no uc_mcontext. +-#elif !V8_OS_OPENBSD ++#elif !V8_OS_OPENBSD && !V8_OS_HAIKU + #include + #endif + +@@ -522,7 +522,21 @@ void SignalHandler::FillRegisterState(void* context, RegisterState* state) { + state->sp = reinterpret_cast(mcontext.jmp_context.gpr[1]); + state->fp = reinterpret_cast(mcontext.jmp_context.gpr[31]); + state->lr = reinterpret_cast(mcontext.jmp_context.lr); +-#endif // V8_OS_AIX ++#elif V8_OS_HAIKU ++#if V8_HOST_ARCH_IA32 ++ state->pc = reinterpret_cast(mcontext.eip); ++ state->sp = reinterpret_cast(mcontext.esp); ++ state->fp = reinterpret_cast(mcontext.ebp); ++#elif V8_HOST_ARCH_X64 ++ state->pc = reinterpret_cast(mcontext.rip); ++ state->sp = reinterpret_cast(mcontext.rsp); ++ state->fp = reinterpret_cast(mcontext.rbp); ++#elif V8_HOST_ARCH_ARM ++ state->pc = reinterpret_cast(mcontext.r15); ++ state->sp = reinterpret_cast(mcontext.r13); ++ state->fp = reinterpret_cast(mcontext.r11); ++#endif // V8_HOST_ARCH_* ++#endif // V8_OS_HAIKU + } + + #endif // USE_SIGNALS +diff --git a/src/buildtools/config/haiku.pri b/src/buildtools/config/haiku.pri +new file mode 100644 +index 0000000..56c18bd +--- /dev/null ++++ b/src/buildtools/config/haiku.pri +@@ -0,0 +1,178 @@ ++include(common.pri) ++include(functions.pri) ++ ++defineReplace(extractCFlag) { ++ return($$qtwebengine_extractCFlag($$1)) ++} ++ ++QT_FOR_CONFIG += gui-private webenginecore-private pdf-private ++ ++gn_args += \ ++ use_cups=false \ ++ use_gio=false \ ++ use_gnome_keyring=false \ ++ linux_use_bundled_binutils=false \ ++ use_udev=true \ ++ use_bundled_fontconfig=false \ ++ use_sysroot=false \ ++ enable_session_service=false \ ++ is_cfi=false \ ++ use_ozone=true \ ++ ozone_auto_platforms=false \ ++ ozone_platform_headless=false \ ++ ozone_platform_external=true \ ++ ozone_platform=\"qt\" \ ++ ozone_extra_path=\"$$QTWEBENGINE_ROOT/src/core/ozone/ozone_extra.gni\" ++ ++use_gold_linker: gn_args += use_gold=true ++else: gn_args += use_gold=false ++ ++use_lld_linker: gn_args += use_lld=true ++else: gn_args += use_lld=false ++ ++clang { ++ clang_full_path = $$which($${QMAKE_CXX}) ++ # Remove the "/bin/clang++" part. ++ clang_prefix = $$section(clang_full_path, /, 0, -3) ++ gn_args += \ ++ is_clang=true \ ++ clang_use_chrome_plugins=false \ ++ clang_use_default_sample_profile=false \ ++ clang_base_path=\"$${clang_prefix}\" ++ ++ linux-clang-libc++: gn_args += use_libcxx=true ++} else { ++ gn_args += \ ++ is_clang=false ++} ++ ++cross_compile:!host_build { ++ TOOLCHAIN_SYSROOT = $$[QT_SYSROOT] ++ !isEmpty(TOOLCHAIN_SYSROOT): gn_args += target_sysroot=\"$${TOOLCHAIN_SYSROOT}\" ++} ++ ++contains(QT_ARCH, "arm") { ++ # Extract ARM specific compiler options that we have to pass to gn, ++ # but let gn figure out a default if an option is not present. ++ MTUNE = $$extractCFlag("-mtune=.*") ++ !isEmpty(MTUNE): gn_args += arm_tune=\"$$MTUNE\" ++ ++ MFLOAT = $$extractCFlag("-mfloat-abi=.*") ++ !isEmpty(MFLOAT): gn_args += arm_float_abi=\"$$MFLOAT\" ++ ++ MARCH = $$extractCFlag("-march=.*") ++ !isEmpty(MARCH): gn_args += arm_arch=\"$$MARCH\" ++ ++ MARMV = $$replace(MARCH, "armv",) ++ !isEmpty(MARMV) { ++ MARMV = $$split(MARMV,) ++ MARMV = $$member(MARMV, 0) ++ lessThan(MARMV, 6): error("$$MARCH architecture is not supported") ++ gn_args += arm_version=$$MARMV ++ } ++ ++ # TODO: use neon detection from qtbase ++ !lessThan(MARMV, 8) { ++ gn_args += arm_use_neon=true ++ } else { ++ MFPU = $$extractCFlag("-mfpu=.*") ++ !isEmpty(MFPU):contains(MFPU, ".*neon.*") { ++ gn_args += arm_use_neon=true ++ } else { ++ gn_args += arm_use_neon=false ++ # If the toolchain does not explicitly specify to use NEON instructions ++ # we use arm_neon_optional for ARMv7 ++ equals(MARMV, 7): gn_args += arm_optionally_use_neon=true ++ } ++ } ++ ++ qtConfig(webengine-arm-thumb) { ++ gn_args += arm_use_thumb=true # this adds -mthumb ++ } else { ++ gn_args += arm_use_thumb=false ++ !qtConfig(webengine-system-ffmpeg) { ++ # Fixme QTBUG-71772 ++ gn_args += media_use_ffmpeg=false ++ gn_args += use_webaudio_ffmpeg=false ++ } ++ } ++} ++ ++contains(QT_ARCH, "mips") { ++ MARCH = $$extractCFlag("-march=.*") ++ !isEmpty(MARCH) { ++ equals(MARCH, "mips32r6"): gn_args += mips_arch_variant=\"r6\" ++ else: equals(MARCH, "mips32r2"): gn_args += mips_arch_variant=\"r2\" ++ else: equals(MARCH, "mips32"): gn_args += mips_arch_variant=\"r1\" ++ } else { ++ contains(QMAKE_CFLAGS, "mips32r6"): gn_args += mips_arch_variant=\"r6\" ++ else: contains(QMAKE_CFLAGS, "mips32r2"): gn_args += mips_arch_variant=\"r2\" ++ else: contains(QMAKE_CFLAGS, "mips32"): gn_args += mips_arch_variant=\"r1\" ++ } ++ ++ contains(QMAKE_CFLAGS, "-mmsa"): gn_args += mips_use_msa=true ++ ++ contains(QMAKE_CFLAGS, "-mdsp2"): gn_args += mips_dsp_rev=2 ++ else: contains(QMAKE_CFLAGS, "-mdsp"): gn_args += mips_dsp_rev=1 ++} ++ ++host_build { ++ gn_args += custom_toolchain=\"$$QTWEBENGINE_OUT_ROOT/src/toolchain:host\" ++ GN_HOST_CPU = $$gnArch($$QT_ARCH) ++ gn_args += host_cpu=\"$$GN_HOST_CPU\" ++ # Don't bother trying to use system libraries in this case ++ gn_args += use_glib=false ++} else { ++ gn_args += custom_toolchain=\"$$QTWEBENGINE_OUT_ROOT/src/toolchain:target\" ++ gn_args += host_toolchain=\"$$QTWEBENGINE_OUT_ROOT/src/toolchain:host\" ++ GN_TARGET_CPU = $$gnArch($$QT_ARCH) ++ cross_compile { ++ gn_args += v8_snapshot_toolchain=\"$$QTWEBENGINE_OUT_ROOT/src/toolchain:v8_snapshot\" ++ # FIXME: we should set host_cpu in case host-toolchain doesn't match os arch, ++ # but currently we don't it available at this point ++ gn_args += target_cpu=\"$$GN_TARGET_CPU\" ++ } else { ++ gn_args += host_cpu=\"$$GN_TARGET_CPU\" ++ } ++ !contains(QT_CONFIG, no-pkg-config) { ++ # Strip '>2 /dev/null' from $$pkgConfigExecutable() ++ PKGCONFIG = $$first($$list($$pkgConfigExecutable())) ++ gn_args += pkg_config=\"$$PKGCONFIG\" ++ PKG_CONFIG_HOST = $$(GN_PKG_CONFIG_HOST) ++ pkgConfigLibDir = $$(PKG_CONFIG_LIBDIR) ++ pkgConfigSysrootDir = $$(PKG_CONFIG_SYSROOT_DIR) ++ isEmpty(PKG_CONFIG_HOST): cross_compile { ++ !isEmpty(pkgConfigLibDir)|!isEmpty(pkgConfigSysrootDir) { ++ PKG_CONFIG_HOST = $$pkgConfigHostExecutable() ++ } ++ } ++ isEmpty(PKG_CONFIG_HOST): PKG_CONFIG_HOST = $$QMAKE_PKG_CONFIG_HOST ++ gn_args += host_pkg_config=\"$$PKG_CONFIG_HOST\" ++ } ++ ++ qtConfig(webengine-system-zlib) { ++ qtConfig(webengine-system-minizip): gn_args += use_system_zlib=true use_system_minizip=true ++ gn_args += pdfium_use_system_zlib=true ++ } ++ ++ qtConfig(webengine-system-png) { ++ gn_args += use_system_libpng=true pdfium_use_system_libpng=true ++ } ++ ++ qtConfig(webengine-system-jpeg) { ++ gn_args += use_system_libjpeg=true ++ } else { ++ gn_args += use_system_libjpeg=false ++ } ++ qtConfig(webengine-system-freetype) { ++ gn_args += use_system_freetype=true ++ } else { ++ gn_args += use_system_freetype=false ++ } ++ qtConfig(webengine-system-harfbuzz) { ++ gn_args += use_system_harfbuzz=true ++ } else { ++ gn_args += use_system_harfbuzz=false ++ } ++ gn_args += use_glib=false ++} +diff --git a/src/buildtools/config/linking.pri b/src/buildtools/config/linking.pri +index f295e2c..caf1961 100644 +--- a/src/buildtools/config/linking.pri ++++ b/src/buildtools/config/linking.pri +@@ -34,7 +34,7 @@ if(macos|ios) { + } + } + +-linux { ++if(linux|haiku) { + !static { + QMAKE_LFLAGS += @$${RSP_OBJECT_FILE} + QMAKE_LFLAGS += -Wl,--start-group @$${RSP_ARCHIVE_FILE} -Wl,--end-group +diff --git a/src/buildtools/configure.json b/src/buildtools/configure.json +index 1ca6214..9944b31 100644 +--- a/src/buildtools/configure.json ++++ b/src/buildtools/configure.json +@@ -485,7 +485,6 @@ + }, + "webengine-system-gn": { + "label": "Use System Gn", +- "autoDetect": "false", + "condition": "tests.webengine-gn", + "output": [ "privateFeature" ] + }, +diff --git a/src/core/config/haiku.pri b/src/core/config/haiku.pri +new file mode 100644 +index 0000000..82139a4 +--- /dev/null ++++ b/src/core/config/haiku.pri +@@ -0,0 +1,26 @@ ++include(common.pri) ++ ++!host_build{ ++ gn_args += use_pulseaudio=false ++ gn_args += use_alsa=false ++ ++ !packagesExist(libpci): gn_args += use_libpci=false ++ ++ qtConfig(webengine-webrtc): qtConfig(webengine-webrtc-pipewire): gn_args += rtc_use_pipewire=true ++ ++ qtConfig(webengine-system-libevent): gn_args += use_system_libevent=true ++ qtConfig(webengine-system-libwebp): gn_args += use_system_libwebp=true ++ qtConfig(webengine-system-libxml2): gn_args += use_system_libxml=true use_system_libxslt=true ++ qtConfig(webengine-system-opus): gn_args += use_system_opus=true ++ qtConfig(webengine-system-snappy): gn_args += use_system_snappy=true ++ qtConfig(webengine-system-libvpx): gn_args += use_system_libvpx=true ++ qtConfig(webengine-system-icu): gn_args += use_system_icu=true icu_use_data_file=false ++ qtConfig(webengine-system-ffmpeg): gn_args += use_system_ffmpeg=true ++ qtConfig(webengine-system-re2): gn_args += use_system_re2=true ++ qtConfig(webengine-system-lcms2): gn_args += use_system_lcms2=true ++ ++ # FIXME: ++ #qtConfig(webengine-system-protobuf): gn_args += use_system_protobuf=true ++ #qtConfig(webengine-system-jsoncpp): gn_args += use_system_jsoncpp=true ++ #qtConfig(webengine-system-libsrtp: gn_args += use_system_libsrtp=true ++} +-- +2.30.2 + + +From 93e009ea227f651ba5316af9a577872f529dbc21 Mon Sep 17 00:00:00 2001 +From: Jerome Duval +Date: Sat, 30 Jan 2021 14:10:47 +0100 +Subject: Patch from FreeBSD + + +diff --git a/configure.pri b/configure.pri +index d3ba9b1..6e864e6 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 6b36b3d..4146314 100644 +--- a/mkspecs/features/functions.prf ++++ b/mkspecs/features/functions.prf +@@ -84,6 +84,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) + } +@@ -114,6 +118,7 @@ defineReplace(gnOS) { + macos: return(mac) + win32: return(win) + linux: return(linux) ++ haiku: return(haiku) + error(Unsupported platform) + return(unknown) + } +diff --git a/src/buildtools/buildtools.pro b/src/buildtools/buildtools.pro +index 1366d18..d6fbdfd 100644 +--- a/src/buildtools/buildtools.pro ++++ b/src/buildtools/buildtools.pro +@@ -1,6 +1,6 @@ + TEMPLATE = subdirs + +-linux { ++unix { + # configure_host.pro and configure_target.pro are phony pro files that + # extract things like compiler and linker from qmake. + # Only used on Linux as it is only important for cross-building and alternative compilers. +diff --git a/src/buildtools/config/haiku.pri b/src/buildtools/config/haiku.pri +index 56c18bd..340bdd7 100644 +--- a/src/buildtools/config/haiku.pri ++++ b/src/buildtools/config/haiku.pri +@@ -1,178 +1,8 @@ +-include(common.pri) +-include(functions.pri) +- +-defineReplace(extractCFlag) { +- return($$qtwebengine_extractCFlag($$1)) +-} +- +-QT_FOR_CONFIG += gui-private webenginecore-private pdf-private +- ++include(linux.pri) + gn_args += \ +- use_cups=false \ +- use_gio=false \ +- use_gnome_keyring=false \ +- linux_use_bundled_binutils=false \ +- use_udev=true \ +- use_bundled_fontconfig=false \ +- use_sysroot=false \ +- enable_session_service=false \ +- is_cfi=false \ +- use_ozone=true \ +- ozone_auto_platforms=false \ +- ozone_platform_headless=false \ +- ozone_platform_external=true \ +- ozone_platform=\"qt\" \ +- ozone_extra_path=\"$$QTWEBENGINE_ROOT/src/core/ozone/ozone_extra.gni\" +- +-use_gold_linker: gn_args += use_gold=true +-else: gn_args += use_gold=false +- +-use_lld_linker: gn_args += use_lld=true +-else: gn_args += use_lld=false +- +-clang { +- clang_full_path = $$which($${QMAKE_CXX}) +- # Remove the "/bin/clang++" part. +- clang_prefix = $$section(clang_full_path, /, 0, -3) +- gn_args += \ +- is_clang=true \ +- clang_use_chrome_plugins=false \ +- clang_use_default_sample_profile=false \ +- clang_base_path=\"$${clang_prefix}\" +- +- linux-clang-libc++: gn_args += use_libcxx=true +-} else { +- gn_args += \ +- is_clang=false +-} +- +-cross_compile:!host_build { +- TOOLCHAIN_SYSROOT = $$[QT_SYSROOT] +- !isEmpty(TOOLCHAIN_SYSROOT): gn_args += target_sysroot=\"$${TOOLCHAIN_SYSROOT}\" +-} +- +-contains(QT_ARCH, "arm") { +- # Extract ARM specific compiler options that we have to pass to gn, +- # but let gn figure out a default if an option is not present. +- MTUNE = $$extractCFlag("-mtune=.*") +- !isEmpty(MTUNE): gn_args += arm_tune=\"$$MTUNE\" +- +- MFLOAT = $$extractCFlag("-mfloat-abi=.*") +- !isEmpty(MFLOAT): gn_args += arm_float_abi=\"$$MFLOAT\" +- +- MARCH = $$extractCFlag("-march=.*") +- !isEmpty(MARCH): gn_args += arm_arch=\"$$MARCH\" +- +- MARMV = $$replace(MARCH, "armv",) +- !isEmpty(MARMV) { +- MARMV = $$split(MARMV,) +- MARMV = $$member(MARMV, 0) +- lessThan(MARMV, 6): error("$$MARCH architecture is not supported") +- gn_args += arm_version=$$MARMV +- } +- +- # TODO: use neon detection from qtbase +- !lessThan(MARMV, 8) { +- gn_args += arm_use_neon=true +- } else { +- MFPU = $$extractCFlag("-mfpu=.*") +- !isEmpty(MFPU):contains(MFPU, ".*neon.*") { +- gn_args += arm_use_neon=true +- } else { +- gn_args += arm_use_neon=false +- # If the toolchain does not explicitly specify to use NEON instructions +- # we use arm_neon_optional for ARMv7 +- equals(MARMV, 7): gn_args += arm_optionally_use_neon=true +- } +- } +- +- qtConfig(webengine-arm-thumb) { +- gn_args += arm_use_thumb=true # this adds -mthumb +- } else { +- gn_args += arm_use_thumb=false +- !qtConfig(webengine-system-ffmpeg) { +- # Fixme QTBUG-71772 +- gn_args += media_use_ffmpeg=false +- gn_args += use_webaudio_ffmpeg=false +- } +- } +-} +- +-contains(QT_ARCH, "mips") { +- MARCH = $$extractCFlag("-march=.*") +- !isEmpty(MARCH) { +- equals(MARCH, "mips32r6"): gn_args += mips_arch_variant=\"r6\" +- else: equals(MARCH, "mips32r2"): gn_args += mips_arch_variant=\"r2\" +- else: equals(MARCH, "mips32"): gn_args += mips_arch_variant=\"r1\" +- } else { +- contains(QMAKE_CFLAGS, "mips32r6"): gn_args += mips_arch_variant=\"r6\" +- else: contains(QMAKE_CFLAGS, "mips32r2"): gn_args += mips_arch_variant=\"r2\" +- else: contains(QMAKE_CFLAGS, "mips32"): gn_args += mips_arch_variant=\"r1\" +- } +- +- contains(QMAKE_CFLAGS, "-mmsa"): gn_args += mips_use_msa=true +- +- contains(QMAKE_CFLAGS, "-mdsp2"): gn_args += mips_dsp_rev=2 +- else: contains(QMAKE_CFLAGS, "-mdsp"): gn_args += mips_dsp_rev=1 +-} +- +-host_build { +- gn_args += custom_toolchain=\"$$QTWEBENGINE_OUT_ROOT/src/toolchain:host\" +- GN_HOST_CPU = $$gnArch($$QT_ARCH) +- gn_args += host_cpu=\"$$GN_HOST_CPU\" +- # Don't bother trying to use system libraries in this case +- gn_args += use_glib=false +-} else { +- gn_args += custom_toolchain=\"$$QTWEBENGINE_OUT_ROOT/src/toolchain:target\" +- gn_args += host_toolchain=\"$$QTWEBENGINE_OUT_ROOT/src/toolchain:host\" +- GN_TARGET_CPU = $$gnArch($$QT_ARCH) +- cross_compile { +- gn_args += v8_snapshot_toolchain=\"$$QTWEBENGINE_OUT_ROOT/src/toolchain:v8_snapshot\" +- # FIXME: we should set host_cpu in case host-toolchain doesn't match os arch, +- # but currently we don't it available at this point +- gn_args += target_cpu=\"$$GN_TARGET_CPU\" +- } else { +- gn_args += host_cpu=\"$$GN_TARGET_CPU\" +- } +- !contains(QT_CONFIG, no-pkg-config) { +- # Strip '>2 /dev/null' from $$pkgConfigExecutable() +- PKGCONFIG = $$first($$list($$pkgConfigExecutable())) +- gn_args += pkg_config=\"$$PKGCONFIG\" +- PKG_CONFIG_HOST = $$(GN_PKG_CONFIG_HOST) +- pkgConfigLibDir = $$(PKG_CONFIG_LIBDIR) +- pkgConfigSysrootDir = $$(PKG_CONFIG_SYSROOT_DIR) +- isEmpty(PKG_CONFIG_HOST): cross_compile { +- !isEmpty(pkgConfigLibDir)|!isEmpty(pkgConfigSysrootDir) { +- PKG_CONFIG_HOST = $$pkgConfigHostExecutable() +- } +- } +- isEmpty(PKG_CONFIG_HOST): PKG_CONFIG_HOST = $$QMAKE_PKG_CONFIG_HOST +- gn_args += host_pkg_config=\"$$PKG_CONFIG_HOST\" +- } +- +- qtConfig(webengine-system-zlib) { +- qtConfig(webengine-system-minizip): gn_args += use_system_zlib=true use_system_minizip=true +- gn_args += pdfium_use_system_zlib=true +- } +- +- qtConfig(webengine-system-png) { +- gn_args += use_system_libpng=true pdfium_use_system_libpng=true +- } ++ enable_basic_printing=true \ ++ enable_print_preview=true \ ++ use_dbus=true \ ++ use_udev=false + +- qtConfig(webengine-system-jpeg) { +- gn_args += use_system_libjpeg=true +- } else { +- gn_args += use_system_libjpeg=false +- } +- qtConfig(webengine-system-freetype) { +- gn_args += use_system_freetype=true +- } else { +- gn_args += use_system_freetype=false +- } +- qtConfig(webengine-system-harfbuzz) { +- gn_args += use_system_harfbuzz=true +- } else { +- gn_args += use_system_harfbuzz=false +- } +- gn_args += use_glib=false +-} ++gn_args += use_system_yasm=true +diff --git a/src/buildtools/config/linking.pri b/src/buildtools/config/linking.pri +index caf1961..90d63b0 100644 +--- a/src/buildtools/config/linking.pri ++++ b/src/buildtools/config/linking.pri +@@ -34,7 +34,7 @@ if(macos|ios) { + } + } + +-if(linux|haiku) { ++if(unix) { + !static { + QMAKE_LFLAGS += @$${RSP_OBJECT_FILE} + QMAKE_LFLAGS += -Wl,--start-group @$${RSP_ARCHIVE_FILE} -Wl,--end-group +@@ -60,7 +60,7 @@ LIBS_PRIVATE += $$NINJA_LIB_DIRS $$NINJA_LIBS + + unix:qtConfig(webengine-noexecstack): \ + QMAKE_LFLAGS += -Wl,-z,noexecstack +-linux { ++unix { + # add chromium flags + for(flag, NINJA_LFLAGS) { + # filter out some flags +diff --git a/src/buildtools/config/support.pri b/src/buildtools/config/support.pri +index e192f87..fd41a1e 100644 +--- a/src/buildtools/config/support.pri ++++ b/src/buildtools/config/support.pri +@@ -5,7 +5,7 @@ defineTest(qtwebengine_skipBuild) { + + # this should match webengine-core-support + defineReplace(qtwebengine_checkWebEngineCoreError) { +- !linux:!win32:!macos { ++ !linux:!win32:!macos:!unix { + qtwebengine_skipBuild("QtWebEngine can be built only on Linux, Windows or macOS.") + return(false) + } +@@ -23,14 +23,14 @@ defineReplace(qtwebengine_checkWebEngineCoreError) { + !qtwebengine_checkForFlex(QtWebEngine):return(false) + !qtwebengine_checkForPython2(QtWebengine):return(false) + !qtwebengine_checkForSanitizer(QtWebEngine):return(false) +- linux:!qtwebengine_checkForPkgCfg(QtWebEngine):return(false) +- linux:!qtwebengine_checkForHostPkgCfg(QtWebEngine):return(false) ++ unix:!qtwebengine_checkForPkgCfg(QtWebEngine):return(false) ++ unix:!qtwebengine_checkForHostPkgCfg(QtWebEngine):return(false) + linux:!qtwebengine_checkForGlibc(QtWebEngine):return(false) +- linux:!qtwebengine_checkForKhronos(QtWebEngine):return(false) +- linux:!qtwebengine_checkForPackage(QtWebEngine,nss):return(false) +- linux:!qtwebengine_checkForPackage(QtWebEngine,dbus):return(false) +- linux:!qtwebengine_checkForPackage(QtWebEngine,fontconfig):return(false) +- linux:!qtwebengine_checkForQpaXcb(QtWebEngine):return(false) ++ unix:!qtwebengine_checkForKhronos(QtWebEngine):return(false) ++ unix:!qtwebengine_checkForPackage(QtWebEngine,nss):return(false) ++ unix:!qtwebengine_checkForPackage(QtWebEngine,dbus):return(false) ++ unix:!qtwebengine_checkForPackage(QtWebEngine,fontconfig):return(false) ++ unix:!qtwebengine_checkForQpaXcb(QtWebEngine):return(false) + win32:!qtwebengine_checkForCompiler64(QtWebEngine):return(false) + win32:!qtwebengine_checkForWinVersion(QtWebEngine):return(false) + return(true) +@@ -38,7 +38,7 @@ defineReplace(qtwebengine_checkWebEngineCoreError) { + + # this shuold match webengine-qtpdf-support + defineReplace(qtwebengine_checkPdfError) { +- !linux:!win32:!macos:!ios { ++ !linux:!win32:!macos:!ios:!unix { + qtwebengine_skipBuild("QtPdf can be built only on Linux, Windows, macOS or iOS.") + return(false) + } +@@ -52,8 +52,8 @@ defineReplace(qtwebengine_checkPdfError) { + !qtwebengine_checkForFlex(QtPdf):return(false) + !qtwebengine_checkForPython2(QtPdf):return(false) + !qtwebengine_checkForSanitizer(QtPdf):return(false) +- linux:!qtwebengine_checkForPkgCfg(QtPdf):return(false) +- linux:!qtwebengine_checkForHostPkgCfg(QtPdf):return(false) ++ unix:!qtwebengine_checkForPkgCfg(QtPdf):return(false) ++ unix:!qtwebengine_checkForHostPkgCfg(QtPdf):return(false) + win32:!qtwebengine_checkForWinVersion(QtPdf):return(false) + return(true) + } +diff --git a/src/buildtools/configure.json b/src/buildtools/configure.json +index 9944b31..43f6669 100644 +--- a/src/buildtools/configure.json ++++ b/src/buildtools/configure.json +@@ -362,7 +362,7 @@ + "features": { + "webengine-core-support": { + "label": "Support Qt WebEngine Core", +- "condition": "(config.linux || config.win32 || config.macos) ++ "condition": "(config.unix || config.win32 || config.macos) + && !config.static + && module.gui + && features.webengine-submodule +@@ -374,21 +374,21 @@ + && features.webengine-flex + && features.webengine-python2 + && (!config.sanitizer || features.webengine-sanitizer) +- && (!config.linux || features.pkg-config) +- && (!config.linux || features.webengine-host-pkg-config) ++ && (!config.unix || features.pkg-config) ++ && (!config.unix || features.webengine-host-pkg-config) + && (!config.linux || features.webengine-system-glibc) +- && (!config.linux || features.webengine-system-khr) +- && (!config.linux || features.webengine-system-nss) +- && (!config.linux || features.webengine-system-dbus) +- && (!config.linux || features.webengine-system-fontconfig) +- && (!config.linux || !features.pkg-config || !features.xcb || features.webengine-ozone-x11) ++ && (!config.unix || features.webengine-system-khr) ++ && (!config.unix || features.webengine-system-nss) ++ && (!config.unix || features.webengine-system-dbus) ++ && (!config.unix || features.webengine-system-fontconfig) ++ && (!config.unix || !features.pkg-config || !features.xcb || features.webengine-ozone-x11) + && (!config.win32 || features.webengine-win-compiler64) + && (!config.win32 || features.webengine-winversion)", + "output": [ "privateFeature" ] + }, + "webengine-qtpdf-support": { + "label": "Support Qt Pdf", +- "condition": "(config.linux || config.win32 || config.macos || config.ios) ++ "condition": "(config.unix || config.win32 || config.macos || config.ios) + && module.gui + && features.webengine-submodule + && features.webengine-nowhitespace +diff --git a/src/core/api/core_api.pro b/src/core/api/core_api.pro +index d53fb69..f3a5626 100644 +--- a/src/core/api/core_api.pro ++++ b/src/core/api/core_api.pro +@@ -67,7 +67,7 @@ SOURCES = \ + qwebengineurlschemehandler.cpp + + ### Qt6 Remove this workaround +-unix:!isEmpty(QMAKE_LFLAGS_VERSION_SCRIPT):!static { ++linux:!isEmpty(QMAKE_LFLAGS_VERSION_SCRIPT):!static { + SOURCES += qtbug-60565.cpp \ + qtbug-61521.cpp + } +diff --git a/src/core/core_module.pro b/src/core/core_module.pro +index 3b439e8..1819d7f 100644 +--- a/src/core/core_module.pro ++++ b/src/core/core_module.pro +@@ -41,7 +41,7 @@ QMAKE_INFO_PLIST = Info_mac.plist + # and doesn't let Chromium get access to libc symbols through dlsym. + CONFIG -= bsymbolic_functions + +-linux:qtConfig(separate_debug_info): QMAKE_POST_LINK="cd $(DESTDIR) && $(STRIP) --strip-unneeded $(TARGET)" ++unix:qtConfig(separate_debug_info): QMAKE_POST_LINK="cd $(DESTDIR) && $(STRIP) --strip-unneeded $(TARGET)" + + REPACK_DIR = $$OUT_PWD/$$getConfigDir() + +-- +2.30.2 + + +From 0c7b29cf8c8e415da59959a20d3e162557485a1e Mon Sep 17 00:00:00 2001 +From: Jerome Duval +Date: Sat, 30 Jan 2021 15:52:01 +0100 +Subject: gn patch + + +diff --git a/src/3rdparty/gn/base/files/file.h b/src/3rdparty/gn/base/files/file.h +index 61239ad..4a4485a 100644 +--- a/src/3rdparty/gn/base/files/file.h ++++ b/src/3rdparty/gn/base/files/file.h +@@ -23,7 +23,7 @@ + namespace base { + + #if defined(OS_BSD) || defined(OS_MACOSX) || defined(OS_NACL) || \ +- defined(OS_ANDROID) && __ANDROID_API__ < 21 ++ defined(OS_ANDROID) && __ANDROID_API__ < 21 || defined(OS_HAIKU) + typedef struct stat stat_wrapper_t; + #elif defined(OS_POSIX) || defined(OS_FUCHSIA) + typedef struct stat64 stat_wrapper_t; +diff --git a/src/3rdparty/gn/base/files/file_posix.cc b/src/3rdparty/gn/base/files/file_posix.cc +index ed9a5e2..49bd48f 100644 +--- a/src/3rdparty/gn/base/files/file_posix.cc ++++ b/src/3rdparty/gn/base/files/file_posix.cc +@@ -25,7 +25,7 @@ static_assert(File::FROM_BEGIN == SEEK_SET && File::FROM_CURRENT == SEEK_CUR && + namespace { + + #if defined(OS_BSD) || defined(OS_MACOSX) || defined(OS_NACL) || \ +- defined(OS_ANDROID) && __ANDROID_API__ < 21 ++ defined(OS_ANDROID) && __ANDROID_API__ < 21 || defined(OS_HAIKU) + int CallFstat(int fd, stat_wrapper_t* sb) { + return fstat(fd, sb); + } +diff --git a/src/3rdparty/gn/base/files/file_util.h b/src/3rdparty/gn/base/files/file_util.h +index e22f40f..1a48cd9 100644 +--- a/src/3rdparty/gn/base/files/file_util.h ++++ b/src/3rdparty/gn/base/files/file_util.h +@@ -361,7 +361,7 @@ bool VerifyPathControlledByAdmin(const base::FilePath& path); + // the directory |path|, in the number of FilePath::CharType, or -1 on failure. + int GetMaximumPathComponentLength(const base::FilePath& path); + +-#if defined(OS_LINUX) || defined(OS_AIX) ++#if defined(OS_LINUX) || 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/gn/base/files/file_util_posix.cc b/src/3rdparty/gn/base/files/file_util_posix.cc +index eb07e64..9058455 100644 +--- a/src/3rdparty/gn/base/files/file_util_posix.cc ++++ b/src/3rdparty/gn/base/files/file_util_posix.cc +@@ -56,7 +56,7 @@ namespace base { + namespace { + + #if defined(OS_BSD) || defined(OS_MACOSX) || defined(OS_NACL) || \ +- defined(OS_ANDROID) && __ANDROID_API__ < 21 ++ defined(OS_ANDROID) && __ANDROID_API__ < 21 || defined(OS_HAIKU) + int CallStat(const char* path, stat_wrapper_t* sb) { + return stat(path, sb); + } +diff --git a/src/3rdparty/gn/base/files/scoped_file.cc b/src/3rdparty/gn/base/files/scoped_file.cc +index 11afedd..31e4f60 100644 +--- a/src/3rdparty/gn/base/files/scoped_file.cc ++++ b/src/3rdparty/gn/base/files/scoped_file.cc +@@ -31,7 +31,7 @@ void ScopedFDCloseTraits::Free(int fd) { + int ret = IGNORE_EINTR(close(fd)); + + #if defined(OS_LINUX) || defined(OS_MACOSX) || defined(OS_FUCHSIA) || \ +- defined(OS_ANDROID) ++ defined(OS_ANDROID) || defined(OS_HAIKU) + // NB: Some file descriptors can return errors from close() e.g. network + // filesystems such as NFS and Linux input devices. On Linux, macOS, and + // Fuchsia's POSIX layer, errors from close other than EBADF do not indicate +diff --git a/src/3rdparty/gn/build/gen.py b/src/3rdparty/gn/build/gen.py +index 8c646be..9d430fa 100755 +--- a/src/3rdparty/gn/build/gen.py ++++ b/src/3rdparty/gn/build/gen.py +@@ -43,10 +43,12 @@ class Platform(object): + self._platform = 'freebsd' + elif self._platform.startswith('openbsd'): + self._platform = 'openbsd' ++ elif self._platform.startswith('haiku'): ++ self._platform = 'haiku' + + @staticmethod + def known_platforms(): +- return ['linux', 'darwin', 'msvc', 'aix', 'fuchsia', 'freebsd', 'openbsd'] ++ return ['linux', 'darwin', 'msvc', 'aix', 'fuchsia', 'freebsd', 'openbsd', 'haiku'] + + def platform(self): + return self._platform +@@ -69,8 +71,11 @@ class Platform(object): + def is_aix(self): + return self._platform == 'aix' + ++ def is_haiku(self): ++ return self._platform == 'haiku' ++ + def is_posix(self): +- return self._platform in ['linux', 'freebsd', 'darwin', 'aix', 'openbsd'] ++ return self._platform in ['linux', 'freebsd', 'darwin', 'aix', 'openbsd', 'haiku'] + + + def main(argv): +@@ -189,6 +194,7 @@ def WriteGenericNinja(path, static_libraries, executables, + 'freebsd': 'build_linux.ninja.template', + 'aix': 'build_aix.ninja.template', + 'openbsd': 'build_openbsd.ninja.template', ++ 'haiku': 'build_linux.ninja.template', + }[platform.platform()]) + + with open(template_filename) as f: +@@ -350,13 +356,19 @@ def WriteGNNinja(path, platform, host, options): + cflags.extend([ + '-D_FILE_OFFSET_BITS=64', + '-D__STDC_CONSTANT_MACROS', '-D__STDC_FORMAT_MACROS', +- '-pthread', + '-pipe', + '-fno-exceptions', + '-fno-rtti', + '-fdiagnostics-color', + ]) +- cflags_cc.extend(['-std=c++14', '-Wno-c++11-narrowing']) ++ if not platform.is_haiku(): ++ cflags.extend([ ++ '-pthread', ++ ]) ++ ++ cflags_cc.extend(['-std=c++14']) ++ if not platform.is_haiku(): ++ cflags_cc.extend(['-Wno-c++11-narrowing']) + + if platform.is_linux(): + ldflags.append('-Wl,--as-needed') +@@ -374,7 +386,7 @@ def WriteGNNinja(path, platform, host, options): + cflags_cc.append('-maix64') + ldflags.append('-maix64') + +- if platform.is_posix(): ++ if platform.is_posix() and not platform.is_haiku(): + ldflags.append('-pthread') + + if options.use_lto: +diff --git a/src/3rdparty/gn/tools/gn/args.cc b/src/3rdparty/gn/tools/gn/args.cc +index 802c373..7064acc 100644 +--- a/src/3rdparty/gn/tools/gn/args.cc ++++ b/src/3rdparty/gn/tools/gn/args.cc +@@ -314,6 +314,8 @@ void Args::SetSystemVarsLocked(Scope* dest) const { + os = "aix"; + #elif defined(OS_OPENBSD) + os = "openbsd"; ++#elif defined(OS_HAIKU) ++ os = "haiku"; + #else + #error Unknown OS type. + #endif +diff --git a/src/3rdparty/gn/tools/gn/exec_process.cc b/src/3rdparty/gn/tools/gn/exec_process.cc +index 6c13558..d359cb1 100644 +--- a/src/3rdparty/gn/tools/gn/exec_process.cc ++++ b/src/3rdparty/gn/tools/gn/exec_process.cc +@@ -21,7 +21,12 @@ + #else + #include + #include ++#if !defined(OS_HAIKU) + #include ++#else ++#include ++#include ++#endif + #include + #include + +diff --git a/src/3rdparty/gn/util/build_config.h b/src/3rdparty/gn/util/build_config.h +index addd7cf..74029bd 100644 +--- a/src/3rdparty/gn/util/build_config.h ++++ b/src/3rdparty/gn/util/build_config.h +@@ -65,6 +65,8 @@ + #define OS_AIX 1 + #elif defined(__asmjs__) + #define OS_ASMJS ++#elif defined(__HAIKU__) ++#define OS_HAIKU 1 + #else + #error Please add support for your platform in build_config.h + #endif +@@ -82,7 +84,7 @@ + #if defined(OS_AIX) || defined(OS_ANDROID) || defined(OS_ASMJS) || \ + defined(OS_FREEBSD) || defined(OS_LINUX) || defined(OS_MACOSX) || \ + defined(OS_NACL) || defined(OS_NETBSD) || defined(OS_OPENBSD) || \ +- defined(OS_QNX) || defined(OS_SOLARIS) ++ defined(OS_QNX) || defined(OS_SOLARIS) || defined(OS_HAIKU) + #define OS_POSIX 1 + #endif + +-- +2.30.2 + + +From 29e4d9ca51fface0ae6ffe160f7cf29f567c4b17 Mon Sep 17 00:00:00 2001 +From: Jerome Duval +Date: Sat, 30 Jan 2021 16:39:12 +0100 +Subject: Patch from FreeBSD + + +diff --git a/src/3rdparty/chromium/components/BUILD.gn b/src/3rdparty/chromium/components/BUILD.gn +index 0b5a047..8d87fc4 100644 +--- a/src/3rdparty/chromium/components/BUILD.gn ++++ b/src/3rdparty/chromium/components/BUILD.gn +@@ -286,7 +286,7 @@ test("components_unittests") { + "//components/webcrypto:unit_tests", + ] + +- if (!is_fuchsia) { ++ if (!is_fuchsia && !is_haiku) { + deps += [ + "//components/crash/content/browser:unit_tests", + "//components/crash/core/app:unit_tests", +@@ -396,13 +396,6 @@ test("components_unittests") { + deps += [ "//components/browser_watcher:unit_tests" ] + } + +- if (is_haiku) { +- deps -= [ +- "//components/crash/content/browser:unit_tests", +- "//components/data_reduction_proxy/content/browser:unit_tests", +- ] +- } +- + if (enable_basic_printing) { + deps += [ + "//components/printing/browser:unit_tests", +diff --git a/src/3rdparty/chromium/content/child/BUILD.gn b/src/3rdparty/chromium/content/child/BUILD.gn +index 131caa7..7ac5ba7 100644 +--- a/src/3rdparty/chromium/content/child/BUILD.gn ++++ b/src/3rdparty/chromium/content/child/BUILD.gn +@@ -147,8 +147,12 @@ target(link_target_type, "child") { + deps += [ + "//components/services/font/public/cpp", + "//components/services/font/public/mojom", +- "//services/service_manager/zygote", + ] ++ if (!is_haiku) { ++ deps += [ ++ "//services/service_manager/zygote", ++ ] ++ } + } + + if (is_win) { +diff --git a/src/3rdparty/chromium/content/gpu/BUILD.gn b/src/3rdparty/chromium/content/gpu/BUILD.gn +index 2c81e0a..ec6ea09 100644 +--- a/src/3rdparty/chromium/content/gpu/BUILD.gn ++++ b/src/3rdparty/chromium/content/gpu/BUILD.gn +@@ -96,7 +96,7 @@ target(link_target_type, "gpu_sources") { + ] + } + +- if (is_linux) { ++ if (is_linux && !is_haiku) { + deps += [ "//services/service_manager/zygote" ] + } + +@@ -130,7 +130,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/public/common/BUILD.gn b/src/3rdparty/chromium/content/public/common/BUILD.gn +index 962a420..b415f8e 100644 +--- a/src/3rdparty/chromium/content/public/common/BUILD.gn ++++ b/src/3rdparty/chromium/content/public/common/BUILD.gn +@@ -254,7 +254,7 @@ jumbo_source_set("common_sources") { + deps += [ "//content/public/android:jni" ] + } + +- if (is_linux) { ++ if (is_linux && !is_haiku) { + deps += [ "//services/service_manager/zygote" ] + } + +diff --git a/src/3rdparty/chromium/content/renderer/BUILD.gn b/src/3rdparty/chromium/content/renderer/BUILD.gn +index 9dff344..e6617cd 100644 +--- a/src/3rdparty/chromium/content/renderer/BUILD.gn ++++ b/src/3rdparty/chromium/content/renderer/BUILD.gn +@@ -464,8 +464,12 @@ target(link_target_type, "renderer") { + if (is_linux) { + deps += [ + "//components/services/font/public/cpp", +- "//services/service_manager/zygote", + ] ++ if (!is_haiku) { ++ deps += [ ++ "//services/service_manager/zygote", ++ ] ++ } + } + + if (is_mac) { +diff --git a/src/3rdparty/chromium/content/shell/BUILD.gn b/src/3rdparty/chromium/content/shell/BUILD.gn +index e29b1e9..666ce35 100644 +--- a/src/3rdparty/chromium/content/shell/BUILD.gn ++++ b/src/3rdparty/chromium/content/shell/BUILD.gn +@@ -90,7 +90,7 @@ static_library("content_shell_app") { + "//content/public/app:both", + "//v8", + ] +- if (!is_fuchsia) { ++ if (!is_fuchsia && !is_haiku) { + deps += [ + "//components/crash/core/app", + "//components/crash/core/app:test_support", +@@ -367,11 +367,10 @@ static_library("content_shell_lib") { + deps += [ "//third_party/fuchsia-sdk/sdk/fidl/fuchsia.ui.policy" ] + } + if (is_haiku) { +- sources += [ "app/blink_test_platform_support_fuchsia.cc" ] + deps -= [ +- "//components/crash/content/app", +- "//components/crash/content/app:test_support", + "//components/crash/content/browser", ++ "//components/crash/core/app", ++ "//components/crash/core/app:test_support", + ] + } + +@@ -958,7 +957,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", +diff --git a/src/3rdparty/chromium/content/utility/BUILD.gn b/src/3rdparty/chromium/content/utility/BUILD.gn +index 475e36c..2c018570 100644 +--- a/src/3rdparty/chromium/content/utility/BUILD.gn ++++ b/src/3rdparty/chromium/content/utility/BUILD.gn +@@ -82,7 +82,7 @@ jumbo_source_set("utility") { + deps += [ "//services/proxy_resolver:lib" ] + } + +- if (is_linux && !use_qt) { ++ if (is_linux && !use_qt && !is_haiku) { + deps += [ "//content/utility/soda:soda_sandbox_hook" ] + } + +diff --git a/src/3rdparty/chromium/device/bluetooth/BUILD.gn b/src/3rdparty/chromium/device/bluetooth/BUILD.gn +index f745146..8c766ad 100644 +--- a/src/3rdparty/chromium/device/bluetooth/BUILD.gn ++++ b/src/3rdparty/chromium/device/bluetooth/BUILD.gn +@@ -275,7 +275,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/headless/BUILD.gn b/src/3rdparty/chromium/headless/BUILD.gn +index bf09d56..9ab39dc 100644 +--- a/src/3rdparty/chromium/headless/BUILD.gn ++++ b/src/3rdparty/chromium/headless/BUILD.gn +@@ -276,7 +276,7 @@ jumbo_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 @@ jumbo_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) { +@@ -451,7 +451,7 @@ jumbo_component("headless_non_renderer") { + "//v8", + ] + +- if (!is_fuchsia) { ++ if (!is_fuchsia && !is_haiku) { + deps += [ "//components/crash/content/browser" ] + } + if (is_win) { +@@ -810,7 +810,7 @@ jumbo_static_library("headless_shell_lib") { + public_deps += [ ":headless_non_renderer" ] + } + +- if (!is_fuchsia) { ++ if (!is_fuchsia && !is_haiku) { + deps += [ "//components/crash/content/browser" ] + } + +-- +2.30.2 + + +From 813cb0a0fb82c2940fbffdb34b2bb1c560512a92 Mon Sep 17 00:00:00 2001 +From: Jerome Duval +Date: Sat, 30 Jan 2021 19:04:08 +0100 +Subject: boringssl patches from FreeBSD + + +diff --git a/src/3rdparty/chromium/third_party/boringssl/BUILD.gn b/src/3rdparty/chromium/third_party/boringssl/BUILD.gn +index b435499..84ae9a0 100644 +--- a/src/3rdparty/chromium/third_party/boringssl/BUILD.gn ++++ b/src/3rdparty/chromium/third_party/boringssl/BUILD.gn +@@ -72,7 +72,7 @@ if (is_win && !is_msan && current_cpu != "arm64") { + } else if (current_cpu == "x64") { + if (is_mac) { + sources += crypto_sources_mac_x86_64 +- } else if (is_linux || is_android) { ++ } else if (is_linux || is_haiku || is_android) { + sources += crypto_sources_linux_x86_64 + } else { + public_configs = [ ":no_asm_config" ] +@@ -80,13 +80,13 @@ if (is_win && !is_msan && current_cpu != "arm64") { + } else if (current_cpu == "x86") { + if (is_mac) { + sources += crypto_sources_mac_x86 +- } else if (is_linux || is_android) { ++ } else if (is_linux || is_haiku || is_android) { + sources += crypto_sources_linux_x86 + } else { + public_configs = [ ":no_asm_config" ] + } + } else if (current_cpu == "arm") { +- if (is_linux || is_android) { ++ if (is_linux || is_haiku || is_android) { + sources += crypto_sources_linux_arm + } else if (is_ios) { + sources += crypto_sources_ios_arm +@@ -94,13 +94,20 @@ if (is_win && !is_msan && current_cpu != "arm64") { + public_configs = [ ":no_asm_config" ] + } + } else if (current_cpu == "arm64") { +- if (is_linux || is_android) { ++ if (is_linux || is_haiku || is_android) { + sources += crypto_sources_linux_aarch64 + } else if (is_ios) { + sources += crypto_sources_ios_aarch64 + } else { + public_configs = [ ":no_asm_config" ] + } ++ } else if (current_cpu == "ppc64") { ++ if (is_linux || is_haiku) { ++ # TODO: ppc64 (be) check ++ sources += crypto_sources_linux_ppc64le ++ } else { ++ public_configs = [ ":no_asm_config" ] ++ } + } else { + public_configs = [ ":no_asm_config" ] + } +diff --git a/src/3rdparty/chromium/third_party/boringssl/src/crypto/asn1/a_int.c b/src/3rdparty/chromium/third_party/boringssl/src/crypto/asn1/a_int.c +index 7b483f2..311bc26 100644 +--- a/src/3rdparty/chromium/third_party/boringssl/src/crypto/asn1/a_int.c ++++ b/src/3rdparty/chromium/third_party/boringssl/src/crypto/asn1/a_int.c +@@ -310,7 +310,9 @@ int ASN1_INTEGER_set_uint64(ASN1_INTEGER *out, uint64_t v) + + OPENSSL_free(out->data); + out->data = newdata; ++#ifndef OPENSSL_BIGENDIAN + v = CRYPTO_bswap8(v); ++#endif + memcpy(out->data, &v, sizeof(v)); + + out->type = V_ASN1_INTEGER; +diff --git a/src/3rdparty/chromium/third_party/boringssl/src/crypto/chacha/chacha.c b/src/3rdparty/chromium/third_party/boringssl/src/crypto/chacha/chacha.c +index b539f99..abc56df 100644 +--- a/src/3rdparty/chromium/third_party/boringssl/src/crypto/chacha/chacha.c ++++ b/src/3rdparty/chromium/third_party/boringssl/src/crypto/chacha/chacha.c +@@ -29,6 +29,14 @@ + (((uint32_t)((p)[0])) | ((uint32_t)((p)[1]) << 8) | \ + ((uint32_t)((p)[2]) << 16) | ((uint32_t)((p)[3]) << 24)) + ++#define U32TO8_LITTLE(p, v) \ ++ { \ ++ (p)[0] = (v >> 0) & 0xff; \ ++ (p)[1] = (v >> 8) & 0xff; \ ++ (p)[2] = (v >> 16) & 0xff; \ ++ (p)[3] = (v >> 24) & 0xff; \ ++ } ++ + // sigma contains the ChaCha constants, which happen to be an ASCII string. + static const uint8_t sigma[16] = { 'e', 'x', 'p', 'a', 'n', 'd', ' ', '3', + '2', '-', 'b', 'y', 't', 'e', ' ', 'k' }; +@@ -45,9 +53,27 @@ static const uint8_t sigma[16] = { 'e', 'x', 'p', 'a', 'n', 'd', ' ', '3', + void CRYPTO_hchacha20(uint8_t out[32], const uint8_t key[32], + const uint8_t nonce[16]) { + uint32_t x[16]; +- OPENSSL_memcpy(x, sigma, sizeof(sigma)); +- OPENSSL_memcpy(&x[4], key, 32); +- OPENSSL_memcpy(&x[12], nonce, 16); ++ int i; ++ ++ x[0] = U8TO32_LITTLE(sigma + 0); ++ x[1] = U8TO32_LITTLE(sigma + 4); ++ x[2] = U8TO32_LITTLE(sigma + 8); ++ x[3] = U8TO32_LITTLE(sigma + 12); ++ ++ x[4] = U8TO32_LITTLE(key + 0); ++ x[5] = U8TO32_LITTLE(key + 4); ++ x[6] = U8TO32_LITTLE(key + 8); ++ x[7] = U8TO32_LITTLE(key + 12); ++ ++ x[8] = U8TO32_LITTLE(key + 16); ++ x[9] = U8TO32_LITTLE(key + 20); ++ x[10] = U8TO32_LITTLE(key + 24); ++ x[11] = U8TO32_LITTLE(key + 28); ++ ++ x[12] = U8TO32_LITTLE(nonce + 0); ++ x[13] = U8TO32_LITTLE(nonce + 4); ++ x[14] = U8TO32_LITTLE(nonce + 8); ++ x[15] = U8TO32_LITTLE(nonce + 12); + + for (size_t i = 0; i < 20; i += 2) { + QUARTERROUND(0, 4, 8, 12) +@@ -60,8 +86,10 @@ void CRYPTO_hchacha20(uint8_t out[32], const uint8_t key[32], + QUARTERROUND(3, 4, 9, 14) + } + +- OPENSSL_memcpy(out, &x[0], sizeof(uint32_t) * 4); +- OPENSSL_memcpy(&out[16], &x[12], sizeof(uint32_t) * 4); ++ for (i = 0; i < 4; ++i) { ++ U32TO8_LITTLE(out + 4 * i, x[i]); ++ U32TO8_LITTLE(&out[16] + 4 * i, x[12+i]); ++ } + } + + #if defined(CHACHA20_ASM) +@@ -99,14 +127,6 @@ void CRYPTO_chacha_20(uint8_t *out, const uint8_t *in, size_t in_len, + + #else + +-#define U32TO8_LITTLE(p, v) \ +- { \ +- (p)[0] = (v >> 0) & 0xff; \ +- (p)[1] = (v >> 8) & 0xff; \ +- (p)[2] = (v >> 16) & 0xff; \ +- (p)[3] = (v >> 24) & 0xff; \ +- } +- + // chacha_core performs 20 rounds of ChaCha on the input words in + // |input| and writes the 64 output bytes to |output|. + static void chacha_core(uint8_t output[64], const uint32_t input[16]) { +diff --git a/src/3rdparty/chromium/third_party/boringssl/src/crypto/cipher_extra/e_aesgcmsiv.c b/src/3rdparty/chromium/third_party/boringssl/src/crypto/cipher_extra/e_aesgcmsiv.c +index d717572..92f7dce 100644 +--- a/src/3rdparty/chromium/third_party/boringssl/src/crypto/cipher_extra/e_aesgcmsiv.c ++++ b/src/3rdparty/chromium/third_party/boringssl/src/crypto/cipher_extra/e_aesgcmsiv.c +@@ -630,7 +630,11 @@ static void gcm_siv_crypt(uint8_t *out, const uint8_t *in, size_t in_len, + for (size_t done = 0; done < in_len;) { + uint8_t keystream[AES_BLOCK_SIZE]; + enc_block(counter.c, keystream, key); ++#ifdef OPENSSL_BIGENDIAN ++ counter.w[0] = CRYPTO_bswap4(CRYPTO_bswap4(counter.w[0]) + 1); ++#else + counter.w[0]++; ++#endif + + size_t todo = AES_BLOCK_SIZE; + if (in_len - done < todo) { +@@ -678,8 +682,13 @@ static void gcm_siv_polyval( + } bitlens; + } length_block; + ++#ifdef OPENSSL_BIGENDIAN ++ length_block.bitlens.ad = CRYPTO_bswap8(ad_len * 8); ++ length_block.bitlens.in = CRYPTO_bswap8(in_len * 8); ++#else + length_block.bitlens.ad = ad_len * 8; + length_block.bitlens.in = in_len * 8; ++#endif + CRYPTO_POLYVAL_update_blocks(&polyval_ctx, length_block.c, + sizeof(length_block)); + +diff --git a/src/3rdparty/chromium/third_party/boringssl/src/crypto/cpu-aarch64-linux.c b/src/3rdparty/chromium/third_party/boringssl/src/crypto/cpu-aarch64-linux.c +index 0184dd4..2726151 100644 +--- a/src/3rdparty/chromium/third_party/boringssl/src/crypto/cpu-aarch64-linux.c ++++ b/src/3rdparty/chromium/third_party/boringssl/src/crypto/cpu-aarch64-linux.c +@@ -14,49 +14,47 @@ + + #include + +-#if defined(OPENSSL_AARCH64) && defined(OPENSSL_LINUX) && \ +- !defined(OPENSSL_STATIC_ARMCAP) +- +-#include ++#if defined(OPENSSL_AARCH64) + + #include + + #include "internal.h" + +- + extern uint32_t OPENSSL_armcap_P; + ++#include ++ ++#ifndef ID_AA64ISAR0_AES_VAL ++#define ID_AA64ISAR0_AES_VAL ID_AA64ISAR0_AES ++#endif ++#ifndef ID_AA64ISAR0_AES_VAL ++#define ID_AA64ISAR0_AES_VAL ID_AA64ISAR0_AES ++#endif ++#ifndef ID_AA64ISAR0_SHA1_VAL ++#define ID_AA64ISAR0_SHA1_VAL ID_AA64ISAR0_SHA1 ++#endif ++#ifndef ID_AA64ISAR0_SHA2_VAL ++#define ID_AA64ISAR0_SHA2_VAL ID_AA64ISAR0_SHA2 ++#endif ++ + void OPENSSL_cpuid_setup(void) { +- unsigned long hwcap = getauxval(AT_HWCAP); +- +- // See /usr/include/asm/hwcap.h on an aarch64 installation for the source of +- // these values. +- static const unsigned long kNEON = 1 << 1; +- static const unsigned long kAES = 1 << 3; +- static const unsigned long kPMULL = 1 << 4; +- static const unsigned long kSHA1 = 1 << 5; +- static const unsigned long kSHA256 = 1 << 6; +- +- if ((hwcap & kNEON) == 0) { +- // Matching OpenSSL, if NEON is missing, don't report other features +- // either. +- return; +- } ++ uint64_t id_aa64isar0; ++ ++ id_aa64isar0 = READ_SPECIALREG(id_aa64isar0_el1); + + OPENSSL_armcap_P |= ARMV7_NEON; + +- if (hwcap & kAES) { ++ if (ID_AA64ISAR0_AES_VAL(id_aa64isar0) >= ID_AA64ISAR0_AES_BASE) { + OPENSSL_armcap_P |= ARMV8_AES; + } +- if (hwcap & kPMULL) { ++ if (ID_AA64ISAR0_AES_VAL(id_aa64isar0) == ID_AA64ISAR0_AES_PMULL) { + OPENSSL_armcap_P |= ARMV8_PMULL; + } +- if (hwcap & kSHA1) { ++ if (ID_AA64ISAR0_SHA1_VAL(id_aa64isar0) == ID_AA64ISAR0_SHA1_BASE) { + OPENSSL_armcap_P |= ARMV8_SHA1; + } +- if (hwcap & kSHA256) { ++ if(ID_AA64ISAR0_SHA2_VAL(id_aa64isar0) >= ID_AA64ISAR0_SHA2_BASE) { + OPENSSL_armcap_P |= ARMV8_SHA256; + } + } +- +-#endif // OPENSSL_AARCH64 && !OPENSSL_STATIC_ARMCAP ++#endif // OPENSSL_AARCH64 +diff --git a/src/3rdparty/chromium/third_party/boringssl/src/crypto/curve25519/spake25519.c b/src/3rdparty/chromium/third_party/boringssl/src/crypto/curve25519/spake25519.c +index 650178c..16e0efb 100644 +--- a/src/3rdparty/chromium/third_party/boringssl/src/crypto/curve25519/spake25519.c ++++ b/src/3rdparty/chromium/third_party/boringssl/src/crypto/curve25519/spake25519.c +@@ -339,8 +339,17 @@ static void scalar_double(scalar *s) { + uint32_t carry = 0; + + for (size_t i = 0; i < 8; i++) { +- const uint32_t carry_out = s->words[i] >> 31; +- s->words[i] = (s->words[i] << 1) | carry; ++#ifdef OPENSSL_BIGENDIAN ++ const uint32_t si = CRYPTO_bswap4(s->words[i]); ++#else ++ const uint32_t si = s->words[i]; ++#endif ++ const uint32_t carry_out = si >> 31; ++#ifdef OPENSSL_BIGENDIAN ++ s->words[i] = CRYPTO_bswap4((si << 1) | carry); ++#else ++ s->words[i] = (si << 1) | carry; ++#endif + carry = carry_out; + } + } +@@ -350,8 +359,13 @@ static void scalar_add(scalar *dest, const scalar *src) { + uint32_t carry = 0; + + for (size_t i = 0; i < 8; i++) { ++#ifdef OPENSSL_BIGENDIAN ++ uint64_t tmp = ((uint64_t)CRYPTO_bswap4(dest->words[i]) + CRYPTO_bswap4(src->words[i])) + carry; ++ dest->words[i] = CRYPTO_bswap4((uint32_t)tmp); ++#else + uint64_t tmp = ((uint64_t)dest->words[i] + src->words[i]) + carry; + dest->words[i] = (uint32_t)tmp; ++#endif + carry = (uint32_t)(tmp >> 32); + } + } +diff --git a/src/3rdparty/chromium/third_party/boringssl/src/crypto/evp/scrypt.c b/src/3rdparty/chromium/third_party/boringssl/src/crypto/evp/scrypt.c +index 2feb650..d3dd725 100644 +--- a/src/3rdparty/chromium/third_party/boringssl/src/crypto/evp/scrypt.c ++++ b/src/3rdparty/chromium/third_party/boringssl/src/crypto/evp/scrypt.c +@@ -196,10 +196,28 @@ int EVP_PBE_scrypt(const char *password, size_t password_len, + goto err; + } + ++#ifdef OPENSSL_BIGENDIAN ++ uint32_t *B32 = B->words; ++ size_t B_words = B_bytes >> 2; ++ do { ++ *B32 = CRYPTO_bswap4(*B32); ++ B32++; ++ } while(--B_words); ++#endif ++ + for (uint64_t i = 0; i < p; i++) { + scryptROMix(B + 2 * r * i, r, N, T, V); + } + ++#ifdef OPENSSL_BIGENDIAN ++ B32 = B->words; ++ B_words = B_bytes >> 2; ++ do { ++ *B32 = CRYPTO_bswap4(*B32); ++ B32++; ++ } while(--B_words); ++#endif ++ + if (!PKCS5_PBKDF2_HMAC(password, password_len, (const uint8_t *)B, B_bytes, 1, + EVP_sha256(), key_len, out_key)) { + goto err; +diff --git a/src/3rdparty/chromium/third_party/boringssl/src/crypto/ex_data.c b/src/3rdparty/chromium/third_party/boringssl/src/crypto/ex_data.c +index 71d60a5..7ffea5a 100644 +--- a/src/3rdparty/chromium/third_party/boringssl/src/crypto/ex_data.c ++++ b/src/3rdparty/chromium/third_party/boringssl/src/crypto/ex_data.c +@@ -186,7 +186,9 @@ int CRYPTO_set_ex_data(CRYPTO_EX_DATA *ad, int index, void *val) { + } + } + +- sk_void_set(ad->sk, index, val); ++ // expression result unused; should this cast be to 'void'? ++ // seems it should, feel free to investigate those #def ++ (void) sk_void_set(ad->sk, index, val); + return 1; + } + +diff --git a/src/3rdparty/chromium/third_party/boringssl/src/crypto/fipsmodule/bn/bytes.c b/src/3rdparty/chromium/third_party/boringssl/src/crypto/fipsmodule/bn/bytes.c +index 56241e3..bba4939 100644 +--- a/src/3rdparty/chromium/third_party/boringssl/src/crypto/fipsmodule/bn/bytes.c ++++ b/src/3rdparty/chromium/third_party/boringssl/src/crypto/fipsmodule/bn/bytes.c +@@ -136,9 +136,13 @@ BIGNUM *BN_le2bn(const uint8_t *in, size_t len, BIGNUM *ret) { + // Make sure the top bytes will be zeroed. + ret->d[num_words - 1] = 0; + +- // We only support little-endian platforms, so we can simply memcpy the +- // internal representation. ++#ifdef OPENSSL_BIGENDIAN ++ uint8_t *out = (uint8_t *)ret->d; ++ for (size_t i = 0; i < len; i++) ++ out[i ^ (BN_BYTES-1)] = in[i]; ++#else + OPENSSL_memcpy(ret->d, in, len); ++#endif + return ret; + } + +@@ -157,7 +161,11 @@ size_t BN_bn2bin(const BIGNUM *in, uint8_t *out) { + static int fits_in_bytes(const uint8_t *bytes, size_t num_bytes, size_t len) { + uint8_t mask = 0; + for (size_t i = len; i < num_bytes; i++) { ++#ifdef OPENSSL_BIGENDIAN ++ mask |= bytes[i ^ (BN_BYTES-1)]; ++#else + mask |= bytes[i]; ++#endif + } + return mask == 0; + } +@@ -172,9 +180,13 @@ int BN_bn2le_padded(uint8_t *out, size_t len, const BIGNUM *in) { + num_bytes = len; + } + +- // We only support little-endian platforms, so we can simply memcpy into the +- // internal representation. ++#ifdef OPENSSL_BIGENDIAN ++ for (size_t i = 0; i < num_bytes; i++) { ++ out[i] = bytes[i ^ (BN_BYTES-1)]; ++ } ++#else + OPENSSL_memcpy(out, bytes, num_bytes); ++#endif + // Pad out the rest of the buffer with zeroes. + OPENSSL_memset(out + num_bytes, 0, len - num_bytes); + return 1; +@@ -190,11 +202,15 @@ int BN_bn2bin_padded(uint8_t *out, size_t len, const BIGNUM *in) { + num_bytes = len; + } + +- // We only support little-endian platforms, so we can simply write the buffer +- // in reverse. ++#ifdef OPENSSL_BIGENDIAN ++ for (size_t i = 0; i < num_bytes; i++) { ++ out[len - i - 1] = bytes[i ^ (BN_BYTES-1)]; ++ } ++#else + for (size_t i = 0; i < num_bytes; i++) { + out[len - i - 1] = bytes[i]; + } ++#endif + // Pad out the rest of the buffer with zeroes. + OPENSSL_memset(out, 0, len - num_bytes); + return 1; +diff --git a/src/3rdparty/chromium/third_party/boringssl/src/crypto/fipsmodule/ecdsa/ecdsa.c b/src/3rdparty/chromium/third_party/boringssl/src/crypto/fipsmodule/ecdsa/ecdsa.c +index 56d9f16..68c3843 100644 +--- a/src/3rdparty/chromium/third_party/boringssl/src/crypto/fipsmodule/ecdsa/ecdsa.c ++++ b/src/3rdparty/chromium/third_party/boringssl/src/crypto/fipsmodule/ecdsa/ecdsa.c +@@ -80,7 +80,11 @@ static void digest_to_scalar(const EC_GROUP *group, EC_SCALAR *out, + } + OPENSSL_memset(out, 0, sizeof(EC_SCALAR)); + for (size_t i = 0; i < digest_len; i++) { ++#ifdef OPENSSL_BIGENDIAN ++ out->bytes[i ^ (BN_BYTES-1)] = digest[digest_len - 1 - i]; ++#else + out->bytes[i] = digest[digest_len - 1 - i]; ++#endif + } + + // If it is still too long, truncate remaining bits with a shift. +diff --git a/src/3rdparty/chromium/third_party/boringssl/src/crypto/fipsmodule/modes/polyval.c b/src/3rdparty/chromium/third_party/boringssl/src/crypto/fipsmodule/modes/polyval.c +index 857dc0e..b5349a8 100644 +--- a/src/3rdparty/chromium/third_party/boringssl/src/crypto/fipsmodule/modes/polyval.c ++++ b/src/3rdparty/chromium/third_party/boringssl/src/crypto/fipsmodule/modes/polyval.c +@@ -32,16 +32,26 @@ static void byte_reverse(polyval_block *b) { + // the GHASH field, multiplies that by 'x' and serialises the result back into + // |b|, but with GHASH's backwards bit ordering. + static void reverse_and_mulX_ghash(polyval_block *b) { ++#ifdef OPENSSL_BIGENDIAN ++ uint64_t hi = CRYPTO_bswap8(b->u[0]); ++ uint64_t lo = CRYPTO_bswap8(b->u[1]); ++#else + uint64_t hi = b->u[0]; + uint64_t lo = b->u[1]; ++#endif + const crypto_word_t carry = constant_time_eq_w(hi & 1, 1); + hi >>= 1; + hi |= lo << 63; + lo >>= 1; + lo ^= ((uint64_t) constant_time_select_w(carry, 0xe1, 0)) << 56; + ++#ifdef OPENSSL_BIGENDIAN ++ b->u[0] = lo; ++ b->u[1] = hi; ++#else + b->u[0] = CRYPTO_bswap8(lo); + b->u[1] = CRYPTO_bswap8(hi); ++#endif + } + + // POLYVAL(H, X_1, ..., X_n) = +diff --git a/src/3rdparty/chromium/third_party/boringssl/src/crypto/fipsmodule/rand/ctrdrbg.c b/src/3rdparty/chromium/third_party/boringssl/src/crypto/fipsmodule/rand/ctrdrbg.c +index b2fda1d..84822a5 100644 +--- a/src/3rdparty/chromium/third_party/boringssl/src/crypto/fipsmodule/rand/ctrdrbg.c ++++ b/src/3rdparty/chromium/third_party/boringssl/src/crypto/fipsmodule/rand/ctrdrbg.c +@@ -70,8 +70,12 @@ OPENSSL_STATIC_ASSERT(CTR_DRBG_ENTROPY_LEN % AES_BLOCK_SIZE == 0, + // ctr_inc adds |n| to the last four bytes of |drbg->counter|, treated as a + // big-endian number. + static void ctr32_add(CTR_DRBG_STATE *drbg, uint32_t n) { ++#ifdef OPENSSL_BIGENDIAN ++ drbg->counter.words[3] += n; ++#else + drbg->counter.words[3] = + CRYPTO_bswap4(CRYPTO_bswap4(drbg->counter.words[3]) + n); ++#endif + } + + static int ctr_drbg_update(CTR_DRBG_STATE *drbg, const uint8_t *data, +diff --git a/src/3rdparty/chromium/third_party/boringssl/src/crypto/poly1305/poly1305.c b/src/3rdparty/chromium/third_party/boringssl/src/crypto/poly1305/poly1305.c +index a6dd145..5c3f7e8 100644 +--- a/src/3rdparty/chromium/third_party/boringssl/src/crypto/poly1305/poly1305.c ++++ b/src/3rdparty/chromium/third_party/boringssl/src/crypto/poly1305/poly1305.c +@@ -32,10 +32,16 @@ + static uint32_t U8TO32_LE(const uint8_t *m) { + uint32_t r; + OPENSSL_memcpy(&r, m, sizeof(r)); ++#ifdef OPENSSL_BIGENDIAN ++ r = CRYPTO_bswap4(r); ++#endif + return r; + } + + static void U32TO8_LE(uint8_t *m, uint32_t v) { ++#ifdef OPENSSL_BIGENDIAN ++ v = CRYPTO_bswap4(v); ++#endif + OPENSSL_memcpy(m, &v, sizeof(v)); + } + +diff --git a/src/3rdparty/chromium/third_party/boringssl/src/third_party/fiat/curve25519.c b/src/3rdparty/chromium/third_party/boringssl/src/third_party/fiat/curve25519.c +index 564becb..243f2cb 100644 +--- a/src/3rdparty/chromium/third_party/boringssl/src/third_party/fiat/curve25519.c ++++ b/src/3rdparty/chromium/third_party/boringssl/src/third_party/fiat/curve25519.c +@@ -1964,9 +1964,14 @@ int ED25519_verify(const uint8_t *message, size_t message_len, + UINT64_C(0x1000000000000000), + }; + for (size_t i = 3;; i--) { +- if (scopy.u64[i] > kOrder[i]) { ++#ifdef OPENSSL_BIGENDIAN ++ const uint64_t n = CRYPTO_bswap8(scopy.u64[i]); ++#else ++ const uint64_t n = scopy.u64[i]; ++#endif ++ if (n > kOrder[i]) { + return 0; +- } else if (scopy.u64[i] < kOrder[i]) { ++ } else if (n < kOrder[i]) { + break; + } else if (i == 0) { + return 0; +-- +2.30.2 + + +From b86f6f6f18e06de51bd2d56faede78169555c30e Mon Sep 17 00:00:00 2001 +From: Jerome Duval +Date: Sat, 30 Jan 2021 19:25:32 +0100 +Subject: nasm: rename float.h to floats.h, float.c to floats.c + + +diff --git a/src/3rdparty/chromium/third_party/nasm/asm/directiv.c b/src/3rdparty/chromium/third_party/nasm/asm/directiv.c +index d2c5e9c..53d1a14 100644 +--- a/src/3rdparty/chromium/third_party/nasm/asm/directiv.c ++++ b/src/3rdparty/chromium/third_party/nasm/asm/directiv.c +@@ -46,7 +46,7 @@ + #include "nasmlib.h" + #include "ilog2.h" + #include "error.h" +-#include "float.h" ++#include "floats.h" + #include "stdscan.h" + #include "preproc.h" + #include "eval.h" +diff --git a/src/3rdparty/chromium/third_party/nasm/asm/eval.c b/src/3rdparty/chromium/third_party/nasm/asm/eval.c +index 7c51904..4217c1a 100644 +--- a/src/3rdparty/chromium/third_party/nasm/asm/eval.c ++++ b/src/3rdparty/chromium/third_party/nasm/asm/eval.c +@@ -49,7 +49,7 @@ + #include "error.h" + #include "eval.h" + #include "labels.h" +-#include "float.h" ++#include "floats.h" + #include "assemble.h" + + #define TEMPEXPRS_DELTA 128 +diff --git a/src/3rdparty/chromium/third_party/nasm/asm/float.c b/src/3rdparty/chromium/third_party/nasm/asm/floats.c +similarity index 99% +rename from src/3rdparty/chromium/third_party/nasm/asm/float.c +rename to src/3rdparty/chromium/third_party/nasm/asm/floats.c +index ff3d9c8..30e297c 100644 +--- a/src/3rdparty/chromium/third_party/nasm/asm/float.c ++++ b/src/3rdparty/chromium/third_party/nasm/asm/floats.c +@@ -43,7 +43,7 @@ + #include + + #include "nasm.h" +-#include "float.h" ++#include "floats.h" + #include "error.h" + + /* +diff --git a/src/3rdparty/chromium/third_party/nasm/asm/float.h b/src/3rdparty/chromium/third_party/nasm/asm/floats.h +similarity index 100% +rename from src/3rdparty/chromium/third_party/nasm/asm/float.h +rename to src/3rdparty/chromium/third_party/nasm/asm/floats.h +diff --git a/src/3rdparty/chromium/third_party/nasm/asm/nasm.c b/src/3rdparty/chromium/third_party/nasm/asm/nasm.c +index ad05e44..2e571d9 100644 +--- a/src/3rdparty/chromium/third_party/nasm/asm/nasm.c ++++ b/src/3rdparty/chromium/third_party/nasm/asm/nasm.c +@@ -49,7 +49,7 @@ + #include "error.h" + #include "saa.h" + #include "raa.h" +-#include "float.h" ++#include "floats.h" + #include "stdscan.h" + #include "insns.h" + #include "preproc.h" +diff --git a/src/3rdparty/chromium/third_party/nasm/asm/parser.c b/src/3rdparty/chromium/third_party/nasm/asm/parser.c +index 78f347f..c44dc2c 100644 +--- a/src/3rdparty/chromium/third_party/nasm/asm/parser.c ++++ b/src/3rdparty/chromium/third_party/nasm/asm/parser.c +@@ -50,7 +50,7 @@ + #include "stdscan.h" + #include "eval.h" + #include "parser.h" +-#include "float.h" ++#include "floats.h" + #include "assemble.h" + #include "tables.h" + +diff --git a/src/3rdparty/chromium/third_party/nasm/nasm_sources.gni b/src/3rdparty/chromium/third_party/nasm/nasm_sources.gni +index 93742d8..adbf216 100644 +--- a/src/3rdparty/chromium/third_party/nasm/nasm_sources.gni ++++ b/src/3rdparty/chromium/third_party/nasm/nasm_sources.gni +@@ -13,7 +13,7 @@ nasmlib_sources = [ + "asm/eval.c", + "asm/exprdump.c", + "asm/exprlib.c", +- "asm/float.c", ++ "asm/floats.c", + "asm/labels.c", + "asm/listing.c", + "asm/parser.c", +-- +2.30.2 + + +From 26f75aa0b51c6c2f920f033703830a60a1f47e56 Mon Sep 17 00:00:00 2001 +From: Jerome Duval +Date: Sat, 30 Jan 2021 19:27:53 +0100 +Subject: Patches from FreeBSD + + +diff --git a/src/3rdparty/chromium/BUILD.gn b/src/3rdparty/chromium/BUILD.gn +index d26fe54..3695c7b 100644 +--- a/src/3rdparty/chromium/BUILD.gn ++++ b/src/3rdparty/chromium/BUILD.gn +@@ -419,7 +419,7 @@ group("gn_all") { + ] + } + +- if (is_linux || is_android) { ++ if ((is_linux && !is_haiku)|| is_android) { + deps += [ + "//third_party/breakpad:breakpad_unittests", + "//third_party/breakpad:core-2-minidump", +@@ -460,8 +460,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", + ] + +@@ -516,10 +514,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", +@@ -592,10 +586,6 @@ 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 && !is_haiku) { +@@ -802,7 +792,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_desktop_linux && use_ozone) { + deps += [ "//chrome/browser/vr/testapp:vr_testapp" ] +@@ -1085,7 +1074,7 @@ if (!is_ios && !use_qt) { + ] + } + +- if (!is_win && !is_android) { ++ if (!is_win && !is_android && !is_haiku) { + data_deps += + [ "//third_party/breakpad:minidump_stackwalk($host_toolchain)" ] + } +@@ -1094,7 +1083,7 @@ if (!is_ios && !use_qt) { + data_deps += [ "//third_party/breakpad:dump_syms($host_toolchain)" ] + } + +- if (is_linux) { ++ if (is_linux && !is_haiku) { + data_deps += [ "//third_party/breakpad:dump_syms($host_toolchain)" ] + } + +@@ -1286,9 +1275,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 += [ +diff --git a/src/3rdparty/chromium/base/BUILD.gn b/src/3rdparty/chromium/base/BUILD.gn +index 3b0bc84..2f5fa91 100644 +--- a/src/3rdparty/chromium/base/BUILD.gn ++++ b/src/3rdparty/chromium/base/BUILD.gn +@@ -59,7 +59,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. +@@ -929,7 +929,7 @@ jumbo_component("base") { + "timer/hi_res_timer_manager_posix.cc", + ] + +- if (!is_nacl && !is_mac && !is_ios) { ++ if (!is_nacl && !is_mac && !is_ios && !is_haiku) { + sources += [ + "profiler/stack_copier_signal.cc", + "profiler/stack_copier_signal.h", +@@ -938,6 +938,12 @@ jumbo_component("base") { + "profiler/thread_delegate_posix.h", + ] + } ++ ++ if (is_haiku) { ++ sources += [ ++ "profiler/stack_sampler_posix.cc", ++ ] ++ } + } + + jumbo_excluded_sources = [] +@@ -1239,7 +1245,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) { +@@ -1350,7 +1358,7 @@ jumbo_component("base") { + "allocator/allocator_shim_override_glibc_weak_symbols.h", + ] + deps += [ "//base/allocator:tcmalloc" ] +- } else if (is_linux && use_allocator == "none") { ++ } else if ((is_linux && !is_haiku) && use_allocator == "none") { + sources += [ "allocator/allocator_shim_default_dispatch_to_glibc.cc" ] + } else if (is_android && use_allocator == "none") { + sources += [ +@@ -1675,7 +1683,9 @@ jumbo_component("base") { + } + + if (is_haiku) { +- sources -= [ "process/memory.cc" ] ++ sources -= [ ++ "process/memory.cc", ++ ] + sources += [ + "base_paths_haiku.cc", + "base_paths_haiku.h", +diff --git a/src/3rdparty/chromium/build/config/BUILDCONFIG.gn b/src/3rdparty/chromium/build/config/BUILDCONFIG.gn +index 7059914..eb6357b 100644 +--- a/src/3rdparty/chromium/build/config/BUILDCONFIG.gn ++++ b/src/3rdparty/chromium/build/config/BUILDCONFIG.gn +@@ -131,7 +131,7 @@ 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 != "haiku" && (current_os != "linux" || +@@ -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" +@@ -231,15 +231,13 @@ 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" + } else { + _default_toolchain = "//build/toolchain/linux:$target_cpu" + } +-} else if (target_os == "haiku") { +- _default_toolchain = "//build/toolchain/haiku:$target_cpu" + } else if (target_os == "fuchsia") { + _default_toolchain = "//build/toolchain/fuchsia:$target_cpu" + } else if (target_os == "ios") { +@@ -297,7 +295,7 @@ is_android = current_os == "android" + is_chromeos = current_os == "chromeos" + is_fuchsia = current_os == "fuchsia" + is_ios = current_os == "ios" +-is_linux = current_os == "chromeos" || current_os == "linux" ++is_linux = current_os == "chromeos" || current_os == "linux" || current_os == "haiku" + is_mac = current_os == "mac" + is_nacl = current_os == "nacl" + is_win = current_os == "win" || current_os == "winuwp" +@@ -392,15 +390,6 @@ if (!is_chromeos) { + "*\bchromeos/*", + ] + } +-if (!is_haiku) { +- sources_assignment_filter += [ +- "*_haiku.h", +- "*_haiku.cc", +- "*_haiku_unittest.h", +- "*_haiku_unittest.cc", +- "*\bhaiku/*", +- ] +-} + + # DO NOT ADD MORE PATTERNS TO THIS LIST, see set_sources_assignment_filter call + # below. +diff --git a/src/3rdparty/chromium/build/config/compiler/BUILD.gn b/src/3rdparty/chromium/build/config/compiler/BUILD.gn +index a87c58a..2acba29 100644 +--- a/src/3rdparty/chromium/build/config/compiler/BUILD.gn ++++ b/src/3rdparty/chromium/build/config/compiler/BUILD.gn +@@ -480,7 +480,7 @@ config("compiler") { + cflags += [ "-B$binutils_path" ] + } + +- if (is_linux) { ++ if (is_linux && !is_haiku) { + cflags += [ "-pthread" ] + # Do not use the -pthread ldflag here since it becomes a no-op + # when using -nodefaultlibs, which would cause an unused argument +diff --git a/src/3rdparty/chromium/components/crash/content/browser/BUILD.gn b/src/3rdparty/chromium/components/crash/content/browser/BUILD.gn +index 40c3604..242c9af 100644 +--- a/src/3rdparty/chromium/components/crash/content/browser/BUILD.gn ++++ b/src/3rdparty/chromium/components/crash/content/browser/BUILD.gn +@@ -28,7 +28,7 @@ source_set("browser") { + "//content/public/common", + ] + +- if (is_linux || is_android) { ++ if ((is_linux && !is_haiku) || is_android) { + set_sources_assignment_filter([]) + + # Want this file on both Linux and Android. +@@ -42,13 +42,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 622b76d..957a3d8 100644 +--- a/src/3rdparty/chromium/components/crash/core/common/BUILD.gn ++++ b/src/3rdparty/chromium/components/crash/core/common/BUILD.gn +@@ -104,7 +104,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" ] + } +@@ -167,7 +169,7 @@ source_set("unit_tests") { + sources += [ "objc_zombie_unittest.mm" ] + } + +- if (!is_mac && !is_ios && !is_win && !is_fuchsia && !is_android) { ++ if (!is_mac && !is_ios && !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/content/browser/BUILD.gn b/src/3rdparty/chromium/content/browser/BUILD.gn +index ca3f49e..5f561aa 100644 +--- a/src/3rdparty/chromium/content/browser/BUILD.gn ++++ b/src/3rdparty/chromium/content/browser/BUILD.gn +@@ -1936,7 +1936,7 @@ jumbo_static_library("browser") { + deps += [ "//ui/events" ] + } + +- if (is_linux) { ++ if (is_linux || is_haiku) { + sources += [ + "font_service.cc", + "font_service.h", +@@ -2003,6 +2003,9 @@ jumbo_static_library("browser") { + # resources on other platforms. + deps += [ "//content/browser/devtools:devtools_resources" ] + } ++ if (is_haiku) { ++ deps -= [ "//services/service_manager/zygote" ] ++ } + + if (enable_basic_printing) { + deps += [ "//printing" ] +diff --git a/src/3rdparty/chromium/tools/perf/chrome_telemetry_build/BUILD.gn b/src/3rdparty/chromium/tools/perf/chrome_telemetry_build/BUILD.gn +index 8c7ba3a..ac704ff 100644 +--- a/src/3rdparty/chromium/tools/perf/chrome_telemetry_build/BUILD.gn ++++ b/src/3rdparty/chromium/tools/perf/chrome_telemetry_build/BUILD.gn +@@ -47,7 +47,7 @@ group("telemetry_chrome_test") { + data_deps += [ "//chrome:reorder_imports" ] + } + +- if (is_linux) { ++ if (is_linux && !is_haiku) { + data_deps += [ + "//third_party/breakpad:dump_syms($host_toolchain)", + "//third_party/crashpad/crashpad/tools:crashpad_database_util", +diff --git a/src/3rdparty/chromium/ui/base/ui_features.gni b/src/3rdparty/chromium/ui/base/ui_features.gni +index c3c4127..0d89c71 100644 +--- a/src/3rdparty/chromium/ui/base/ui_features.gni ++++ b/src/3rdparty/chromium/ui/base/ui_features.gni +@@ -6,7 +6,7 @@ import("//build/config/ui.gni") + + declare_args() { + # Optional system library. +- use_xkbcommon = use_ozone && is_linux && !is_chromecast ++ use_xkbcommon = use_ozone && is_linux && !is_chromecast && !is_haiku + + # Whether the platform provides a native accessibility toolkit. + has_native_accessibility = use_atk || is_win || is_mac +-- +2.30.2 + + +From 2395f100ad7204784a54b6a970b0173a0d8628d9 Mon Sep 17 00:00:00 2001 +From: Jerome Duval +Date: Sat, 30 Jan 2021 19:36:57 +0100 +Subject: Haiku perfetto patches based on FreeBSD + + +diff --git a/src/3rdparty/chromium/third_party/perfetto/buildtools/BUILD.gn b/src/3rdparty/chromium/third_party/perfetto/buildtools/BUILD.gn +index 857c2d9..2650164 100644 +--- a/src/3rdparty/chromium/third_party/perfetto/buildtools/BUILD.gn ++++ b/src/3rdparty/chromium/third_party/perfetto/buildtools/BUILD.gn +@@ -49,8 +49,12 @@ config("test_warning_suppressions") { + } else { + cflags = [ + "-Wno-unknown-warning-option", +- "-Wno-deprecated-copy", + ] ++ if (!is_haiku) { ++ cflags = [ ++ "-Wno-deprecated-copy", ++ ] ++ } + } + } + +diff --git a/src/3rdparty/chromium/third_party/perfetto/include/perfetto/base/build_config.h b/src/3rdparty/chromium/third_party/perfetto/include/perfetto/base/build_config.h +index 047d897..056729a 100644 +--- a/src/3rdparty/chromium/third_party/perfetto/include/perfetto/base/build_config.h ++++ b/src/3rdparty/chromium/third_party/perfetto/include/perfetto/base/build_config.h +@@ -28,6 +28,7 @@ + #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_ANDROID() 1 + #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_MACOSX() 0 + #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_LINUX() 0 ++#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_HAIKU() 0 + #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_WIN() 0 + #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_WASM() 0 + #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_FUCHSIA() 0 +@@ -37,6 +38,7 @@ + #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_ANDROID() 0 + #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_MACOSX() 1 + #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_LINUX() 0 ++#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_HAIKU() 0 + #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_WIN() 0 + #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_WASM() 0 + #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_FUCHSIA() 0 +@@ -50,6 +52,17 @@ + #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_ANDROID() 0 + #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_MACOSX() 0 + #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_LINUX() 1 ++#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_HAIKU() 0 ++#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_WIN() 0 ++#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_WASM() 0 ++#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_FUCHSIA() 0 ++#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_NACL() 0 ++#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_IOS() 0 ++#elif defined(__HAIKU__) ++#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_ANDROID() 0 ++#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_MACOSX() 0 ++#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_LINUX() 1 ++#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_HAIKU() 1 + #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_WIN() 0 + #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_WASM() 0 + #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_FUCHSIA() 0 +@@ -59,6 +72,7 @@ + #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_ANDROID() 0 + #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_MACOSX() 0 + #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_LINUX() 0 ++#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_HAIKU() 0 + #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_WIN() 1 + #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_WASM() 0 + #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_FUCHSIA() 0 +@@ -68,6 +82,7 @@ + #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_ANDROID() 0 + #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_MACOSX() 0 + #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_LINUX() 0 ++#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_HAIKU() 0 + #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_WIN() 0 + #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_WASM() 1 + #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_FUCHSIA() 0 +@@ -77,6 +92,7 @@ + #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_ANDROID() 0 + #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_MACOSX() 0 + #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_LINUX() 0 ++#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_HAIKU() 0 + #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_WIN() 0 + #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_WASM() 0 + #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_FUCHSIA() 1 +@@ -86,6 +102,7 @@ + #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_ANDROID() 0 + #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_MACOSX() 0 + #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_LINUX() 0 ++#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_HAIKU() 0 + #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_WIN() 0 + #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_WASM() 0 + #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_FUCHSIA() 0 +diff --git a/src/3rdparty/chromium/third_party/perfetto/include/perfetto/base/thread_utils.h b/src/3rdparty/chromium/third_party/perfetto/include/perfetto/base/thread_utils.h +index 89da007..623cb5a 100644 +--- a/src/3rdparty/chromium/third_party/perfetto/include/perfetto/base/thread_utils.h ++++ b/src/3rdparty/chromium/third_party/perfetto/include/perfetto/base/thread_utils.h +@@ -29,7 +29,11 @@ + #include + #else + #include ++#if !PERFETTO_BUILDFLAG(PERFETTO_OS_HAIKU) + #include ++#else ++#include ++#endif + #include + #include + #endif +@@ -42,6 +46,11 @@ using PlatformThreadId = pid_t; + inline PlatformThreadId GetThreadId() { + return gettid(); + } ++#elif PERFETTO_BUILDFLAG(PERFETTO_OS_HAIKU) ++using PlatformThreadId = thread_id; ++inline PlatformThreadId GetThreadId() { ++ return find_thread(NULL); ++} + #elif PERFETTO_BUILDFLAG(PERFETTO_OS_LINUX) + using PlatformThreadId = pid_t; + inline PlatformThreadId GetThreadId() { +diff --git a/src/3rdparty/chromium/third_party/perfetto/include/perfetto/base/time.h b/src/3rdparty/chromium/third_party/perfetto/include/perfetto/base/time.h +index 0ee6042..15c1f9e 100644 +--- a/src/3rdparty/chromium/third_party/perfetto/include/perfetto/base/time.h ++++ b/src/3rdparty/chromium/third_party/perfetto/include/perfetto/base/time.h +@@ -141,6 +141,9 @@ inline TimeNanos GetTimeInternalNs(clockid_t clk_id) { + // Return ns from boot. Conversely to GetWallTimeNs, this clock counts also time + // during suspend (when supported). + inline TimeNanos GetBootTimeNs() { ++#if PERFETTO_BUILDFLAG(PERFETTO_OS_HAIKU) ++ return GetTimeInternalNs(kWallTimeClockSource); ++#else + // Determine if CLOCK_BOOTTIME is available on the first call. + static const clockid_t kBootTimeClockSource = [] { + struct timespec ts = {}; +@@ -148,6 +151,7 @@ inline TimeNanos GetBootTimeNs() { + return res == 0 ? CLOCK_BOOTTIME : kWallTimeClockSource; + }(); + return GetTimeInternalNs(kBootTimeClockSource); ++#endif + } + + inline TimeNanos GetWallTimeNs() { +diff --git a/src/3rdparty/chromium/third_party/perfetto/include/perfetto/ext/base/event_fd.h b/src/3rdparty/chromium/third_party/perfetto/include/perfetto/ext/base/event_fd.h +index 9e1715b..55854d9 100644 +--- a/src/3rdparty/chromium/third_party/perfetto/include/perfetto/ext/base/event_fd.h ++++ b/src/3rdparty/chromium/third_party/perfetto/include/perfetto/ext/base/event_fd.h +@@ -20,8 +20,8 @@ + #include "perfetto/base/build_config.h" + #include "perfetto/ext/base/scoped_file.h" + +-#if PERFETTO_BUILDFLAG(PERFETTO_OS_LINUX) || \ +- PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID) ++#if !PERFETTO_BUILDFLAG(PERFETTO_OS_HAIKU) && (PERFETTO_BUILDFLAG(PERFETTO_OS_LINUX) || \ ++ PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID)) + #define PERFETTO_USE_EVENTFD() 1 + #else + #define PERFETTO_USE_EVENTFD() 0 +diff --git a/src/3rdparty/chromium/third_party/perfetto/include/perfetto/ext/base/utils.h b/src/3rdparty/chromium/third_party/perfetto/include/perfetto/ext/base/utils.h +index aadded6..eb1bfc6 100644 +--- a/src/3rdparty/chromium/third_party/perfetto/include/perfetto/ext/base/utils.h ++++ b/src/3rdparty/chromium/third_party/perfetto/include/perfetto/ext/base/utils.h +@@ -23,6 +23,7 @@ + #include + #include + #include ++#include + #if !PERFETTO_BUILDFLAG(PERFETTO_OS_WIN) + #include + #endif +@@ -71,7 +72,7 @@ struct FreeDeleter { + + template + constexpr T AssumeLittleEndian(T value) { +- static_assert(__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__, ++ static_assert(std::is_same::value && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__, + "Unimplemented on big-endian archs"); + return value; + } +diff --git a/src/3rdparty/chromium/third_party/perfetto/include/perfetto/protozero/message.h b/src/3rdparty/chromium/third_party/perfetto/include/perfetto/protozero/message.h +index b53dcda..ade4151 100644 +--- a/src/3rdparty/chromium/third_party/perfetto/include/perfetto/protozero/message.h ++++ b/src/3rdparty/chromium/third_party/perfetto/include/perfetto/protozero/message.h +@@ -137,6 +137,13 @@ class PERFETTO_EXPORT Message { + + pos = proto_utils::WriteVarInt(proto_utils::MakeTagFixed(field_id), pos); + memcpy(pos, &value, sizeof(T)); ++#if __BYTE_ORDER__ != __ORDER_LITTLE_ENDIAN__ ++ for (size_t i = sizeof(T)/2; i--; ) { ++ uint8_t tmp = pos[i]; ++ pos[i] = pos[sizeof(T)-1-i]; ++ pos[sizeof(T)-1-i] = tmp; ++ } ++#endif + pos += sizeof(T); + // TODO: Optimize memcpy performance, see http://crbug.com/624311 . + WriteToStream(buffer, pos); +diff --git a/src/3rdparty/chromium/third_party/perfetto/src/base/file_utils.cc b/src/3rdparty/chromium/third_party/perfetto/src/base/file_utils.cc +index b8020ad..622bd7d 100644 +--- a/src/3rdparty/chromium/third_party/perfetto/src/base/file_utils.cc ++++ b/src/3rdparty/chromium/third_party/perfetto/src/base/file_utils.cc +@@ -89,7 +89,7 @@ ssize_t WriteAll(int fd, const void* buf, size_t count) { + + bool FlushFile(int fd) { + PERFETTO_DCHECK(fd != 0); +-#if PERFETTO_BUILDFLAG(PERFETTO_OS_LINUX) || \ ++#if PERFETTO_BUILDFLAG(PERFETTO_OS_LINUX) && !PERFETTO_BUILDFLAG(PERFETTO_OS_HAIKU) || \ + PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID) + return !PERFETTO_EINTR(fdatasync(fd)); + #elif PERFETTO_BUILDFLAG(PERFETTO_OS_WIN) +diff --git a/src/3rdparty/chromium/third_party/perfetto/src/base/paged_memory.cc b/src/3rdparty/chromium/third_party/perfetto/src/base/paged_memory.cc +index c7feb53..b412b33 100644 +--- a/src/3rdparty/chromium/third_party/perfetto/src/base/paged_memory.cc ++++ b/src/3rdparty/chromium/third_party/perfetto/src/base/paged_memory.cc +@@ -113,7 +113,8 @@ bool PagedMemory::AdviseDontNeed(void* p, size_t size) { + PERFETTO_DCHECK(p_); + PERFETTO_DCHECK(p >= p_); + PERFETTO_DCHECK(static_cast(p) + size <= p_ + size_); +-#if PERFETTO_BUILDFLAG(PERFETTO_OS_WIN) || PERFETTO_BUILDFLAG(PERFETTO_OS_NACL) ++#if PERFETTO_BUILDFLAG(PERFETTO_OS_WIN) || PERFETTO_BUILDFLAG(PERFETTO_OS_NACL) \ ++ || PERFETTO_BUILDFLAG(PERFETTO_OS_HAIKU) + // Discarding pages on Windows has more CPU cost than is justified for the + // possible memory savings. + return false; +diff --git a/src/3rdparty/chromium/third_party/perfetto/src/base/subprocess.cc b/src/3rdparty/chromium/third_party/perfetto/src/base/subprocess.cc +index 92346a4..3e90904 100644 +--- a/src/3rdparty/chromium/third_party/perfetto/src/base/subprocess.cc ++++ b/src/3rdparty/chromium/third_party/perfetto/src/base/subprocess.cc +@@ -31,8 +31,8 @@ + #include "perfetto/base/time.h" + #include "perfetto/ext/base/utils.h" + +-#if PERFETTO_BUILDFLAG(PERFETTO_OS_LINUX) || \ +- PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID) ++#if !PERFETTO_BUILDFLAG(PERFETTO_OS_HAIKU) && (PERFETTO_BUILDFLAG(PERFETTO_OS_LINUX) || \ ++ PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID)) + #include + #endif + +@@ -56,8 +56,8 @@ struct ChildProcessArgs { + // Don't add any dynamic allocation in this function. This will be invoked + // under a fork(), potentially in a state where the allocator lock is held. + void __attribute__((noreturn)) ChildProcess(ChildProcessArgs* args) { +-#if PERFETTO_BUILDFLAG(PERFETTO_OS_LINUX) || \ +- PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID) ++#if !PERFETTO_BUILDFLAG(PERFETTO_OS_HAIKU) && (PERFETTO_BUILDFLAG(PERFETTO_OS_LINUX) || \ ++ PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID)) + // In no case we want a child process to outlive its parent process. This is + // relevant for tests, so that a test failure/crash doesn't leave child + // processes around that get reparented to init. +diff --git a/src/3rdparty/chromium/third_party/perfetto/src/base/thread_task_runner.cc b/src/3rdparty/chromium/third_party/perfetto/src/base/thread_task_runner.cc +index d1a3b93..6ffbd84 100644 +--- a/src/3rdparty/chromium/third_party/perfetto/src/base/thread_task_runner.cc ++++ b/src/3rdparty/chromium/third_party/perfetto/src/base/thread_task_runner.cc +@@ -27,7 +27,7 @@ + #include "perfetto/base/logging.h" + #include "perfetto/ext/base/unix_task_runner.h" + +-#if PERFETTO_BUILDFLAG(PERFETTO_OS_LINUX) || \ ++#if (PERFETTO_BUILDFLAG(PERFETTO_OS_LINUX) && !PERFETTO_BUILDFLAG(PERFETTO_OS_HAIKU)) || \ + PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID) + #include + #endif +@@ -84,6 +84,8 @@ void ThreadTaskRunner::RunTaskThread( + if (!name_.empty()) { + #if PERFETTO_BUILDFLAG(PERFETTO_OS_MACOSX) + pthread_setname_np(name_.c_str()); ++#elif PERFETTO_BUILDFLAG(PERFETTO_OS_HAIKU) ++ rename_thread(find_thread(NULL), name_.c_str()); + #elif PERFETTO_BUILDFLAG(PERFETTO_OS_LINUX) || \ + PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID) + prctl(PR_SET_NAME, name_.c_str()); +diff --git a/src/3rdparty/chromium/third_party/perfetto/src/base/unix_socket.cc b/src/3rdparty/chromium/third_party/perfetto/src/base/unix_socket.cc +index 3a92198..45c2942 100644 +--- a/src/3rdparty/chromium/third_party/perfetto/src/base/unix_socket.cc ++++ b/src/3rdparty/chromium/third_party/perfetto/src/base/unix_socket.cc +@@ -37,7 +37,7 @@ + #include "perfetto/ext/base/string_utils.h" + #include "perfetto/ext/base/utils.h" + +-#if PERFETTO_BUILDFLAG(PERFETTO_OS_MACOSX) ++#if PERFETTO_BUILDFLAG(PERFETTO_OS_MACOSX) || PERFETTO_BUILDFLAG(PERFETTO_OS_HAIKU) + #include + #endif + +@@ -601,7 +601,7 @@ void UnixSocket::ReadPeerCredentials() { + if (sock_raw_.family() != SockFamily::kUnix) + return; + +-#if PERFETTO_BUILDFLAG(PERFETTO_OS_LINUX) || \ ++#if (PERFETTO_BUILDFLAG(PERFETTO_OS_LINUX) && !PERFETTO_BUILDFLAG(PERFETTO_OS_HAIKU)) || \ + PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID) + struct ucred user_cred; + socklen_t len = sizeof(user_cred); +diff --git a/src/3rdparty/chromium/third_party/perfetto/src/protozero/message.cc b/src/3rdparty/chromium/third_party/perfetto/src/protozero/message.cc +index 419f7f1..1a60504 100644 +--- a/src/3rdparty/chromium/third_party/perfetto/src/protozero/message.cc ++++ b/src/3rdparty/chromium/third_party/perfetto/src/protozero/message.cc +@@ -22,12 +22,6 @@ + #include "perfetto/base/logging.h" + #include "perfetto/protozero/message_handle.h" + +-#if __BYTE_ORDER__ != __ORDER_LITTLE_ENDIAN__ +-// The memcpy() for float and double below needs to be adjusted if we want to +-// support big endian CPUs. There doesn't seem to be a compelling need today. +-#error Unimplemented for big endian archs. +-#endif +- + namespace protozero { + + namespace { +diff --git a/src/3rdparty/chromium/third_party/perfetto/src/protozero/proto_decoder.cc b/src/3rdparty/chromium/third_party/perfetto/src/protozero/proto_decoder.cc +index b606818..6b5b308 100644 +--- a/src/3rdparty/chromium/third_party/perfetto/src/protozero/proto_decoder.cc ++++ b/src/3rdparty/chromium/third_party/perfetto/src/protozero/proto_decoder.cc +@@ -28,7 +28,8 @@ namespace protozero { + using namespace proto_utils; + + #if __BYTE_ORDER__ != __ORDER_LITTLE_ENDIAN__ +-#error Unimplemented for big endian archs. ++#define BYTE_SWAP_TO_LE32(x) __builtin_bswap32(x) ++#define BYTE_SWAP_TO_LE64(x) __builtin_bswap64(x) + #endif + + namespace { +diff --git a/src/3rdparty/chromium/third_party/perfetto/src/tracing/core/tracing_service_impl.cc b/src/3rdparty/chromium/third_party/perfetto/src/tracing/core/tracing_service_impl.cc +index 734b1f7..7d24087 100644 +--- a/src/3rdparty/chromium/third_party/perfetto/src/tracing/core/tracing_service_impl.cc ++++ b/src/3rdparty/chromium/third_party/perfetto/src/tracing/core/tracing_service_impl.cc +@@ -2326,6 +2326,7 @@ void TracingServiceImpl::SnapshotClocks(std::vector* packets, + + #if !PERFETTO_BUILDFLAG(PERFETTO_OS_MACOSX) && \ + !PERFETTO_BUILDFLAG(PERFETTO_OS_WIN) && \ ++ !PERFETTO_BUILDFLAG(PERFETTO_OS_HAIKU) && \ + !PERFETTO_BUILDFLAG(PERFETTO_OS_NACL) + struct { + clockid_t id; +-- +2.30.2 + + +From 7b802e1dccb70ed6b16dcefc34e04b1a4aa0b8cb Mon Sep 17 00:00:00 2001 +From: Jerome Duval +Date: Sat, 30 Jan 2021 21:33:44 +0100 +Subject: protobuf build workaround + + +diff --git a/src/3rdparty/chromium/third_party/protobuf/src/google/protobuf/port_def.inc b/src/3rdparty/chromium/third_party/protobuf/src/google/protobuf/port_def.inc +index f1bd85d..e126473 100644 +--- a/src/3rdparty/chromium/third_party/protobuf/src/google/protobuf/port_def.inc ++++ b/src/3rdparty/chromium/third_party/protobuf/src/google/protobuf/port_def.inc +@@ -510,7 +510,9 @@ + + PROTOBUF_EXPORT_TEMPLATE_TEST(DEFAULT, ); + PROTOBUF_EXPORT_TEMPLATE_TEST(DEFAULT, __attribute__((visibility("default")))); ++#ifndef __HAIKU__ + PROTOBUF_EXPORT_TEMPLATE_TEST(MSVC_HACK, __declspec(dllexport)); ++#endif + PROTOBUF_EXPORT_TEMPLATE_TEST(DEFAULT, __declspec(dllimport)); + + #undef PROTOBUF_EXPORT_TEMPLATE_TEST +-- +2.30.2 + + +From 3282ce162c66415fa938c04c7ee060fd82ad6597 Mon Sep 17 00:00:00 2001 +From: Jerome Duval +Date: Sat, 6 Feb 2021 16:18:33 +0100 +Subject: Haiku patches (from FreeBSD or Kasper) + + +diff --git a/src/3rdparty/chromium/base/BUILD.gn b/src/3rdparty/chromium/base/BUILD.gn +index 2f5fa91..f435258 100644 +--- a/src/3rdparty/chromium/base/BUILD.gn ++++ b/src/3rdparty/chromium/base/BUILD.gn +@@ -1682,24 +1682,6 @@ jumbo_component("base") { + public_deps += [ "//third_party/boringssl" ] + } + +- if (is_haiku) { +- sources -= [ +- "process/memory.cc", +- ] +- sources += [ +- "base_paths_haiku.cc", +- "base_paths_haiku.h", +- "process/memory_stubs.cc", +- "process/process_handle_haiku.cc", +- "process/process_iterator_haiku.cc", +- "process/process_metrics_haiku.cc", +- "threading/platform_thread_haiku.cc", +- "sys_info_haiku.cc" +- ] +- +- defines += [ "_BSD_SOURCE", "__USE_XOPEN2K8" ] +- } +- + # NaCl. + if (is_nacl) { + # Explicitly include the linux file. +@@ -1973,6 +1955,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/debug/elf_reader.cc b/src/3rdparty/chromium/base/debug/elf_reader.cc +index aea4f3b..0125ddd 100644 +--- a/src/3rdparty/chromium/base/debug/elf_reader.cc ++++ b/src/3rdparty/chromium/base/debug/elf_reader.cc +@@ -7,6 +7,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_posix.cc b/src/3rdparty/chromium/base/debug/stack_trace_posix.cc +index 92f7e41..d24568c 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) && !defined(OS_HAIKU) && !defined(OS_HAIKU) ++#if !defined(__UCLIBC__) && !defined(_AIX) && !defined(OS_HAIKU) + #include + #endif + +@@ -35,7 +35,7 @@ + #include + #endif + +-#if defined(OS_LINUX) ++#if defined(OS_LINUX) || defined(OS_HAIKU) + #include "base/debug/proc_maps_linux.h" + #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 b5e2736..9583801 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 +@@ -21,6 +21,9 @@ + #include "base/trace_event/memory_allocator_dump.h" + #include "base/trace_event/memory_dump_manager.h" + ++#define MADV_DONTNEED POSIX_MADV_DONTNEED ++#define madvise posix_madvise ++ + #if defined(ADDRESS_SANITIZER) + #include + #endif // defined(ADDRESS_SANITIZER) +@@ -292,6 +295,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); +@@ -300,6 +304,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 220cbdd..34c0e62 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) ++#if defined(OS_LINUX) || defined(OS_HAIKU) + namespace content { + class SandboxIPCHandler; + } +@@ -121,7 +121,7 @@ class BASE_EXPORT PlatformSharedMemoryRegion { + kMaxValue = GET_SHMEM_TEMP_DIR_FAILURE + }; + +-#if defined(OS_LINUX) ++#if defined(OS_LINUX) || defined(OS_HAIKU) + // Structure to limit access to executable region creation. + struct ExecutableRegion { + private: +@@ -266,7 +266,7 @@ class BASE_EXPORT PlatformSharedMemoryRegion { + CheckPlatformHandlePermissionsCorrespondToMode); + static PlatformSharedMemoryRegion Create(Mode mode, + size_t size +-#if defined(OS_LINUX) ++#if defined(OS_LINUX) || 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 61ee202..a1ad768 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 +@@ -69,7 +69,7 @@ FDPair ScopedFDPair::get() const { + return {fd.get(), readonly_fd.get()}; + } + +-#if defined(OS_LINUX) ++#if defined(OS_LINUX) || defined(OS_HAIKU) + // static + ScopedFD PlatformSharedMemoryRegion::ExecutableRegion::CreateFD(size_t size) { + PlatformSharedMemoryRegion region = +@@ -78,7 +78,7 @@ ScopedFD PlatformSharedMemoryRegion::ExecutableRegion::CreateFD(size_t size) { + return region.PassPlatformHandle().fd; + return ScopedFD(); + } +-#endif // defined(OS_LINUX) ++#endif // defined(OS_LINUX) || defined(OS_HAIKU) + + // static + PlatformSharedMemoryRegion PlatformSharedMemoryRegion::Take( +@@ -203,7 +203,7 @@ bool PlatformSharedMemoryRegion::MapAtInternal(off_t offset, + // static + PlatformSharedMemoryRegion PlatformSharedMemoryRegion::Create(Mode mode, + size_t size +-#if defined(OS_LINUX) ++#if defined(OS_LINUX) || defined(OS_HAIKU) + , + bool executable + #endif +@@ -232,7 +232,7 @@ PlatformSharedMemoryRegion PlatformSharedMemoryRegion::Create(Mode mode, + // flag. + FilePath directory; + if (!GetShmemTempDir( +-#if defined(OS_LINUX) ++#if defined(OS_LINUX) || defined(OS_HAIKU) + executable, + #else + false /* executable */, +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/process/memory.cc b/src/3rdparty/chromium/base/process/memory.cc +index 4a09c8d..e7e711c 100644 +--- a/src/3rdparty/chromium/base/process/memory.cc ++++ b/src/3rdparty/chromium/base/process/memory.cc +@@ -42,7 +42,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 { + +@@ -61,7 +61,7 @@ void TerminateBecauseOutOfMemory(size_t size) { + #endif // !defined(OS_WIN) + + // Defined in memory_mac.mm for Mac. +-#if !defined(OS_MACOSX) ++#if !defined(OS_MACOSX) && !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/process_metrics_posix.cc b/src/3rdparty/chromium/base/process/process_metrics_posix.cc +index c0d1f32..59f9df8 100644 +--- a/src/3rdparty/chromium/base/process/process_metrics_posix.cc ++++ b/src/3rdparty/chromium/base/process/process_metrics_posix.cc +@@ -54,7 +54,7 @@ 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 = 8192; ++static const rlim_t kSystemDefaultMaxFds = 4096; + #endif + + size_t GetMaxFds() { +diff --git a/src/3rdparty/chromium/base/process/process_posix.cc b/src/3rdparty/chromium/base/process/process_posix.cc +index 17dae52..5dceb89 100644 +--- a/src/3rdparty/chromium/base/process/process_posix.cc ++++ b/src/3rdparty/chromium/base/process/process_posix.cc +@@ -267,12 +267,12 @@ Process Process::DeprecatedGetProcessFromHandle(ProcessHandle handle) { + return Process(handle); + } + +-#if !defined(OS_LINUX) && !defined(OS_MACOSX) && !defined(OS_AIX) ++#if !defined(OS_LINUX) && !defined(OS_MACOSX) && !defined(OS_AIX) && !defined(OS_HAIKU) + // static + bool Process::CanBackgroundProcesses() { + return false; + } +-#endif // !defined(OS_LINUX) && !defined(OS_MACOSX) && !defined(OS_AIX) ++#endif // !defined(OS_LINUX) && !defined(OS_MACOSX) && !defined(OS_AIX) && !defined(OS_HAIKU) + + // static + void Process::TerminateCurrentProcessImmediately(int exit_code) { +@@ -362,7 +362,7 @@ bool Process::WaitForExitWithTimeout(TimeDelta timeout, int* exit_code) const { + + void Process::Exited(int exit_code) const {} + +-#if !defined(OS_LINUX) && !defined(OS_MACOSX) && !defined(OS_AIX) ++#if !defined(OS_LINUX) && !defined(OS_MACOSX) && !defined(OS_AIX) && !defined(OS_HAIKU) + bool Process::IsProcessBackgrounded() const { + // See SetProcessBackgrounded(). + DCHECK(IsValid()); +@@ -376,7 +376,7 @@ bool Process::SetProcessBackgrounded(bool value) { + NOTIMPLEMENTED(); + return false; + } +-#endif // !defined(OS_LINUX) && !defined(OS_MACOSX) && !defined(OS_AIX) ++#endif // !defined(OS_LINUX) && !defined(OS_MACOSX) && !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 2aee7c4..d144393 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/sys_info_haiku.cc b/src/3rdparty/chromium/base/system/sys_info_haiku.cc +similarity index 67% +rename from src/3rdparty/chromium/base/sys_info_haiku.cc +rename to src/3rdparty/chromium/base/system/sys_info_haiku.cc +index e38fda1..a9598a1 100644 +--- a/src/3rdparty/chromium/base/sys_info_haiku.cc ++++ b/src/3rdparty/chromium/base/system/sys_info_haiku.cc +@@ -2,7 +2,7 @@ + // Use of this source code is governed by a BSD-style license that can be + // found in the LICENSE file. + +-#include "base/sys_info.h" ++#include "base/system/sys_info.h" + + #include "base/logging.h" + +@@ -19,21 +19,11 @@ int64_t SysInfo::AmountOfPhysicalMemoryImpl() { + + // static + int64_t SysInfo::AmountOfAvailablePhysicalMemoryImpl() { +- // TODO(fuchsia): https://crbug.com/706592 This is not exposed. +- NOTREACHED(); +- return 0; +-} +- +-// static +-int SysInfo::NumberOfProcessors() { + system_info systemInfo; + get_system_info(&systemInfo); +- return static_cast(systemInfo.cpu_count); ++ return static_cast((systemInfo.max_pages - systemInfo.used_pages) ++ * (B_PAGE_SIZE / 1048576.0f) + 0.5f); + } + +-// static +-int64_t SysInfo::AmountOfVirtualMemory() { +- return 0; +-} + + } // 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 8961acf..90795e6 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) { ++ } else if (is_linux && !is_haiku) { + sources += [ + "epoll.c", + "linux/config.h", +diff --git a/src/3rdparty/chromium/base/third_party/libevent/haiku/config.h b/src/3rdparty/chromium/base/third_party/libevent/haiku/config.h +index aee0d1c..5990ae7 100644 +--- a/src/3rdparty/chromium/base/third_party/libevent/haiku/config.h ++++ b/src/3rdparty/chromium/base/third_party/libevent/haiku/config.h +@@ -122,7 +122,7 @@ + #define HAVE_STRLCPY 1 + + /* Define to 1 if you have the `strsep' function. */ +-/* #undef HAVE_STRSEP */ ++#define HAVE_STRSEP 1 + + /* Define to 1 if you have the `strtok_r' function. */ + #define HAVE_STRTOK_R 1 +diff --git a/src/3rdparty/chromium/base/threading/platform_thread.h b/src/3rdparty/chromium/base/threading/platform_thread.h +index aa5b952..8506dbf 100644 +--- a/src/3rdparty/chromium/base/threading/platform_thread.h ++++ b/src/3rdparty/chromium/base/threading/platform_thread.h +@@ -221,7 +221,7 @@ class BASE_EXPORT PlatformThread { + + static ThreadPriority GetCurrentThreadPriority(); + +-#if defined(OS_LINUX) ++#if defined(OS_LINUX) || 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 +index fb46138..2713e02 100644 +--- a/src/3rdparty/chromium/base/threading/platform_thread_haiku.cc ++++ b/src/3rdparty/chromium/base/threading/platform_thread_haiku.cc +@@ -21,24 +21,47 @@ const ThreadPriorityToNiceValuePair kThreadPriorityToNiceValueMap[4] = { + {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; + } + +-bool GetCurrentThreadPriorityForPlatform(ThreadPriority* priority) { +- sched_param prio = {0}; +- int policy; +- if (pthread_getschedparam(pthread_self(), &policy, &prio) != 0) { +- return false; ++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); + } +- *priority = NiceValueToThreadPriority(prio.sched_priority); +- return true; ++ return base::nullopt; + } + + } // namespace internal + ++ ++// static ++void PlatformThread::SetThreadPriority(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, getpid()); ++ ++ 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() {} +diff --git a/src/3rdparty/chromium/base/threading/platform_thread_linux.cc b/src/3rdparty/chromium/base/threading/platform_thread_linux.cc +index 095c49b..3f170a6 100644 +--- a/src/3rdparty/chromium/base/threading/platform_thread_linux.cc ++++ b/src/3rdparty/chromium/base/threading/platform_thread_linux.cc +@@ -18,7 +18,9 @@ + + #if !defined(OS_NACL) && !defined(OS_AIX) + #include ++#if !defined(OS_HAIKU) + #include ++#endif + #include + #include + #include +@@ -99,7 +101,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; +@@ -141,7 +143,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 5b48f67..abc3b04 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) + // Threads on linux/android may inherit their priority from the thread + // where they were created. This explicitly sets the priority of all new + // threads. +diff --git a/src/3rdparty/chromium/build/config/BUILD.gn b/src/3rdparty/chromium/build/config/BUILD.gn +index e2462f1..abba7d2 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) { ++ } else if (is_linux && !is_haiku) { + libs = [ + "dl", + "pthread", +diff --git a/src/3rdparty/chromium/build/config/compiler/BUILD.gn b/src/3rdparty/chromium/build/config/compiler/BUILD.gn +index 2acba29..511d817 100644 +--- a/src/3rdparty/chromium/build/config/compiler/BUILD.gn ++++ b/src/3rdparty/chromium/build/config/compiler/BUILD.gn +@@ -1501,7 +1501,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" ] ++ } + } + } + +@@ -1772,7 +1774,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/gcc/BUILD.gn b/src/3rdparty/chromium/build/config/gcc/BUILD.gn +index 747245f..be85a17 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 +index a3bb107..95fed9d 100644 +--- a/src/3rdparty/chromium/build/config/haiku/BUILD.gn ++++ b/src/3rdparty/chromium/build/config/haiku/BUILD.gn +@@ -35,11 +35,3 @@ if (use_glib) { + } + } + +-# Ensures all exported symbols are added to the dynamic symbol table. This is +-# necessary to expose Chrome's custom operator new() and operator delete() (and +-# other memory-related symbols) to libraries. Otherwise, they might +-# (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") { +- ldflags = [ "-rdynamic" ] +-} +diff --git a/src/3rdparty/chromium/build/config/ui.gni b/src/3rdparty/chromium/build/config/ui.gni +index c6f816b..ff45e09 100644 +--- a/src/3rdparty/chromium/build/config/ui.gni ++++ b/src/3rdparty/chromium/build/config/ui.gni +@@ -27,7 +27,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_fuchsia ++ use_aura = is_win || is_linux || is_fuchsia || is_haiku + } + + declare_args() { +diff --git a/src/3rdparty/chromium/chrome/common/webui_url_constants.cc b/src/3rdparty/chromium/chrome/common/webui_url_constants.cc +index bae0b89..f600c37 100644 +--- a/src/3rdparty/chromium/chrome/common/webui_url_constants.cc ++++ b/src/3rdparty/chromium/chrome/common/webui_url_constants.cc +@@ -322,7 +322,7 @@ bool IsSystemWebUIHost(base::StringPiece host) { + const char kChromeUICastHost[] = "cast"; + #endif + +-#if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) ++#if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) || defined(OS_HAIKU) + const char kChromeUIDiscardsHost[] = "discards"; + const char kChromeUIDiscardsURL[] = "chrome://discards/"; + const char kChromeUIHatsHost[] = "hats"; +@@ -333,17 +333,17 @@ const char kChromeUIHatsURL[] = "chrome://hats/"; + const char kChromeUILinuxProxyConfigHost[] = "linux-proxy-config"; + #endif + +-#if defined(OS_WIN) || defined(OS_LINUX) || defined(OS_ANDROID) ++#if defined(OS_WIN) || defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_HAIKU) + const char kChromeUISandboxHost[] = "sandbox"; + #endif + + #if defined(OS_WIN) || defined(OS_MACOSX) || \ +- (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(TOOLKIT_VIEWS)) || defined(USE_AURA) ++#if ((defined(OS_LINUX) || 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 e1b1e52..e3da202 100644 +--- a/src/3rdparty/chromium/chrome/common/webui_url_constants.h ++++ b/src/3rdparty/chromium/chrome/common/webui_url_constants.h +@@ -283,7 +283,7 @@ bool IsSystemWebUIHost(base::StringPiece host); + extern const char kChromeUICastHost[]; + #endif + +-#if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) ++#if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) || defined(OS_HAIKU) + extern const char kChromeUIDiscardsHost[]; + extern const char kChromeUIDiscardsURL[]; + extern const char kChromeUIHatsHost[]; +@@ -295,17 +295,17 @@ extern const char kChromeUIHatsURL[]; + extern const char kChromeUILinuxProxyConfigHost[]; + #endif + +-#if defined(OS_WIN) || defined(OS_LINUX) || defined(OS_ANDROID) ++#if defined(OS_WIN) || defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_HAIKU) + extern const char kChromeUISandboxHost[]; + #endif + + #if defined(OS_WIN) || defined(OS_MACOSX) || \ +- (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(TOOLKIT_VIEWS)) || defined(USE_AURA) ++#if ((defined(OS_LINUX) || defined(OS_HAIKU)) && defined(TOOLKIT_VIEWS)) || defined(USE_AURA) + extern const char kChromeUITabModalConfirmDialogHost[]; + #endif + +diff --git a/src/3rdparty/chromium/components/metrics/BUILD.gn b/src/3rdparty/chromium/components/metrics/BUILD.gn +index 01487a8..f94f116 100644 +--- a/src/3rdparty/chromium/components/metrics/BUILD.gn ++++ b/src/3rdparty/chromium/components/metrics/BUILD.gn +@@ -173,6 +173,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 e4b1781..eb40030 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_MACOSX) || (defined(OS_LINUX) && !defined(OS_CHROMEOS)) ++#if defined(OS_MACOSX) || (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/content/browser/child_process_launcher_helper_linux.cc b/src/3rdparty/chromium/content/browser/child_process_launcher_helper_linux.cc +index e53e60e..1bb5bfc 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 +@@ -18,7 +18,9 @@ + #include "content/public/common/sandboxed_process_launcher_delegate.h" + #include "services/service_manager/sandbox/linux/sandbox_linux.h" + #include "services/service_manager/zygote/common/common_sandbox_support_linux.h" ++#if !defined(OS_HAIKU) + #include "services/service_manager/zygote/common/zygote_handle.h" ++#endif + #include "services/service_manager/zygote/host/zygote_communication_linux.h" + #include "services/service_manager/zygote/host/zygote_host_impl_linux.h" + +@@ -50,11 +52,13 @@ 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, service_manager::GetSandboxFD())); + } ++#endif + + options->environment = delegate_->GetEnvironment(); + +@@ -69,6 +73,7 @@ ChildProcessLauncherHelper::LaunchProcessOnLauncherThread( + int* launch_result) { + *is_synchronous_launch = true; + ++#if !defined(OS_HAIKU) + service_manager::ZygoteHandle zygote_handle = + base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kNoZygote) + ? nullptr +@@ -82,7 +87,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; +@@ -92,13 +96,13 @@ ChildProcessLauncherHelper::LaunchProcessOnLauncherThread( + service_manager::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); +@@ -116,10 +120,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 { +@@ -143,13 +151,17 @@ void ChildProcessLauncherHelper::ForceNormalProcessTerminationSync( + DCHECK(CurrentlyOnProcessLauncherTaskRunner()); + process.process.Terminate(service_manager::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 44d1f36..aa5dc21 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 +@@ -109,7 +109,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/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 ec99318..3c11252 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_MACOSX) + #include "ui/accelerated_widget_mac/window_resize_helper_mac.h" + #endif +-#if defined(OS_LINUX) ++#if defined(OS_LINUX) || 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) ++#if defined(OS_LINUX) || 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) ++#if defined(OS_LINUX) || 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 7475c7c..5f35c98 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) ++#if defined(OS_LINUX) || 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) ++#if defined(OS_LINUX) || 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 07b3dfe..2c48444 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 +@@ -240,7 +240,7 @@ + #include "content/browser/gpu/gpu_data_manager_impl.h" + #endif + +-#if defined(OS_LINUX) ++#if defined(OS_LINUX) || defined(OS_HAIKU) + #include + #include + +@@ -1204,7 +1204,7 @@ static constexpr size_t kUnknownPlatformProcessLimit = 0; + // to indicate failure and std::numeric_limits::max() to indicate + // unlimited. + size_t GetPlatformProcessLimit() { +-#if defined(OS_LINUX) ++#if defined(OS_LINUX) + struct rlimit limit; + if (getrlimit(RLIMIT_NPROC, &limit) != 0) + return kUnknownPlatformProcessLimit; +@@ -1303,7 +1303,7 @@ void RenderProcessHostImpl::IOThreadHostImpl::BindHostReceiver(mojo::GenericPend + return; + } + +-#if defined(OS_LINUX) ++#if defined(OS_LINUX) || defined(OS_HAIKU) + if (auto font_receiver = receiver.As()) { + ConnectToFontService(std::move(font_receiver)); + return; +@@ -1719,7 +1719,7 @@ bool RenderProcessHostImpl::Init() { + renderer_prefix = + browser_command_line.GetSwitchValueNative(switches::kRendererCmdPrefix); + +-#if defined(OS_LINUX) ++#if defined(OS_LINUX) || defined(OS_HAIKU) + int flags = renderer_prefix.empty() ? ChildProcessHost::CHILD_ALLOW_SELF + : ChildProcessHost::CHILD_NORMAL; + #elif defined(OS_MACOSX) +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 e747268..c720008 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 +@@ -475,10 +475,10 @@ class CONTENT_EXPORT RenderProcessHostImpl + is_for_guests_only_ = is_for_guests_only; + } + +-#if defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX) ++#if defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX) && !defined(OS_HAIKU) + // Launch the zygote early in the browser startup. + static void EarlyZygoteLaunch(); +-#endif // defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX) ++#endif // defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX) && !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/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/gpu/gpu_sandbox_hook_linux.cc b/src/3rdparty/chromium/content/gpu/gpu_sandbox_hook_linux.cc +index 6cacc8a..6b3d365 100644 +--- a/src/3rdparty/chromium/content/gpu/gpu_sandbox_hook_linux.cc ++++ b/src/3rdparty/chromium/content/gpu/gpu_sandbox_hook_linux.cc +@@ -97,8 +97,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 AddV4L2GpuWhitelist( + std::vector* permissions, + const service_manager::SandboxSeccompBPF::Options& options) { +@@ -333,8 +334,10 @@ std::vector FilePermissionsForGpu( + AddStandardGpuWhiteList(&permissions); + return permissions; + } ++#endif + + void LoadArmGpuLibraries() { ++#if !defined(OS_HAIKU) + // Preload the Mali library. + if (UseChromecastSandboxWhitelist()) { + for (const char* path : kWhitelistedChromecastPaths) { +@@ -349,6 +352,7 @@ void LoadArmGpuLibraries() { + // Preload the Tegra V4L2 (video decode acceleration) library. + dlopen(kLibTegraPath, dlopen_flag); + } ++#endif + } + + bool LoadAmdGpuLibraries() { +@@ -429,6 +433,8 @@ bool BrokerProcessPreSandboxHook( + } // namespace + + bool GpuProcessPreSandboxHook(service_manager::SandboxLinux::Options options) { ++ NOTIMPLEMENTED(); ++#if !defined(OS_HAIKU) + service_manager::SandboxLinux::GetInstance()->StartBrokerProcess( + CommandSetForGPU(options), FilePermissionsForGpu(options), + base::BindOnce(BrokerProcessPreSandboxHook), options); +@@ -440,6 +446,7 @@ bool GpuProcessPreSandboxHook(service_manager::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 1f9802f..dfb5a97 100644 +--- a/src/3rdparty/chromium/content/public/common/child_process_host.h ++++ b/src/3rdparty/chromium/content/public/common/child_process_host.h +@@ -80,7 +80,7 @@ class CONTENT_EXPORT ChildProcessHost : public IPC::Sender { + // No special behavior requested. + CHILD_NORMAL = 0, + +-#if defined(OS_LINUX) ++#if defined(OS_LINUX) || 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/renderer/renderer_main_platform_delegate_linux.cc b/src/3rdparty/chromium/content/renderer/renderer_main_platform_delegate_linux.cc +index 43ea0af..d7ed8b7 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/device/gamepad/gamepad_provider.cc b/src/3rdparty/chromium/device/gamepad/gamepad_provider.cc +index 25fc2e6..c4c2871 100644 +--- a/src/3rdparty/chromium/device/gamepad/gamepad_provider.cc ++++ b/src/3rdparty/chromium/device/gamepad/gamepad_provider.cc +@@ -147,7 +147,7 @@ void GamepadProvider::Initialize(std::unique_ptr fetcher) { + + if (!polling_thread_) + polling_thread_.reset(new base::Thread("Gamepad polling thread")); +-#if defined(OS_LINUX) ++#if defined(OS_LINUX) || 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 79ea620..5fbf120 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 +@@ -56,7 +56,7 @@ uint32_t GetPlatformSpecificTextureTarget() { + return macos_specific_texture_target; + #elif defined(OS_ANDROID) || defined(OS_LINUX) + 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(); +@@ -84,7 +84,7 @@ GPU_EXPORT uint32_t GetBufferTextureTarget(gfx::BufferUsage usage, + + GPU_EXPORT bool NativeBufferNeedsPlatformSpecificTextureTarget( + gfx::BufferFormat format) { +-#if defined(USE_OZONE) || defined(OS_LINUX) ++#if defined(USE_OZONE) || defined(OS_LINUX) || 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 50714b8..1f1f8f9 100644 +--- a/src/3rdparty/chromium/gpu/config/gpu_test_config.cc ++++ b/src/3rdparty/chromium/gpu/config/gpu_test_config.cc +@@ -25,7 +25,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/BUILD.gn b/src/3rdparty/chromium/gpu/ipc/common/BUILD.gn +index 40f74b8..1218ad9 100644 +--- a/src/3rdparty/chromium/gpu/ipc/common/BUILD.gn ++++ b/src/3rdparty/chromium/gpu/ipc/common/BUILD.gn +@@ -98,6 +98,10 @@ source_set("ipc_common_sources") { + "gpu_memory_buffer_impl_native_pixmap.cc", + "gpu_memory_buffer_impl_native_pixmap.h", + ] ++ configs += [ ++ "//third_party/vulkan:vulkan_config", ++ ] ++ + } + if (is_android) { + sources += [ +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 a283842..6e4dc09 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 +@@ -14,7 +14,7 @@ + #include "gpu/ipc/common/gpu_memory_buffer_impl_io_surface.h" + #endif + +-#if defined(OS_LINUX) ++#if defined(OS_LINUX) || defined(OS_HAIKU) + #include "ui/gfx/client_native_pixmap_factory.h" + #include "ui/gfx/linux/client_native_pixmap_factory_dmabuf.h" + #endif +@@ -24,7 +24,7 @@ + #include "ui/ozone/public/ozone_platform.h" + #endif + +-#if defined(USE_OZONE) || defined(OS_LINUX) ++#if defined(USE_OZONE) || defined(OS_LINUX) || defined(OS_HAIKU) + #include "gpu/ipc/common/gpu_memory_buffer_impl_native_pixmap.h" + #endif + +diff --git a/src/3rdparty/chromium/gpu/ipc/service/BUILD.gn b/src/3rdparty/chromium/gpu/ipc/service/BUILD.gn +index 53350e8..061621b 100644 +--- a/src/3rdparty/chromium/gpu/ipc/service/BUILD.gn ++++ b/src/3rdparty/chromium/gpu/ipc/service/BUILD.gn +@@ -130,7 +130,8 @@ jumbo_component("service") { + if (is_linux) { + sources += [ "image_transport_surface_linux.cc" ] + } +- if (is_linux || use_ozone) { ++# if ((is_linux || use_ozone) && !is_haiku) { ++ if ((is_linux || use_ozone)) { + sources += [ + "gpu_memory_buffer_factory_native_pixmap.cc", + "gpu_memory_buffer_factory_native_pixmap.h", +diff --git a/src/3rdparty/chromium/gpu/vulkan/features.gni b/src/3rdparty/chromium/gpu/vulkan/features.gni +index 045a548..2c0fd65 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_android || is_fuchsia || is_win ++ enable_vulkan = (is_linux && !is_haiku) || 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/media/capture/BUILD.gn b/src/3rdparty/chromium/media/capture/BUILD.gn +index 0f253c9..1770be6 100644 +--- a/src/3rdparty/chromium/media/capture/BUILD.gn ++++ b/src/3rdparty/chromium/media/capture/BUILD.gn +@@ -227,7 +227,7 @@ jumbo_component("capture_lib") { + } + + # This includes the case of ChromeOS +- if (is_linux) { ++ if (is_linux && !is_haiku) { + sources += [ + "video/linux/camera_config_chromeos.cc", + "video/linux/camera_config_chromeos.h", +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 0b9c476..0f3fc88 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::GetDeviceDescriptors( + VideoCaptureApi::ANDROID_API2_LEGACY + #elif defined(OS_FUCHSIA) + VideoCaptureApi::UNKNOWN ++#elif defined(OS_HAIKU) ++ VideoCaptureApi::UNKNOWN + #endif + ); + entry_index++; +diff --git a/src/3rdparty/chromium/net/BUILD.gn b/src/3rdparty/chromium/net/BUILD.gn +index f5cecb0..9c77665 100644 +--- a/src/3rdparty/chromium/net/BUILD.gn ++++ b/src/3rdparty/chromium/net/BUILD.gn +@@ -103,7 +103,7 @@ net_configs = [ + "//build/config/compiler:wexit_time_destructors", + ] + +-if (is_linux) { ++if (is_linux && !is_haiku) { + net_configs += [ "//build/config/linux:libresolv" ] + } + +@@ -1256,6 +1256,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", +@@ -1386,7 +1396,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", +@@ -1419,7 +1429,7 @@ component("net") { + } + + # Use getifaddrs() on POSIX platforms, except Linux and Android. +- if (is_posix && !is_linux && !is_android) { ++ if (is_posix && ((!is_linux && !is_android) || is_haiku)) { + 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 ffb6e6e..531644e 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 +@@ -177,6 +179,7 @@ AddressTrackerLinux::AddressTrackerLinux( + AddressTrackerLinux::~AddressTrackerLinux() = default; + + void AddressTrackerLinux::Init() { ++#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"; +@@ -261,6 +264,7 @@ void AddressTrackerLinux::Init() { + base::BindRepeating(&AddressTrackerLinux::OnFileCanReadWithoutBlocking, + base::Unretained(this))); + } ++#endif + } + + void AddressTrackerLinux::AbortAndForceOnline() { +@@ -348,6 +352,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|. +@@ -460,6 +465,10 @@ void AddressTrackerLinux::HandleMessage(const char* buffer, + break; + } + } ++#else ++ NOTIMPLEMENTED(); ++ AbortAndForceOnline(); ++#endif + } + + void AddressTrackerLinux::OnFileCanReadWithoutBlocking() { +@@ -487,31 +496,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 13e14a7..c1271de 100644 +--- a/src/3rdparty/chromium/net/base/net_errors_posix.cc ++++ b/src/3rdparty/chromium/net/base/net_errors_posix.cc +@@ -106,8 +106,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 c340cce..a45d49f 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 ++ + namespace net { + namespace internal { + +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 7df6892..d1ff16f 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_MACOSX) && !defined(OS_IOS) + // This was needed to debug crbug.com/640281. + // TODO(zhongyi): Remove once the bug is resolved. +@@ -70,7 +76,7 @@ const int kActivityMonitorMinimumSamplesForThroughputEstimate = 2; + const base::TimeDelta kActivityMonitorMsThreshold = + base::TimeDelta::FromMilliseconds(100); + +-#if defined(OS_MACOSX) ++#if defined(OS_MACOSX) || 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 +@@ -99,7 +105,7 @@ int GetIPv4AddressFromIndex(int socket, uint32_t index, uint32_t* address) { + return OK; + } + +-#endif // OS_MACOSX ++#endif // OS_MACOSX || defined(OS_HAIKU) + + #if defined(OS_MACOSX) && !defined(OS_IOS) + +@@ -653,13 +659,13 @@ int UDPSocketPosix::SetDoNotFragment() { + } + + void UDPSocketPosix::SetMsgConfirm(bool confirm) { +-#if !defined(OS_MACOSX) && !defined(OS_IOS) ++#if !defined(OS_MACOSX) && !defined(OS_IOS) && !defined(OS_HAIKU) + if (confirm) { + sendto_flags_ |= MSG_CONFIRM; + } else { + sendto_flags_ &= ~MSG_CONFIRM; + } +-#endif // !defined(OS_MACOSX) && !defined(OS_IOS) ++#endif // !defined(OS_MACOSX) && !defined(OS_IOS) && !defined(OS_HAIKU) + } + + int UDPSocketPosix::AllowAddressReuse() { +@@ -944,17 +950,17 @@ int UDPSocketPosix::SetMulticastOptions() { + if (multicast_interface_ != 0) { + switch (addr_family_) { + case AF_INET: { +-#if defined(OS_MACOSX) ++#if defined(OS_MACOSX) || 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_MACOSX) ++#else // defined(OS_MACOSX) || defined(OS_HAIKU) + ip_mreqn mreq = {}; + mreq.imr_ifindex = multicast_interface_; + mreq.imr_address.s_addr = htonl(INADDR_ANY); +-#endif // !defined(OS_MACOSX) ++#endif // !defined(OS_MACOSX) || defined(OS_HAIKU) + int rv = setsockopt(socket_, IPPROTO_IP, IP_MULTICAST_IF, + reinterpret_cast(&mreq), sizeof(mreq)); + if (rv) +@@ -1018,7 +1024,7 @@ int UDPSocketPosix::JoinGroup(const IPAddress& group_address) const { + if (addr_family_ != AF_INET) + return ERR_ADDRESS_INVALID; + +-#if defined(OS_MACOSX) ++#if defined(OS_MACOSX) || defined(OS_HAIKU) + ip_mreq mreq = {}; + int error = GetIPv4AddressFromIndex(socket_, multicast_interface_, + &mreq.imr_interface.s_addr); +@@ -1066,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_MACOSX) || 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 f40ae96..b88a4bb 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 +@@ -48,7 +48,7 @@ UnixDomainServerSocket::~UnixDomainServerSocket() = default; + // static + bool UnixDomainServerSocket::GetPeerCredentials(SocketDescriptor socket, + Credentials* credentials) { +-#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_FUCHSIA) ++#if defined(OS_LINUX) || defined(OS_ANDROID) || 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 01433e4..e7453be 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 +@@ -29,7 +29,7 @@ class NET_EXPORT UnixDomainServerSocket : public ServerSocket { + public: + // Credentials of a peer process connected to the socket. + struct NET_EXPORT Credentials { +-#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_FUCHSIA) ++#if defined(OS_LINUX) || defined(OS_ANDROID) || 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/sandbox/features.gni b/src/3rdparty/chromium/sandbox/features.gni +index 09280d3..c500a55 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_android) && ++use_seccomp_bpf = (is_linux || 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 c27351f..fdcaca5 100644 +--- a/src/3rdparty/chromium/sandbox/linux/BUILD.gn ++++ b/src/3rdparty/chromium/sandbox/linux/BUILD.gn +@@ -12,12 +12,12 @@ if (is_android) { + } + + declare_args() { +- compile_suid_client = is_linux ++ compile_suid_client = is_linux && !is_haiku + +- compile_credentials = is_linux ++ compile_credentials = is_linux && !is_haiku + + # On Android, use plain GTest. +- use_base_test_suite = is_linux ++ use_base_test_suite = is_linux && !is_haiku + } + + if (is_nacl_nonsfi) { +@@ -370,14 +370,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", +@@ -397,6 +400,10 @@ component("sandbox_services") { + "syscall_broker/broker_simple_message.cc", + "syscall_broker/broker_simple_message.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 8cbf4ac..7e37b6f 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 +@@ -92,7 +94,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/services/audio/BUILD.gn b/src/3rdparty/chromium/services/audio/BUILD.gn +index c2b59d5..76566e4 100644 +--- a/src/3rdparty/chromium/services/audio/BUILD.gn ++++ b/src/3rdparty/chromium/services/audio/BUILD.gn +@@ -82,7 +82,7 @@ source_set("audio") { + "//services/service_manager/sandbox", + ] + +- if (is_linux) { ++ if (is_linux && !is_haiku) { + 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 8f7e556..bb1cf01 100644 +--- a/src/3rdparty/chromium/services/device/geolocation/location_arbitrator.cc ++++ b/src/3rdparty/chromium/services/device/geolocation/location_arbitrator.cc +@@ -160,7 +160,7 @@ LocationArbitrator::NewNetworkLocationProvider( + + std::unique_ptr + LocationArbitrator::NewSystemLocationProvider() { +-#if defined(OS_MACOSX) || defined(OS_LINUX) || defined(OS_FUCHSIA) ++#if defined(OS_MACOSX) || defined(OS_LINUX) || defined(OS_FUCHSIA) || defined(OS_HAIKU) + return nullptr; + #else + return device::NewSystemLocationProvider(); +diff --git a/src/3rdparty/chromium/services/device/hid/BUILD.gn b/src/3rdparty/chromium/services/device/hid/BUILD.gn +index 494ecc1..6d510f8 100644 +--- a/src/3rdparty/chromium/services/device/hid/BUILD.gn ++++ b/src/3rdparty/chromium/services/device/hid/BUILD.gn +@@ -50,6 +50,12 @@ source_set("hid") { + ] + deps += [ "//device/udev_linux" ] + } ++ if (is_haiku) { ++ sources -= [ ++ "hid_connection_linux.cc", ++ "hid_connection_linux.h", ++ ] ++ } + + if (is_chromeos) { + deps += [ "//chromeos/dbus/permission_broker" ] +diff --git a/src/3rdparty/chromium/services/device/usb/BUILD.gn b/src/3rdparty/chromium/services/device/usb/BUILD.gn +index fc390a0..678f5a7 100644 +--- a/src/3rdparty/chromium/services/device/usb/BUILD.gn ++++ b/src/3rdparty/chromium/services/device/usb/BUILD.gn +@@ -110,7 +110,7 @@ static_library("usb") { + ] + } + +- 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 19dc45c..6d64595 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") { + "//services/service_manager/sandbox:sandbox", + ] + } ++ 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 2fbbd76..02ef550 100644 +--- a/src/3rdparty/chromium/services/network/network_context.cc ++++ b/src/3rdparty/chromium/services/network/network_context.cc +@@ -1810,7 +1810,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 da2704d..abc1c3c 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(service_manager::SandboxLinux::Options options) { ++#if !defined(OS_HAIKU) + auto* instance = service_manager::SandboxLinux::GetInstance(); + + // TODO(tsepez): remove universal permission under filesytem root. +@@ -32,6 +33,7 @@ bool NetworkPreSandboxHook(service_manager::SandboxLinux::Options options) { + service_manager::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 c423ae8..5e97be9 100644 +--- a/src/3rdparty/chromium/services/network/network_service.cc ++++ b/src/3rdparty/chromium/services/network/network_service.cc +@@ -67,7 +67,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 + +@@ -636,7 +636,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 0d5ffd8..a49dad7 100644 +--- a/src/3rdparty/chromium/services/network/network_service.h ++++ b/src/3rdparty/chromium/services/network/network_service.h +@@ -156,7 +156,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_MACOSX) && !defined(OS_IOS)) +diff --git a/src/3rdparty/chromium/services/service_manager/embedder/main.cc b/src/3rdparty/chromium/services/service_manager/embedder/main.cc +index aa6fff2..5205579 100644 +--- a/src/3rdparty/chromium/services/service_manager/embedder/main.cc ++++ b/src/3rdparty/chromium/services/service_manager/embedder/main.cc +@@ -277,7 +277,7 @@ int Main(const MainParams& params) { + base::EnableTerminationOnOutOfMemory(); + #endif + +-#if defined(OS_LINUX) ++#if defined(OS_LINUX) || defined(OS_HAIKU) + // The various desktop environments set this environment variable that + // allows the dbus client library to connect directly to the bus. When this + // variable is not set (test environments like xvfb-run), the dbus client +diff --git a/src/3rdparty/chromium/services/service_manager/embedder/set_process_title.cc b/src/3rdparty/chromium/services/service_manager/embedder/set_process_title.cc +index 1dc53b8..88375e4 100644 +--- a/src/3rdparty/chromium/services/service_manager/embedder/set_process_title.cc ++++ b/src/3rdparty/chromium/services/service_manager/embedder/set_process_title.cc +@@ -34,7 +34,7 @@ namespace service_manager { + + // TODO(jrg): Find out if setproctitle or equivalent is available on Android. + #if defined(OS_POSIX) && !defined(OS_MACOSX) && !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/services/service_manager/embedder/set_process_title_linux.h b/src/3rdparty/chromium/services/service_manager/embedder/set_process_title_linux.h +index 690c927..28700a2 100644 +--- a/src/3rdparty/chromium/services/service_manager/embedder/set_process_title_linux.h ++++ b/src/3rdparty/chromium/services/service_manager/embedder/set_process_title_linux.h +@@ -5,6 +5,9 @@ + #ifndef SERVICES_SERVICE_MANAGER_EMBEDDER_SET_PROCESS_TITLE_LINUX_H_ + #define SERVICES_SERVICE_MANAGER_EMBEDDER_SET_PROCESS_TITLE_LINUX_H_ + ++#include "build/build_config.h" ++ ++#if !defined(OS_HAIKU) + // Set the process title that will show in "ps" and similar tools. Takes + // printf-style format string and arguments. After calling setproctitle() + // the original main() argv[] array should not be used. By default, the +@@ -14,6 +17,7 @@ + // This signature and naming is to be compatible with most other Unix + // implementations of setproctitle(). + void setproctitle(const char* fmt, ...); ++#endif + + // Initialize state needed for setproctitle() on Linux. Pass the argv pointer + // from main() to setproctitle_init() before calling setproctitle(). +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 d62e2b3..3b2fe19 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/services/service_manager/sandbox/BUILD.gn b/src/3rdparty/chromium/services/service_manager/sandbox/BUILD.gn +index e361e2b..7e12845 100644 +--- a/src/3rdparty/chromium/services/service_manager/sandbox/BUILD.gn ++++ b/src/3rdparty/chromium/services/service_manager/sandbox/BUILD.gn +@@ -26,7 +26,7 @@ component("sandbox") { + "//base", + "//sandbox:common", + ] +- if (is_linux) { ++ if (is_linux && !is_haiku) { + sources += [ + "linux/bpf_audio_policy_linux.cc", + "linux/bpf_audio_policy_linux.h", +diff --git a/src/3rdparty/chromium/services/service_manager/zygote/common/zygote_features.gni b/src/3rdparty/chromium/services/service_manager/zygote/common/zygote_features.gni +index c7580b3..ae0c131 100644 +--- a/src/3rdparty/chromium/services/service_manager/zygote/common/zygote_features.gni ++++ b/src/3rdparty/chromium/services/service_manager/zygote/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/third_party/angle/src/libANGLE/renderer/driver_utils.cpp b/src/3rdparty/chromium/third_party/angle/src/libANGLE/renderer/driver_utils.cpp +index 12984c2..297bd8f 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 +@@ -16,7 +16,7 @@ + # include + #endif + +-#if defined(ANGLE_PLATFORM_LINUX) ++#if defined(ANGLE_PLATFORM_POSIX) + # include + #endif + +@@ -206,7 +206,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. +@@ -218,6 +218,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; +@@ -228,7 +235,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 da41eb8..bc58274 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 +@@ -133,7 +133,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 a9309a3..a3f4e72 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 +@@ -229,7 +229,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 a370776..b2dce95 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 c5c65a3..ef24f07 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/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 174f3d1..67c281a 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 +@@ -65,11 +65,11 @@ + #include "third_party/blink/renderer/controller/oom_intervention_impl.h" + #endif + +-#if defined(OS_LINUX) ++#if defined(OS_LINUX) || defined(OS_HAIKU) + #include "third_party/blink/renderer/controller/memory_usage_monitor_posix.h" + #endif + +-#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_MACOSX) || \ ++#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_HAIKU) || \ + 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" +@@ -146,7 +146,7 @@ void InitializeCommon(Platform* platform, mojo::BinderMap* binders) { + CrashMemoryMetricsReporterImpl::Instance(); + #endif + +-#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_MACOSX) || \ ++#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_HAIKU) || \ + defined(OS_WIN) + // Initialize UserLevelMemoryPressureSignalGenerator so it starts monitoring. + if (UserLevelMemoryPressureSignalGenerator::Enabled()) +@@ -192,7 +192,7 @@ void BlinkInitializer::RegisterInterfaces(mojo::BinderMap& binders) { + &CrashMemoryMetricsReporterImpl::Bind)), + main_thread->GetTaskRunner()); + #endif +-#if defined(OS_LINUX) ++#if defined(OS_LINUX) || 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 8558d53..74edbba 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) ++#if defined(OS_LINUX) || 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 2952709..9a1caa7 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) ++#if defined(OS_LINUX) || 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) ++#if defined(OS_LINUX) || defined(OS_HAIKU) + , + public mojom::blink::MemoryUsageMonitorLinux + #endif +@@ -29,7 +29,7 @@ class CONTROLLER_EXPORT MemoryUsageMonitorPosix + public: + MemoryUsageMonitorPosix() = default; + +-#if defined(OS_LINUX) ++#if defined(OS_LINUX) || 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) ++#if defined(OS_LINUX) || 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) ++#if defined(OS_LINUX) || 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 b10407a..58fc8e8 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) ++#if defined(OS_LINUX) || 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 9255459..d5f10d5 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 +@@ -40,7 +40,7 @@ constexpr base::TimeDelta kEncodeRowSlackBeforeDeadline = + base::TimeDelta::FromMicroseconds(100); + + /* The value is based on user statistics on Nov 2017. */ +-#if (defined(OS_LINUX) || defined(OS_MACOSX) || defined(OS_WIN)) ++#if (defined(OS_LINUX) || defined(OS_MACOSX) || 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 b3fdbc5..fb0dc04 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 +@@ -122,7 +122,7 @@ class InternalPopupMenu::ItemIterationContext { + is_in_group_(false), + buffer_(buffer) { + DCHECK(buffer_); +-#if defined(OS_LINUX) ++#if defined(OS_LINUX) || defined(OS_HAIKU) + // On other platforms, the