main.cc 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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
  3. // found in the LICENSE file.
  4. #include <stddef.h>
  5. #include <memory>
  6. #include "base/at_exit.h"
  7. #include "base/command_line.h"
  8. #include "build/build_config.h"
  9. #if BUILDFLAG(IS_MAC)
  10. #include "base/mac/scoped_nsautorelease_pool.h"
  11. #endif
  12. #if BUILDFLAG(IS_WIN)
  13. #include "base/strings/utf_string_conversions.h"
  14. #endif
  15. #include "base/message_loop/message_pump_type.h"
  16. #include "base/task/single_thread_task_executor.h"
  17. #include "ui/gl/gl_surface.h"
  18. extern "C" {
  19. #if defined(GLES2_CONFORM_SUPPORT_ONLY)
  20. #include "gpu/gles2_conform_support/gtf/gtf_stubs.h"
  21. #else
  22. #include "third_party/gles2_conform/GTF_ES/glsl/GTF/Source/GTFMain.h" // nogncheck
  23. #endif
  24. }
  25. int main(int argc, char *argv[]) {
  26. base::AtExitManager at_exit;
  27. base::CommandLine::Init(argc, argv);
  28. base::SingleThreadTaskExecutor main_task_executor(base::MessagePumpType::UI);
  29. base::CommandLine::StringVector args =
  30. base::CommandLine::ForCurrentProcess()->GetArgs();
  31. #if BUILDFLAG(IS_MAC)
  32. base::mac::ScopedNSAutoreleasePool pool;
  33. #endif
  34. std::unique_ptr<const char* []> argsArray(new const char*[args.size() + 1]);
  35. argsArray[0] = argv[0];
  36. #if BUILDFLAG(IS_WIN)
  37. std::vector<std::string> argsNonWide(args.size());
  38. for (size_t index = 0; index < args.size(); ++index) {
  39. argsNonWide[index] = base::WideToASCII(args[index]);
  40. argsArray[index+1] = argsNonWide[index].c_str();
  41. }
  42. #else
  43. for (size_t index = 0; index < args.size(); ++index) {
  44. argsArray[index+1] = args[index].c_str();
  45. }
  46. #endif
  47. GTFMain(static_cast<int>(args.size()+1),
  48. const_cast<char**>(argsArray.get()));
  49. return 0;
  50. }