Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(269)

Unified Diff: mojo/shell/background/background_shell_main.cc

Issue 1667273002: Creates BackgroundShell and uses it in test (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix android Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/shell/background/background_shell_main.h ('k') | mojo/shell/standalone/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/shell/background/background_shell_main.cc
diff --git a/mojo/shell/background/background_shell_main.cc b/mojo/shell/background/background_shell_main.cc
new file mode 100644
index 0000000000000000000000000000000000000000..72c082f483a034d346190579077e3d70720cb848
--- /dev/null
+++ b/mojo/shell/background/background_shell_main.cc
@@ -0,0 +1,43 @@
+// Copyright 2016 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 "mojo/shell/background/background_shell_main.h"
+
+#include "base/at_exit.h"
+#include "base/command_line.h"
+#include "base/debug/debugger.h"
+#include "base/process/launch.h"
+#include "mojo/shell/runner/common/switches.h"
+#include "mojo/shell/runner/host/child_process.h"
+#include "mojo/shell/runner/init.h"
+
+namespace mojo {
+namespace shell {
+namespace {
+
+int RunChildProcess() {
+ base::AtExitManager at_exit;
+ InitializeLogging();
+ WaitForDebuggerIfNecessary();
+#if !defined(OFFICIAL_BUILD) && defined(OS_WIN)
+ base::RouteStdioToConsole(false);
+#endif
+ return ChildProcessMain();
+}
+
+} // namespace
+} // shell
+} // mojo
+
+int main(int argc, char** argv) {
+ base::CommandLine::Init(argc, argv);
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kChildProcess)) {
+ return mojo::shell::RunChildProcess();
+ }
+ // Reset CommandLine as most likely main() is going to use CommandLine too
+ // and expect to be able to initialize it.
+ base::CommandLine::Reset();
+ return MasterProcessMain(argc, argv);
+}
« no previous file with comments | « mojo/shell/background/background_shell_main.h ('k') | mojo/shell/standalone/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698