| OLD | NEW |
| (Empty) |
| 1 // Copyright 2013 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. | |
| 4 | |
| 5 #include <stdio.h> | |
| 6 #include <string.h> | |
| 7 | |
| 8 #include <iostream> | |
| 9 | |
| 10 #include "base/base_switches.h" | |
| 11 #include "base/bind.h" | |
| 12 #include "base/command_line.h" | |
| 13 #include "base/debug/stack_trace.h" | |
| 14 #include "base/files/file_util.h" | |
| 15 #include "base/i18n/icu_util.h" | |
| 16 #include "base/message_loop/message_loop.h" | |
| 17 #include "base/path_service.h" | |
| 18 #include "base/run_loop.h" | |
| 19 #include "base/single_thread_task_runner.h" | |
| 20 #include "base/synchronization/waitable_event.h" | |
| 21 #include "base/threading/platform_thread.h" | |
| 22 #include "services/shell/standalone/context.h" | |
| 23 #include "services/shell/switches.h" | |
| 24 | |
| 25 namespace shell { | |
| 26 | |
| 27 int LauncherProcessMain() { | |
| 28 #if !defined(OFFICIAL_BUILD) | |
| 29 base::debug::EnableInProcessStackDumping(); | |
| 30 #endif | |
| 31 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | |
| 32 // http://crbug.com/546644 | |
| 33 command_line->AppendSwitch(switches::kNoSandbox); | |
| 34 | |
| 35 base::PlatformThread::SetName("mojo_runner"); | |
| 36 | |
| 37 // We want the Context to outlive the MessageLoop so that pipes are all | |
| 38 // gracefully closed / error-out before we try to shut the Context down. | |
| 39 Context shell_context; | |
| 40 { | |
| 41 base::MessageLoop message_loop; | |
| 42 CHECK(base::i18n::InitializeICU()); | |
| 43 shell_context.Init(nullptr); | |
| 44 | |
| 45 message_loop.task_runner()->PostTask( | |
| 46 FROM_HERE, base::Bind(&Context::RunCommandLineApplication, | |
| 47 base::Unretained(&shell_context))); | |
| 48 | |
| 49 base::RunLoop().Run(); | |
| 50 | |
| 51 // Must be called before |message_loop| is destroyed. | |
| 52 shell_context.Shutdown(); | |
| 53 } | |
| 54 | |
| 55 return 0; | |
| 56 } | |
| 57 | |
| 58 } // namespace shell | |
| OLD | NEW |