Chromium Code Reviews| Index: gpu/gles2_conform_support/native/main.cc |
| diff --git a/gpu/gles2_conform_support/native/main.cc b/gpu/gles2_conform_support/native/main.cc |
| index ea1cdf303ceee4d989f1198f3fa04816da4ac9b3..489cd8a038a4fefe543adc0a89de50955639951f 100644 |
| --- a/gpu/gles2_conform_support/native/main.cc |
| +++ b/gpu/gles2_conform_support/native/main.cc |
| @@ -8,6 +8,9 @@ |
| #if defined(OS_MACOSX) |
| #include "base/mac/scoped_nsautorelease_pool.h" |
| #endif |
| +#if defined(OS_WIN) |
| +#include "base/strings/utf_string_conversions.h" |
| +#endif |
| #include "ui/gl/gl_surface.h" |
| extern "C" { |
| @@ -23,10 +26,30 @@ int main(int argc, char *argv[]) { |
| CommandLine::Init(argc, argv); |
| base::MessageLoopForUI message_loop; |
| + CommandLine::StringVector args = |
| + CommandLine::ForCurrentProcess()->GetArgs(); |
| + |
| #if defined(OS_MACOSX) |
| base::mac::ScopedNSAutoreleasePool pool; |
| #endif |
| - GTFMain(argc, argv); |
| + |
| + char const** argsArray = new const char *[args.size()]; |
|
piman
2014/08/26 18:57:07
nit: scoped_ptr<char const*[]>
nit: new const char
Jamie Madill
2014/08/26 19:29:54
Done.
|
| + |
| +#if defined(OS_WIN) |
| + std::vector<std::string> argsNonWide; |
| + for (size_t index = 0; index < args.size(); ++index) { |
| + argsNonWide.push_back(base::UTF16ToUTF8(args[index])); |
| + argsArray[index] = argsNonWide[index].c_str(); |
|
piman
2014/08/26 18:57:07
I'm not sure that's safe. when you push_back a new
Jamie Madill
2014/08/26 19:29:54
Good point. I split the operation into two loops.
|
| + } |
| +#else |
| + for (size_t index = 0; index < args.size(); ++index) { |
| + argsArray[index] = args[index].c_str(); |
| + } |
| +#endif |
| + |
| + GTFMain(static_cast<int>(args.size()), |
| + const_cast<char**>(argsArray)); |
| + delete [] argsArray; |
| return 0; |
| } |