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

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

Issue 1676913002: [mojo] Delete third_party/mojo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase 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
Index: mojo/shell/runner/host/child_process_host.cc
diff --git a/mojo/shell/runner/host/child_process_host.cc b/mojo/shell/runner/host/child_process_host.cc
index 4e9fa9f164949347ba300667dd0a350039a189f4..17b17a171d1e11b183512447395e684449c3eb01 100644
--- a/mojo/shell/runner/host/child_process_host.cc
+++ b/mojo/shell/runner/host/child_process_host.cc
@@ -22,7 +22,6 @@
#include "mojo/public/cpp/bindings/interface_ptr_info.h"
#include "mojo/public/cpp/system/core.h"
#include "mojo/shell/runner/common/switches.h"
-#include "third_party/mojo/src/mojo/edk/embedder/embedder.h"
#if defined(OS_LINUX) && !defined(OS_ANDROID)
#include "sandbox/linux/services/namespace_sandbox.h"
@@ -64,26 +63,16 @@ ChildProcessHost::ChildProcessHost(base::TaskRunner* launch_process_runner,
: launch_process_runner_(launch_process_runner),
start_sandboxed_(start_sandboxed),
app_path_(app_path),
- channel_info_(nullptr),
start_child_process_event_(false, false),
weak_factory_(this) {
pipe_holder_ = new PipeHolder();
- if (base::CommandLine::ForCurrentProcess()->HasSwitch("use-new-edk")) {
- node_channel_.reset(new edk::PlatformChannelPair);
- primordial_pipe_token_ = edk::GenerateRandomToken();
- } else {
- pipe_holder_->SetPipe(embedder::CreateChannel(
- platform_channel_pair_.PassServerHandle(),
- base::Bind(&ChildProcessHost::DidCreateChannel, base::Unretained(this)),
- base::ThreadTaskRunnerHandle::Get()));
- OnMessagePipeCreated();
- }
+ node_channel_.reset(new edk::PlatformChannelPair);
+ primordial_pipe_token_ = edk::GenerateRandomToken();
}
ChildProcessHost::ChildProcessHost(ScopedHandle channel)
: launch_process_runner_(nullptr),
start_sandboxed_(false),
- channel_info_(nullptr),
start_child_process_event_(false, false),
weak_factory_(this) {
CHECK(channel.is_valid());
@@ -102,32 +91,30 @@ void ChildProcessHost::Start(const ProcessReadyCallback& callback) {
DCHECK(process_ready_callback_.is_null());
process_ready_callback_ = callback;
- if (base::CommandLine::ForCurrentProcess()->HasSwitch("use-new-edk")) {
- // With the new EDK, bootstrap message pipes are created asynchronously.
- // We recieve the bound pipe (if successful) on an arbitrary thread,
- // stash it in the thread-safe |pipe_holder_|, and then try to call
- // OnMessagePipeCreated() on the host's main thread.
- //
- // Because of the way the launcher process shuts down, it's possible for
- // the main thread's MessageLoop to stop running (but not yet be destroyed!)
- // while this boostrap is pending, resulting in OnMessagePipeCreated() never
- // being called.
- //
- // A typical child process (i.e. one using ApplicationImpl to bind the other
- // end of this pipe) may hang forever waiting for an Initialize() message
- // unless the pipe is closed. This in turn means that Join() could hang
- // waiting for the process to exit. Deadlock!
- //
- // |pipe_holder_| exists for this reason. If it's still holding onto the
- // pipe when Join() is called, the pipe will be closed.
- DCHECK(!primordial_pipe_token_.empty());
- edk::CreateParentMessagePipe(
- primordial_pipe_token_,
- base::Bind(&OnParentMessagePipeCreated, pipe_holder_,
- base::ThreadTaskRunnerHandle::Get(),
- base::Bind(&ChildProcessHost::OnMessagePipeCreated,
- weak_factory_.GetWeakPtr())));
- }
+ // With the new EDK, bootstrap message pipes are created asynchronously.
jam 2016/02/08 17:32:12 nit: remove new edk since there's only one now?
Ken Rockot(use gerrit already) 2016/02/08 17:51:18 Done
+ // We recieve the bound pipe (if successful) on an arbitrary thread,
+ // stash it in the thread-safe |pipe_holder_|, and then try to call
+ // OnMessagePipeCreated() on the host's main thread.
+ //
+ // Because of the way the launcher process shuts down, it's possible for
+ // the main thread's MessageLoop to stop running (but not yet be destroyed!)
+ // while this boostrap is pending, resulting in OnMessagePipeCreated() never
+ // being called.
+ //
+ // A typical child process (i.e. one using ApplicationImpl to bind the other
+ // end of this pipe) may hang forever waiting for an Initialize() message
+ // unless the pipe is closed. This in turn means that Join() could hang
+ // waiting for the process to exit. Deadlock!
+ //
+ // |pipe_holder_| exists for this reason. If it's still holding onto the
+ // pipe when Join() is called, the pipe will be closed.
+ DCHECK(!primordial_pipe_token_.empty());
+ edk::CreateParentMessagePipe(
+ primordial_pipe_token_,
+ base::Bind(&OnParentMessagePipeCreated, pipe_holder_,
+ base::ThreadTaskRunnerHandle::Get(),
+ base::Bind(&ChildProcessHost::OnMessagePipeCreated,
+ weak_factory_.GetWeakPtr())));
launch_process_runner_->PostTaskAndReply(
FROM_HERE,
@@ -261,9 +248,9 @@ void ChildProcessHost::DoLaunch() {
platform_channel_pair_.ChildProcessLaunched();
if (node_channel_.get()) {
node_channel_->ChildProcessLaunched();
- mojo::embedder::ChildProcessLaunched(
+ mojo::edk::ChildProcessLaunched(
child_process_.Handle(),
- mojo::embedder::ScopedPlatformHandle(mojo::embedder::PlatformHandle(
+ mojo::edk::ScopedPlatformHandle(mojo::edk::PlatformHandle(
node_channel_->PassServerHandle().release().handle)));
}
}
@@ -278,14 +265,6 @@ void ChildProcessHost::AppCompleted(int32_t result) {
}
}
-void ChildProcessHost::DidCreateChannel(embedder::ChannelInfo* channel_info) {
- DVLOG(2) << "AppChildProcessHost::DidCreateChannel()";
-
- DCHECK(channel_info ||
- base::CommandLine::ForCurrentProcess()->HasSwitch("use-new-edk"));
- channel_info_ = channel_info;
-}
-
void ChildProcessHost::OnMessagePipeCreated() {
controller_.Bind(
InterfacePtrInfo<mojom::ChildController>(pipe_holder_->PassPipe(), 0u));

Powered by Google App Engine
This is Rietveld 408576698