$OpenBSD: patch-content_gpu_gpu_main_cc,v 1.11 2016/01/23 18:49:31 robert Exp $
--- content/gpu/gpu_main.cc.orig.port	Wed Jan 20 21:01:21 2016
+++ content/gpu/gpu_main.cc	Fri Jan 22 19:58:58 2016
@@ -72,6 +72,10 @@
 #include "content/common/sandbox_mac.h"
 #endif
 
+#if defined(OS_BSD)
+#include "content/common/sandbox_init_openbsd.h"
+#endif
+
 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY)
 #include "content/common/gpu/media/vaapi_wrapper.h"
 #endif
@@ -99,8 +103,8 @@ bool WarmUpSandbox(const base::CommandLine& command_li
 bool CollectGraphicsInfo(gpu::GPUInfo& gpu_info);
 #endif
 
-#if defined(OS_LINUX)
-#if !defined(OS_CHROMEOS)
+#if defined(OS_LINUX) || defined(OS_BSD)
+#if !defined(OS_CHROMEOS) && !defined(OS_BSD)
 bool CanAccessNvidiaDeviceFile();
 #endif
 bool StartSandboxLinux(const gpu::GPUInfo&, GpuWatchdogThread*, bool);
@@ -177,13 +181,13 @@ int GpuMain(const MainFunctionParams& parameters) {
   // Use a UI message loop because ANGLE and the desktop GL platform can
   // create child windows to render to.
   base::MessageLoop main_message_loop(base::MessageLoop::TYPE_UI);
-#elif defined(OS_LINUX) && defined(USE_X11)
+#elif (defined(OS_BSD) || defined(OS_LINUX)) && defined(USE_X11)
   // We need a UI loop so that we can grab the Expose events. See GLSurfaceGLX
   // and https://crbug.com/326995.
   base::MessageLoop main_message_loop(base::MessageLoop::TYPE_UI);
   scoped_ptr<ui::PlatformEventSource> event_source =
       ui::PlatformEventSource::CreateDefault();
-#elif defined(OS_LINUX)
+#elif defined(OS_LINUX) || defined(OS_BSD)
   base::MessageLoop main_message_loop(base::MessageLoop::TYPE_DEFAULT);
 #elif defined(OS_MACOSX)
   // This is necessary for CoreAnimation layers hosted in the GPU process to be
@@ -243,7 +247,7 @@ int GpuMain(const MainFunctionParams& parameters) {
 
   // Warm up resources that don't need access to GPUInfo.
   if (WarmUpSandbox(command_line)) {
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_BSD)
     bool initialized_sandbox = false;
     bool initialized_gl_context = false;
     bool should_initialize_gl_context = false;
@@ -304,9 +308,9 @@ int GpuMain(const MainFunctionParams& parameters) {
       }
 #endif
 
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_BSD)
       initialized_gl_context = true;
-#if !defined(OS_CHROMEOS)
+#if !defined(OS_CHROMEOS) && !defined(OS_BSD)
       if (gpu_info.gpu.vendor_id == 0x10de &&  // NVIDIA
           gpu_info.driver_vendor == "NVIDIA" &&
           !CanAccessNvidiaDeviceFile())
@@ -343,7 +347,7 @@ int GpuMain(const MainFunctionParams& parameters) {
       watchdog_thread = NULL;
     }
 
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_BSD)
     should_initialize_gl_context = !initialized_gl_context &&
                                    !dead_on_arrival;
 
@@ -351,6 +355,7 @@ int GpuMain(const MainFunctionParams& parameters) {
       gpu_info.sandboxed = StartSandboxLinux(gpu_info, watchdog_thread.get(),
                                              should_initialize_gl_context);
     }
+
 #elif defined(OS_WIN)
     gpu_info.sandboxed = StartSandboxWindows(parameters.sandbox_info);
 #elif defined(OS_MACOSX)
@@ -468,8 +473,8 @@ bool CollectGraphicsInfo(gpu::GPUInfo& gpu_info) {
 }
 #endif
 
-#if defined(OS_LINUX)
-#if !defined(OS_CHROMEOS)
+#if defined(OS_LINUX) || defined(OS_BSD)
+#if !defined(OS_CHROMEOS) && !defined(OS_BSD)
 bool CanAccessNvidiaDeviceFile() {
   bool res = true;
   base::ThreadRestrictions::AssertIOAllowed();
@@ -527,6 +532,7 @@ bool StartSandboxLinux(const gpu::GPUInfo& gpu_info,
 
   WarmUpSandboxNvidia(gpu_info, should_initialize_gl_context);
 
+#if !defined(OS_BSD)
   if (watchdog_thread) {
     // LinuxSandbox needs to be able to ensure that the thread
     // has really been stopped.
@@ -546,11 +552,15 @@ bool StartSandboxLinux(const gpu::GPUInfo& gpu_info,
   // LinuxSandbox::InitializeSandbox() must always be called
   // with only one thread.
   res = LinuxSandbox::InitializeSandbox();
+
   if (watchdog_thread) {
     base::Thread::Options options;
     options.timer_slack = base::TIMER_SLACK_MAXIMUM;
     watchdog_thread->StartWithOptions(options);
   }
+#else
+  res = InitializeSandbox();
+#endif
 
   return res;
 }
