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

Unified Diff: content/common/child_process_host_impl.cc

Issue 960693003: Enable ChannelMojo for non-renderer child processes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Splitted out the ipc/ change Created 5 years, 9 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: 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 69a63507f5866808d58339dc9aa9f17ccc654caa..00a09a6771f8c50bb353a98945f9747eeb17236f 100644
--- a/content/common/child_process_host_impl.cc
+++ b/content/common/child_process_host_impl.cc
@@ -25,6 +25,8 @@
#include "ipc/ipc_channel.h"
#include "ipc/ipc_logging.h"
#include "ipc/message_filter.h"
+#include "ipc/mojo/ipc_channel_mojo.h"
+#include "ipc/mojo/ipc_channel_mojo_host.h"
#if defined(OS_LINUX)
#include "base/linux_util.h"
@@ -159,13 +161,31 @@ void ChildProcessHostImpl::AddFilter(IPC::MessageFilter* filter) {
filter->OnFilterAdded(channel_.get());
}
+void ChildProcessHostImpl::OnProcessLaunched(base::ProcessHandle process) {
+ if (channel_mojo_host_)
+ channel_mojo_host_->OnClientLaunched(process);
+}
+
void ChildProcessHostImpl::ForceShutdown() {
Send(new ChildProcessMsg_Shutdown());
}
std::string ChildProcessHostImpl::CreateChannel() {
channel_id_ = IPC::Channel::GenerateVerifiedChannelID(std::string());
- channel_ = IPC::Channel::CreateServer(channel_id_, this);
+
+ if (delegate_->ShouldUseMojoChannel()) {
+ if (!channel_mojo_host_) {
+ channel_mojo_host_.reset(new IPC::ChannelMojoHost(
+ base::MessageLoop::current()->task_runner()));
+ }
+
+ channel_ =
+ IPC::ChannelMojo::Create(channel_mojo_host_->channel_delegate(),
+ channel_id_, IPC::Channel::MODE_SERVER, this);
+ } else {
+ channel_ = IPC::Channel::CreateServer(channel_id_, this);
+ }
+
if (!channel_->Connect())
return std::string();
« no previous file with comments | « content/common/child_process_host_impl.h ('k') | content/public/browser/browser_child_process_host_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698