From bac19a554984dc2be7c7173917835f0e488efa5a Mon Sep 17 00:00:00 2001
From: Kacper Kasper <kacperkasper@gmail.com>
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 <stdlib.h>
+
+#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 <cxxabi.h>
 #endif
-#if !defined(__UCLIBC__) && !defined(_AIX)
+#if !defined(__UCLIBC__) && !defined(_AIX) && !defined(OS_HAIKU) && !defined(OS_HAIKU)
 #include <execinfo.h>
 #endif
 
@@ -88,7 +88,7 @@ void DemangleSymbols(std::string* text) {
   // Note: code in this function is NOT async-signal safe (std::string uses
   // malloc internally).
 
-#if !defined(__UCLIBC__) && !defined(_AIX)
+#if !defined(__UCLIBC__) && !defined(_AIX) && !defined(OS_HAIKU)
   std::string::size_type search_from = 0;
   while (search_from < text->size()) {
     // Look for the start of a mangled symbol, from search_from.
@@ -135,7 +135,7 @@ class BacktraceOutputHandler {
   virtual ~BacktraceOutputHandler() = default;
 };
 
-#if !defined(__UCLIBC__) && !defined(_AIX)
+#if !defined(__UCLIBC__) && !defined(_AIX) && !defined(OS_HAIKU)
 void OutputPointer(void* pointer, BacktraceOutputHandler* handler) {
   // This should be more than enough to store a 64-bit number in hex:
   // 16 hex digits + 1 for null-terminator.
@@ -834,7 +834,7 @@ size_t CollectStackTrace(void** trace, size_t count) {
   // NOTE: This code MUST be async-signal safe (it's used by in-process
   // stack dumping signal handler). NO malloc or stdio is allowed here.
 
-#if !defined(__UCLIBC__) && !defined(_AIX)
+#if !defined(__UCLIBC__) && !defined(_AIX) && !defined(OS_HAIKU)
   // Though the backtrace API man page does not list any possible negative
   // return values, we take no chance.
   return base::saturated_cast<size_t>(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<int*>(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<struct ucred*>(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 <stdint.h>
 #include <stdlib.h>
 #include <sys/resource.h>
+#if !defined(OS_HAIKU)
 #include <sys/syscall.h>
+#endif
 #include <sys/time.h>
 #include <sys/types.h>
 #include <sys/wait.h>
@@ -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/<pid>/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> 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 <kernel/OS.h>
+
+namespace base {
+
+// static
+int64_t SysInfo::AmountOfPhysicalMemoryImpl() {
+    system_info systemInfo;
+    get_system_info(&systemInfo);
+    return static_cast<int64_t>(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<int>(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 <dlfcn.h> 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 <fcntl.h> 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 <inttypes.h> 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 <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the <netinet/in6.h> 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 <poll.h> 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 <port.h> 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 <fcntl.h> */
+#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 <signal.h> header file. */
+#define HAVE_SIGNAL_H 1
+
+/* Define to 1 if you have the <stdarg.h> header file. */
+#define HAVE_STDARG_H 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> 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 <sys/devpoll.h> header file. */
+/* #undef HAVE_SYS_DEVPOLL_H */
+
+/* Define to 1 if you have the <sys/epoll.h> header file. */
+/* #undef HAVE_SYS_EPOLL_H */
+
+/* Define to 1 if you have the <sys/event.h> header file. */
+/* #undef HAVE_SYS_EVENT_H */
+
+/* Define to 1 if you have the <sys/ioctl.h> header file. */
+#define HAVE_SYS_IOCTL_H 1
+
+/* Define to 1 if you have the <sys/param.h> header file. */
+#define HAVE_SYS_PARAM_H 1
+
+/* Define to 1 if you have the <sys/queue.h> header file. */
+#define HAVE_SYS_QUEUE_H 1
+
+/* Define to 1 if you have the <sys/select.h> header file. */
+#define HAVE_SYS_SELECT_H 1
+
+/* Define to 1 if you have the <sys/socket.h> header file. */
+#define HAVE_SYS_SOCKET_H 1
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+#define HAVE_SYS_TIME_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define if TAILQ_FOREACH is defined in <sys/queue.h> */
+/* #undef HAVE_TAILQFOREACH */
+
+/* Define if timeradd is defined in <sys/time.h> */
+#define HAVE_TIMERADD 1
+
+/* Define if timerclear is defined in <sys/time.h> */
+#define HAVE_TIMERCLEAR 1
+
+/* Define if timercmp is defined in <sys/time.h> */
+#define HAVE_TIMERCMP 1
+
+/* Define if timerisset is defined in <sys/time.h> */
+#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 <unistd.h> 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 <sys/time.h> and <time.h>. */
+#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 <sys/types.h> does not define. */
+/* #undef pid_t */
+
+/* Define to `unsigned int' if <sys/types.h> 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 <dlfcn.h> 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 <fcntl.h> 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 <inttypes.h> 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 <memory.h> header file. */
+#define _EVENT_HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the <netinet/in6.h> 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 <poll.h> 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 <port.h> 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 <fcntl.h> */
+#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 <signal.h> header file. */
+#define _EVENT_HAVE_SIGNAL_H 1
+
+/* Define to 1 if you have the <stdarg.h> header file. */
+#define _EVENT_HAVE_STDARG_H 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define _EVENT_HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define _EVENT_HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define _EVENT_HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> 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 <sys/devpoll.h> header file. */
+/* #undef _EVENT_HAVE_SYS_DEVPOLL_H */
+
+/* Define to 1 if you have the <sys/epoll.h> header file. */
+/* #undef _EVENT_HAVE_SYS_EPOLL_H */
+
+/* Define to 1 if you have the <sys/event.h> header file. */
+/* #undef _EVENT_HAVE_SYS_EVENT_H */
+
+/* Define to 1 if you have the <sys/ioctl.h> header file. */
+#define _EVENT_HAVE_SYS_IOCTL_H 1
+
+/* Define to 1 if you have the <sys/param.h> header file. */
+#define _EVENT_HAVE_SYS_PARAM_H 1
+
+/* Define to 1 if you have the <sys/queue.h> header file. */
+#define _EVENT_HAVE_SYS_QUEUE_H 1
+
+/* Define to 1 if you have the <sys/select.h> header file. */
+#define _EVENT_HAVE_SYS_SELECT_H 1
+
+/* Define to 1 if you have the <sys/socket.h> header file. */
+#define _EVENT_HAVE_SYS_SOCKET_H 1
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define _EVENT_HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+#define _EVENT_HAVE_SYS_TIME_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define _EVENT_HAVE_SYS_TYPES_H 1
+
+/* Define if TAILQ_FOREACH is defined in <sys/queue.h> */
+/* #undef _EVENT_HAVE_TAILQFOREACH */
+
+/* Define if timeradd is defined in <sys/time.h> */
+#define _EVENT_HAVE_TIMERADD 1
+
+/* Define if timerclear is defined in <sys/time.h> */
+#define _EVENT_HAVE_TIMERCLEAR 1
+
+/* Define if timercmp is defined in <sys/time.h> */
+#define _EVENT_HAVE_TIMERCMP 1
+
+/* Define if timerisset is defined in <sys/time.h> */
+#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 <unistd.h> 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 <sys/time.h> and <time.h>. */
+#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 <sys/types.h> does not define. */
+/* #undef _EVENT_pid_t */
+
+/* Define to `unsigned int' if <sys/types.h> 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 <pthread.h>
+#include <sched.h>
+
+#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<std::unique_ptr<service_manager::ZygoteForkDelegate>>
       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<unsigned int>::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<long>::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<unsigned int> {
 // 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<long> {
   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<SkCanvas> 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 <stddef.h>
 #include <windows.h>
 #include <winnt.h>
+#elif defined(OS_HAIKU)
+#include <OS.h>
 #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<void*>(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<uint8_t*>(threadInfo.stack_end);
+  uint8_t* stack_start = reinterpret_cast<uint8_t*>(threadInfo.stack_base);
+  CHECK(stack_start);
+  CHECK_GT(stack_start, stack_end);
+  size_t thread_stack_size = static_cast<size_t>(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 <kernel/image.h>
+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 <net/if.h>
+#ifdef __HAIKU__
+#include <ifaddrs.h>
+#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 <sys/prctl.h>
 #include <sys/syscall.h>
+#elif defined(WEBRTC_HAIKU)
+#include <OS.h>
 #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<unsigned long>(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 <direct.h> 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 <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* */
+/* #undef HAVE_LC_MESSAGES */
+
+/* Define to 1 if you have the <libgen.h> header file. */
+#define HAVE_LIBGEN_H 1
+
+/* Define to 1 if you have the <memory.h> 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 <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> 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 <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> 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 <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/types.h> 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 <unistd.h> 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 <sys/types.h> 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 <stdint.h>
+#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<jobject> 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<GLImplementation> GetAllowedGLImplementations() {
+  std::vector<GLImplementation> 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<GLContext> 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<GLContextStub> stub_context =
+          new GLContextStub(share_group);
+      stub_context->SetUseStubApi(true);
+      return stub_context;
+    }
+    default:
+      NOTREACHED();
+      return nullptr;
+  }
+}
+
+#ifndef TOOLKIT_QT
+scoped_refptr<GLSurface> 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<GLSurface> 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<GLGetProcAddressProc>(
+          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 <sys/resource.h>
 #endif
 
-#if !defined(_AIX) && !defined(V8_OS_FUCHSIA)
+#if !defined(_AIX) && !defined(V8_OS_FUCHSIA) && !defined(V8_OS_HAIKU)
 #include <sys/syscall.h>
 #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 <sys/time.h>
 #include <atomic>
 
-#if !V8_OS_QNX && !V8_OS_AIX
+#if !V8_OS_QNX && !V8_OS_AIX && !V8_OS_HAIKU
 #include <sys/syscall.h>  // NOLINT
 #endif
 
@@ -20,7 +20,7 @@
 #include <mach/mach.h>
 // OpenBSD doesn't have <ucontext.h>. ucontext_t lives in <signal.h>
 // and is a typedef for struct sigcontext. There is no uc_mcontext.
-#elif !V8_OS_OPENBSD
+#elif !V8_OS_OPENBSD && !V8_OS_HAIKU
 #include <ucontext.h>
 #endif
 
@@ -522,7 +522,21 @@ void SignalHandler::FillRegisterState(void* context, RegisterState* state) {
   state->sp = reinterpret_cast<void*>(mcontext.jmp_context.gpr[1]);
   state->fp = reinterpret_cast<void*>(mcontext.jmp_context.gpr[31]);
   state->lr = reinterpret_cast<void*>(mcontext.jmp_context.lr);
-#endif  // V8_OS_AIX
+#elif V8_OS_HAIKU
+#if V8_HOST_ARCH_IA32
+  state->pc = reinterpret_cast<void*>(mcontext.eip);
+  state->sp = reinterpret_cast<void*>(mcontext.esp);
+  state->fp = reinterpret_cast<void*>(mcontext.ebp);
+#elif V8_HOST_ARCH_X64
+  state->pc = reinterpret_cast<void*>(mcontext.rip);
+  state->sp = reinterpret_cast<void*>(mcontext.rsp);
+  state->fp = reinterpret_cast<void*>(mcontext.rbp);
+#elif V8_HOST_ARCH_ARM
+  state->pc = reinterpret_cast<void*>(mcontext.r15);
+  state->sp = reinterpret_cast<void*>(mcontext.r13);
+  state->fp = reinterpret_cast<void*>(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 <jerome.duval@gmail.com>
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 <jerome.duval@gmail.com>
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 <errno.h>
 #include <fcntl.h>
+#if !defined(OS_HAIKU)
 #include <sys/signal.h>
+#else
+#include <signal.h>
+#include <sys/select.h>
+#endif
 #include <sys/wait.h>
 #include <unistd.h>
 
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 <jerome.duval@gmail.com>
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 <jerome.duval@gmail.com>
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 <openssl/cpu.h>
 
-#if defined(OPENSSL_AARCH64) && defined(OPENSSL_LINUX) && \
-    !defined(OPENSSL_STATIC_ARMCAP)
-
-#include <sys/auxv.h>
+#if defined(OPENSSL_AARCH64)
 
 #include <openssl/arm_arch.h>
 
 #include "internal.h"
 
-
 extern uint32_t OPENSSL_armcap_P;
 
+#include <machine/armreg.h>
+
+#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 <jerome.duval@gmail.com>
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 <string.h>
 
 #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 <jerome.duval@gmail.com>
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 <jerome.duval@gmail.com>
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 <zircon/types.h>
 #else
 #include <pthread.h>
+#if !PERFETTO_BUILDFLAG(PERFETTO_OS_HAIKU)
 #include <sys/syscall.h>
+#else
+#include <OS.h>
+#endif
 #include <sys/types.h>
 #include <unistd.h>
 #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 <errno.h>
 #include <stddef.h>
 #include <stdlib.h>
+#include <type_traits>
 #if !PERFETTO_BUILDFLAG(PERFETTO_OS_WIN)
 #include <sys/types.h>
 #endif
@@ -71,7 +72,7 @@ struct FreeDeleter {
 
 template <typename T>
 constexpr T AssumeLittleEndian(T value) {
-  static_assert(__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__,
+  static_assert(std::is_same<T,T>::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<T>(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<char*>(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 <sys/prctl.h>
 #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 <sys/prctl.h>
 #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 <sys/ucred.h>
 #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<TracePacket>* 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 <jerome.duval@gmail.com>
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 <jerome.duval@gmail.com>
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 <arpa/inet.h>
 #include <elf.h>
 
+#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 <cxxabi.h>
 #endif
-#if !defined(__UCLIBC__) && !defined(_AIX) && !defined(OS_HAIKU) && !defined(OS_HAIKU)
+#if !defined(__UCLIBC__) && !defined(_AIX) && !defined(OS_HAIKU)
 #include <execinfo.h>
 #endif
 
@@ -35,7 +35,7 @@
 #include <AvailabilityMacros.h>
 #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 <sanitizer/asan_interface.h>
 #endif  // defined(ADDRESS_SANITIZER)
@@ -292,6 +295,7 @@ bool MadvFreeDiscardableMemoryPosix::IsResident() const {
   std::vector<unsigned char> 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 <dlfcn.h>
 #include <elf.h>
+#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<int>(systemInfo.cpu_count);
+    return static_cast<int64_t>((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<bool> 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<ThreadPriority> 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 <pthread.h>
+#if !defined(OS_HAIKU)
 #include <sys/prctl.h>
+#endif
 #include <sys/resource.h>
 #include <sys/time.h>
 #include <sys/types.h>
@@ -99,7 +101,7 @@ const ThreadPriorityToNiceValuePair kThreadPriorityToNiceValueMap[4] = {
 
 Optional<bool> 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<ThreadPriority> 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<os_crypt::Config> 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 <sys/resource.h>
 #include <sys/time.h>
 
@@ -1204,7 +1204,7 @@ static constexpr size_t kUnknownPlatformProcessLimit = 0;
 // to indicate failure and std::numeric_limits<size_t>::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<font_service::mojom::FontService>()) {
     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 <sys/stat.h>
+#include <unistd.h>
 
 #include <limits>
 #include <memory>
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<BrokerFilePermission>* permissions,
     const service_manager::SandboxSeccompBPF::Options& options) {
@@ -333,8 +334,10 @@ std::vector<BrokerFilePermission> 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<GamepadDataFetcher> 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 <unistd.h>
+
 #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 <errno.h>
+#ifndef OS_HAIKU
 #include <linux/if.h>
+#endif
 #include <stdint.h>
 #include <sys/ioctl.h>
 #include <utility>
@@ -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<int> 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 <sys/socket.h>  // Needed to include netlink.
 // Mask superfluous definition of |struct net|. This is fixed in Linux 2.6.38.
-#define net net_kernel
-#include <linux/rtnetlink.h>
-#undef net
 #include <stddef.h>
 
 #include <map>
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 <sys/ioctl.h>
 #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 <errno.h>
 #include <limits.h>
+#if !defined(OS_HAIKU)
 #include <sys/inotify.h>
+#endif
 #include <unistd.h>
 
 #include <map>
@@ -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 <sys/sockio.h>
+#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<const char*>(&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 <stddef.h>
 #include <stdint.h>
 #include <string.h>
+#if !defined(OS_HAIKU)
 #include <sys/prctl.h>
+#endif
 #include <sys/socket.h>
 #include <sys/types.h>
 #include <time.h>
@@ -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<LocationProvider>
 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<const uint8_t> 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 <sys/system_properties.h>
 #endif
 
-#if defined(ANGLE_PLATFORM_LINUX)
+#if defined(ANGLE_PLATFORM_POSIX)
 #    include <sys/utsname.h>
 #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<int>(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<mojom::blink::MemoryUsageMonitorLinux> 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<mojom::blink::MemoryUsageMonitorLinux> 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<mojom::blink::MemoryUsageMonitorLinux> 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 <option> background color is the same as the
     // <select> background color. On Linux, that makes the <option>
     // background color very dark, so by default, try to use a lighter
diff --git a/src/3rdparty/chromium/third_party/blink/renderer/core/inspector/inspector_memory_agent.cc b/src/3rdparty/chromium/third_party/blink/renderer/core/inspector/inspector_memory_agent.cc
index b7bbd98..4aab29f 100644
--- a/src/3rdparty/chromium/third_party/blink/renderer/core/inspector/inspector_memory_agent.cc
+++ b/src/3rdparty/chromium/third_party/blink/renderer/core/inspector/inspector_memory_agent.cc
@@ -185,7 +185,7 @@ InspectorMemoryAgent::GetSamplingProfileById(uint32_t id) {
 
 Vector<String> InspectorMemoryAgent::Symbolize(
     const WebVector<void*>& addresses) {
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_HAIKU)
   // TODO(alph): Move symbolization to the client.
   Vector<void*> addresses_to_symbolize;
   for (size_t i = 0; i < addresses.size(); i++) {
diff --git a/src/3rdparty/chromium/third_party/blink/renderer/core/layout/layout_view.cc b/src/3rdparty/chromium/third_party/blink/renderer/core/layout/layout_view.cc
index 65ecfe4..18bd4d2 100644
--- a/src/3rdparty/chromium/third_party/blink/renderer/core/layout/layout_view.cc
+++ b/src/3rdparty/chromium/third_party/blink/renderer/core/layout/layout_view.cc
@@ -60,7 +60,7 @@
 #include "third_party/blink/renderer/platform/instrumentation/tracing/traced_value.h"
 #include "third_party/blink/renderer/platform/runtime_enabled_features.h"
 
-#if defined(OS_LINUX) || defined(OS_CHROMEOS)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU)
 #include "third_party/blink/renderer/platform/fonts/font_cache.h"
 #endif
 
@@ -324,7 +324,7 @@ void LayoutView::UpdateLayout() {
   DCHECK(!layout_state_);
   LayoutState root_layout_state(*this);
 
-#if defined(OS_LINUX) || defined(OS_CHROMEOS)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU)
   // The font code in FontPlatformData does not have a direct connection to the
   // document, the frame or anything from which we could retrieve the device
   // scale factor. After using zoom for DSF, the GraphicsContext does only ever
diff --git a/src/3rdparty/chromium/third_party/blink/renderer/core/paint/paint_layer.cc b/src/3rdparty/chromium/third_party/blink/renderer/core/paint/paint_layer.cc
index 0d52eb1..55861da 100644
--- a/src/3rdparty/chromium/third_party/blink/renderer/core/paint/paint_layer.cc
+++ b/src/3rdparty/chromium/third_party/blink/renderer/core/paint/paint_layer.cc
@@ -107,7 +107,7 @@ namespace {
 static CompositingQueryMode g_compositing_query_mode =
     kCompositingQueriesAreOnlyAllowedInCertainDocumentLifecyclePhases;
 
-#ifdef OS_LINUX
+#if defined(OS_LINUX) || defined(OS_HAIKU)
 struct SameSizeAsPaintLayer : DisplayItemClient {
   // The bit fields may fit into the machine word of DisplayItemClient which
   // has only 8-bit data.
diff --git a/src/3rdparty/chromium/third_party/blink/renderer/core/scroll/scrollbar_theme_aura.cc b/src/3rdparty/chromium/third_party/blink/renderer/core/scroll/scrollbar_theme_aura.cc
index a97ee2b..4435e85 100644
--- a/src/3rdparty/chromium/third_party/blink/renderer/core/scroll/scrollbar_theme_aura.cc
+++ b/src/3rdparty/chromium/third_party/blink/renderer/core/scroll/scrollbar_theme_aura.cc
@@ -137,7 +137,7 @@ bool ScrollbarThemeAura::SupportsDragSnapBack() const {
 // Disable snapback on desktop Linux to better integrate with the desktop
 // behavior. Typically, Linux apps do not implement scrollbar snapback (this
 // is true for at least GTK and QT apps).
-#if (defined(OS_LINUX) && !defined(OS_CHROMEOS))
+#if (defined(OS_LINUX) && !defined(OS_CHROMEOS)) || defined(OS_HAIKU)
   return false;
 #else
   return true;
@@ -301,7 +301,7 @@ ScrollbarPart ScrollbarThemeAura::PartsToInvalidateOnThumbPositionChange(
 
 bool ScrollbarThemeAura::ShouldCenterOnThumb(const Scrollbar& scrollbar,
                                              const WebMouseEvent& event) {
-#if (defined(OS_LINUX) && !defined(OS_CHROMEOS))
+#if ((defined(OS_HAIKU) || defined(OS_LINUX)) && !defined(OS_CHROMEOS))
   if (event.button == WebPointerProperties::Button::kMiddle)
     return true;
 #endif
diff --git a/src/3rdparty/chromium/third_party/blink/renderer/modules/mediastream/processed_local_audio_source.cc b/src/3rdparty/chromium/third_party/blink/renderer/modules/mediastream/processed_local_audio_source.cc
index 65886b2..99e3204 100644
--- a/src/3rdparty/chromium/third_party/blink/renderer/modules/mediastream/processed_local_audio_source.cc
+++ b/src/3rdparty/chromium/third_party/blink/renderer/modules/mediastream/processed_local_audio_source.cc
@@ -453,7 +453,7 @@ void ProcessedLocalAudioSource::CaptureUsingProcessor(
     bool key_pressed) {
 #if defined(OS_WIN) || defined(OS_MACOSX)
   DCHECK_LE(volume, 1.0);
-#elif (defined(OS_LINUX) && !defined(OS_CHROMEOS)) || defined(OS_OPENBSD)
+#elif (defined(OS_LINUX) && !defined(OS_CHROMEOS)) || defined(OS_HAIKU)
   // We have a special situation on Linux where the microphone volume can be
   // "higher than maximum". The input volume slider in the sound preference
   // allows the user to set a scaling that is higher than 100%. It means that
diff --git a/src/3rdparty/chromium/third_party/blink/renderer/platform/fonts/font_cache.cc b/src/3rdparty/chromium/third_party/blink/renderer/platform/fonts/font_cache.cc
index 396a27a..5a49fe0 100644
--- a/src/3rdparty/chromium/third_party/blink/renderer/platform/fonts/font_cache.cc
+++ b/src/3rdparty/chromium/third_party/blink/renderer/platform/fonts/font_cache.cc
@@ -76,7 +76,7 @@ static const char kColorEmojiLocale[] = "und-Zsye";
 
 SkFontMgr* FontCache::static_font_manager_ = nullptr;
 
-#if defined(OS_LINUX) || defined(OS_CHROMEOS)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU)
 float FontCache::device_scale_factor_ = 1.0;
 #endif
 
@@ -115,7 +115,7 @@ FontCache::FontCache()
 FontPlatformData* FontCache::SystemFontPlatformData(
     const FontDescription& font_description) {
   const AtomicString& family = FontCache::SystemFontFamily();
-#if defined(OS_LINUX) || defined(OS_FUCHSIA)
+#if defined(OS_LINUX) || defined(OS_FUCHSIA) || defined(OS_HAIKU)
   if (family.IsEmpty() || family == font_family_names::kSystemUi)
     return nullptr;
 #else
diff --git a/src/3rdparty/chromium/third_party/blink/renderer/platform/fonts/font_cache.h b/src/3rdparty/chromium/third_party/blink/renderer/platform/fonts/font_cache.h
index 41c6340..91a5b71 100644
--- a/src/3rdparty/chromium/third_party/blink/renderer/platform/fonts/font_cache.h
+++ b/src/3rdparty/chromium/third_party/blink/renderer/platform/fonts/font_cache.h
@@ -58,7 +58,7 @@
 #include "third_party/skia/include/core/SkFontMgr.h"
 #include "third_party/skia/include/core/SkRefCnt.h"
 
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_HAIKU)
 #include "ui/gfx/font_fallback_linux.h"
 #endif
 
@@ -169,7 +169,7 @@ class PLATFORM_EXPORT FontCache {
   sk_sp<SkFontMgr> FontManager() { return font_manager_; }
   static void SetFontManager(sk_sp<SkFontMgr>);
 
-#if defined(OS_LINUX) || defined(OS_CHROMEOS)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU)
   // These are needed for calling QueryRenderStyleForStrike, since
   // gfx::GetFontRenderParams makes distinctions based on DSF.
   static float DeviceScaleFactor() { return device_scale_factor_; }
@@ -244,11 +244,11 @@ class PLATFORM_EXPORT FontCache {
       const FontDescription&);
 #endif  // defined(OS_ANDROID)
 
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_HAIKU)
   static bool GetFontForCharacter(UChar32,
                                   const char* preferred_locale,
                                   gfx::FallbackFontData*);
-#endif  // defined(OS_LINUX)
+#endif  // defined(OS_LINUX) || defined(OS_HAIKU)
 
   scoped_refptr<SimpleFontData> FontDataFromFontPlatformData(
       const FontPlatformData*,
@@ -327,12 +327,12 @@ class PLATFORM_EXPORT FontCache {
                                    const FontFaceCreationParams&,
                                    std::string& name);
 
-#if defined(OS_ANDROID) || defined(OS_LINUX)
+#if defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_HAIKU)
   static AtomicString GetFamilyNameForCharacter(SkFontMgr*,
                                                 UChar32,
                                                 const FontDescription&,
                                                 FontFallbackPriority);
-#endif  // defined(OS_ANDROID) || defined(OS_LINUX)
+#endif  // defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_HAIKU)
 
   scoped_refptr<SimpleFontData> FallbackOnStandardFontStyle(
       const FontDescription&,
@@ -366,7 +366,7 @@ class PLATFORM_EXPORT FontCache {
   std::unique_ptr<FallbackFamilyStyleCache> fallback_params_cache_;
 #endif  // defined(OS_WIN)
 
-#if defined(OS_LINUX) || defined(OS_CHROMEOS)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU)
   static float device_scale_factor_;
 #endif
 
diff --git a/src/3rdparty/chromium/third_party/blink/renderer/platform/fonts/font_description.cc b/src/3rdparty/chromium/third_party/blink/renderer/platform/fonts/font_description.cc
index 9e3ffe6..5efd7fb 100644
--- a/src/3rdparty/chromium/third_party/blink/renderer/platform/fonts/font_description.cc
+++ b/src/3rdparty/chromium/third_party/blink/renderer/platform/fonts/font_description.cc
@@ -38,7 +38,7 @@
 #include "third_party/blink/renderer/platform/wtf/text/string_hash.h"
 #include "third_party/blink/renderer/platform/wtf/text/string_hasher.h"
 
-#if defined(OS_LINUX) || defined(OS_CHROMEOS)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU)
 #include "third_party/blink/renderer/platform/fonts/font_cache.h"
 #endif
 
@@ -225,7 +225,7 @@ FontCacheKey FontDescription::CacheKey(
       static_cast<unsigned>(fields_.orientation_) << 1 |          // bit 2-3
       static_cast<unsigned>(fields_.subpixel_text_position_);     // bit 1
 
-#if defined(OS_LINUX) || defined(OS_CHROMEOS)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_HAIKU)
   float device_scale_factor_for_key = FontCache::DeviceScaleFactor();
 #else
   float device_scale_factor_for_key = 1.0f;
diff --git a/src/3rdparty/chromium/third_party/blink/renderer/platform/fonts/font_metrics.cc b/src/3rdparty/chromium/third_party/blink/renderer/platform/fonts/font_metrics.cc
index 390f70e..0515782 100644
--- a/src/3rdparty/chromium/third_party/blink/renderer/platform/fonts/font_metrics.cc
+++ b/src/3rdparty/chromium/third_party/blink/renderer/platform/fonts/font_metrics.cc
@@ -38,7 +38,7 @@
 
 namespace blink {
 
-#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_FUCHSIA)
+#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_FUCHSIA) || defined(OS_HAIKU)
 // This is the largest VDMX table which we'll try to load and parse.
 static const size_t kMaxVDMXTableSize = 1024 * 1024;  // 1 MB
 #endif
@@ -60,7 +60,7 @@ void FontMetrics::AscentDescentWithHacks(
   int vdmx_ascent = 0, vdmx_descent = 0;
   bool is_vdmx_valid = false;
 
-#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_FUCHSIA)
+#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_FUCHSIA) || defined(OS_HAIKU)
   // Manually digging up VDMX metrics is only applicable when bytecode hinting
   // using FreeType.  With DirectWrite or CoreText, no bytecode hinting is ever
   // done.  This code should be pushed into FreeType (hinted font metrics).
@@ -106,7 +106,7 @@ void FontMetrics::AscentDescentWithHacks(
       visual_overflow_inflation_for_ascent = 1;
     if (descent < metrics.fDescent) {
       visual_overflow_inflation_for_descent = 1;
-#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_FUCHSIA)
+#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_FUCHSIA) || defined(OS_HAIKU)
       // When subpixel positioning is enabled, if the descent is rounded down,
       // the descent part of the glyph may be truncated when displayed in a
       // 'overflow: hidden' container.  To avoid that, borrow 1 unit from the
diff --git a/src/3rdparty/chromium/third_party/blink/renderer/platform/fonts/font_unique_name_lookup.cc b/src/3rdparty/chromium/third_party/blink/renderer/platform/fonts/font_unique_name_lookup.cc
index 94cc7b6..c6c7234 100644
--- a/src/3rdparty/chromium/third_party/blink/renderer/platform/fonts/font_unique_name_lookup.cc
+++ b/src/3rdparty/chromium/third_party/blink/renderer/platform/fonts/font_unique_name_lookup.cc
@@ -8,7 +8,7 @@
 #if defined(OS_ANDROID)
 #include "third_party/blink/public/mojom/font_unique_name_lookup/font_unique_name_lookup.mojom-blink.h"
 #include "third_party/blink/renderer/platform/fonts/android/font_unique_name_lookup_android.h"
-#elif defined(OS_LINUX)
+#elif defined(OS_LINUX) || defined(OS_HAIKU)
 #include "third_party/blink/renderer/platform/fonts/linux/font_unique_name_lookup_linux.h"
 #elif defined(OS_WIN)
 #include "third_party/blink/renderer/platform/fonts/win/font_unique_name_lookup_win.h"
@@ -23,7 +23,7 @@ std::unique_ptr<FontUniqueNameLookup>
 FontUniqueNameLookup::GetPlatformUniqueNameLookup() {
 #if defined(OS_ANDROID)
   return std::make_unique<FontUniqueNameLookupAndroid>();
-#elif defined(OS_LINUX)
+#elif defined(OS_LINUX) || defined(OS_HAIKU)
   return std::make_unique<FontUniqueNameLookupLinux>();
 #elif defined(OS_WIN)
   return std::make_unique<FontUniqueNameLookupWin>();
diff --git a/src/3rdparty/chromium/third_party/blink/renderer/platform/fonts/skia/font_cache_skia.cc b/src/3rdparty/chromium/third_party/blink/renderer/platform/fonts/skia/font_cache_skia.cc
index 7537fb4..2483dc3 100644
--- a/src/3rdparty/chromium/third_party/blink/renderer/platform/fonts/skia/font_cache_skia.cc
+++ b/src/3rdparty/chromium/third_party/blink/renderer/platform/fonts/skia/font_cache_skia.cc
@@ -60,7 +60,7 @@ AtomicString ToAtomicString(const SkString& str) {
   return AtomicString::FromUTF8(str.c_str(), str.size());
 }
 
-#if defined(OS_ANDROID) || defined(OS_LINUX)
+#if defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_HAIKU)
 // This function is called on android or when we are emulating android fonts on
 // linux and the embedder has overriden the default fontManager with
 // WebFontRendering::setSkiaFontMgr.
@@ -83,7 +83,7 @@ AtomicString FontCache::GetFamilyNameForCharacter(
   typeface->getFamilyName(&skia_family_name);
   return ToAtomicString(skia_family_name);
 }
-#endif  // defined(OS_ANDROID) || defined(OS_LINUX)
+#endif  // defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_HAIKU)
 
 void FontCache::PlatformInit() {}
 
@@ -228,7 +228,7 @@ sk_sp<SkTypeface> FontCache::CreateTypeface(
   }
 #endif
 
-#if defined(OS_LINUX) || defined(OS_WIN)
+#if defined(OS_LINUX) || defined(OS_WIN) || defined(OS_HAIKU)
   // On linux if the fontManager has been overridden then we should be calling
   // the embedder provided font Manager rather than calling
   // SkTypeface::CreateFromName which may redirect the call to the default font
@@ -262,7 +262,7 @@ std::unique_ptr<FontPlatformData> FontCache::CreateFontPlatformData(
   std::string name;
 
   sk_sp<SkTypeface> typeface;
-#if defined(OS_ANDROID) || defined(OS_LINUX)
+#if defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_HAIKU)
   if (alternate_name == AlternateFontName::kLocalUniqueFace &&
       RuntimeEnabledFeatures::FontSrcLocalMatchingEnabled()) {
     typeface = CreateTypefaceFromUniqueName(creation_params);
diff --git a/src/3rdparty/chromium/third_party/blink/renderer/platform/graphics/gpu/webgl_image_conversion.cc b/src/3rdparty/chromium/third_party/blink/renderer/platform/graphics/gpu/webgl_image_conversion.cc
index 0736906..d2e2f4d 100644
--- a/src/3rdparty/chromium/third_party/blink/renderer/platform/graphics/gpu/webgl_image_conversion.cc
+++ b/src/3rdparty/chromium/third_party/blink/renderer/platform/graphics/gpu/webgl_image_conversion.cc
@@ -458,8 +458,8 @@ void Unpack<WebGLImageConversion::kDataFormatBGRA8, uint8_t, uint8_t>(
   for (unsigned i = 0; i < pixels_per_row; ++i) {
     uint32_t bgra = source32[i];
 #if defined(ARCH_CPU_BIG_ENDIAN)
-    uint32_t brMask = 0xff00ff00;
-    uint32_t gaMask = 0x00ff00ff;
+    uint32_t br_mask = 0xff00ff00;
+    uint32_t ga_mask = 0x00ff00ff;
 #else
     uint32_t br_mask = 0x00ff00ff;
     uint32_t ga_mask = 0xff00ff00;
diff --git a/src/3rdparty/chromium/third_party/blink/renderer/platform/graphics/gpu/webgl_image_conversion_test.cc b/src/3rdparty/chromium/third_party/blink/renderer/platform/graphics/gpu/webgl_image_conversion_test.cc
index e315615..7f3599c 100644
--- a/src/3rdparty/chromium/third_party/blink/renderer/platform/graphics/gpu/webgl_image_conversion_test.cc
+++ b/src/3rdparty/chromium/third_party/blink/renderer/platform/graphics/gpu/webgl_image_conversion_test.cc
@@ -76,9 +76,9 @@ TEST_F(WebGLImageConversionTest, convertBGRA8toRGBA8) {
                              0x34567888, 0x12345678, 0x34567888,
                              0x12345678, 0x34567888, 0x12345678};
 #if defined(ARCH_CPU_BIG_ENDIAN)
-  uint32_t expectedData[9] = {0x56341278, 0x78563488, 0x56341278,
-                              0x78563488, 0x56341278, 0x78563488,
-                              0x56341278, 0x78563488, 0x56341278};
+  uint32_t expected_data[9] = {0x56341278, 0x78563488, 0x56341278,
+			       0x78563488, 0x56341278, 0x78563488,
+			       0x56341278, 0x78563488, 0x56341278};
 #else
   uint32_t expected_data[9] = {0x12785634, 0x34887856, 0x12785634,
                                0x34887856, 0x12785634, 0x34887856,
diff --git a/src/3rdparty/chromium/third_party/blink/renderer/platform/graphics/video_frame_submitter.cc b/src/3rdparty/chromium/third_party/blink/renderer/platform/graphics/video_frame_submitter.cc
index e0cb888..582571a 100644
--- a/src/3rdparty/chromium/third_party/blink/renderer/platform/graphics/video_frame_submitter.cc
+++ b/src/3rdparty/chromium/third_party/blink/renderer/platform/graphics/video_frame_submitter.cc
@@ -187,7 +187,7 @@ void VideoFrameSubmitter::OnBeginFrame(
     if (viz::FrameTokenGT(pair.key, *next_frame_token_))
       continue;
 
-#ifdef OS_LINUX
+#if defined(OS_LINUX) || defined(OS_HAIKU)
     // TODO: On Linux failure flag is unreliable, and perfectly rendered frames
     // are reported as failures all the time.
     bool presentation_failure = false;
diff --git a/src/3rdparty/chromium/third_party/blink/renderer/platform/image-decoders/jpeg/jpeg_image_decoder.cc b/src/3rdparty/chromium/third_party/blink/renderer/platform/image-decoders/jpeg/jpeg_image_decoder.cc
index 7320d1e..6e23aa1 100644
--- a/src/3rdparty/chromium/third_party/blink/renderer/platform/image-decoders/jpeg/jpeg_image_decoder.cc
+++ b/src/3rdparty/chromium/third_party/blink/renderer/platform/image-decoders/jpeg/jpeg_image_decoder.cc
@@ -53,23 +53,30 @@ extern "C" {
 #include <setjmp.h>
 }
 
-#if defined(ARCH_CPU_BIG_ENDIAN)
-#error Blink assumes a little-endian target.
-#endif
-
 #if defined(JCS_ALPHA_EXTENSIONS)
 #define TURBO_JPEG_RGB_SWIZZLE
-#if SK_B32_SHIFT  // Output little-endian RGBA pixels (Android).
+#if SK_PMCOLOR_BYTE_ORDER(R, G, B, A)
 inline J_COLOR_SPACE rgbOutputColorSpace() {
   return JCS_EXT_RGBA;
 }
-#else  // Output little-endian BGRA pixels.
+#elif SK_PMCOLOR_BYTE_ORDER(B, G, R, A)
 inline J_COLOR_SPACE rgbOutputColorSpace() {
   return JCS_EXT_BGRA;
 }
+#elif SK_PMCOLOR_BYTE_ORDER(A, R, G, B)
+inline J_COLOR_SPACE rgbOutputColorSpace() {
+  return JCS_EXT_ARGB;
+}
+#elif SK_PMCOLOR_BYTE_ORDER(A, B, G, R)
+inline J_COLOR_SPACE rgbOutputColorSpace() {
+  return JCS_EXT_ABGR;
+}
+#else
+#error Component order not supported by libjpeg_turbo
 #endif
 inline bool turboSwizzled(J_COLOR_SPACE colorSpace) {
-  return colorSpace == JCS_EXT_RGBA || colorSpace == JCS_EXT_BGRA;
+  return colorSpace == JCS_EXT_RGBA || colorSpace == JCS_EXT_BGRA ||
+    colorSpace == JCS_EXT_ABGR || colorSpace == JCS_EXT_ARGB;
 }
 #else
 inline J_COLOR_SPACE rgbOutputColorSpace() {
diff --git a/src/3rdparty/chromium/third_party/blink/renderer/platform/wtf/container_annotations.h b/src/3rdparty/chromium/third_party/blink/renderer/platform/wtf/container_annotations.h
index 3dc1afc..aea011a 100644
--- a/src/3rdparty/chromium/third_party/blink/renderer/platform/wtf/container_annotations.h
+++ b/src/3rdparty/chromium/third_party/blink/renderer/platform/wtf/container_annotations.h
@@ -10,7 +10,7 @@
 
 // TODO(ochang): Remove the ARCH_CPU_X86_64 condition to enable this for X86
 // once the crashes there have been fixed: http://crbug.com/461406
-#if defined(ADDRESS_SANITIZER) && defined(OS_LINUX) && defined(ARCH_CPU_X86_64)
+#if defined(ADDRESS_SANITIZER) && (defined(OS_LINUX) || defined(OS_HAIKU)) && defined(ARCH_CPU_X86_64)
 #define ANNOTATE_CONTIGUOUS_CONTAINER
 #define ANNOTATE_NEW_BUFFER(buffer, capacity, newSize)                       \
   if (buffer) {                                                              \
@@ -35,13 +35,13 @@
   ANNOTATE_NEW_BUFFER(buffer, newCapacity, bufferSize);
 // Annotations require buffers to begin on an 8-byte boundary.
 
-#else  // ADDRESS_SANITIZER && OS_LINUX && ARCH_CPU_X86_64
+#else  // ADDRESS_SANITIZER && (OS_LINUX || OS_HAIKU) && ARCH_CPU_X86_64
 
 #define ANNOTATE_NEW_BUFFER(buffer, capacity, newSize)
 #define ANNOTATE_DELETE_BUFFER(buffer, capacity, oldSize)
 #define ANNOTATE_CHANGE_SIZE(buffer, capacity, oldSize, newSize)
 #define ANNOTATE_CHANGE_CAPACITY(buffer, oldCapacity, bufferSize, newCapacity)
 
-#endif  // ADDRESS_SANITIZER && OS_LINUX && ARCH_CPU_X86_64
+#endif  // ADDRESS_SANITIZER && (OS_LINUX || OS_HAIKU) && ARCH_CPU_X86_64
 
 #endif  // THIRD_PARTY_BLINK_RENDERER_PLATFORM_WTF_CONTAINER_ANNOTATIONS_H_
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 2aa53fe..f2e3200 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
@@ -19,6 +19,11 @@
 extern "C" void* __libc_stack_end;  // NOLINT
 #endif
 
+#if defined(OS_HAIKU)
+#include <signal.h>
+#include <pthread.h>
+#endif
+
 namespace WTF {
 
 size_t GetUnderestimatedStackSize() {
@@ -90,7 +95,7 @@ size_t GetUnderestimatedStackSize() {
   }
   return pthread_get_stacksize_np(pthread_self());
 #elif defined(OS_HAIKU) || defined(OS_WIN) && defined(COMPILER_MSVC)
-return Threading::ThreadStackSize();
+return WTF::internal::ThreadStackSize();
 #else
 #error "Stack frame size estimation not supported on this platform."
   return 0;
diff --git a/src/3rdparty/chromium/third_party/blink/renderer/platform/wtf/threading_pthreads.cc b/src/3rdparty/chromium/third_party/blink/renderer/platform/wtf/threading_pthreads.cc
index c772694..df8ac64 100644
--- a/src/3rdparty/chromium/third_party/blink/renderer/platform/wtf/threading_pthreads.cc
+++ b/src/3rdparty/chromium/third_party/blink/renderer/platform/wtf/threading_pthreads.cc
@@ -54,10 +54,15 @@
 #include <sys/syscall.h>
 #endif
 
-#if defined(OS_LINUX) || defined(OS_ANDROID)
+#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_HAIKU)
 #include <unistd.h>
 #endif
 
+#if defined(OS_HAIKU)
+#include <signal.h>
+#include <pthread.h>
+#endif
+
 namespace WTF {
 
 MutexBase::MutexBase(bool recursive) {
diff --git a/src/3rdparty/chromium/third_party/crashpad/crashpad/build/crashpad_buildconfig.gni b/src/3rdparty/chromium/third_party/crashpad/crashpad/build/crashpad_buildconfig.gni
index 7540fb2..105af6d 100644
--- a/src/3rdparty/chromium/third_party/crashpad/crashpad/build/crashpad_buildconfig.gni
+++ b/src/3rdparty/chromium/third_party/crashpad/crashpad/build/crashpad_buildconfig.gni
@@ -38,7 +38,7 @@ if (crashpad_is_in_chromium) {
   crashpad_is_mac = is_mac
   crashpad_is_ios = is_ios
   crashpad_is_win = is_win
-  crashpad_is_linux = is_linux
+  crashpad_is_linux = is_linux && !is_haiku
   crashpad_is_android = is_android
   crashpad_is_fuchsia = is_fuchsia
 
diff --git a/src/3rdparty/chromium/third_party/crashpad/crashpad/client/BUILD.gn b/src/3rdparty/chromium/third_party/crashpad/crashpad/client/BUILD.gn
index 476ceb2..2fba55e 100644
--- a/src/3rdparty/chromium/third_party/crashpad/crashpad/client/BUILD.gn
+++ b/src/3rdparty/chromium/third_party/crashpad/crashpad/client/BUILD.gn
@@ -75,6 +75,12 @@ static_library("client") {
     sources += [ "crashpad_client_fuchsia.cc" ]
   }
 
+  if (crashpad_is_posix) {
+    sources += [
+      "crashpad_client_posix.cc",
+    ]
+  }
+
   if (crashpad_is_linux || crashpad_is_android || crashpad_is_fuchsia) {
     sources += [ "crash_report_database_generic.cc" ]
   }
diff --git a/src/3rdparty/chromium/third_party/crashpad/crashpad/client/crashpad_client_posix.cc b/src/3rdparty/chromium/third_party/crashpad/crashpad/client/crashpad_client_posix.cc
new file mode 100644
index 0000000..ea179b8
--- /dev/null
+++ b/src/3rdparty/chromium/third_party/crashpad/crashpad/client/crashpad_client_posix.cc
@@ -0,0 +1,38 @@
+// Copyright 2017 The Crashpad Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#include "client/crashpad_client.h"
+
+#include "base/logging.h"
+
+namespace crashpad {
+
+CrashpadClient::CrashpadClient() {}
+
+CrashpadClient::~CrashpadClient() {}
+
+bool CrashpadClient::StartHandler(
+    const base::FilePath& handler,
+    const base::FilePath& database,
+    const base::FilePath& metrics_dir,
+    const std::string& url,
+    const std::map<std::string, std::string>& annotations,
+    const std::vector<std::string>& arguments,
+    bool restartable,
+    bool asynchronous_start) {
+  NOTREACHED();  // TODO(scottmg): https://crashpad.chromium.org/bug/196
+  return false;
+}
+
+}  // namespace crashpad
diff --git a/src/3rdparty/chromium/third_party/crashpad/crashpad/util/misc/address_types.h b/src/3rdparty/chromium/third_party/crashpad/crashpad/util/misc/address_types.h
index 870938d..3606ac8 100644
--- a/src/3rdparty/chromium/third_party/crashpad/crashpad/util/misc/address_types.h
+++ b/src/3rdparty/chromium/third_party/crashpad/crashpad/util/misc/address_types.h
@@ -25,7 +25,7 @@
 #include <mach/mach_types.h>
 #elif defined(OS_WIN)
 #include "util/win/address_types.h"
-#elif defined(OS_LINUX) || defined(OS_ANDROID)
+#elif defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_HAIKU)
 #include "util/linux/address_types.h"
 #elif defined(OS_FUCHSIA)
 #include <zircon/types.h>
@@ -55,7 +55,7 @@ using VMSize = mach_vm_size_t;
 using VMAddress = WinVMAddress;
 using VMSize = WinVMSize;
 
-#elif defined(OS_LINUX) || defined(OS_ANDROID)
+#elif defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_HAIKU)
 
 using VMAddress = LinuxVMAddress;
 using VMSize = LinuxVMSize;
diff --git a/src/3rdparty/chromium/third_party/crashpad/crashpad/util/misc/capture_context.h b/src/3rdparty/chromium/third_party/crashpad/crashpad/util/misc/capture_context.h
index a88a103..0f638ae 100644
--- a/src/3rdparty/chromium/third_party/crashpad/crashpad/util/misc/capture_context.h
+++ b/src/3rdparty/chromium/third_party/crashpad/crashpad/util/misc/capture_context.h
@@ -23,7 +23,7 @@
 #include <mach/mach.h>
 #elif defined(OS_WIN)
 #include <windows.h>
-#elif defined(OS_LINUX) || defined(OS_ANDROID)
+#elif defined(OS_LINUX) || defined(OS_ANDROID) 
 #include <ucontext.h>
 #elif defined(OS_FUCHSIA)
 #include <signal.h>
@@ -39,7 +39,7 @@ using NativeCPUContext = x86_thread_state;
 #endif
 #elif defined(OS_WIN)
 using NativeCPUContext = CONTEXT;
-#elif defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_FUCHSIA)
+#elif defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_FUCHSIA) || defined(OS_HAIKU)
 using NativeCPUContext = ucontext_t;
 #endif  // OS_MACOSX
 
diff --git a/src/3rdparty/chromium/third_party/crashpad/crashpad/util/misc/metrics.cc b/src/3rdparty/chromium/third_party/crashpad/crashpad/util/misc/metrics.cc
index bda9031..b71241d 100644
--- a/src/3rdparty/chromium/third_party/crashpad/crashpad/util/misc/metrics.cc
+++ b/src/3rdparty/chromium/third_party/crashpad/crashpad/util/misc/metrics.cc
@@ -25,7 +25,7 @@
 #define METRICS_OS_NAME "Win"
 #elif defined(OS_ANDROID)
 #define METRICS_OS_NAME "Android"
-#elif defined(OS_LINUX)
+#elif defined(OS_LINUX) || defined(OS_HAIKU)
 #define METRICS_OS_NAME "Linux"
 #elif defined(OS_FUCHSIA)
 #define METRICS_OS_NAME "Fuchsia"
diff --git a/src/3rdparty/chromium/third_party/crashpad/crashpad/util/misc/uuid.cc b/src/3rdparty/chromium/third_party/crashpad/crashpad/util/misc/uuid.cc
index ffd4970..2fdeb54 100644
--- a/src/3rdparty/chromium/third_party/crashpad/crashpad/util/misc/uuid.cc
+++ b/src/3rdparty/chromium/third_party/crashpad/crashpad/util/misc/uuid.cc
@@ -95,7 +95,7 @@ bool UUID::InitializeWithNew() {
   InitializeFromBytes(uuid);
   return true;
 #elif defined(OS_WIN) || defined(OS_LINUX) || defined(OS_ANDROID) || \
-    defined(OS_FUCHSIA)
+    defined(OS_FUCHSIA) || defined(OS_HAIKU)
   // Linux, Android, and Fuchsia do not provide a UUID generator in a
   // widely-available system library. On Linux and Android, uuid_generate()
   // from libuuid is not available everywhere.
diff --git a/src/3rdparty/chromium/third_party/crashpad/crashpad/util/posix/close_multiple.cc b/src/3rdparty/chromium/third_party/crashpad/crashpad/util/posix/close_multiple.cc
index 238f158..406f980 100644
--- a/src/3rdparty/chromium/third_party/crashpad/crashpad/util/posix/close_multiple.cc
+++ b/src/3rdparty/chromium/third_party/crashpad/crashpad/util/posix/close_multiple.cc
@@ -31,7 +31,7 @@
 #include "util/file/directory_reader.h"
 #include "util/misc/implicit_cast.h"
 
-#if defined(OS_MACOSX)
+#if defined(OS_MACOSX) || defined(OS_BSD)
 #include <sys/sysctl.h>
 #endif
 
@@ -72,12 +72,15 @@ void CloseNowOrOnExec(int fd, bool ebadf_ok) {
 // This is an advantage over looping over all possible file descriptors, because
 // no attempt needs to be made to close file descriptors that are not open.
 bool CloseMultipleNowOrOnExecUsingFDDir(int min_fd, int preserve_fd) {
-#if defined(OS_MACOSX)
+#if defined(OS_MACOSX) || defined(OS_BSD)
   static constexpr char kFDDir[] = "/dev/fd";
 #elif defined(OS_LINUX) || defined(OS_ANDROID)
   static constexpr char kFDDir[] = "/proc/self/fd";
 #endif
 
+#if defined(OS_HAIKU)
+  return false;
+#else
   DirectoryReader reader;
   if (!reader.Open(base::FilePath(kFDDir))) {
     return false;
@@ -104,6 +107,7 @@ bool CloseMultipleNowOrOnExecUsingFDDir(int min_fd, int preserve_fd) {
   }
 
   return true;
+#endif
 }
 
 }  // namespace
@@ -146,7 +150,7 @@ void CloseMultipleNowOrOnExec(int fd, int preserve_fd) {
   // while the system is running, but it’s still a better upper bound than the
   // current RLIMIT_NOFILE value.
 
-#if defined(OS_MACOSX)
+#if defined(OS_MACOSX) || defined(OS_BSD)
   // See 10.11.6 xnu-3248.60.10/bsd/kern/kern_resource.c maxfilesperproc,
   // referenced by dosetrlimit().
   int oid[] = {CTL_KERN, KERN_MAXFILESPERPROC};
diff --git a/src/3rdparty/chromium/third_party/crashpad/crashpad/util/posix/double_fork_and_exec.cc b/src/3rdparty/chromium/third_party/crashpad/crashpad/util/posix/double_fork_and_exec.cc
index e4ad998..c568f4c 100644
--- a/src/3rdparty/chromium/third_party/crashpad/crashpad/util/posix/double_fork_and_exec.cc
+++ b/src/3rdparty/chromium/third_party/crashpad/crashpad/util/posix/double_fork_and_exec.cc
@@ -24,6 +24,10 @@
 #include "base/strings/stringprintf.h"
 #include "util/posix/close_multiple.h"
 
+#if defined(OS_HAIKU)
+#define WCOREDUMP(x) WIFCORED(x)
+#endif
+
 namespace crashpad {
 
 bool DoubleForkAndExec(const std::vector<std::string>& argv,
diff --git a/src/3rdparty/chromium/third_party/crashpad/crashpad/util/posix/drop_privileges.cc b/src/3rdparty/chromium/third_party/crashpad/crashpad/util/posix/drop_privileges.cc
index 884a411..f9c113d 100644
--- a/src/3rdparty/chromium/third_party/crashpad/crashpad/util/posix/drop_privileges.cc
+++ b/src/3rdparty/chromium/third_party/crashpad/crashpad/util/posix/drop_privileges.cc
@@ -23,7 +23,7 @@ void DropPrivileges() {
   gid_t gid = getgid();
   uid_t uid = getuid();
 
-#if defined(OS_MACOSX)
+#if defined(OS_MACOSX) || defined(OS_HAIKU)
   // Based on the POSIX.1-2008 2013 edition documentation for setreuid() and
   // setregid(), setreuid() and setregid() alone should be sufficient to drop
   // privileges. The standard specifies that the saved ID should be set to the
diff --git a/src/3rdparty/chromium/third_party/crashpad/crashpad/util/posix/signals.cc b/src/3rdparty/chromium/third_party/crashpad/crashpad/util/posix/signals.cc
index 53c1038..5469da7 100644
--- a/src/3rdparty/chromium/third_party/crashpad/crashpad/util/posix/signals.cc
+++ b/src/3rdparty/chromium/third_party/crashpad/crashpad/util/posix/signals.cc
@@ -45,10 +45,10 @@ constexpr int kCrashSignals[] = {
 #if defined(SIGEMT)
     SIGEMT,
 #endif  // defined(SIGEMT)
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_HAIKU)
     SIGXCPU,
     SIGXFSZ,
-#endif  // defined(OS_LINUX)
+#endif  // defined(OS_LINUX) || defined(OS_HAIKU)
 };
 
 // These are the non-core-generating but terminating signals.
@@ -85,7 +85,7 @@ constexpr int kTerminateSignals[] = {
     SIGXCPU,
     SIGXFSZ,
 #endif  // defined(OS_MACOSX)
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) 
     SIGIO,
 #endif  // defined(OS_LINUX)
 };
@@ -224,8 +224,12 @@ bool Signals::WillSignalReraiseAutonomously(const siginfo_t* siginfo) {
          // remains. See 10.12.3 xnu-3789.41.3/bsd/kern/kern_sig.c
          // psignal_internal().
          (code > 0 &&
+#if defined(SI_ASYNCIO)
           code != SI_ASYNCIO &&
+#endif
+#if defined(SI_MESGQ)
           code != SI_MESGQ &&
+#endif
           code != SI_QUEUE &&
           code != SI_TIMER &&
           code != SI_USER &&
diff --git a/src/3rdparty/chromium/third_party/crashpad/crashpad/util/posix/symbolic_constants_posix.cc b/src/3rdparty/chromium/third_party/crashpad/crashpad/util/posix/symbolic_constants_posix.cc
index 5937c57..15f381e 100644
--- a/src/3rdparty/chromium/third_party/crashpad/crashpad/util/posix/symbolic_constants_posix.cc
+++ b/src/3rdparty/chromium/third_party/crashpad/crashpad/util/posix/symbolic_constants_posix.cc
@@ -64,7 +64,7 @@ constexpr const char* kSignalNames[] = {
     "INFO",
     "USR1",
     "USR2",
-#elif defined(OS_LINUX) || defined(OS_ANDROID)
+#elif defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_HAIKU)
 #if defined(ARCH_CPU_MIPS_FAMILY)
     "HUP",
     "INT",
@@ -135,7 +135,7 @@ constexpr const char* kSignalNames[] = {
 #endif  // defined(ARCH_CPU_MIPS_FAMILY)
 #endif
 };
-#if defined(OS_LINUX) || defined(OS_ANDROID)
+#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_HAIKU)
 // NSIG is 64 to account for real-time signals.
 static_assert(base::size(kSignalNames) == 32, "kSignalNames length");
 #else
diff --git a/src/3rdparty/chromium/third_party/nasm/config/config-linux.h b/src/3rdparty/chromium/third_party/nasm/config/config-linux.h
index 7eb7c20..318ce19 100644
--- a/src/3rdparty/chromium/third_party/nasm/config/config-linux.h
+++ b/src/3rdparty/chromium/third_party/nasm/config/config-linux.h
@@ -117,7 +117,7 @@
 #define HAVE_ACCESS 1
 
 /* Define to 1 if you have the `canonicalize_file_name' function. */
-#define HAVE_CANONICALIZE_FILE_NAME 1
+/*#undef HAVE_CANONICALIZE_FILE_NAME */
 
 /* Define to 1 if you have the `cpu_to_le16' intrinsic function. */
 /* #undef HAVE_CPU_TO_LE16 */
@@ -158,7 +158,7 @@
 
 /* Define to 1 if you have the declaration of `strsep', and to 0 if you don't.
    */
-#define HAVE_DECL_STRSEP 1
+#define HAVE_DECL_STRSEP 0
 
 /* Define to 1 if you have the <endian.h> header file. */
 #define HAVE_ENDIAN_H 1
@@ -310,7 +310,7 @@
 /* #undef HAVE_STRRCHRNUL */
 
 /* Define to 1 if you have the `strsep' function. */
-#define HAVE_STRSEP 1
+/* #undef HAVE_STRSEP */
 
 /* Define to 1 if the system has the type `struct stat'. */
 #define HAVE_STRUCT_STAT 1
diff --git a/src/3rdparty/chromium/third_party/pdfium/core/fxcrt/cfx_datetime.cpp b/src/3rdparty/chromium/third_party/pdfium/core/fxcrt/cfx_datetime.cpp
index 56c6609..25c9dff 100644
--- a/src/3rdparty/chromium/third_party/pdfium/core/fxcrt/cfx_datetime.cpp
+++ b/src/3rdparty/chromium/third_party/pdfium/core/fxcrt/cfx_datetime.cpp
@@ -9,7 +9,7 @@
 #include "build/build_config.h"
 #include "core/fxcrt/fx_system.h"
 
-#if defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_MACOSX) || \
+#if defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_MACOSX) || defined(OS_HAIKU) || \
     defined(OS_ASMJS) || defined(__wasm__)
 #include <sys/time.h>
 #include <time.h>
diff --git a/src/3rdparty/chromium/third_party/pdfium/core/fxcrt/fx_system.h b/src/3rdparty/chromium/third_party/pdfium/core/fxcrt/fx_system.h
index b306df2..3746b0d 100644
--- a/src/3rdparty/chromium/third_party/pdfium/core/fxcrt/fx_system.h
+++ b/src/3rdparty/chromium/third_party/pdfium/core/fxcrt/fx_system.h
@@ -27,7 +27,7 @@
 #define _FX_PLATFORM_ _FX_PLATFORM_WINDOWS_
 #elif defined(_WIN64)
 #define _FX_PLATFORM_ _FX_PLATFORM_WINDOWS_
-#elif defined(__linux__)
+#elif defined(__linux__) || defined(__HAIKU__)
 #define _FX_PLATFORM_ _FX_PLATFORM_LINUX_
 #elif defined(__APPLE__)
 #define _FX_PLATFORM_ _FX_PLATFORM_APPLE_
diff --git a/src/3rdparty/chromium/third_party/pdfium/core/fxge/fx_ge_linux.cpp b/src/3rdparty/chromium/third_party/pdfium/core/fxge/fx_ge_linux.cpp
index d76d39d..b8d6c0c 100644
--- a/src/3rdparty/chromium/third_party/pdfium/core/fxge/fx_ge_linux.cpp
+++ b/src/3rdparty/chromium/third_party/pdfium/core/fxge/fx_ge_linux.cpp
@@ -155,9 +155,8 @@ std::unique_ptr<SystemFontInfoIface> SystemFontInfoIface::CreateDefault(
     const char** pUserPaths) {
   auto pInfo = pdfium::MakeUnique<CFX_LinuxFontInfo>();
   if (!pInfo->ParseFontCfg(pUserPaths)) {
-    pInfo->AddPath("/usr/share/fonts");
-    pInfo->AddPath("/usr/share/X11/fonts/Type1");
-    pInfo->AddPath("/usr/share/X11/fonts/TTF");
+    pInfo->AddPath("%%LOCALBASE%%/data/fonts/otfonts");
+    pInfo->AddPath("%%LOCALBASE%%/data/fonts/ttfonts");
     pInfo->AddPath("/usr/local/share/fonts");
   }
   return std::move(pInfo);
diff --git a/src/3rdparty/chromium/third_party/pdfium/fxjs/cjs_publicmethods.cpp b/src/3rdparty/chromium/third_party/pdfium/fxjs/cjs_publicmethods.cpp
index 8eed97d..d619c71 100644
--- a/src/3rdparty/chromium/third_party/pdfium/fxjs/cjs_publicmethods.cpp
+++ b/src/3rdparty/chromium/third_party/pdfium/fxjs/cjs_publicmethods.cpp
@@ -86,6 +86,103 @@ constexpr const wchar_t* kDateFormats[] = {L"m/d",
 constexpr const wchar_t* kTimeFormats[] = {L"HH:MM", L"h:MM tt", L"HH:MM:ss",
                                            L"h:MM:ss tt"};
 
+#if defined(__HAIKU__)
+/*
+ * cvt.c - IEEE floating point formatting routines for FreeBSD
+ * from GNU libc-4.6.27
+ */
+
+/*
+ *    ap_ecvt converts to decimal
+ *      the number of digits is specified by ndigit
+ *      decpt is set to the position of the decimal point
+ *      sign is set to 0 for positive, 1 for negative
+ */
+
+#define	NDIG	80
+
+static char *
+     ap_cvt(double arg, int ndigits, int *decpt, int *sign, int eflag)
+{
+    register int r2;
+    double fi, fj;
+    register char *p, *p1;
+    static char buf[NDIG];
+
+    if (ndigits >= NDIG - 1)
+	ndigits = NDIG - 2;
+    r2 = 0;
+    *sign = 0;
+    p = &buf[0];
+    if (arg < 0) {
+	*sign = 1;
+	arg = -arg;
+    }
+    arg = modf(arg, &fi);
+    p1 = &buf[NDIG];
+    /*
+     * Do integer part
+     */
+    if (fi != 0) {
+	p1 = &buf[NDIG];
+	while (fi != 0) {
+	    fj = modf(fi / 10, &fi);
+	    *--p1 = (int) ((fj + .03) * 10) + '0';
+	    r2++;
+	}
+	while (p1 < &buf[NDIG])
+	    *p++ = *p1++;
+    }
+    else if (arg > 0) {
+	while ((fj = arg * 10) < 1) {
+	    arg = fj;
+	    r2--;
+	}
+    }
+    p1 = &buf[ndigits];
+    if (eflag == 0)
+	p1 += r2;
+    *decpt = r2;
+    if (p1 < &buf[0]) {
+	buf[0] = '\0';
+        return (buf);
+    }
+    while (p <= p1 && p < &buf[NDIG]) {
+	arg *= 10;
+	arg = modf(arg, &fj);
+	*p++ = (int) fj + '0';
+    }
+    if (p1 >= &buf[NDIG]) {
+	buf[NDIG - 1] = '\0';
+	return (buf);
+    }
+    p = p1;
+    *p1 += 5;
+    while (*p1 > '9') {
+	*p1 = '0';
+	if (p1 > buf)
+	    ++ * --p1;
+	else {
+	    *p1 = '1';
+	    (*decpt)++;
+	    if (eflag == 0) {
+		if (p > buf)
+		    *p = '0';
+		p++;
+	    }
+	}
+    }
+    *p = '\0';
+    return (buf);
+}
+
+static char *
+     fcvt(double arg, int ndigits, int *decpt, int *sign)
+{
+     return (ap_cvt(arg, ndigits, decpt, sign, 0));
+}
+#endif // defined(__FreeBSD__)
+
 template <typename T>
 T StrTrim(const T& str) {
   T result = str;
diff --git a/src/3rdparty/chromium/third_party/pdfium/fxjs/fx_date_helpers.cpp b/src/3rdparty/chromium/third_party/pdfium/fxjs/fx_date_helpers.cpp
index 5256fb1..8ae3f76 100644
--- a/src/3rdparty/chromium/third_party/pdfium/fxjs/fx_date_helpers.cpp
+++ b/src/3rdparty/chromium/third_party/pdfium/fxjs/fx_date_helpers.cpp
@@ -35,6 +35,11 @@ double GetLocalTZA() {
     return 0;
   time_t t = 0;
   FXSYS_time(&t);
+#ifdef __HAIKU__
+  struct tm lt;
+  localtime_r(&t, &lt);
+  return (double)(-(lt.tm_gmtoff * 1000));
+#else
   FXSYS_localtime(&t);
 #if defined(OS_WIN)
   // In gcc 'timezone' is a global variable declared in time.h. In VC++, that
@@ -43,6 +48,7 @@ double GetLocalTZA() {
   _get_timezone(&timezone);
 #endif
   return (double)(-(timezone * 1000));
+#endif // __HAIKU__
 }
 
 int GetDaylightSavingTA(double d) {
diff --git a/src/3rdparty/chromium/third_party/pdfium/third_party/base/allocator/partition_allocator/page_allocator_constants.h b/src/3rdparty/chromium/third_party/pdfium/third_party/base/allocator/partition_allocator/page_allocator_constants.h
index 567e3a3..ed5671b 100644
--- a/src/3rdparty/chromium/third_party/pdfium/third_party/base/allocator/partition_allocator/page_allocator_constants.h
+++ b/src/3rdparty/chromium/third_party/pdfium/third_party/base/allocator/partition_allocator/page_allocator_constants.h
@@ -13,7 +13,7 @@ namespace pdfium {
 namespace base {
 #if defined(OS_WIN) || defined(ARCH_CPU_PPC64)
 static constexpr size_t kPageAllocationGranularityShift = 16;  // 64KB
-#elif defined(_MIPS_ARCH_LOONGSON)
+#elif defined(_MIPS_ARCH_LOONGSON) || defined(ARCH_CPU_PPC64)
 static constexpr size_t kPageAllocationGranularityShift = 14;  // 16KB
 #else
 static constexpr size_t kPageAllocationGranularityShift = 12;  // 4KB
diff --git a/src/3rdparty/chromium/third_party/pdfium/third_party/base/allocator/partition_allocator/page_allocator_internals_posix.h b/src/3rdparty/chromium/third_party/pdfium/third_party/base/allocator/partition_allocator/page_allocator_internals_posix.h
index 2d62cb8..31bf067 100644
--- a/src/3rdparty/chromium/third_party/pdfium/third_party/base/allocator/partition_allocator/page_allocator_internals_posix.h
+++ b/src/3rdparty/chromium/third_party/pdfium/third_party/base/allocator/partition_allocator/page_allocator_internals_posix.h
@@ -16,7 +16,7 @@
 #if defined(OS_ANDROID)
 #include <sys/prctl.h>
 #endif
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_HAIKU)
 #include <sys/resource.h>
 
 #include <algorithm>
@@ -206,7 +206,7 @@ void DiscardSystemPagesInternal(void* address, size_t length) {
   // performance benefits unclear.
   //
   // Therefore, we just do the simple thing: MADV_DONTNEED.
-  CHECK(!madvise(address, length, MADV_DONTNEED));
+  CHECK(!posix_madvise(address, length, POSIX_MADV_DONTNEED));
 #endif
 }
 
diff --git a/src/3rdparty/chromium/third_party/pdfium/xfa/fgas/font/cfx_fontsourceenum_file.cpp b/src/3rdparty/chromium/third_party/pdfium/xfa/fgas/font/cfx_fontsourceenum_file.cpp
index 83283ec..d729b3b 100644
--- a/src/3rdparty/chromium/third_party/pdfium/xfa/fgas/font/cfx_fontsourceenum_file.cpp
+++ b/src/3rdparty/chromium/third_party/pdfium/xfa/fgas/font/cfx_fontsourceenum_file.cpp
@@ -16,9 +16,8 @@ constexpr char kFolderSeparator = '/';
 
 constexpr const char* kFontFolders[] = {
 #if _FX_PLATFORM_ == _FX_PLATFORM_LINUX_
-    "/usr/share/fonts",
-    "/usr/share/X11/fonts/Type1",
-    "/usr/share/X11/fonts/TTF",
+    "%%LOCALBASE%%/data/fonts/otfonts",
+    "%%LOCALBASE%%/data/fonts/ttffonts",
     "/usr/local/share/fonts",
 #elif defined(OS_MACOSX)
     "~/Library/Fonts",
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 45c2942..7744a9e 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) || PERFETTO_BUILDFLAG(PERFETTO_OS_HAIKU)
+#if PERFETTO_BUILDFLAG(PERFETTO_OS_MACOSX)
 #include <sys/ucred.h>
 #endif
 
@@ -601,7 +601,7 @@ void UnixSocket::ReadPeerCredentials() {
   if (sock_raw_.family() != SockFamily::kUnix)
     return;
 
-#if (PERFETTO_BUILDFLAG(PERFETTO_OS_LINUX) && !PERFETTO_BUILDFLAG(PERFETTO_OS_HAIKU)) || \
+#if (PERFETTO_BUILDFLAG(PERFETTO_OS_LINUX)) || \
     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/tracing/ipc/memfd.cc b/src/3rdparty/chromium/third_party/perfetto/src/tracing/ipc/memfd.cc
index 64025bf..d0a85d4 100644
--- a/src/3rdparty/chromium/third_party/perfetto/src/tracing/ipc/memfd.cc
+++ b/src/3rdparty/chromium/third_party/perfetto/src/tracing/ipc/memfd.cc
@@ -19,8 +19,9 @@
 #include <errno.h>
 
 #define PERFETTO_MEMFD_ENABLED()             \
-  PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID) || \
-      PERFETTO_BUILDFLAG(PERFETTO_OS_LINUX)
+  (PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID) || \
+      PERFETTO_BUILDFLAG(PERFETTO_OS_LINUX)) \
+      	&& !PERFETTO_BUILDFLAG(PERFETTO_OS_HAIKU)
 
 #if PERFETTO_MEMFD_ENABLED()
 
diff --git a/src/3rdparty/chromium/third_party/skia/include/core/SkTypes.h b/src/3rdparty/chromium/third_party/skia/include/core/SkTypes.h
index a1355a5..bc4bfa8 100644
--- a/src/3rdparty/chromium/third_party/skia/include/core/SkTypes.h
+++ b/src/3rdparty/chromium/third_party/skia/include/core/SkTypes.h
@@ -33,7 +33,7 @@
     #elif defined(linux) || defined(__linux) || defined(__FreeBSD__) || \
           defined(__OpenBSD__) || defined(__sun) || defined(__NetBSD__) || \
           defined(__DragonFly__) || defined(__Fuchsia__) || \
-          defined(__GLIBC__) || defined(__GNU__) || defined(__unix__)
+          defined(__GLIBC__) || defined(__GNU__) || defined(__unix__) || defined(__HAIKU__)
         #define SK_BUILD_FOR_UNIX
     #elif TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
         #define SK_BUILD_FOR_IOS
diff --git a/src/3rdparty/chromium/third_party/sqlite/BUILD.gn b/src/3rdparty/chromium/third_party/sqlite/BUILD.gn
index 7038659..1b599a4 100644
--- a/src/3rdparty/chromium/third_party/sqlite/BUILD.gn
+++ b/src/3rdparty/chromium/third_party/sqlite/BUILD.gn
@@ -138,7 +138,7 @@ config("sqlite_warnings") {
       ]
     }
   }
-  if (is_linux) {
+  if (is_linux && !is_haiku) {
     cflags += [
       # SQLite doesn't believe in compiler warnings, preferring testing.
       # http://www.sqlite.org/faq.html#q17
@@ -189,7 +189,7 @@ component("chromium_sqlite3") {
     }
   }
 
-  if (is_linux || is_android) {
+  if ((is_linux && !is_haiku) || is_android) {
     defines += [
       # Linux provides fdatasync(), a faster equivalent of fsync().
       "fdatasync=fdatasync",
diff --git a/src/3rdparty/chromium/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_userspace.c b/src/3rdparty/chromium/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_userspace.c
index 28922b6..41987be 100755
--- a/src/3rdparty/chromium/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_userspace.c
+++ b/src/3rdparty/chromium/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_userspace.c
@@ -40,9 +40,12 @@
 #include <pthread_np.h>
 #endif
 
-#if defined(__Userspace_os_Linux)
+#if defined(__Userspace_os_Linux) && !defined(__HAIKU__)
 #include <sys/prctl.h>
 #endif
+#if defined(__HAIKU__)
+#include <sys/sockio.h>
+#endif
 
 #if defined(__Userspace_os_Windows)
 /* Adapter to translate Unix thread start routines to Windows thread start
@@ -86,12 +89,15 @@ sctp_userspace_set_threadname(const char *name)
 #if defined(__Userspace_os_Darwin)
 	pthread_setname_np(name);
 #endif
-#if defined(__Userspace_os_Linux)
+#if defined(__Userspace_os_Linux) && !defined(__HAIKU__)
 	prctl(PR_SET_NAME, name);
 #endif
 #if defined(__Userspace_os_FreeBSD)
 	pthread_set_name_np(pthread_self(), name);
 #endif
+#if defined(__HAIKU__)
+	rename_thread(find_thread(NULL), name);
+#endif
 }
 
 #if !defined(_WIN32) && !defined(__Userspace_os_NaCl)
diff --git a/src/3rdparty/chromium/third_party/usrsctp/usrsctplib/usrsctplib/user_socket.c b/src/3rdparty/chromium/third_party/usrsctp/usrsctplib/usrsctplib/user_socket.c
index 146a6d9..7293a9b 100755
--- a/src/3rdparty/chromium/third_party/usrsctp/usrsctplib/usrsctplib/user_socket.c
+++ b/src/3rdparty/chromium/third_party/usrsctp/usrsctplib/usrsctplib/user_socket.c
@@ -627,6 +627,9 @@ copyiniov(struct iovec *iovp, u_int iovcnt, struct iovec **iov, int error)
 	u_int iovlen;
 
 	*iov = NULL;
+#ifndef UIO_MAXIOV
+#define UIO_MAXIOV IOV_MAX
+#endif
 	if (iovcnt > UIO_MAXIOV)
 		return (error);
 	iovlen = iovcnt * sizeof (struct iovec);
@@ -1068,7 +1071,7 @@ userspace_sctp_recvmsg(struct socket *so,
 	if (error) {
 		if ((auio.uio_resid != ulen) &&
 		    (error == EINTR ||
-#if !defined(__Userspace_os_NetBSD)
+#if !defined(__Userspace_os_NetBSD) && !defined(__HAIKU__)
 		     error == ERESTART ||
 #endif
 		     error == EWOULDBLOCK)) {
@@ -1161,7 +1164,7 @@ usrsctp_recvv(struct socket *so,
 	if (errno) {
 		if ((auio.uio_resid != ulen) &&
 		    (errno == EINTR ||
-#if !defined(__Userspace_os_NetBSD)
+#if !defined(__Userspace_os_NetBSD) && !defined(__HAIKU__)
 		     errno == ERESTART ||
 #endif
 		     errno == EWOULDBLOCK)) {
@@ -2117,7 +2120,7 @@ int user_connect(struct socket *so, struct sockaddr *sa)
 		error = pthread_cond_wait(SOCK_COND(so), SOCK_MTX(so));
 #endif
 		if (error) {
-#if defined(__Userspace_os_NetBSD)
+#if defined(__Userspace_os_NetBSD) || defined(__HAIKU__)
 			if (error == EINTR) {
 #else
 			if (error == EINTR || error == ERESTART) {
@@ -2137,7 +2140,7 @@ bad:
 	if (!interrupted) {
 		so->so_state &= ~SS_ISCONNECTING;
 	}
-#if !defined(__Userspace_os_NetBSD)
+#if !defined(__Userspace_os_NetBSD) && !defined(__HAIKU__)
 	if (error == ERESTART) {
 		error = EINTR;
 	}
diff --git a/src/3rdparty/chromium/third_party/webrtc/BUILD.gn b/src/3rdparty/chromium/third_party/webrtc/BUILD.gn
index 01082a0..7b22ace 100644
--- a/src/3rdparty/chromium/third_party/webrtc/BUILD.gn
+++ b/src/3rdparty/chromium/third_party/webrtc/BUILD.gn
@@ -169,7 +169,7 @@ config("common_inherited_config") {
       "WEBRTC_IOS",
     ]
   }
-  if (is_linux) {
+  if (is_linux && !is_haiku) {
     defines += [ "WEBRTC_LINUX" ]
   }
   if (is_mac) {
diff --git a/src/3rdparty/chromium/third_party/webrtc/rtc_base/ip_address.cc b/src/3rdparty/chromium/third_party/webrtc/rtc_base/ip_address.cc
index 9dd534c..77db2e1 100644
--- a/src/3rdparty/chromium/third_party/webrtc/rtc_base/ip_address.cc
+++ b/src/3rdparty/chromium/third_party/webrtc/rtc_base/ip_address.cc
@@ -33,12 +33,12 @@ namespace rtc {
 
 // Prefixes used for categorizing IPv6 addresses.
 static const in6_addr kV4MappedPrefix = {
-    {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xFF, 0xFF, 0}}};
-static const in6_addr k6To4Prefix = {{{0x20, 0x02, 0}}};
-static const in6_addr kTeredoPrefix = {{{0x20, 0x01, 0x00, 0x00}}};
-static const in6_addr kV4CompatibilityPrefix = {{{0}}};
-static const in6_addr k6BonePrefix = {{{0x3f, 0xfe, 0}}};
-static const in6_addr kPrivateNetworkPrefix = {{{0xFD}}};
+    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xFF, 0xFF, 0}};
+static const in6_addr k6To4Prefix = {{0x20, 0x02, 0}};
+static const in6_addr kTeredoPrefix = {{0x20, 0x01, 0x00, 0x00}};
+static const in6_addr kV4CompatibilityPrefix = {{0}};
+static const in6_addr k6BonePrefix = {{0x3f, 0xfe, 0}};
+static const in6_addr kPrivateNetworkPrefix = {{0xFD}};
 
 static bool IPIsHelper(const IPAddress& ip,
                        const in6_addr& tomatch,
diff --git a/src/3rdparty/chromium/third_party/webrtc/rtc_base/physical_socket_server.cc b/src/3rdparty/chromium/third_party/webrtc/rtc_base/physical_socket_server.cc
index 0cbcb81..fb6fac1 100644
--- a/src/3rdparty/chromium/third_party/webrtc/rtc_base/physical_socket_server.cc
+++ b/src/3rdparty/chromium/third_party/webrtc/rtc_base/physical_socket_server.cc
@@ -70,7 +70,7 @@ typedef void* SockOptArg;
 
 #endif  // WEBRTC_POSIX
 
-#if defined(WEBRTC_POSIX) && !defined(WEBRTC_MAC) && !defined(__native_client__)
+#if defined(WEBRTC_POSIX) && !defined(WEBRTC_MAC) && !defined(__native_client__) && !defined(__HAIKU__)
 
 int64_t GetSocketRecvTimestamp(int socket) {
   struct timeval tv_ioctl;
@@ -319,7 +319,7 @@ int PhysicalSocket::SetOption(Option opt, int value) {
     value <<= 2;
 #endif
   }
-#if defined(WEBRTC_POSIX)
+#if defined(WEBRTC_POSIX) && !defined(__HAIKU__)
   if (sopt == IPV6_TCLASS) {
     // Set the IPv4 option in all cases to support dual-stack sockets.
     ::setsockopt(s_, IPPROTO_IP, IP_TOS, (SockOptArg)&value, sizeof(value));
@@ -554,7 +554,7 @@ int PhysicalSocket::TranslateOption(Option opt, int* slevel, int* sopt) {
 #elif defined(WEBRTC_MAC) || defined(BSD) || defined(__native_client__)
       RTC_LOG(LS_WARNING) << "Socket::OPT_DONTFRAGMENT not supported.";
       return -1;
-#elif defined(WEBRTC_POSIX)
+#elif defined(WEBRTC_POSIX) && !defined(__HAIKU__)
       *slevel = IPPROTO_IP;
       *sopt = IP_MTU_DISCOVER;
       break;
@@ -572,7 +572,7 @@ int PhysicalSocket::TranslateOption(Option opt, int* slevel, int* sopt) {
       *sopt = TCP_NODELAY;
       break;
     case OPT_DSCP:
-#if defined(WEBRTC_POSIX)
+#if defined(WEBRTC_POSIX) && !defined(__HAIKU__)
       if (family_ == AF_INET6) {
         *slevel = IPPROTO_IPV6;
         *sopt = IPV6_TCLASS;
diff --git a/src/3rdparty/chromium/third_party/webrtc/rtc_base/system/rtc_export_template.h b/src/3rdparty/chromium/third_party/webrtc/rtc_base/system/rtc_export_template.h
index 4ac7043..65a9234 100644
--- a/src/3rdparty/chromium/third_party/webrtc/rtc_base/system/rtc_export_template.h
+++ b/src/3rdparty/chromium/third_party/webrtc/rtc_base/system/rtc_export_template.h
@@ -185,7 +185,9 @@
 
 RTC_EXPORT_TEMPLATE_TEST(DEFAULT, );  // NOLINT
 RTC_EXPORT_TEMPLATE_TEST(DEFAULT, __attribute__((visibility("default"))));
+#ifndef __HAIKU__
 RTC_EXPORT_TEMPLATE_TEST(MSVC_HACK, __declspec(dllexport));
+#endif
 RTC_EXPORT_TEMPLATE_TEST(DEFAULT, __declspec(dllimport));
 
 #undef RTC_EXPORT_TEMPLATE_TEST
diff --git a/src/3rdparty/chromium/third_party/webrtc/system_wrappers/source/cpu_info.cc b/src/3rdparty/chromium/third_party/webrtc/system_wrappers/source/cpu_info.cc
index 7288c67..ce72c96 100644
--- a/src/3rdparty/chromium/third_party/webrtc/system_wrappers/source/cpu_info.cc
+++ b/src/3rdparty/chromium/third_party/webrtc/system_wrappers/source/cpu_info.cc
@@ -12,7 +12,7 @@
 
 #if defined(WEBRTC_WIN)
 #include <windows.h>
-#elif defined(WEBRTC_LINUX)
+#elif defined(WEBRTC_LINUX) || defined(WEBRTC_HAIKU)
 #include <unistd.h>
 #elif defined(WEBRTC_MAC)
 #include <sys/sysctl.h>
@@ -30,7 +30,7 @@ static int DetectNumberOfCores() {
   SYSTEM_INFO si;
   GetNativeSystemInfo(&si);
   number_of_cores = static_cast<int>(si.dwNumberOfProcessors);
-#elif defined(WEBRTC_LINUX) || defined(WEBRTC_ANDROID)
+#elif defined(WEBRTC_LINUX) || defined(WEBRTC_ANDROID) || defined(WEBRTC_HAIKU)
   number_of_cores = static_cast<int>(sysconf(_SC_NPROCESSORS_ONLN));
   if (number_of_cores < 0) {
     RTC_LOG(LS_ERROR) << "Failed to get number of cores";
diff --git a/src/3rdparty/chromium/ui/compositor/compositor.cc b/src/3rdparty/chromium/ui/compositor/compositor.cc
index dd4f89d..c096df1 100644
--- a/src/3rdparty/chromium/ui/compositor/compositor.cc
+++ b/src/3rdparty/chromium/ui/compositor/compositor.cc
@@ -705,7 +705,7 @@ void Compositor::OnFrameTokenChanged(uint32_t frame_token) {
   NOTREACHED();
 }
 
-#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
+#if defined(OS_LINUX) && !defined(OS_CHROMEOS) || defined(OS_HAIKU)
 void Compositor::OnCompleteSwapWithNewSize(const gfx::Size& size) {
   for (auto& observer : observer_list_)
     observer.OnCompositingCompleteSwapWithNewSize(this, size);
diff --git a/src/3rdparty/chromium/ui/compositor/compositor.h b/src/3rdparty/chromium/ui/compositor/compositor.h
index 3e2d230..61f5352 100644
--- a/src/3rdparty/chromium/ui/compositor/compositor.h
+++ b/src/3rdparty/chromium/ui/compositor/compositor.h
@@ -341,7 +341,7 @@ class COMPOSITOR_EXPORT Compositor : public cc::LayerTreeHostClient,
   void OnFirstSurfaceActivation(const viz::SurfaceInfo& surface_info) override;
   void OnFrameTokenChanged(uint32_t frame_token) override;
 
-#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
+#if defined(OS_LINUX) && !defined(OS_CHROMEOS) || defined(OS_HAIKU)
   void OnCompleteSwapWithNewSize(const gfx::Size& size);
 #endif
 
diff --git a/src/3rdparty/chromium/ui/compositor/compositor_observer.h b/src/3rdparty/chromium/ui/compositor/compositor_observer.h
index 501aa3d..9f465c8 100644
--- a/src/3rdparty/chromium/ui/compositor/compositor_observer.h
+++ b/src/3rdparty/chromium/ui/compositor/compositor_observer.h
@@ -42,11 +42,11 @@ class COMPOSITOR_EXPORT CompositorObserver {
   // Called when a child of the compositor is resizing.
   virtual void OnCompositingChildResizing(Compositor* compositor) {}
 
-#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
+#if defined(OS_LINUX) && !defined(OS_CHROMEOS) || defined(OS_HAIKU)
   // Called when a swap with new size is completed.
   virtual void OnCompositingCompleteSwapWithNewSize(ui::Compositor* compositor,
                                                     const gfx::Size& size) {}
-#endif  // defined(OS_LINUX)
+#endif  // defined(OS_LINUX) || defined(OS_HAIKU)
 
   // Called at the top of the compositor's destructor, to give observers a
   // chance to remove themselves.
diff --git a/src/3rdparty/chromium/ui/events/keycodes/dom/keycode_converter.cc b/src/3rdparty/chromium/ui/events/keycodes/dom/keycode_converter.cc
index e555048..190548f 100644
--- a/src/3rdparty/chromium/ui/events/keycodes/dom/keycode_converter.cc
+++ b/src/3rdparty/chromium/ui/events/keycodes/dom/keycode_converter.cc
@@ -20,7 +20,7 @@ namespace {
 #if defined(OS_WIN)
 #define DOM_CODE(usb, evdev, xkb, win, mac, code, id) \
   { usb, win, code }
-#elif defined(OS_LINUX)
+#elif defined(OS_LINUX) || defined(OS_HAIKU)
 #define DOM_CODE(usb, evdev, xkb, win, mac, code, id) \
   { usb, xkb, code }
 #elif defined(OS_MACOSX)
diff --git a/src/3rdparty/chromium/ui/gfx/BUILD.gn b/src/3rdparty/chromium/ui/gfx/BUILD.gn
index af04bdf..29ded0a 100644
--- a/src/3rdparty/chromium/ui/gfx/BUILD.gn
+++ b/src/3rdparty/chromium/ui/gfx/BUILD.gn
@@ -569,7 +569,7 @@ jumbo_source_set("memory_buffer_sources") {
     "//ui/gfx/geometry",
   ]
 
-  if (is_linux && !use_qt) {
+  if (is_linux && !is_haiku && !use_qt) {
     sources += [
       "linux/client_native_pixmap_dmabuf.cc",
       "linux/client_native_pixmap_dmabuf.h",
@@ -582,7 +582,7 @@ jumbo_source_set("memory_buffer_sources") {
     deps += [ "//build/config/linux/libdrm" ]
   }
 
-  if (is_linux || is_android) {
+  if ((is_linux || is_android) && !is_haiku) {
     deps += [ "//third_party/libsync" ]
   }
 
diff --git a/src/3rdparty/chromium/ui/gfx/font_render_params.h b/src/3rdparty/chromium/ui/gfx/font_render_params.h
index 29d81b9..930c633 100644
--- a/src/3rdparty/chromium/ui/gfx/font_render_params.h
+++ b/src/3rdparty/chromium/ui/gfx/font_render_params.h
@@ -111,14 +111,14 @@ GFX_EXPORT FontRenderParams GetFontRenderParams(
     const FontRenderParamsQuery& query,
     std::string* family_out);
 
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_HAIKU)
 // Clears GetFontRenderParams()'s cache. Intended to be called by tests that are
 // changing Fontconfig's configuration.
 GFX_EXPORT void ClearFontRenderParamsCacheForTest();
 #endif
 
 #if defined(OS_WIN) || defined(OS_LINUX) || defined(OS_ANDROID) || \
-    defined(OS_FUCHSIA)
+    defined(OS_FUCHSIA) || defined(OS_HAIKU)
 // Gets the device scale factor to query the FontRenderParams.
 GFX_EXPORT float GetFontRenderParamsDeviceScaleFactor();
 
diff --git a/src/3rdparty/chromium/ui/gfx/gpu_memory_buffer.h b/src/3rdparty/chromium/ui/gfx/gpu_memory_buffer.h
index 2351778..5be07ec 100644
--- a/src/3rdparty/chromium/ui/gfx/gpu_memory_buffer.h
+++ b/src/3rdparty/chromium/ui/gfx/gpu_memory_buffer.h
@@ -15,7 +15,7 @@
 #include "ui/gfx/geometry/rect.h"
 #include "ui/gfx/gfx_export.h"
 
-#if defined(USE_OZONE) || defined(OS_LINUX)
+#if defined(USE_OZONE) || defined(OS_LINUX)  || defined(OS_HAIKU)
 #include "ui/gfx/native_pixmap_handle.h"
 #elif defined(OS_MACOSX) && !defined(OS_IOS)
 #include "ui/gfx/mac/io_surface.h"
@@ -69,7 +69,7 @@ struct GFX_EXPORT GpuMemoryBufferHandle {
   base::UnsafeSharedMemoryRegion region;
   uint32_t offset = 0;
   int32_t stride = 0;
-#if defined(OS_LINUX) || defined(OS_FUCHSIA)
+#if defined(OS_LINUX) || defined(OS_FUCHSIA) || defined(OS_HAIKU)
   NativePixmapHandle native_pixmap_handle;
 #elif defined(OS_MACOSX) && !defined(OS_IOS)
   ScopedRefCountedIOSurfaceMachPort mach_port;
diff --git a/src/3rdparty/chromium/ui/gfx/mojom/native_handle_types_mojom_traits.cc b/src/3rdparty/chromium/ui/gfx/mojom/native_handle_types_mojom_traits.cc
index 6263574..8f43fdc 100644
--- a/src/3rdparty/chromium/ui/gfx/mojom/native_handle_types_mojom_traits.cc
+++ b/src/3rdparty/chromium/ui/gfx/mojom/native_handle_types_mojom_traits.cc
@@ -8,15 +8,15 @@
 
 namespace mojo {
 
-#if defined(OS_LINUX) || defined(USE_OZONE)
+#if defined(OS_LINUX) || defined(USE_OZONE) || defined(OS_HAIKU)
 mojo::PlatformHandle StructTraits<
     gfx::mojom::NativePixmapPlaneDataView,
     gfx::NativePixmapPlane>::buffer_handle(gfx::NativePixmapPlane& plane) {
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_HAIKU)
   return mojo::PlatformHandle(std::move(plane.fd));
 #elif defined(OS_FUCHSIA)
   return mojo::PlatformHandle(std::move(plane.vmo));
-#endif  // defined(OS_LINUX)
+#endif  // defined(OS_LINUX) || defined(OS_HAIKU)
 }
 
 bool StructTraits<
@@ -28,7 +28,7 @@ bool StructTraits<
   out->size = data.size();
 
   mojo::PlatformHandle handle = data.TakeBufferHandle();
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_HAIKU)
   if (!handle.is_fd())
     return false;
   out->fd = handle.TakeFD();
@@ -36,7 +36,7 @@ bool StructTraits<
   if (!handle.is_handle())
     return false;
   out->vmo = zx::vmo(handle.TakeHandle());
-#endif  // defined(OS_LINUX)
+#endif  // defined(OS_LINUX) || defined(OS_HAIKU)
 
   return true;
 }
@@ -45,7 +45,7 @@ bool StructTraits<
     gfx::mojom::NativePixmapHandleDataView,
     gfx::NativePixmapHandle>::Read(gfx::mojom::NativePixmapHandleDataView data,
                                    gfx::NativePixmapHandle* out) {
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_HAIKU)
   out->modifier = data.modifier();
 #endif
 
diff --git a/src/3rdparty/chromium/ui/gfx/mojom/native_handle_types_mojom_traits.h b/src/3rdparty/chromium/ui/gfx/mojom/native_handle_types_mojom_traits.h
index 4836957..8065366 100644
--- a/src/3rdparty/chromium/ui/gfx/mojom/native_handle_types_mojom_traits.h
+++ b/src/3rdparty/chromium/ui/gfx/mojom/native_handle_types_mojom_traits.h
@@ -14,13 +14,13 @@
 #include "mojo/public/cpp/system/platform_handle.h"
 #include "ui/gfx/mojom/native_handle_types.mojom-shared.h"
 
-#if defined(OS_LINUX) || defined(USE_OZONE)
+#if defined(OS_LINUX) || defined(USE_OZONE) || defined(OS_HAIKU)
 #include "ui/gfx/native_pixmap_handle.h"
 #endif
 
 namespace mojo {
 
-#if defined(OS_LINUX) || defined(USE_OZONE)
+#if defined(OS_LINUX) || defined(USE_OZONE) || defined(OS_HAIKU)
 template <>
 struct COMPONENT_EXPORT(GFX_NATIVE_HANDLE_TYPES_SHARED_MOJOM_TRAITS)
     StructTraits<gfx::mojom::NativePixmapPlaneDataView,
@@ -48,7 +48,7 @@ struct COMPONENT_EXPORT(GFX_NATIVE_HANDLE_TYPES_SHARED_MOJOM_TRAITS)
     return pixmap_handle.planes;
   }
 
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_HAIKU)
   static uint64_t modifier(const gfx::NativePixmapHandle& pixmap_handle) {
     return pixmap_handle.modifier;
   }
@@ -72,7 +72,7 @@ struct COMPONENT_EXPORT(GFX_NATIVE_HANDLE_TYPES_SHARED_MOJOM_TRAITS)
   static bool Read(gfx::mojom::NativePixmapHandleDataView data,
                    gfx::NativePixmapHandle* out);
 };
-#endif  // defined(OS_LINUX) || defined(USE_OZONE)
+#endif  // defined(OS_LINUX) || defined(USE_OZONE) || defined(OS_HAIKU)
 
 }  // namespace mojo
 
diff --git a/src/3rdparty/chromium/ui/gfx/native_pixmap_handle.cc b/src/3rdparty/chromium/ui/gfx/native_pixmap_handle.cc
index addb321..2cddbc1 100644
--- a/src/3rdparty/chromium/ui/gfx/native_pixmap_handle.cc
+++ b/src/3rdparty/chromium/ui/gfx/native_pixmap_handle.cc
@@ -33,7 +33,7 @@ NativePixmapPlane::NativePixmapPlane() : stride(0), offset(0), size(0) {}
 NativePixmapPlane::NativePixmapPlane(int stride,
                                      int offset,
                                      uint64_t size
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_HAIKU)
                                      ,
                                      base::ScopedFD fd
 #elif defined(OS_FUCHSIA)
@@ -44,7 +44,7 @@ NativePixmapPlane::NativePixmapPlane(int stride,
     : stride(stride),
       offset(offset),
       size(size)
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_HAIKU)
       ,
       fd(std::move(fd))
 #elif defined(OS_FUCHSIA)
@@ -72,7 +72,7 @@ NativePixmapHandle& NativePixmapHandle::operator=(NativePixmapHandle&& other) =
 NativePixmapHandle CloneHandleForIPC(const NativePixmapHandle& handle) {
   NativePixmapHandle clone;
   for (auto& plane : handle.planes) {
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_HAIKU)
     DCHECK(plane.fd.is_valid());
     base::ScopedFD fd_dup(HANDLE_EINTR(dup(plane.fd.get())));
     if (!fd_dup.is_valid()) {
@@ -98,7 +98,7 @@ NativePixmapHandle CloneHandleForIPC(const NativePixmapHandle& handle) {
 #endif
   }
 
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_HAIKU)
   clone.modifier = handle.modifier;
 #endif
 
diff --git a/src/3rdparty/chromium/ui/gfx/native_pixmap_handle.h b/src/3rdparty/chromium/ui/gfx/native_pixmap_handle.h
index b7f4c18..e8de10b 100644
--- a/src/3rdparty/chromium/ui/gfx/native_pixmap_handle.h
+++ b/src/3rdparty/chromium/ui/gfx/native_pixmap_handle.h
@@ -15,7 +15,7 @@
 #include "build/build_config.h"
 #include "ui/gfx/gfx_export.h"
 
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_HAIKU)
 #include "base/files/scoped_file.h"
 #endif
 
@@ -32,7 +32,7 @@ struct GFX_EXPORT NativePixmapPlane {
   NativePixmapPlane(int stride,
                     int offset,
                     uint64_t size
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_HAIKU)
                     ,
                     base::ScopedFD fd
 #elif defined(OS_FUCHSIA)
@@ -53,7 +53,7 @@ struct GFX_EXPORT NativePixmapPlane {
   // This is necessary to map the buffers.
   uint64_t size;
 
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_HAIKU)
   // File descriptor for the underlying memory object (usually dmabuf).
   base::ScopedFD fd;
 #elif defined(OS_FUCHSIA)
@@ -82,7 +82,7 @@ struct GFX_EXPORT NativePixmapHandle {
 
   std::vector<NativePixmapPlane> planes;
 
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_HAIKU)
   // The modifier is retrieved from GBM library and passed to EGL driver.
   // Generally it's platform specific, and we don't need to modify it in
   // Chromium code. Also one per plane per entry.
diff --git a/src/3rdparty/chromium/ui/gl/BUILD.gn b/src/3rdparty/chromium/ui/gl/BUILD.gn
index 6600f0c..0e591f0 100644
--- a/src/3rdparty/chromium/ui/gl/BUILD.gn
+++ b/src/3rdparty/chromium/ui/gl/BUILD.gn
@@ -536,7 +536,7 @@ jumbo_static_library("test_support") {
     deps += [ "//ui/platform_window/x11" ]
   }
 
-  if (use_ozone) {
+  if (use_ozone && !is_haiku) {
     deps += [ "//ui/ozone" ]
   }
 }
diff --git a/src/3rdparty/chromium/ui/gl/gl_fence.cc b/src/3rdparty/chromium/ui/gl/gl_fence.cc
index 71f0eea..ee676fa 100644
--- a/src/3rdparty/chromium/ui/gl/gl_fence.cc
+++ b/src/3rdparty/chromium/ui/gl/gl_fence.cc
@@ -18,7 +18,7 @@
 #include "ui/gl/gl_fence_apple.h"
 #endif
 
-#if defined(USE_EGL) && defined(OS_POSIX) && !defined(OS_MACOSX)
+#if defined(USE_EGL) && defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_HAIKU)
 #define USE_GL_FENCE_ANDROID_NATIVE_FENCE_SYNC
 #include "ui/gl/gl_fence_android_native_fence_sync.h"
 #include "ui/gl/gl_surface_egl.h"
diff --git a/src/3rdparty/chromium/ui/gl/init/BUILD.gn b/src/3rdparty/chromium/ui/gl/init/BUILD.gn
index abadb15..0c2ab61 100644
--- a/src/3rdparty/chromium/ui/gl/init/BUILD.gn
+++ b/src/3rdparty/chromium/ui/gl/init/BUILD.gn
@@ -32,7 +32,13 @@ jumbo_component("init") {
 
   public_deps = [ "//ui/gl" ]
 
-  if (is_android) {
+  if (is_haiku && !use_ozone) {
+    sources += [
+      "gl_factory_haiku.cc",
+      "gl_initializer_haiku.cc",
+    ]
+    libs = [ "GL" ]
+  } else if (is_android) {
     sources += [
       "gl_factory_android.cc",
       "gl_initializer_android.cc",
@@ -71,14 +77,5 @@ 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
index 945e254..c5fb0ec 100644
--- a/src/3rdparty/chromium/ui/gl/init/gl_factory_haiku.cc
+++ b/src/3rdparty/chromium/ui/gl/init/gl_factory_haiku.cc
@@ -7,14 +7,12 @@
 #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 {
@@ -24,7 +22,6 @@ std::vector<GLImplementation> GetAllowedGLImplementations() {
   std::vector<GLImplementation> impls;
   //impls.push_back(kGLImplementationDesktopGL);
   impls.push_back(kGLImplementationEGLGLES2);
-  impls.push_back(kGLImplementationOSMesaGL);
   impls.push_back(kGLImplementationSwiftShaderGL);
   return impls;
 }
@@ -44,9 +41,6 @@ scoped_refptr<GLContext> CreateGLContext(GLShareGroup* share_group,
                                          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:
@@ -66,18 +60,14 @@ scoped_refptr<GLContext> CreateGLContext(GLShareGroup* share_group,
   }
 }
 
-#ifndef TOOLKIT_QT
 scoped_refptr<GLSurface> 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));
+      return InitializeGLSurface(new NativeViewGLSurfaceEGL(0, nullptr));
     case kGLImplementationMockGL:
     case kGLImplementationStubGL:
       return new GLSurfaceStub;
@@ -91,13 +81,7 @@ scoped_refptr<GLSurface> 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() &&
@@ -115,7 +99,6 @@ scoped_refptr<GLSurface> CreateOffscreenGLSurfaceWithFormat(
       return nullptr;
   }
 }
-#endif
 
 void SetDisabledExtensionsPlatform(const std::string& disabled_extensions) {
   GLImplementation implementation = GetGLImplementation();
@@ -126,7 +109,6 @@ void SetDisabledExtensionsPlatform(const std::string& disabled_extensions) {
       SetDisabledExtensionsEGL(disabled_extensions);
       break;
     case kGLImplementationSwiftShaderGL:
-    case kGLImplementationOSMesaGL:
     case kGLImplementationMockGL:
     case kGLImplementationStubGL:
       break;
@@ -143,7 +125,6 @@ bool InitializeExtensionSettingsOneOffPlatform() {
     case kGLImplementationEGLGLES2:
       return InitializeExtensionSettingsOneOffEGL();
     case kGLImplementationSwiftShaderGL:
-    case kGLImplementationOSMesaGL:
     case kGLImplementationMockGL:
     case kGLImplementationStubGL:
       return true;
diff --git a/src/3rdparty/chromium/ui/gl/init/gl_initializer_haiku.cc b/src/3rdparty/chromium/ui/gl/init/gl_initializer_haiku.cc
index e828e50..bbffdaf 100644
--- a/src/3rdparty/chromium/ui/gl/init/gl_initializer_haiku.cc
+++ b/src/3rdparty/chromium/ui/gl/init/gl_initializer_haiku.cc
@@ -10,12 +10,10 @@
 #include "base/threading/thread_restrictions.h"
 #include "build/build_config.h"
 #include "ui/gfx/switches.h"
+#include "ui/gl/buildflags.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"
 
@@ -102,20 +100,10 @@ bool InitializeStaticEGLInternal(GLImplementation implementation) {
 
 }  // 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())) {
@@ -128,7 +116,6 @@ bool InitializeGLOneOffPlatform() {
   }
 }
 
-#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
@@ -142,7 +129,6 @@ bool InitializeStaticGLBindings(GLImplementation implementation) {
   base::ThreadRestrictions::ScopedAllowIO allow_io;
 
   switch (implementation) {
-    case kGLImplementationOSMesaGL:
     case kGLImplementationDesktopGL:
     case kGLImplementationSwiftShaderGL:
     case kGLImplementationEGLGLES2:
@@ -159,11 +145,6 @@ bool InitializeStaticGLBindings(GLImplementation implementation) {
   return false;
 }
 
-void InitializeDebugGLBindings() {
-  InitializeDebugGLBindingsEGL();
-  InitializeDebugGLBindingsGL();
-}
-
 void ShutdownGLPlatform() {
   GLSurfaceEGL::ShutdownOneOff();
   ClearBindingsEGL();
diff --git a/src/3rdparty/chromium/ui/ozone/BUILD.gn b/src/3rdparty/chromium/ui/ozone/BUILD.gn
index 7d52290..d89b022 100644
--- a/src/3rdparty/chromium/ui/ozone/BUILD.gn
+++ b/src/3rdparty/chromium/ui/ozone/BUILD.gn
@@ -135,6 +135,8 @@ jumbo_component("ozone_base") {
     "//ui/ozone/platform/*",
     "//ui/base/ime/chromeos/*",
   ]
+  
+  all_dependent_configs = [ "//third_party/vulkan:vulkan_config" ]
 
   # Out of tree platforms can depend on this.
   visibility += ozone_external_platform_visibility
diff --git a/src/3rdparty/chromium/ui/ozone/ozone.gni b/src/3rdparty/chromium/ui/ozone/ozone.gni
index 1d9bb9c..ab905f3 100644
--- a/src/3rdparty/chromium/ui/ozone/ozone.gni
+++ b/src/3rdparty/chromium/ui/ozone/ozone.gni
@@ -67,7 +67,7 @@ declare_args() {
       ozone_platform = "x11"
       ozone_platform_gbm = true
       ozone_platform_x11 = true
-    } else if (is_desktop_linux) {
+    } else if (is_desktop_linux && !is_haiku) {
       ozone_platform = "x11"
       ozone_platform_wayland = true
       ozone_platform_x11 = true
diff --git a/src/3rdparty/chromium/ui/ozone/public/surface_factory_ozone.h b/src/3rdparty/chromium/ui/ozone/public/surface_factory_ozone.h
index fde22b2..2c2a8a3 100644
--- a/src/3rdparty/chromium/ui/ozone/public/surface_factory_ozone.h
+++ b/src/3rdparty/chromium/ui/ozone/public/surface_factory_ozone.h
@@ -27,6 +27,8 @@
 #include "gpu/vulkan/vulkan_implementation.h"
 #endif
 
+#include <vulkan/vulkan_core.h>
+
 namespace gfx {
 class NativePixmap;
 }
diff --git a/src/3rdparty/chromium/v8/BUILD.gn b/src/3rdparty/chromium/v8/BUILD.gn
index ab20142..7d6fd1d 100644
--- a/src/3rdparty/chromium/v8/BUILD.gn
+++ b/src/3rdparty/chromium/v8/BUILD.gn
@@ -3542,7 +3542,6 @@ v8_source_set("v8_base_without_compiler") {
   # to implement atomic memory access
   if (v8_current_cpu == "mips" || v8_current_cpu == "mipsel" ||
       v8_current_cpu == "mips64" || v8_current_cpu == "mips64el" ||
-      v8_current_cpu == "ppc" || v8_current_cpu == "ppc64" ||
       v8_current_cpu == "s390" || v8_current_cpu == "s390x") {
     libs += [ "atomic" ]
   }
@@ -3790,7 +3789,7 @@ v8_component("v8_libbase") {
     }
   }
 
-  if (is_linux) {
+  if (is_linux && !is_haiku) {
     sources += [
       "src/base/debug/stack_trace_posix.cc",
       "src/base/platform/platform-linux.cc",
@@ -3810,6 +3809,12 @@ v8_component("v8_libbase") {
       "dl",
       "rt",
     ]
+  } else if (is_haiku) {
+    sources += [
+      "src/base/debug/stack_trace_posix.cc",
+      "src/base/platform/platform-haiku.cc",
+    ]
+    libs = [ "execinfo" ]
   } else if (is_android) {
     if (current_toolchain == host_toolchain) {
       libs = [
@@ -4030,6 +4035,7 @@ if (v8_monolithic) {
       ":v8_libsampler",
       "//build/win:default_exe_manifest",
     ]
+    libs = ["execinfo"]
 
     configs = [ ":internal_config" ]
   }
diff --git a/src/3rdparty/chromium/v8/gni/v8.gni b/src/3rdparty/chromium/v8/gni/v8.gni
index bb8c1d2..80ae0cc 100644
--- a/src/3rdparty/chromium/v8/gni/v8.gni
+++ b/src/3rdparty/chromium/v8/gni/v8.gni
@@ -208,7 +208,7 @@ template("v8_executable") {
       configs -= invoker.remove_configs
     }
     configs += invoker.configs
-    if (is_linux) {
+    if (is_linux && !is_haiku) {
       # For enabling ASLR.
       ldflags = [ "-pie" ]
     }
diff --git a/src/3rdparty/chromium/v8/include/v8config.h b/src/3rdparty/chromium/v8/include/v8config.h
index 5333834..d06d201 100644
--- a/src/3rdparty/chromium/v8/include/v8config.h
+++ b/src/3rdparty/chromium/v8/include/v8config.h
@@ -276,7 +276,18 @@
 # define V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT \
     (__has_attribute(warn_unused_result))
 
+// Work around Clang bug present in 9.0.1, at least.
+//
+// Clang stores alignment as a 32-bit unsigned integer, but V8 only uses
+// V8_ASSUME_ALIGNED() for a 4GB (2^32) alignment
+// (kPtrComprIsolateRootAlignment).  As such, the alignment overflows and
+// becomes zero, triggering an internal Clang assertion that alignment must not
+// be zero.
+#if 0
 # define V8_HAS_BUILTIN_ASSUME_ALIGNED (__has_builtin(__builtin_assume_aligned))
+#else
+# define V8_HAS_BUILTIN_ASSUME_ALIGNED 0
+#endif
 # define V8_HAS_BUILTIN_BSWAP16 (__has_builtin(__builtin_bswap16))
 # define V8_HAS_BUILTIN_BSWAP32 (__has_builtin(__builtin_bswap32))
 # define V8_HAS_BUILTIN_BSWAP64 (__has_builtin(__builtin_bswap64))
diff --git a/src/3rdparty/chromium/v8/src/api/api.cc b/src/3rdparty/chromium/v8/src/api/api.cc
index b2d6db3..90463b9 100644
--- a/src/3rdparty/chromium/v8/src/api/api.cc
+++ b/src/3rdparty/chromium/v8/src/api/api.cc
@@ -113,7 +113,7 @@
 #include "src/wasm/wasm-result.h"
 #include "src/wasm/wasm-serialization.h"
 
-#if V8_OS_LINUX || V8_OS_MACOSX || V8_OS_FREEBSD
+#if V8_OS_LINUX || V8_OS_MACOSX || V8_OS_FREEBSD || V8_OS_HAIKU
 #include <signal.h>
 #include "include/v8-wasm-trap-handler-posix.h"
 #include "src/trap-handler/handler-inside-posix.h"
@@ -5726,7 +5726,7 @@ bool v8::V8::Initialize() {
   return true;
 }
 
-#if V8_OS_LINUX || V8_OS_MACOSX
+#if V8_OS_LINUX || V8_OS_MACOSX || V8_OS_OPENBSD || V8_OS_HAIKU
 bool TryHandleWebAssemblyTrapPosix(int sig_code, siginfo_t* info,
                                    void* context) {
 #if V8_TARGET_ARCH_X64 && !V8_OS_ANDROID
diff --git a/src/3rdparty/chromium/v8/src/base/cpu.cc b/src/3rdparty/chromium/v8/src/base/cpu.cc
index f1c48fa..22a42e9 100644
--- a/src/3rdparty/chromium/v8/src/base/cpu.cc
+++ b/src/3rdparty/chromium/v8/src/base/cpu.cc
@@ -427,6 +427,7 @@ CPU::CPU()
 
 #if V8_OS_LINUX
 
+#if V8_OS_LINUX
   CPUInfo cpu_info;
 
   // Extract implementor from the "CPU implementer" field.
@@ -460,6 +461,7 @@ CPU::CPU()
     }
     delete[] part;
   }
+#endif
 
   // Extract architecture from the "CPU Architecture" field.
   // The list is well-known, unlike the the output of
diff --git a/src/3rdparty/chromium/v8/src/base/platform/platform-freebsd.cc b/src/3rdparty/chromium/v8/src/base/platform/platform-freebsd.cc
deleted file mode 100644
index 3c0b2d1..0000000
--- a/src/3rdparty/chromium/v8/src/base/platform/platform-freebsd.cc
+++ /dev/null
@@ -1,118 +0,0 @@
-// Copyright 2012 the V8 project authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Platform-specific code for FreeBSD goes here. For the POSIX-compatible
-// parts, the implementation is in platform-posix.cc.
-
-#include <pthread.h>
-#include <semaphore.h>
-#include <signal.h>
-#include <stdlib.h>
-#include <sys/resource.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <sys/ucontext.h>
-#include <sys/user.h>
-
-#include <sys/fcntl.h>  // open
-#include <sys/mman.h>   // mmap & munmap
-#include <sys/stat.h>   // open
-#include <sys/sysctl.h>
-#include <unistd.h>     // getpagesize
-// If you don't have execinfo.h then you need devel/libexecinfo from ports.
-#include <errno.h>
-#include <limits.h>
-#include <stdarg.h>
-#include <strings.h>    // index
-
-#include <cmath>
-
-#undef MAP_TYPE
-
-#include "src/base/macros.h"
-#include "src/base/platform/platform-posix-time.h"
-#include "src/base/platform/platform-posix.h"
-#include "src/base/platform/platform.h"
-
-namespace v8 {
-namespace base {
-
-TimezoneCache* OS::CreateTimezoneCache() {
-  return new PosixDefaultTimezoneCache();
-}
-
-static unsigned StringToLong(char* buffer) {
-  return static_cast<unsigned>(strtol(buffer, nullptr, 16));  // NOLINT
-}
-
-std::vector<OS::SharedLibraryAddress> OS::GetSharedLibraryAddresses() {
-  std::vector<SharedLibraryAddress> result;
-  int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_VMMAP, getpid()};
-  size_t miblen = sizeof(mib) / sizeof(mib[0]);
-  size_t buffer_size;
-  if (sysctl(mib, miblen, nullptr, &buffer_size, nullptr, 0) == 0) {
-    // Overallocate the buffer by 1/3 to account for concurrent
-    // kinfo_vmentry change. 1/3 is an arbitrary constant that
-    // works in practice.
-    buffer_size = buffer_size * 4 / 3;
-    std::vector<char> buffer(buffer_size);
-    int ret = sysctl(mib, miblen, buffer.data(), &buffer_size, nullptr, 0);
-
-    if (ret == 0 || (ret == -1 && errno == ENOMEM)) {
-      char* start = buffer.data();
-      char* end = start + buffer_size;
-
-      while (start < end) {
-        struct kinfo_vmentry* map =
-            reinterpret_cast<struct kinfo_vmentry*>(start);
-        const size_t ssize = map->kve_structsize;
-        char* path = map->kve_path;
-
-        CHECK_NE(0, ssize);
-
-        if ((map->kve_protection & KVME_PROT_READ) != 0 &&
-            (map->kve_protection & KVME_PROT_EXEC) != 0 && path[0] != '\0') {
-          char* sep = strrchr(path, '/');
-          std::string lib_name;
-          if (sep != nullptr) {
-            lib_name = std::string(++sep);
-          } else {
-            lib_name = std::string(path);
-          }
-          result.push_back(SharedLibraryAddress(
-              lib_name, reinterpret_cast<uintptr_t>(map->kve_start),
-              reinterpret_cast<uintptr_t>(map->kve_end)));
-        }
-
-        start += ssize;
-      }
-    }
-  }
-  return result;
-}
-
-void OS::SignalCodeMovingGC() {}
-
-void OS::AdjustSchedulingParams() {}
-
-// static
-void* Stack::GetStackStart() {
-  pthread_attr_t attr;
-  int error;
-  pthread_attr_init(&attr);
-  error = pthread_attr_get_np(pthread_self(), &attr);
-  if (!error) {
-    void* base;
-    size_t size;
-    error = pthread_attr_getstack(&attr, &base, &size);
-    CHECK(!error);
-    pthread_attr_destroy(&attr);
-    return reinterpret_cast<uint8_t*>(base) + size;
-  }
-  pthread_attr_destroy(&attr);
-  return nullptr;
-}
-
-}  // namespace base
-}  // namespace v8
diff --git a/src/3rdparty/chromium/v8/src/base/platform/platform-haiku.cc b/src/3rdparty/chromium/v8/src/base/platform/platform-haiku.cc
new file mode 100644
index 0000000..2f7fa84
--- /dev/null
+++ b/src/3rdparty/chromium/v8/src/base/platform/platform-haiku.cc
@@ -0,0 +1,64 @@
+// Copyright 2012 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Platform-specific code for FreeBSD goes here. For the POSIX-compatible
+// parts, the implementation is in platform-posix.cc.
+
+#include <pthread.h>
+#include <semaphore.h>
+#include <signal.h>
+#include <stdlib.h>
+#include <sys/resource.h>
+#include <sys/time.h>
+#include <sys/types.h>
+
+#include <fcntl.h>  // open
+#include <sys/mman.h>   // mmap & munmap
+#include <sys/stat.h>   // open
+#include <unistd.h>     // getpagesize
+// If you don't have execinfo.h then you need devel/libexecinfo from ports.
+#include <errno.h>
+#include <limits.h>
+#include <stdarg.h>
+#include <strings.h>    // index
+
+#include <cmath>
+
+#include <OS.h>
+
+#undef MAP_TYPE
+
+#include "src/base/macros.h"
+#include "src/base/platform/platform-posix-time.h"
+#include "src/base/platform/platform-posix.h"
+#include "src/base/platform/platform.h"
+
+namespace v8 {
+namespace base {
+
+TimezoneCache* OS::CreateTimezoneCache() {
+  return new PosixDefaultTimezoneCache();
+}
+
+static unsigned StringToLong(char* buffer) {
+  return static_cast<unsigned>(strtol(buffer, nullptr, 16));  // NOLINT
+}
+
+std::vector<OS::SharedLibraryAddress> OS::GetSharedLibraryAddresses() {
+  return std::vector<SharedLibraryAddress>();
+}
+
+void OS::SignalCodeMovingGC() {}
+
+void OS::AdjustSchedulingParams() {}
+
+// static
+void* Stack::GetStackStart() {
+  thread_info threadInfo;
+  get_thread_info(find_thread(NULL), &threadInfo);
+  return threadInfo.stack_base;
+}
+
+}  // namespace base
+}  // namespace v8
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 676e140..f0e20fd 100644
--- a/src/3rdparty/chromium/v8/src/base/platform/platform-posix.cc
+++ b/src/3rdparty/chromium/v8/src/base/platform/platform-posix.cc
@@ -438,7 +438,7 @@ bool OS::DiscardSystemPages(void* address, size_t size) {
 
 // static
 bool OS::HasLazyCommits() {
-#if V8_OS_AIX || V8_OS_LINUX || V8_OS_MACOSX
+#if V8_OS_AIX || V8_OS_LINUX || V8_OS_MACOSX || V8_OS_HAIKU
   return true;
 #else
   // TODO(bbudge) Return true for all POSIX platforms.
@@ -975,7 +975,7 @@ void Thread::SetThreadLocal(LocalStorageKey key, void* value) {
 // pthread_getattr_np used below is non portable (hence the _np suffix). We
 // keep this version in POSIX as most Linux-compatible derivatives will
 // support it. MacOS and FreeBSD are different here.
-#if !defined(V8_OS_FREEBSD) && !defined(V8_OS_MACOSX)
+#if !defined(V8_OS_FREEBSD) && !defined(V8_OS_MACOSX) && !defined(V8_OS_HAIKU)
 
 // static
 void* Stack::GetStackStart() {
diff --git a/src/3rdparty/chromium/v8/src/trap-handler/handler-inside-posix.cc b/src/3rdparty/chromium/v8/src/trap-handler/handler-inside-posix.cc
index 6228e87..47d2d53 100644
--- a/src/3rdparty/chromium/v8/src/trap-handler/handler-inside-posix.cc
+++ b/src/3rdparty/chromium/v8/src/trap-handler/handler-inside-posix.cc
@@ -114,6 +114,8 @@ bool TryHandleSignal(int signum, siginfo_t* info, void* context) {
     auto* context_rip = &uc->uc_mcontext->__ss.__rip;
 #elif V8_OS_FREEBSD
     auto* context_rip = &uc->uc_mcontext.mc_rip;
+#elif V8_OS_HAIKU
+    auto* context_rip = &uc->uc_mcontext.rip;
 #else
 #error Unsupported platform
 #endif
diff --git a/src/3rdparty/chromium/v8/src/trap-handler/handler-inside-posix.h b/src/3rdparty/chromium/v8/src/trap-handler/handler-inside-posix.h
index 49fe23a..9fc916f 100644
--- a/src/3rdparty/chromium/v8/src/trap-handler/handler-inside-posix.h
+++ b/src/3rdparty/chromium/v8/src/trap-handler/handler-inside-posix.h
@@ -12,7 +12,7 @@ namespace v8 {
 namespace internal {
 namespace trap_handler {
 
-#if V8_OS_LINUX || V8_OS_FREEBSD
+#if V8_OS_LINUX || V8_OS_FREEBSD || V8_OS_HAIKU
 constexpr int kOobSignal = SIGSEGV;
 #elif V8_OS_MACOSX
 constexpr int kOobSignal = SIGBUS;
diff --git a/src/3rdparty/chromium/v8/src/trap-handler/trap-handler.h b/src/3rdparty/chromium/v8/src/trap-handler/trap-handler.h
index f6fdca5..30786fb 100644
--- a/src/3rdparty/chromium/v8/src/trap-handler/trap-handler.h
+++ b/src/3rdparty/chromium/v8/src/trap-handler/trap-handler.h
@@ -25,6 +25,8 @@ namespace trap_handler {
 #define V8_TRAP_HANDLER_SUPPORTED true
 #elif V8_TARGET_ARCH_X64 && V8_OS_FREEBSD
 #define V8_TRAP_HANDLER_SUPPORTED true
+#elif V8_TARGET_ARCH_X64 && V8_OS_HAIKU
+#define V8_TRAP_HANDLER_SUPPORTED true
 #else
 #define V8_TRAP_HANDLER_SUPPORTED false
 #endif
diff --git a/src/3rdparty/chromium/v8/test/BUILD.gn b/src/3rdparty/chromium/v8/test/BUILD.gn
index f6d3053..2c174ea 100644
--- a/src/3rdparty/chromium/v8/test/BUILD.gn
+++ b/src/3rdparty/chromium/v8/test/BUILD.gn
@@ -31,7 +31,7 @@ group("gn_all") {
     deps += [
       "cctest:cctest",
       "cctest:generate-bytecode-expectations",
-      "unittests:unittests",
+      #"unittests:unittests",
     ]
   }
 }
@@ -73,10 +73,10 @@ group("v8_bot_default") {
     "message:v8_message",
     "mjsunit:v8_mjsunit",
     "mkgrokdump:mkgrokdump",
-    "unittests:unittests",
+    #"unittests:unittests",
     "wasm-api-tests:wasm_api_tests",
     "wasm-js:v8_wasm_js",
-    "wasm-spec-tests:v8_wasm_spec_tests",
+    #"wasm-spec-tests:v8_wasm_spec_tests",
     "webkit:v8_webkit",
   ]
 }
@@ -93,10 +93,10 @@ group("v8_default") {
     "message:v8_message",
     "mjsunit:v8_mjsunit",
     "mkgrokdump:mkgrokdump",
-    "unittests:unittests",
+    #"unittests:unittests",
     "wasm-api-tests:wasm_api_tests",
-    "wasm-js:v8_wasm_js",
-    "wasm-spec-tests:v8_wasm_spec_tests",
+    #"wasm-js:v8_wasm_js",
+    #"wasm-spec-tests:v8_wasm_spec_tests",
   ]
 }
 
-- 
2.30.2


From 99feb25f593b97e18f1be36f63a793bbd93ee799 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Tue, 16 Feb 2021 20:29:26 +0100
Subject: more Haiku patches


diff --git a/src/3rdparty/chromium/base/process/process_metrics_posix.cc b/src/3rdparty/chromium/base/process/process_metrics_posix.cc
index 59f9df8..e821222 100644
--- a/src/3rdparty/chromium/base/process/process_metrics_posix.cc
+++ b/src/3rdparty/chromium/base/process/process_metrics_posix.cc
@@ -119,7 +119,7 @@ size_t ProcessMetrics::GetMallocUsage() {
 #else
   return minfo.hblkhd + minfo.arena;
 #endif
-#elif defined(OS_FUCHSIA)
+#elif defined(OS_FUCHSIA) || defined(OS_HAIKU)
   // TODO(fuchsia): Not currently exposed. https://crbug.com/735087.
   return 0;
 #endif
diff --git a/src/3rdparty/chromium/base/system/sys_info_haiku.cc b/src/3rdparty/chromium/base/system/sys_info_haiku.cc
index a9598a1..b3ff561 100644
--- a/src/3rdparty/chromium/base/system/sys_info_haiku.cc
+++ b/src/3rdparty/chromium/base/system/sys_info_haiku.cc
@@ -14,7 +14,7 @@ namespace base {
 int64_t SysInfo::AmountOfPhysicalMemoryImpl() {
     system_info systemInfo;
     get_system_info(&systemInfo);
-    return static_cast<int64_t>(systemInfo.max_pages * (B_PAGE_SIZE / 1048576.0f) + 0.5f);
+    return static_cast<int64_t>(systemInfo.max_pages * B_PAGE_SIZE + 0.5f);
 }
 
 // static
@@ -22,7 +22,7 @@ int64_t SysInfo::AmountOfAvailablePhysicalMemoryImpl() {
     system_info systemInfo;
     get_system_info(&systemInfo);
     return static_cast<int64_t>((systemInfo.max_pages - systemInfo.used_pages)
-    	* (B_PAGE_SIZE / 1048576.0f) + 0.5f);
+        * B_PAGE_SIZE + 0.5f);
 }
 
 
diff --git a/src/3rdparty/chromium/build/config/logging.gni b/src/3rdparty/chromium/build/config/logging.gni
index b0ae9e8..7c4a0bc 100644
--- a/src/3rdparty/chromium/build/config/logging.gni
+++ b/src/3rdparty/chromium/build/config/logging.gni
@@ -6,5 +6,5 @@ import("//build/config/dcheck_always_on.gni")
 
 declare_args() {
   # Use LogErrorNotReached() for NOTREACHED().
-  enable_log_error_not_reached = is_chromeos && !(is_debug || dcheck_always_on)
+  enable_log_error_not_reached = is_haiku || is_chromeos && !(is_debug || dcheck_always_on)
 }
diff --git a/src/3rdparty/chromium/content/renderer/render_process_impl.cc b/src/3rdparty/chromium/content/renderer/render_process_impl.cc
index f31a4f9..c646c03 100644
--- a/src/3rdparty/chromium/content/renderer/render_process_impl.cc
+++ b/src/3rdparty/chromium/content/renderer/render_process_impl.cc
@@ -44,7 +44,7 @@
 #if defined(OS_WIN)
 #include "base/win/win_util.h"
 #endif
-#if defined(OS_LINUX) && defined(ARCH_CPU_X86_64)
+#if (defined(OS_LINUX) || defined(OS_HAIKU)) && defined(ARCH_CPU_X86_64)
 #include "v8/include/v8-wasm-trap-handler-posix.h"
 #endif
 namespace {
@@ -162,7 +162,7 @@ RenderProcessImpl::RenderProcessImpl()
 
   SetV8FlagIfNotFeature(features::kWebAssemblyTrapHandler,
                         "--no-wasm-trap-handler");
-#if defined(OS_LINUX) && defined(ARCH_CPU_X86_64)
+#if (defined(OS_LINUX) || defined(OS_HAIKU)) && defined(ARCH_CPU_X86_64)
   if (base::FeatureList::IsEnabled(features::kWebAssemblyTrapHandler)) {
     base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
     if (!command_line->HasSwitch(
diff --git a/src/3rdparty/chromium/content/renderer/render_thread_impl.cc b/src/3rdparty/chromium/content/renderer/render_thread_impl.cc
index fdb6fa9..6e382ba 100644
--- a/src/3rdparty/chromium/content/renderer/render_thread_impl.cc
+++ b/src/3rdparty/chromium/content/renderer/render_thread_impl.cc
@@ -739,7 +739,7 @@ void RenderThreadImpl::Init() {
   DCHECK(parsed_num_raster_threads) << string_value;
   DCHECK_GT(num_raster_threads, 0);
 
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_HAIKU)
   categorized_worker_pool_->SetBackgroundingCallback(
       main_thread_scheduler_->DefaultTaskRunner(),
       base::BindOnce(
@@ -762,7 +762,7 @@ void RenderThreadImpl::Init() {
   base::DiscardableMemoryAllocator::SetInstance(
       discardable_memory_allocator_.get());
 
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_HAIKU)
   if (base::FeatureList::IsEnabled(
           blink::features::kBlinkCompositorUseDisplayThreadPriority)) {
     render_message_filter()->SetThreadPriority(
diff --git a/src/3rdparty/chromium/content/renderer/renderer_blink_platform_impl.cc b/src/3rdparty/chromium/content/renderer/renderer_blink_platform_impl.cc
index 202a83c..0022d1e 100644
--- a/src/3rdparty/chromium/content/renderer/renderer_blink_platform_impl.cc
+++ b/src/3rdparty/chromium/content/renderer/renderer_blink_platform_impl.cc
@@ -98,7 +98,7 @@
 
 #if defined(OS_MACOSX)
 #include "content/child/child_process_sandbox_support_impl_mac.h"
-#elif defined(OS_LINUX)
+#elif defined(OS_LINUX) || defined(OS_HAIKU)
 #include "content/child/child_process_sandbox_support_impl_linux.h"
 #endif
 
@@ -173,7 +173,7 @@ RendererBlinkPlatformImpl::RendererBlinkPlatformImpl(
   if (RenderThreadImpl::current()) {
     io_runner_ = RenderThreadImpl::current()->GetIOTaskRunner();
     thread_safe_sender_ = RenderThreadImpl::current()->thread_safe_sender();
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_HAIKU)
     mojo::PendingRemote<font_service::mojom::FontService> font_service;
     RenderThreadImpl::current()->BindHostReceiver(
         font_service.InitWithNewPipeAndPassReceiver());
@@ -183,7 +183,7 @@ RendererBlinkPlatformImpl::RendererBlinkPlatformImpl(
 #endif
   }
 
-#if defined(OS_LINUX) || defined(OS_MACOSX)
+#if defined(OS_LINUX) || defined(OS_MACOSX) || defined(OS_HAIKU)
   if (sandboxEnabled()) {
 #if defined(OS_MACOSX)
     sandbox_support_ = std::make_unique<WebSandboxSupportMac>();
@@ -265,7 +265,7 @@ RendererBlinkPlatformImpl::CreateNetworkURLLoaderFactory() {
 
 void RendererBlinkPlatformImpl::SetDisplayThreadPriority(
     base::PlatformThreadId thread_id) {
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_HAIKU)
   if (RenderThreadImpl* render_thread = RenderThreadImpl::current()) {
     render_thread->render_message_filter()->SetThreadPriority(
         thread_id, base::ThreadPriority::DISPLAY);
@@ -278,7 +278,7 @@ blink::BlameContext* RendererBlinkPlatformImpl::GetTopLevelBlameContext() {
 }
 
 blink::WebSandboxSupport* RendererBlinkPlatformImpl::GetSandboxSupport() {
-#if defined(OS_LINUX) || defined(OS_MACOSX)
+#if defined(OS_LINUX) || defined(OS_MACOSX) || defined(OS_HAIKU)
   return sandbox_support_.get();
 #else
   // These platforms do not require sandbox support.
diff --git a/src/3rdparty/chromium/content/renderer/renderer_blink_platform_impl.h b/src/3rdparty/chromium/content/renderer/renderer_blink_platform_impl.h
index b637f58..c3dc327 100644
--- a/src/3rdparty/chromium/content/renderer/renderer_blink_platform_impl.h
+++ b/src/3rdparty/chromium/content/renderer/renderer_blink_platform_impl.h
@@ -31,7 +31,7 @@
 #include "third_party/blink/public/mojom/cache_storage/cache_storage.mojom.h"
 #include "third_party/blink/public/mojom/loader/code_cache.mojom.h"
 
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_HAIKU)
 #include "components/services/font/public/cpp/font_loader.h"  // nogncheck
 #include "third_party/skia/include/core/SkRefCnt.h"           // nogncheck
 #endif
@@ -222,7 +222,7 @@ class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl {
 
   scoped_refptr<base::SingleThreadTaskRunner> io_runner_;
 
-#if defined(OS_LINUX) || defined(OS_MACOSX)
+#if defined(OS_LINUX) || defined(OS_MACOSX) || defined(OS_HAIKU)
   std::unique_ptr<blink::WebSandboxSupport> sandbox_support_;
 #endif
 
@@ -246,7 +246,7 @@ class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl {
   mojo::PendingRemote<blink::mojom::CodeCacheHost> code_cache_host_remote_;
   mojo::SharedRemote<blink::mojom::CodeCacheHost> code_cache_host_;
 
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_HAIKU)
   sk_sp<font_service::FontLoader> font_loader_;
 #endif
 
diff --git a/src/3rdparty/chromium/content/utility/utility_blink_platform_with_sandbox_support_impl.cc b/src/3rdparty/chromium/content/utility/utility_blink_platform_with_sandbox_support_impl.cc
index a394549..5bb2f3c 100644
--- a/src/3rdparty/chromium/content/utility/utility_blink_platform_with_sandbox_support_impl.cc
+++ b/src/3rdparty/chromium/content/utility/utility_blink_platform_with_sandbox_support_impl.cc
@@ -9,7 +9,7 @@
 
 #if defined(OS_MACOSX)
 #include "content/child/child_process_sandbox_support_impl_mac.h"
-#elif defined(OS_LINUX)
+#elif defined(OS_LINUX) || defined(OS_HAIKU)
 #include "content/child/child_process_sandbox_support_impl_linux.h"
 #endif
 
@@ -17,7 +17,7 @@ namespace content {
 
 UtilityBlinkPlatformWithSandboxSupportImpl::
     UtilityBlinkPlatformWithSandboxSupportImpl() {
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_HAIKU)
   mojo::PendingRemote<font_service::mojom::FontService> font_service;
   UtilityThread::Get()->BindHostReceiver(
       font_service.InitWithNewPipeAndPassReceiver());
@@ -34,7 +34,7 @@ UtilityBlinkPlatformWithSandboxSupportImpl::
 
 blink::WebSandboxSupport*
 UtilityBlinkPlatformWithSandboxSupportImpl::GetSandboxSupport() {
-#if defined(OS_LINUX) || defined(OS_MACOSX)
+#if defined(OS_LINUX) || defined(OS_MACOSX) || defined(OS_HAIKU)
   return sandbox_support_.get();
 #else
   return nullptr;
diff --git a/src/3rdparty/chromium/content/utility/utility_blink_platform_with_sandbox_support_impl.h b/src/3rdparty/chromium/content/utility/utility_blink_platform_with_sandbox_support_impl.h
index c76ee08..3d67830 100644
--- a/src/3rdparty/chromium/content/utility/utility_blink_platform_with_sandbox_support_impl.h
+++ b/src/3rdparty/chromium/content/utility/utility_blink_platform_with_sandbox_support_impl.h
@@ -11,7 +11,7 @@
 #include "build/build_config.h"
 #include "third_party/blink/public/platform/platform.h"
 
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_HAIKU)
 #include "components/services/font/public/cpp/font_loader.h"  // nogncheck
 #include "third_party/skia/include/core/SkRefCnt.h"           // nogncheck
 #endif
@@ -33,10 +33,10 @@ class UtilityBlinkPlatformWithSandboxSupportImpl : public blink::Platform {
   blink::WebSandboxSupport* GetSandboxSupport() override;
 
  private:
-#if defined(OS_LINUX) || defined(OS_MACOSX)
+#if defined(OS_LINUX) || defined(OS_MACOSX) || defined(OS_HAIKU)
   std::unique_ptr<blink::WebSandboxSupport> sandbox_support_;
 #endif
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_HAIKU)
   sk_sp<font_service::FontLoader> font_loader_;
 #endif
 
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 f2e3200..e2fc0a7 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
@@ -226,7 +226,11 @@ size_t ThreadStackSize() {
   uint8_t* stack_end = reinterpret_cast<uint8_t*>(threadInfo.stack_end);
   uint8_t* stack_start = reinterpret_cast<uint8_t*>(threadInfo.stack_base);
   CHECK(stack_start);
-  CHECK_GT(stack_start, stack_end);
+  // From BeBook (thread_info):
+  // The two stack pointers are currently inverted such that
+  // stack_base is less than stack_end.
+  // (In a stack-grows-down world, the base should be greater than the end.)
+  CHECK_GT(stack_end, stack_start);
   size_t thread_stack_size = static_cast<size_t>(stack_start - stack_end);
   return thread_stack_size;
 }
diff --git a/src/3rdparty/chromium/third_party/blink/renderer/platform/wtf/thread_specific.h b/src/3rdparty/chromium/third_party/blink/renderer/platform/wtf/thread_specific.h
index d691242..be111ad 100644
--- a/src/3rdparty/chromium/third_party/blink/renderer/platform/wtf/thread_specific.h
+++ b/src/3rdparty/chromium/third_party/blink/renderer/platform/wtf/thread_specific.h
@@ -105,7 +105,7 @@ inline bool ThreadSpecific<T>::IsSet() {
 template <typename T>
 inline ThreadSpecific<T>::operator T*() {
   T* off_thread_ptr;
-#if defined(__GLIBC__) || defined(OS_ANDROID) || defined(OS_FREEBSD)
+#if defined(__GLIBC__) || defined(OS_ANDROID) || defined(OS_FREEBSD) || defined(OS_HAIKU)
   // TLS is fast on these platforms.
   // TODO(csharrison): Qualify this statement for Android.
   const bool kMainThreadAlwaysChecksTLS = true;
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 ada4f72..dd76346 100644
--- a/src/3rdparty/chromium/third_party/webrtc/rtc_base/BUILD.gn
+++ b/src/3rdparty/chromium/third_party/webrtc/rtc_base/BUILD.gn
@@ -932,7 +932,7 @@ rtc_library("rtc_base") {
     deps += [ "system:cocoa_threading" ]
   }
 
-  if (is_linux) {
+  if (is_linux && !is_haiku) {
     libs += [
       "dl",
       "rt",
diff --git a/src/3rdparty/chromium/third_party/webrtc/system_wrappers/BUILD.gn b/src/3rdparty/chromium/third_party/webrtc/system_wrappers/BUILD.gn
index 1ff2ddd..b4ced7c 100644
--- a/src/3rdparty/chromium/third_party/webrtc/system_wrappers/BUILD.gn
+++ b/src/3rdparty/chromium/third_party/webrtc/system_wrappers/BUILD.gn
@@ -61,6 +61,10 @@ rtc_library("system_wrappers") {
     }
 
     libs += [ "rt" ]
+
+    if (is_haiku) {
+      libs -= [ "rt" ]
+    }
   }
 
   if (is_win) {
diff --git a/src/3rdparty/chromium/v8/BUILD.gn b/src/3rdparty/chromium/v8/BUILD.gn
index 7d6fd1d..93af5c9 100644
--- a/src/3rdparty/chromium/v8/BUILD.gn
+++ b/src/3rdparty/chromium/v8/BUILD.gn
@@ -254,7 +254,7 @@ if (v8_enable_snapshot_native_code_counters == "") {
 if (v8_enable_pointer_compression == "") {
   # TODO(v8:v7703): temporarily enable pointer compression on arm64 and on x64
   v8_enable_pointer_compression =
-      v8_current_cpu == "arm64" || v8_current_cpu == "x64"
+      (v8_current_cpu == "arm64" || v8_current_cpu == "x64") && !is_haiku
 }
 if (v8_enable_fast_torque == "") {
   v8_enable_fast_torque = v8_enable_fast_mksnapshot
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 f0e20fd..9595ab2 100644
--- a/src/3rdparty/chromium/v8/src/base/platform/platform-posix.cc
+++ b/src/3rdparty/chromium/v8/src/base/platform/platform-posix.cc
@@ -78,8 +78,7 @@ extern int madvise(caddr_t, size_t, int);
 #endif
 
 #if defined(V8_OS_HAIKU)
-#define madvise posix_madvise
-#define MADV_DONTNEED POSIX_MADV_DONTNEED
+#define MADV_FREE POSIX_MADV_DONTNEED
 #endif
 
 #ifndef MADV_FREE
@@ -139,7 +138,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 && !V8_OS_HAIKU
+#if !V8_OS_AIX && !V8_OS_FREEBSD && !V8_OS_QNX
     flags |= MAP_NORESERVE;
 #endif  // !V8_OS_AIX && !V8_OS_FREEBSD && !V8_OS_QNX
 #if V8_OS_QNX
@@ -418,6 +417,8 @@ bool OS::DiscardSystemPages(void* address, size_t size) {
   int ret = madvise(address, size, MADV_FREE_REUSABLE);
 #elif defined(_AIX) || defined(V8_OS_SOLARIS)
   int ret = madvise(reinterpret_cast<caddr_t>(address), size, MADV_FREE);
+#elif defined(V8_OS_HAIKU)
+  int ret = posix_madvise(address, size, MADV_FREE);
 #else
   int ret = madvise(address, size, MADV_FREE);
 #endif
@@ -429,6 +430,8 @@ bool OS::DiscardSystemPages(void* address, size_t size) {
 // imply runtime support.
 #if defined(_AIX) || defined(V8_OS_SOLARIS)
     ret = madvise(reinterpret_cast<caddr_t>(address), size, MADV_DONTNEED);
+#elif defined(V8_OS_HAIKU)
+    ret = posix_madvise(address, size, MADV_FREE);
 #else
     ret = madvise(address, size, MADV_DONTNEED);
 #endif
-- 
2.30.2


From 0f019f6d526da000ff77c74f51bd917b38d7fec1 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Mon, 1 Mar 2021 17:46:18 +0100
Subject: Haiku: use internal certverifier like linux


diff --git a/src/3rdparty/chromium/net/base/features.cc b/src/3rdparty/chromium/net/base/features.cc
index 949b75c..82afe70 100644
--- a/src/3rdparty/chromium/net/base/features.cc
+++ b/src/3rdparty/chromium/net/base/features.cc
@@ -92,7 +92,7 @@ const base::Feature kBlockExternalRequestsFromNonSecureInitiators{
 #if BUILDFLAG(BUILTIN_CERT_VERIFIER_FEATURE_SUPPORTED)
 const base::Feature kCertVerifierBuiltinFeature {
   "CertVerifierBuiltin",
-#if defined(OS_CHROMEOS) || defined(OS_LINUX)
+#if defined(OS_CHROMEOS) || defined(OS_LINUX) || defined(OS_HAIKU)
       base::FEATURE_ENABLED_BY_DEFAULT
 #else
       base::FEATURE_DISABLED_BY_DEFAULT
diff --git a/src/3rdparty/chromium/net/tools/cert_verify_tool/cert_verify_tool.cc b/src/3rdparty/chromium/net/tools/cert_verify_tool/cert_verify_tool.cc
index 69d70e4..d2c4e13 100644
--- a/src/3rdparty/chromium/net/tools/cert_verify_tool/cert_verify_tool.cc
+++ b/src/3rdparty/chromium/net/tools/cert_verify_tool/cert_verify_tool.cc
@@ -29,7 +29,7 @@
 #include "net/url_request/url_request_context_builder.h"
 #include "net/url_request/url_request_context_getter.h"
 
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_HAIKU)
 #include "net/proxy_resolution/proxy_config.h"
 #include "net/proxy_resolution/proxy_config_service_fixed.h"
 #endif
@@ -51,7 +51,7 @@ void SetUpOnNetworkThread(
     base::WaitableEvent* initialization_complete_event) {
   net::URLRequestContextBuilder url_request_context_builder;
   url_request_context_builder.set_user_agent(GetUserAgent());
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_HAIKU)
   // On Linux, use a fixed ProxyConfigService, since the default one
   // depends on glib.
   //
-- 
2.30.2


From 05fdac8df5dc216489d848c016c5d1c82889766f Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Wed, 3 Mar 2021 16:38:32 +0100
Subject: Haiku: some more patches


diff --git a/src/3rdparty/chromium/base/files/scoped_file.cc b/src/3rdparty/chromium/base/files/scoped_file.cc
index 1b9227d..eb64be2 100644
--- a/src/3rdparty/chromium/base/files/scoped_file.cc
+++ b/src/3rdparty/chromium/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/chromium/media/base/scopedfd_helper.h b/src/3rdparty/chromium/media/base/scopedfd_helper.h
index 52dd9cd..f69b482 100644
--- a/src/3rdparty/chromium/media/base/scopedfd_helper.h
+++ b/src/3rdparty/chromium/media/base/scopedfd_helper.h
@@ -14,14 +14,14 @@ namespace media {
 // since the only current user is V4L2 we are limiting the scope to OS_LINUX so
 // the binary size does not inflate on non-using systems. Feel free to adapt
 // this and BUILD.gn as our needs evolve.
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_HAIKU)
 
 // Return a new vector containing duplicates of |fds|, or PCHECKs in case of an
 // error.
 MEDIA_EXPORT std::vector<base::ScopedFD> DuplicateFDs(
     const std::vector<base::ScopedFD>& fds);
 
-#endif  // OS_LINUX
+#endif  // OS_LINUX || OS_HAIKU
 
 }  // namespace media
 
-- 
2.30.2


From 6b44f0c3fcd8a8ac57aa93b84fb1424e27406211 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Wed, 17 Nov 2021 16:45:02 +0100
Subject: Haiku: clean up for r1beta3


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 13cdff2..27fe5a9 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,11 +34,6 @@
 #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/memory/discardable_shared_memory.cc b/src/3rdparty/chromium/base/memory/discardable_shared_memory.cc
index 8677bcc..c116346 100644
--- a/src/3rdparty/chromium/base/memory/discardable_shared_memory.cc
+++ b/src/3rdparty/chromium/base/memory/discardable_shared_memory.cc
@@ -41,11 +41,6 @@
 #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 {
 
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 9583801..38fbc55 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,9 +21,6 @@
 #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 <sanitizer/asan_interface.h>
 #endif  // defined(ADDRESS_SANITIZER)
diff --git a/src/3rdparty/chromium/third_party/pdfium/third_party/base/allocator/partition_allocator/page_allocator_internals_posix.h b/src/3rdparty/chromium/third_party/pdfium/third_party/base/allocator/partition_allocator/page_allocator_internals_posix.h
index 31bf067..3c10a21 100644
--- a/src/3rdparty/chromium/third_party/pdfium/third_party/base/allocator/partition_allocator/page_allocator_internals_posix.h
+++ b/src/3rdparty/chromium/third_party/pdfium/third_party/base/allocator/partition_allocator/page_allocator_internals_posix.h
@@ -206,7 +206,7 @@ void DiscardSystemPagesInternal(void* address, size_t length) {
   // performance benefits unclear.
   //
   // Therefore, we just do the simple thing: MADV_DONTNEED.
-  CHECK(!posix_madvise(address, length, POSIX_MADV_DONTNEED));
+  CHECK(!madvise(address, length, MADV_DONTNEED));
 #endif
 }
 
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 9595ab2..8b06f3d 100644
--- a/src/3rdparty/chromium/v8/src/base/platform/platform-posix.cc
+++ b/src/3rdparty/chromium/v8/src/base/platform/platform-posix.cc
@@ -77,10 +77,6 @@ extern int madvise(caddr_t, size_t, int);
 #endif
 #endif
 
-#if defined(V8_OS_HAIKU)
-#define MADV_FREE POSIX_MADV_DONTNEED
-#endif
-
 #ifndef MADV_FREE
 #define MADV_FREE MADV_DONTNEED
 #endif
@@ -417,8 +413,6 @@ bool OS::DiscardSystemPages(void* address, size_t size) {
   int ret = madvise(address, size, MADV_FREE_REUSABLE);
 #elif defined(_AIX) || defined(V8_OS_SOLARIS)
   int ret = madvise(reinterpret_cast<caddr_t>(address), size, MADV_FREE);
-#elif defined(V8_OS_HAIKU)
-  int ret = posix_madvise(address, size, MADV_FREE);
 #else
   int ret = madvise(address, size, MADV_FREE);
 #endif
@@ -430,8 +424,6 @@ bool OS::DiscardSystemPages(void* address, size_t size) {
 // imply runtime support.
 #if defined(_AIX) || defined(V8_OS_SOLARIS)
     ret = madvise(reinterpret_cast<caddr_t>(address), size, MADV_DONTNEED);
-#elif defined(V8_OS_HAIKU)
-    ret = posix_madvise(address, size, MADV_FREE);
 #else
     ret = madvise(address, size, MADV_DONTNEED);
 #endif
-- 
2.30.2


From 2d093dd1a95000f8af93585e19a2580f0e8f6c33 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Thu, 18 Nov 2021 20:23:52 +0100
Subject: gcc11 fixes


diff --git a/src/3rdparty/chromium/third_party/abseil-cpp/absl/synchronization/internal/graphcycles.cc b/src/3rdparty/chromium/third_party/abseil-cpp/absl/synchronization/internal/graphcycles.cc
index 6a2bcdf..30f8144 100644
--- a/src/3rdparty/chromium/third_party/abseil-cpp/absl/synchronization/internal/graphcycles.cc
+++ b/src/3rdparty/chromium/third_party/abseil-cpp/absl/synchronization/internal/graphcycles.cc
@@ -37,6 +37,7 @@
 
 #include <algorithm>
 #include <array>
+#include <limits>
 #include "absl/base/internal/hide_ptr.h"
 #include "absl/base/internal/raw_logging.h"
 #include "absl/base/internal/spinlock.h"
diff --git a/src/3rdparty/chromium/third_party/perfetto/src/trace_processor/containers/string_pool.h b/src/3rdparty/chromium/third_party/perfetto/src/trace_processor/containers/string_pool.h
index 11ae91c..558ff00 100644
--- a/src/3rdparty/chromium/third_party/perfetto/src/trace_processor/containers/string_pool.h
+++ b/src/3rdparty/chromium/third_party/perfetto/src/trace_processor/containers/string_pool.h
@@ -20,6 +20,7 @@
 #include <stddef.h>
 #include <stdint.h>
 
+#include <limits>
 #include <unordered_map>
 #include <vector>
 
-- 
2.30.2

