Chromium Code Reviews| Index: content/gpu/gpu_main.cc |
| diff --git a/content/gpu/gpu_main.cc b/content/gpu/gpu_main.cc |
| index 7cfe9187ffcd038c57a17c9ef7e1ed41c190f086..84ff0060f2907b792fd553fb22732f6850b8ae98 100644 |
| --- a/content/gpu/gpu_main.cc |
| +++ b/content/gpu/gpu_main.cc |
| @@ -15,6 +15,7 @@ |
| #include "base/rand_util.h" |
| #include "base/strings/string_number_conversions.h" |
| #include "base/strings/stringprintf.h" |
| +#include "base/sys_info.h" |
| #include "base/third_party/dynamic_annotations/dynamic_annotations.h" |
| #include "base/threading/platform_thread.h" |
| #include "base/trace_event/trace_event.h" |
| @@ -43,6 +44,10 @@ |
| #include "ui/gl/gl_switches.h" |
| #include "ui/gl/gpu_switching_manager.h" |
| +#if defined(OS_POSIX) |
| +#include <dlfcn.h> |
| +#endif |
| + |
| #if defined(OS_WIN) |
| #include <dwmapi.h> |
| #include <windows.h> |
| @@ -481,6 +486,29 @@ bool WarmUpSandbox(const base::CommandLine& command_line) { |
| #if defined(OS_WIN) |
| media::DXVAVideoDecodeAccelerator::PreSandboxInitialization(); |
| #endif |
| + |
| +#if defined(OS_LINUX) |
| + if (command_line.HasSwitch(switches::kGpuSandboxStartEarly)) { |
| + // XXX: move all above code to the new GpuProcessPolicyEarlySandbox. |
| + |
| + // uname is used from GpuControlList when calling |
| + // gpu::ApplyGpuDriverBugWorkarounds. |
| + base::SysInfo::OperatingSystemVersion(); |
| + |
| + // Cannot use base::LoadNativeLibrary because it uses RTLD_LAZY. |
| + // We want to avoid the situation where a required symbol is loaded |
| + // after the sandbox is ON. So load all symbols now. |
| + // XXX: Instead of the library name above, uses: |
| + // ui/gl/gl_implementation_x11.cc::kGLLibraryName, kGLESv2LibraryName, ... |
| + dlopen("libglapi.so", RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE); |
| + dlopen("libGL.so", RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE); |
| + |
| + // XXX: find a way to determine when we know we are going to use llvmpipe |
| + // driver. |
| + dlopen("dri/swrast_dri.so", RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE); |
|
Ken Russell (switch to Gerrit)
2016/05/04 20:36:17
Yes, this is not acceptable to commit in its curre
|
| + } |
| +#endif |
| + |
| return true; |
| } |