Index: content/child/child_thread_impl.cc |
diff --git a/content/child/child_thread_impl.cc b/content/child/child_thread_impl.cc |
index d7c88b0237f7a19c0b73a08cb470539b59b04c79..173fb08441cf43f5c35897370cdbed344a2e8acd 100644 |
--- a/content/child/child_thread_impl.cc |
+++ b/content/child/child_thread_impl.cc |
@@ -265,7 +265,7 @@ |
const InProcessChildThreadParams& params) { |
options_.browser_process_io_runner = params.io_runner(); |
options_.channel_name = params.channel_name(); |
- options_.in_process_ipc_token = params.ipc_token(); |
+ options_.in_process_message_pipe_handle = params.handle(); |
options_.in_process_application_token = params.application_token(); |
return *this; |
} |
@@ -335,18 +335,15 @@ |
} |
void ChildThreadImpl::ConnectChannel(bool use_mojo_channel, |
- const std::string& ipc_token) { |
+ mojo::ScopedMessagePipeHandle handle) { |
bool create_pipe_now = true; |
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)); |
- } else { |
- handle = mojo::edk::CreateChildMessagePipe(ipc_token); |
} |
DCHECK(handle.is_valid()); |
channel_->Init(IPC::ChannelMojo::CreateClientFactory(std::move(handle)), |
@@ -393,7 +390,7 @@ |
UMA_HISTOGRAM_TIMES("Mojo.Shell.ChildConnectionTime", timer.Elapsed()); |
} |
- mojo_application_.reset(new MojoApplication()); |
+ mojo_application_.reset(new MojoApplication(GetIOTaskRunner())); |
std::string mojo_application_token; |
if (!IsInBrowserProcess()) { |
mojo_application_token = |
@@ -469,7 +466,9 @@ |
channel_->AddFilter(startup_filter); |
} |
- ConnectChannel(options.use_mojo_channel, options.in_process_ipc_token); |
+ ConnectChannel( |
+ options.use_mojo_channel, |
+ mojo::MakeScopedHandle(options.in_process_message_pipe_handle)); |
IPC::AttachmentBroker* broker = IPC::AttachmentBroker::GetGlobal(); |
if (broker && !broker->IsPrivilegedBroker()) |
broker->RegisterBrokerCommunicationChannel(channel_.get()); |
@@ -611,6 +610,9 @@ |
} |
bool ChildThreadImpl::OnMessageReceived(const IPC::Message& msg) { |
+ if (mojo_application_->OnMessageReceived(msg)) |
+ return true; |
+ |
// Resource responses are sent to the resource dispatcher. |
if (resource_dispatcher_->OnMessageReceived(msg)) |
return true; |