Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(262)

Unified Diff: gpu/gles2_conform_support/egl/egl.cc

Issue 1613103002: command_buffer_gles2: Fix command-line arguments if they are passed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@sampler-binduniform-bug
Patch Set: win2 Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 b439b1eb09866e2b6623837f8d349b909f02c9ef..03c5ed53b89b7d7142214d27ded6d5e695e833aa 100644
--- a/gpu/gles2_conform_support/egl/egl.cc
+++ b/gpu/gles2_conform_support/egl/egl.cc
@@ -8,6 +8,8 @@
#include "base/command_line.h"
#include "base/environment.h"
#include "base/strings/string_split.h"
+#include "base/strings/string_util.h"
+#include "base/strings/utf_string_conversions.h"
#include "gpu/command_buffer/client/gles2_lib.h"
#include "gpu/command_buffer/service/gpu_switches.h"
#include "gpu/config/gpu_util.h"
@@ -112,22 +114,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) {
+ base::CommandLine::StringVector 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.empty()) {
- args.push_back("dummy");
- }
- scoped_ptr<const char* []> argv(new const char*[args.size()]);
- for (size_t i = 0; i < args.size(); ++i) {
- argv[i] = args[i].c_str();
- }
- base::CommandLine::Init(static_cast<int>(args.size()), argv.get());
+ std::string env_string;
+ env->GetVar("CHROME_COMMAND_BUFFER_GLES2_ARGS", &env_string);
+#if defined(OS_WIN)
+ argv = base::SplitString(base::UTF8ToUTF16(env_string),
+ base::kWhitespaceUTF16, base::TRIM_WHITESPACE,
+ base::SPLIT_WANT_NONEMPTY);
+ argv.insert(argv.begin(), base::UTF8ToUTF16("dummy"));
+#else
+ argv = base::SplitString(env_string,
+ base::kWhitespaceASCII, base::TRIM_WHITESPACE,
+ base::SPLIT_WANT_NONEMPTY);
+ argv.insert(argv.begin(), "dummy");
+#endif
+ base::CommandLine::Init(0, nullptr);
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
+ // Need to call both Init and InitFromArgv, since Windows does not use
+ // argc, argv in CommandLine::Init(argc, argv).
+ command_line->InitFromArgv(argv);
if (!command_line->HasSwitch(switches::kDisableGpuDriverBugWorkarounds)) {
gpu::ApplyGpuDriverBugWorkarounds(command_line);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698