summaryrefslogtreecommitdiffstats
path: root/mandoline/app
diff options
context:
space:
mode:
authorjam <jam@chromium.org>2015-11-12 15:23:43 -0800
committerCommit bot <commit-bot@chromium.org>2015-11-12 23:25:11 +0000
commite43baadd5b88da3fd58b7d5a3f546875bccc46a4 (patch)
tree4d494acb6edf4f380dd841aefebe95a66e923c7c /mandoline/app
parent151479f43c58255e210c1d0f730ebf979ea360f6 (diff)
downloadchromium_src-e43baadd5b88da3fd58b7d5a3f546875bccc46a4.zip
chromium_src-e43baadd5b88da3fd58b7d5a3f546875bccc46a4.tar.gz
chromium_src-e43baadd5b88da3fd58b7d5a3f546875bccc46a4.tar.bz2
Remove duplication between Mandoline and mojo_runner main functions.
Review URL: https://codereview.chromium.org/1440053002 Cr-Commit-Position: refs/heads/master@{#359431}
Diffstat (limited to 'mandoline/app')
-rw-r--r--mandoline/app/desktop/BUILD.gn2
-rw-r--r--mandoline/app/desktop/launcher_process.cc68
-rw-r--r--mandoline/app/desktop/launcher_process.h15
-rw-r--r--mandoline/app/desktop/main.cc30
4 files changed, 3 insertions, 112 deletions
diff --git a/mandoline/app/desktop/BUILD.gn b/mandoline/app/desktop/BUILD.gn
index ac6d769..e43c193 100644
--- a/mandoline/app/desktop/BUILD.gn
+++ b/mandoline/app/desktop/BUILD.gn
@@ -11,8 +11,6 @@ group("desktop") {
executable("mandoline") {
sources = [
"../register_local_aliases.cc",
- "launcher_process.cc",
- "launcher_process.h",
"main.cc",
]
diff --git a/mandoline/app/desktop/launcher_process.cc b/mandoline/app/desktop/launcher_process.cc
deleted file mode 100644
index 60f5e32..0000000
--- a/mandoline/app/desktop/launcher_process.cc
+++ /dev/null
@@ -1,68 +0,0 @@
-// Copyright 2015 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 <stdio.h>
-#include <string.h>
-
-#include <algorithm>
-#include <iostream>
-
-#include "base/base_switches.h"
-#include "base/bind.h"
-#include "base/command_line.h"
-#include "base/files/file_util.h"
-#include "base/message_loop/message_loop.h"
-#include "base/path_service.h"
-#include "base/synchronization/waitable_event.h"
-#include "base/trace_event/trace_event.h"
-#include "components/tracing/trace_config_file.h"
-#include "components/tracing/tracing_switches.h"
-#include "mandoline/app/desktop/launcher_process.h"
-#include "mojo/runner/context.h"
-#include "mojo/runner/switches.h"
-#include "mojo/shell/switches.h"
-
-namespace mandoline {
-
-int LauncherProcessMain(int argc, char** argv) {
- mojo::runner::Tracer tracer;
- base::CommandLine* command_line =
- base::CommandLine::ForCurrentProcess();
- if (!command_line->HasSwitch(switches::kMojoSingleProcess))
- command_line->AppendSwitch(switches::kEnableMultiprocess);
- command_line->AppendSwitch("use-new-edk");
-
- bool trace_startup = command_line->HasSwitch(switches::kTraceStartup);
- if (trace_startup) {
- tracer.Start(
- command_line->GetSwitchValueASCII(switches::kTraceStartup),
- command_line->GetSwitchValueASCII(switches::kTraceStartupDuration),
- "mandoline.trace");
- }
-
- // We want the runner::Context to outlive the MessageLoop so that pipes are
- // all gracefully closed / error-out before we try to shut the Context down.
- mojo::runner::Context shell_context;
- {
- base::MessageLoop message_loop;
- base::FilePath shell_dir;
- PathService::Get(base::DIR_MODULE, &shell_dir);
- if (!shell_context.Init(shell_dir)) {
- return 0;
- }
-
- message_loop.PostTask(FROM_HERE,
- base::Bind(&mojo::runner::Context::Run,
- base::Unretained(&shell_context),
- GURL("mojo:desktop_ui")));
- message_loop.Run();
-
- // Must be called before |message_loop| is destroyed.
- shell_context.Shutdown();
- }
-
- return 0;
-}
-
-} // namespace mandoline
diff --git a/mandoline/app/desktop/launcher_process.h b/mandoline/app/desktop/launcher_process.h
deleted file mode 100644
index 045b303..0000000
--- a/mandoline/app/desktop/launcher_process.h
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright 2015 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.
-
-#ifndef MANDOLINE_APP_DESKTOP_LAUNCHER_PROCESS_H_
-#define MANDOLINE_APP_DESKTOP_LAUNCHER_PROCESS_H_
-
-namespace mandoline {
-
-// Main method for the launcher process.
-int LauncherProcessMain(int argc, char** argv);
-
-} // namespace mandoline
-
-#endif // MANDOLINE_APP_DESKTOP_LAUNCHER_PROCESS_H_
diff --git a/mandoline/app/desktop/main.cc b/mandoline/app/desktop/main.cc
index 989d8ec..ddfe4dd9 100644
--- a/mandoline/app/desktop/main.cc
+++ b/mandoline/app/desktop/main.cc
@@ -2,33 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "base/at_exit.h"
-#include "base/command_line.h"
-#include "base/debug/stack_trace.h"
-#include "base/process/launch.h"
-#include "mandoline/app/desktop/launcher_process.h"
-#include "mojo/runner/host/child_process.h"
-#include "mojo/runner/host/switches.h"
-#include "mojo/runner/init.h"
+#include "mojo/runner/desktop/main_helper.h"
int main(int argc, char** argv) {
- base::CommandLine::Init(argc, argv);
- const base::CommandLine& command_line =
- *base::CommandLine::ForCurrentProcess();
-
- base::AtExitManager at_exit;
- mojo::runner::InitializeLogging();
- mojo::runner::WaitForDebuggerIfNecessary();
-
-#if !defined(OFFICIAL_BUILD)
- base::debug::EnableInProcessStackDumping();
-#if defined(OS_WIN)
- base::RouteStdioToConsole(false);
-#endif
-#endif
-
- if (command_line.HasSwitch(switches::kChildProcess))
- return mojo::runner::ChildProcessMain();
-
- return mandoline::LauncherProcessMain(argc, argv);
+ return mojo::runner::RunnerMain(argc, argv, GURL("mojo:desktop_ui"),
+ base::Closure());
}