Re-land: C++ readability review
[chromium-blink-merge.git] / gpu / khronos_glcts_support / native / main.cc
blob62d9b117414edb0620730e9e08b7b34151325a8d
1 // Copyright 2014 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.
5 #include <cstdio>
7 #include "base/at_exit.h"
8 #include "base/command_line.h"
9 #include "base/message_loop/message_loop.h"
11 #include "third_party/khronos_glcts/framework/common/tcuApp.hpp"
12 #include "third_party/khronos_glcts/framework/common/tcuCommandLine.hpp"
13 #include "third_party/khronos_glcts/framework/common/tcuDefs.hpp"
14 #include "third_party/khronos_glcts/framework/common/tcuPlatform.hpp"
15 #include "third_party/khronos_glcts/framework/common/tcuResource.hpp"
16 #include "third_party/khronos_glcts/framework/common/tcuTestLog.hpp"
17 #include "third_party/khronos_glcts/framework/delibs/decpp/deUniquePtr.hpp"
19 // implemented in the native platform
20 tcu::Platform* createPlatform ();
22 void GTFMain(int argc, char* argv[]) {
23 setvbuf(stdout, DE_NULL, _IOLBF, 4*1024);
25 try {
26 tcu::CommandLine cmdLine(argc, argv);
27 tcu::DirArchive archive(cmdLine.getArchiveDir());
28 tcu::TestLog log(cmdLine.getLogFileName(), cmdLine.getLogFlags());
29 de::UniquePtr<tcu::Platform> platform(createPlatform());
30 de::UniquePtr<tcu::App> app(
31 new tcu::App(*platform, archive, log, cmdLine));
33 // Main loop.
34 for (;;) {
35 if (!app->iterate())
36 break;
39 catch (const std::exception& e) {
40 tcu::die("%s", e.what());
44 int main(int argc, char *argv[]) {
45 base::AtExitManager at_exit;
46 base::CommandLine::Init(argc, argv);
47 base::MessageLoopForUI message_loop;
49 GTFMain(argc, argv);
51 return 0;