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

Unified Diff: content/common/child_process_host_impl.cc

Issue 2221153003: Establish MojoChildConnection from BrowserChildProcessHostImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@renderer-channel
Patch Set: rebase Created 4 years, 4 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/common/child_process_host_impl.h ('k') | content/common/mojo/constants.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/child_process_host_impl.cc
diff --git a/content/common/child_process_host_impl.cc b/content/common/child_process_host_impl.cc
index 1dc475da37204b298226e7500c7f1b674a74a6e3..d0fceff83015a72a266bff7a059e2390f4c85b90 100644
--- a/content/common/child_process_host_impl.cc
+++ b/content/common/child_process_host_impl.cc
@@ -28,11 +28,13 @@
#include "gpu/ipc/client/gpu_memory_buffer_impl_shared_memory.h"
#include "ipc/attachment_broker.h"
#include "ipc/attachment_broker_privileged.h"
+#include "ipc/ipc.mojom.h"
#include "ipc/ipc_channel.h"
#include "ipc/ipc_channel_mojo.h"
#include "ipc/ipc_logging.h"
#include "ipc/message_filter.h"
#include "mojo/edk/embedder/embedder.h"
+#include "services/shell/public/cpp/interface_provider.h"
#if defined(OS_LINUX)
#include "base/linux_util.h"
@@ -128,6 +130,10 @@ void ChildProcessHostImpl::AddFilter(IPC::MessageFilter* filter) {
filter->OnFilterAdded(channel_.get());
}
+shell::InterfaceProvider* ChildProcessHostImpl::GetRemoteInterfaces() {
+ return delegate_->GetRemoteInterfaces();
+}
+
void ChildProcessHostImpl::ForceShutdown() {
Send(new ChildProcessMsg_Shutdown());
}
@@ -146,6 +152,26 @@ std::string ChildProcessHostImpl::CreateChannelMojo(
return channel_id_;
}
+void ChildProcessHostImpl::CreateChannelMojo() {
+ // TODO(rockot): Remove |channel_id_| once this is the only code path by which
+ // the Channel is created. For now it serves to at least mutually exclude
+ // different CreateChannel* calls.
+ DCHECK(channel_id_.empty());
+ channel_id_ = "ChannelMojo";
+
+ shell::InterfaceProvider* remote_interfaces = GetRemoteInterfaces();
+ DCHECK(remote_interfaces);
+
+ IPC::mojom::ChannelBootstrapPtr bootstrap;
+ remote_interfaces->GetInterface(&bootstrap);
+ channel_ = IPC::ChannelMojo::Create(bootstrap.PassInterface().PassHandle(),
+ IPC::Channel::MODE_SERVER, this);
+ DCHECK(channel_);
+
+ bool initialized = InitChannel();
+ DCHECK(initialized);
+}
+
std::string ChildProcessHostImpl::CreateChannel() {
DCHECK(channel_id_.empty());
channel_id_ = IPC::Channel::GenerateVerifiedChannelID(std::string());
« no previous file with comments | « content/common/child_process_host_impl.h ('k') | content/common/mojo/constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698