| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include <memory> |
| 8 |
| 7 #include "base/at_exit.h" | 9 #include "base/at_exit.h" |
| 8 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 9 #include "base/memory/scoped_ptr.h" | |
| 10 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
| 11 #if defined(OS_MACOSX) | 12 #if defined(OS_MACOSX) |
| 12 #include "base/mac/scoped_nsautorelease_pool.h" | 13 #include "base/mac/scoped_nsautorelease_pool.h" |
| 13 #endif | 14 #endif |
| 14 #if defined(OS_WIN) | 15 #if defined(OS_WIN) |
| 15 #include "base/strings/utf_string_conversions.h" | 16 #include "base/strings/utf_string_conversions.h" |
| 16 #endif | 17 #endif |
| 17 #include "ui/gl/gl_surface.h" | 18 #include "ui/gl/gl_surface.h" |
| 18 | 19 |
| 19 extern "C" { | 20 extern "C" { |
| 20 #if defined(GLES2_CONFORM_SUPPORT_ONLY) | 21 #if defined(GLES2_CONFORM_SUPPORT_ONLY) |
| 21 #include "gpu/gles2_conform_support/gtf/gtf_stubs.h" | 22 #include "gpu/gles2_conform_support/gtf/gtf_stubs.h" |
| 22 #else | 23 #else |
| 23 #include "third_party/gles2_conform/GTF_ES/glsl/GTF/Source/GTFMain.h" // nognch
eck | 24 #include "third_party/gles2_conform/GTF_ES/glsl/GTF/Source/GTFMain.h" // nognch
eck |
| 24 #endif | 25 #endif |
| 25 } | 26 } |
| 26 | 27 |
| 27 int main(int argc, char *argv[]) { | 28 int main(int argc, char *argv[]) { |
| 28 base::AtExitManager at_exit; | 29 base::AtExitManager at_exit; |
| 29 base::CommandLine::Init(argc, argv); | 30 base::CommandLine::Init(argc, argv); |
| 30 base::MessageLoopForUI message_loop; | 31 base::MessageLoopForUI message_loop; |
| 31 | 32 |
| 32 base::CommandLine::StringVector args = | 33 base::CommandLine::StringVector args = |
| 33 base::CommandLine::ForCurrentProcess()->GetArgs(); | 34 base::CommandLine::ForCurrentProcess()->GetArgs(); |
| 34 | 35 |
| 35 #if defined(OS_MACOSX) | 36 #if defined(OS_MACOSX) |
| 36 base::mac::ScopedNSAutoreleasePool pool; | 37 base::mac::ScopedNSAutoreleasePool pool; |
| 37 #endif | 38 #endif |
| 38 | 39 |
| 39 scoped_ptr<const char*[]> argsArray(new const char*[args.size()+1]); | 40 std::unique_ptr<const char* []> argsArray(new const char*[args.size() + 1]); |
| 40 argsArray[0] = argv[0]; | 41 argsArray[0] = argv[0]; |
| 41 | 42 |
| 42 #if defined(OS_WIN) | 43 #if defined(OS_WIN) |
| 43 std::vector<std::string> argsNonWide(args.size()); | 44 std::vector<std::string> argsNonWide(args.size()); |
| 44 for (size_t index = 0; index < args.size(); ++index) { | 45 for (size_t index = 0; index < args.size(); ++index) { |
| 45 argsNonWide[index] = base::UTF16ToASCII(args[index]); | 46 argsNonWide[index] = base::UTF16ToASCII(args[index]); |
| 46 argsArray[index+1] = argsNonWide[index].c_str(); | 47 argsArray[index+1] = argsNonWide[index].c_str(); |
| 47 } | 48 } |
| 48 #else | 49 #else |
| 49 for (size_t index = 0; index < args.size(); ++index) { | 50 for (size_t index = 0; index < args.size(); ++index) { |
| 50 argsArray[index+1] = args[index].c_str(); | 51 argsArray[index+1] = args[index].c_str(); |
| 51 } | 52 } |
| 52 #endif | 53 #endif |
| 53 | 54 |
| 54 GTFMain(static_cast<int>(args.size()+1), | 55 GTFMain(static_cast<int>(args.size()+1), |
| 55 const_cast<char**>(argsArray.get())); | 56 const_cast<char**>(argsArray.get())); |
| 56 | 57 |
| 57 return 0; | 58 return 0; |
| 58 } | 59 } |
| 59 | 60 |
| OLD | NEW |