Files
ports/devel/electron44/files/patch-content_gpu_gpu__main.cc
T
2026-10-04 04:07:15 +00:00

88 lines
3.7 KiB
C++

--- content/gpu/gpu_main.cc.orig 2026-09-01 23:50:56 UTC
+++ content/gpu/gpu_main.cc
@@ -112,14 +112,18 @@
#include "sandbox/win/src/sandbox.h"
#endif
-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
+#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
#include "services/webnn/public/cpp/webnn_sandbox_init.h"
#endif
-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
#include "content/child/sandboxed_process_thread_type_handler.h"
#include "content/common/gpu_pre_sandbox_hook_linux.h"
+#if BUILDFLAG(IS_BSD)
+#include "sandbox/policy/sandbox.h"
+#else
#include "sandbox/policy/linux/sandbox_linux.h"
+#endif
#include "sandbox/policy/sandbox_type.h"
#endif
@@ -137,7 +141,7 @@ namespace {
namespace {
-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
bool StartSandboxLinux(gpu::GpuWatchdogThread*,
const gpu::GPUInfo*,
const gpu::GpuPreferences&);
@@ -194,7 +198,7 @@ class ContentSandboxHelper : public gpu::GpuSandboxHel
#if BUILDFLAG(IS_WIN)
media::PreSandboxMediaFoundationInitialization();
#endif
-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
+#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
webnn::PreSandboxWebNNInitialization();
#endif
@@ -207,7 +211,7 @@ class ContentSandboxHelper : public gpu::GpuSandboxHel
const gpu::GPUInfo* gpu_info,
const gpu::GpuPreferences& gpu_prefs) override {
TRACE_EVENT("gpu,startup", "gpu_main::EnsureSandboxInitialized");
-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
return StartSandboxLinux(watchdog_thread, gpu_info, gpu_prefs);
#elif BUILDFLAG(IS_WIN)
return StartSandboxWindows(sandbox_info_);
@@ -327,7 +331,7 @@ int GpuMain(MainFunctionParams parameters) {
std::make_unique<base::SingleThreadTaskExecutor>(
gpu_preferences.message_pump_type, /*is_main_thread=*/true);
}
-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
#error "Unsupported Linux platform."
#elif BUILDFLAG(IS_MAC)
// Cross-process CoreAnimation requires a CFRunLoop to function at all, and
@@ -354,7 +358,8 @@ int GpuMain(MainFunctionParams parameters) {
base::MessagePumpWakeupCounter::InitializeForCurrentThread("GpuMain");
base::LockMetricsRecorder::EnableRecordingOnCurrentThread("CrGpuMain");
-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+// XXX BSD
+#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) && !BUILDFLAG(IS_BSD)
// Thread type delegate of the process should be registered before
// thread type change below for the main thread and for thread pool in
// ChildProcess constructor.
@@ -505,7 +510,7 @@ namespace {
namespace {
-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
bool StartSandboxLinux(gpu::GpuWatchdogThread* watchdog_thread,
const gpu::GPUInfo* gpu_info,
const gpu::GpuPreferences& gpu_prefs) {
@@ -553,7 +558,7 @@ bool StartSandboxLinux(gpu::GpuWatchdogThread* watchdo
sandbox_options.accelerated_video_encode_enabled =
!gpu_prefs.disable_accelerated_video_encode;
-#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
+#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
// Video decoding of many video streams can use thousands of FDs as well as
// Exo clients.
// See https://crbug.com/1417237