Chromium Code Reviews| Index: gpu/gles2_conform_support/egl/egl.cc |
| diff --git a/gpu/gles2_conform_support/egl/egl.cc b/gpu/gles2_conform_support/egl/egl.cc |
| index e64285a02ea4f98b8ba16d281b6598989bf41d67..99744002e8b2602a184ab4fc43de422670ded0e4 100644 |
| --- a/gpu/gles2_conform_support/egl/egl.cc |
| +++ b/gpu/gles2_conform_support/egl/egl.cc |
| @@ -5,7 +5,11 @@ |
| #include <EGL/egl.h> |
| #include "base/command_line.h" |
| +#include "base/environment.h" |
| +#include "base/strings/string_split.h" |
| #include "gpu/command_buffer/client/gles2_lib.h" |
| +#include "gpu/command_buffer/service/gpu_switches.h" |
| +#include "gpu/config/gpu_util.h" |
| #include "gpu/gles2_conform_support/egl/display.h" |
| #include "ui/gl/gl_context.h" |
| #include "ui/gl/gl_surface.h" |
| @@ -107,9 +111,26 @@ EGLAPI EGLBoolean EGLAPIENTRY eglInitialize(EGLDisplay dpy, |
| // eglInitialize can be called multiple times, prevent InitializeOneOff from |
| // being called multiple times. |
| if (gfx::GetGLImplementation() == gfx::kGLImplementationNone) { |
| - int argc = 1; |
| - const char* const argv[] = {"dummy"}; |
| - base::CommandLine::Init(argc, argv); |
| + scoped_ptr<base::Environment> env(base::Environment::Create()); |
| + std::vector<std::string> args; |
| + std::string env_args; |
| + if (env->GetVar("CHROME_COMMAND_BUFFER_GLES2_ARGS", &env_args)) { |
| + args = base::SplitString(env_args, " ", base::TRIM_WHITESPACE, |
| + base::SPLIT_WANT_NONEMPTY); |
| + } |
| + if (args.size() == 0) { |
|
hendrikw
2015/12/17 18:39:18
Nit:
if (args.empty())
Kimmo Kinnunen
2015/12/18 08:07:05
Done.
|
| + args.push_back("dummy"); |
| + } |
| + scoped_ptr<const char* []> argv(new const char*[args.size()]); |
| + for (size_t i = 0; i < args.size(); ++i) { |
|
hendrikw
2015/12/17 18:39:18
Nit:
range-for instead >> for (auto& arg : args)
Kimmo Kinnunen
2015/12/18 08:07:05
The index is used in the lhs of the assignment.
|
| + argv[i] = args[i].c_str(); |
| + } |
| + base::CommandLine::Init(args.size(), argv.get()); |
| + base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| + if (!command_line->HasSwitch(switches::kDisableGpuDriverBugWorkarounds)) { |
| + gpu::ApplyGpuDriverBugWorkarounds(command_line); |
| + } |
| + |
| gfx::GLSurface::InitializeOneOff(); |
| } |