Chromium Code Reviews| Index: ui/viewer/viewer_main.cc |
| diff --git a/ui/viewer/viewer_main.cc b/ui/viewer/viewer_main.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..3b3aed3a935e7f9d989e6434332e61f5ce43a8ce |
| --- /dev/null |
| +++ b/ui/viewer/viewer_main.cc |
| @@ -0,0 +1,38 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "base/command_line.h" |
| +#include "base/debug/debugger.h" |
| +#include "base/message_loop.h" |
| +#include "ui/compositor/test/compositor_test_support.h" |
| +#include "ui/viewer/viewer_process.h" |
| + |
| +// Mainline routine for running as the viewer process. |
| +int ViewerProcessMain() { |
| + MessageLoop main_message_loop(MessageLoop::TYPE_UI); |
| + ui::CompositorTestSupport::Initialize(); |
| + |
| + main_message_loop.set_thread_name("MainThread"); |
| + CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| + // TODO(scottmg): Constant. |
|
tfarina
2012/08/28 00:55:37
why don't you do this now? It shouldn't take too m
|
| + if (command_line->HasSwitch("wait-for-debugger")) { |
| + base::debug::WaitForDebugger(60, true); |
| + } |
| + |
| + VLOG(1) << "Viewer process launched: " |
| + << CommandLine::ForCurrentProcess()->GetCommandLineString(); |
| + |
| + base::PlatformThread::SetName("CrViewerMain"); |
| + |
| + // TODO(scottmg): Uniquize this process? |
| + |
| + ViewerProcess viewer_process; |
| + if (viewer_process.Initialize(&main_message_loop, *command_line)) { |
| + MessageLoopForUI::current()->Run(); |
| + } else { |
| + LOG(ERROR) << "Viewer process failed to initialize"; |
| + } |
| + viewer_process.Teardown(); |
| + return 0; |
| +} |