Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/child/child_thread_impl.h" | 5 #include "content/child/child_thread_impl.h" |
| 6 | 6 |
| 7 #include <signal.h> | 7 #include <signal.h> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 409 // Don't double-initialize IPC support in single-process mode. | 409 // Don't double-initialize IPC support in single-process mode. |
| 410 mojo_ipc_support_.reset(new IPC::ScopedIPCSupport(GetIOTaskRunner())); | 410 mojo_ipc_support_.reset(new IPC::ScopedIPCSupport(GetIOTaskRunner())); |
| 411 | 411 |
| 412 InitializeMojoIPCChannel(); | 412 InitializeMojoIPCChannel(); |
| 413 } | 413 } |
| 414 | 414 |
| 415 // If this process was launched with a primordial pipe token, we exchange it | 415 // If this process was launched with a primordial pipe token, we exchange it |
| 416 // for a pipe to connect to the shell. | 416 // for a pipe to connect to the shell. |
| 417 std::string pipe_token = | 417 std::string pipe_token = |
| 418 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 418 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
| 419 switches::kMojoPrimordialPipeToken); | 419 switches::kMojoPrimordialPipeToken); |
|
Ben Goodger (Google)
2016/03/13 00:58:33
since you're passing this on the command line too
Ken Rockot(use gerrit already)
2016/03/13 16:14:25
Done
| |
| 420 if (!pipe_token.empty() && MojoShellConnectionImpl::Get()) { | 420 if (!pipe_token.empty() && MojoShellConnectionImpl::Get()) { |
| 421 mojo::ScopedMessagePipeHandle pipe = | 421 mojo::ScopedMessagePipeHandle pipe = |
| 422 mojo::edk::CreateChildMessagePipe(pipe_token); | 422 mojo::edk::CreateChildMessagePipe(pipe_token); |
| 423 | 423 |
| 424 base::ElapsedTimer timer; | 424 base::ElapsedTimer timer; |
| 425 MojoShellConnectionImpl::Get()->BindToMessagePipe(std::move(pipe)); | 425 MojoShellConnectionImpl::Get()->Connect( |
| 426 mojo::MakeRequest<mojo::shell::mojom::ShellClientFactory>( | |
| 427 std::move(pipe))); | |
| 426 UMA_HISTOGRAM_TIMES("Mojo.Shell.ChildConnectionTime", timer.Elapsed()); | 428 UMA_HISTOGRAM_TIMES("Mojo.Shell.ChildConnectionTime", timer.Elapsed()); |
| 427 } | 429 } |
| 428 | 430 |
| 429 mojo_application_.reset(new MojoApplication(GetIOTaskRunner())); | 431 mojo_application_.reset(new MojoApplication(GetIOTaskRunner())); |
| 430 | 432 |
| 431 sync_message_filter_ = channel_->CreateSyncMessageFilter(); | 433 sync_message_filter_ = channel_->CreateSyncMessageFilter(); |
| 432 thread_safe_sender_ = new ThreadSafeSender( | 434 thread_safe_sender_ = new ThreadSafeSender( |
| 433 message_loop_->task_runner(), sync_message_filter_.get()); | 435 message_loop_->task_runner(), sync_message_filter_.get()); |
| 434 | 436 |
| 435 resource_dispatcher_.reset(new ResourceDispatcher( | 437 resource_dispatcher_.reset(new ResourceDispatcher( |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 750 void ChildThreadImpl::EnsureConnected() { | 752 void ChildThreadImpl::EnsureConnected() { |
| 751 VLOG(0) << "ChildThreadImpl::EnsureConnected()"; | 753 VLOG(0) << "ChildThreadImpl::EnsureConnected()"; |
| 752 base::Process::Current().Terminate(0, false); | 754 base::Process::Current().Terminate(0, false); |
| 753 } | 755 } |
| 754 | 756 |
| 755 bool ChildThreadImpl::IsInBrowserProcess() const { | 757 bool ChildThreadImpl::IsInBrowserProcess() const { |
| 756 return browser_process_io_runner_; | 758 return browser_process_io_runner_; |
| 757 } | 759 } |
| 758 | 760 |
| 759 } // namespace content | 761 } // namespace content |
| OLD | NEW |