summaryrefslogtreecommitdiffstats
path: root/ui/viewer/viewer_main.cc
blob: e49dcc088abe0d2f0e9126d05a4f7b5de1e83e60 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// 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();

  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;
}