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

Unified Diff: content/child/child_thread_impl.cc

Issue 1901513003: Re-land: "Use a token to initialise ChannelMojo and MojoApplication everywhere." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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/child/mojo/mojo_application.h » ('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 173fb08441cf43f5c35897370cdbed344a2e8acd..d7c88b0237f7a19c0b73a08cb470539b59b04c79 100644
--- a/content/child/child_thread_impl.cc
+++ b/content/child/child_thread_impl.cc
@@ -265,7 +265,7 @@ ChildThreadImpl::Options::Builder::InBrowserProcess(
const InProcessChildThreadParams& params) {
options_.browser_process_io_runner = params.io_runner();
options_.channel_name = params.channel_name();
- options_.in_process_message_pipe_handle = params.handle();
+ options_.in_process_ipc_token = params.ipc_token();
options_.in_process_application_token = params.application_token();
return *this;
}
@@ -335,15 +335,18 @@ scoped_refptr<base::SequencedTaskRunner> ChildThreadImpl::GetIOTaskRunner() {
}
void ChildThreadImpl::ConnectChannel(bool use_mojo_channel,
- mojo::ScopedMessagePipeHandle handle) {
+ const std::string& ipc_token) {
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)),
@@ -390,7 +393,7 @@ void ChildThreadImpl::Init(const Options& options) {
UMA_HISTOGRAM_TIMES("Mojo.Shell.ChildConnectionTime", timer.Elapsed());
}
- mojo_application_.reset(new MojoApplication(GetIOTaskRunner()));
+ mojo_application_.reset(new MojoApplication());
std::string mojo_application_token;
if (!IsInBrowserProcess()) {
mojo_application_token =
@@ -466,9 +469,7 @@ void ChildThreadImpl::Init(const Options& options) {
channel_->AddFilter(startup_filter);
}
- ConnectChannel(
- options.use_mojo_channel,
- mojo::MakeScopedHandle(options.in_process_message_pipe_handle));
+ ConnectChannel(options.use_mojo_channel, options.in_process_ipc_token);
IPC::AttachmentBroker* broker = IPC::AttachmentBroker::GetGlobal();
if (broker && !broker->IsPrivilegedBroker())
broker->RegisterBrokerCommunicationChannel(channel_.get());
@@ -610,9 +611,6 @@ std::unique_ptr<base::SharedMemory> ChildThreadImpl::AllocateSharedMemory(
}
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;
« no previous file with comments | « content/child/child_thread_impl.h ('k') | content/child/mojo/mojo_application.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698