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

Unified Diff: mojo/shell/runner/host/child_process.cc

Issue 1877753003: Move mojo\shell to services\shell (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@62scan
Patch Set: . Created 4 years, 8 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/runner/host/child_process.h ('k') | mojo/shell/runner/host/child_process_base.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/shell/runner/host/child_process.cc
diff --git a/mojo/shell/runner/host/child_process.cc b/mojo/shell/runner/host/child_process.cc
deleted file mode 100644
index 260dc66edc70f0fc7f6073d41e8c16aa32de948a..0000000000000000000000000000000000000000
--- a/mojo/shell/runner/host/child_process.cc
+++ /dev/null
@@ -1,131 +0,0 @@
-// Copyright 2014 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/runner/host/child_process.h"
-
-#include <stdint.h>
-
-#include <utility>
-
-#include "base/base_switches.h"
-#include "base/bind.h"
-#include "base/callback_helpers.h"
-#include "base/command_line.h"
-#include "base/debug/stack_trace.h"
-#include "base/files/file_path.h"
-#include "base/i18n/icu_util.h"
-#include "base/location.h"
-#include "base/logging.h"
-#include "base/macros.h"
-#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
-#include "base/message_loop/message_loop.h"
-#include "base/single_thread_task_runner.h"
-#include "base/synchronization/waitable_event.h"
-#include "base/thread_task_runner_handle.h"
-#include "base/threading/thread.h"
-#include "base/threading/thread_checker.h"
-#include "mojo/edk/embedder/embedder.h"
-#include "mojo/edk/embedder/platform_channel_pair.h"
-#include "mojo/edk/embedder/process_delegate.h"
-#include "mojo/edk/embedder/scoped_platform_handle.h"
-#include "mojo/message_pump/message_pump_mojo.h"
-#include "mojo/public/cpp/bindings/binding.h"
-#include "mojo/public/cpp/system/core.h"
-#include "mojo/shell/runner/common/switches.h"
-#include "mojo/shell/runner/host/child_process_base.h"
-#include "mojo/shell/runner/host/native_application_support.h"
-#include "mojo/shell/runner/init.h"
-
-#if defined(OS_LINUX) && !defined(OS_ANDROID)
-#include "base/rand_util.h"
-#include "base/sys_info.h"
-#include "mojo/shell/runner/host/linux_sandbox.h"
-#endif
-
-#if defined(OS_MACOSX)
-#include "mojo/shell/runner/host/mach_broker.h"
-#endif
-
-namespace mojo {
-namespace shell {
-
-namespace {
-
-#if defined(OS_LINUX) && !defined(OS_ANDROID)
-scoped_ptr<mojo::shell::LinuxSandbox> InitializeSandbox() {
- using sandbox::syscall_broker::BrokerFilePermission;
- // Warm parts of base in the copy of base in the mojo runner.
- base::RandUint64();
- base::SysInfo::AmountOfPhysicalMemory();
- base::SysInfo::MaxSharedMemorySize();
- base::SysInfo::NumberOfProcessors();
-
- // TODO(erg,jln): Allowing access to all of /dev/shm/ makes it easy to
- // spy on other shared memory using processes. This is a temporary hack
- // so that we have some sandbox until we have proper shared memory
- // support integrated into mojo.
- std::vector<BrokerFilePermission> permissions;
- permissions.push_back(
- BrokerFilePermission::ReadWriteCreateUnlinkRecursive("/dev/shm/"));
- scoped_ptr<mojo::shell::LinuxSandbox> sandbox(
- new mojo::shell::LinuxSandbox(permissions));
- sandbox->Warmup();
- sandbox->EngageNamespaceSandbox();
- sandbox->EngageSeccompSandbox();
- sandbox->Seal();
- return sandbox;
-}
-#endif
-
-void RunNativeLibrary(
- base::NativeLibrary app_library,
- InterfaceRequest<mojom::ShellClient> shell_client_request) {
- if (!RunNativeApplication(app_library, std::move(shell_client_request))) {
- LOG(ERROR) << "Failure to RunNativeApplication()";
- }
-}
-
-} // namespace
-
-int ChildProcessMain() {
- DVLOG(2) << "ChildProcessMain()";
- const base::CommandLine& command_line =
- *base::CommandLine::ForCurrentProcess();
-
-#if defined(OS_LINUX) && !defined(OS_ANDROID)
- scoped_ptr<mojo::shell::LinuxSandbox> sandbox;
-#endif
- base::NativeLibrary app_library = 0;
- // Load the application library before we engage the sandbox.
- base::FilePath app_library_path =
- command_line.GetSwitchValuePath(switches::kChildProcess);
- if (!app_library_path.empty())
- app_library = mojo::shell::LoadNativeApplication(app_library_path);
- base::i18n::InitializeICU();
- if (app_library)
- CallLibraryEarlyInitialization(app_library);
-
-#if defined(OS_MACOSX)
- // Send our task port to the parent.
- MachBroker::SendTaskPortToParent();
-#endif
-
-#if !defined(OFFICIAL_BUILD)
- // Initialize stack dumping just before initializing sandbox to make
- // sure symbol names in all loaded libraries will be cached.
- base::debug::EnableInProcessStackDumping();
-#endif
-#if defined(OS_LINUX) && !defined(OS_ANDROID)
- if (command_line.HasSwitch(switches::kEnableSandbox))
- sandbox = InitializeSandbox();
-#endif
-
- ChildProcessMain(base::Bind(&RunNativeLibrary, app_library));
-
- return 0;
-}
-
-} // namespace shell
-} // namespace mojo
« no previous file with comments | « mojo/shell/runner/host/child_process.h ('k') | mojo/shell/runner/host/child_process_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698