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

Unified Diff: content/child/child_thread_impl.cc

Issue 2109043002: Eliminate the ChannelMojo channel for renderers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 6 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 | « content/child/child_thread_impl.h ('k') | content/content_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/child_thread_impl.cc
diff --git a/content/child/child_thread_impl.cc b/content/child/child_thread_impl.cc
index f8b6c1e26b594d198332b07fa8c1fbdc7b9171cf..7ae85f510d881327445a6d2db95fca79ae758430 100644
--- a/content/child/child_thread_impl.cc
+++ b/content/child/child_thread_impl.cc
@@ -354,13 +354,14 @@ void ChildThreadImpl::ConnectChannel(bool use_mojo_channel,
if (use_mojo_channel) {
VLOG(1) << "Mojo is enabled on child";
mojo::ScopedMessagePipeHandle handle;
- if (!IsInBrowserProcess()) {
- DCHECK(!handle.is_valid());
- handle = mojo::edk::CreateChildMessagePipe(
- base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
- switches::kMojoChannelToken));
+ std::string token = IsInBrowserProcess() ? ipc_token :
+ base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
+ switches::kMojoChannelToken);
+ if (token.empty()) {
+ IPC::mojom::BootstrapRequest request = GetProxy(&pending_bootstrap_);
+ handle = request.PassMessagePipe();
} else {
- handle = mojo::edk::CreateChildMessagePipe(ipc_token);
+ handle = mojo::edk::CreateChildMessagePipe(token);
}
DCHECK(handle.is_valid());
channel_->Init(IPC::ChannelMojo::CreateClientFactory(std::move(handle)),
@@ -596,6 +597,14 @@ MojoShellConnection* ChildThreadImpl::GetMojoShellConnection() {
return mojo_shell_connection_.get();
}
+bool ChildThreadImpl::AcceptConnection(shell::Connection* connection) {
+ connection->GetInterfaceRegistry()->AddInterface(
+ IPC::mojom::Bootstrap::Name_,
+ base::Bind(&ChildThreadImpl::BindBootstrapRequest,
+ base::Unretained(this)));
+ return true;
+}
+
shell::InterfaceRegistry* ChildThreadImpl::GetInterfaceRegistry() {
if (!interface_registry_.get())
interface_registry_.reset(new shell::InterfaceRegistry(nullptr));
@@ -768,6 +777,13 @@ void ChildThreadImpl::EnsureConnected() {
base::Process::Current().Terminate(0, false);
}
+void ChildThreadImpl::BindBootstrapRequest(
+ mojo::ScopedMessagePipeHandle handle) {
+ IPC::mojom::BootstrapRequest request =
+ mojo::MakeRequest<IPC::mojom::Bootstrap>(std::move(handle));
+ mojo::FuseInterface(std::move(request), pending_bootstrap_.PassInterface());
+}
+
bool ChildThreadImpl::IsInBrowserProcess() const {
return static_cast<bool>(browser_process_io_runner_);
}
« no previous file with comments | « content/child/child_thread_impl.h ('k') | content/content_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698