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

Unified Diff: content/browser/renderer_host/render_process_host_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/browser/mojo/mojo_application_host.cc ('k') | content/browser/utility_process_host_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/render_process_host_impl.cc
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc
index f37f453192b0288959dd83880c2c4c6d2cfb4bda..3ac3942d364a21436c37d9c864622656ca4d3480 100644
--- a/content/browser/renderer_host/render_process_host_impl.cc
+++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -128,8 +128,6 @@
#include "content/common/frame_messages.h"
#include "content/common/gpu_host_messages.h"
#include "content/common/in_process_child_thread_params.h"
-#include "content/common/mojo/channel_init.h"
-#include "content/common/mojo/mojo_messages.h"
#include "content/common/mojo/mojo_shell_connection_impl.h"
#include "content/common/render_process_messages.h"
#include "content/common/resource_messages.h"
@@ -736,9 +734,6 @@ bool RenderProcessHostImpl::Init() {
content::BrowserThread::IO));
#endif
- // Setup the Mojo channel.
- mojo_application_host_->Init();
-
// Call the embedder first so that their IPC filters have priority.
GetContentClient()->browser()->RenderProcessWillLaunch(this);
@@ -758,7 +753,7 @@ bool RenderProcessHostImpl::Init() {
channel_id,
BrowserThread::UnsafeGetMessageLoopForThread(BrowserThread::IO)
->task_runner(),
- in_process_renderer_handle_.release())));
+ mojo_channel_token_, mojo_application_host_->GetToken())));
base::Thread::Options options;
#if defined(OS_WIN) && !defined(OS_MACOSX)
@@ -817,16 +812,9 @@ std::unique_ptr<IPC::ChannelProxy> RenderProcessHostImpl::CreateChannelProxy(
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO);
if (ShouldUseMojoChannel()) {
VLOG(1) << "Mojo Channel is enabled on host";
- mojo::ScopedMessagePipeHandle handle;
-
- if (run_renderer_in_process()) {
- mojo::MessagePipe pipe;
- handle = std::move(pipe.handle0);
- in_process_renderer_handle_ = std::move(pipe.handle1);
- } else {
- mojo_channel_token_ = mojo::edk::GenerateRandomToken();
- handle = mojo::edk::CreateParentMessagePipe(mojo_channel_token_);
- }
+ mojo_channel_token_ = mojo::edk::GenerateRandomToken();
+ mojo::ScopedMessagePipeHandle handle =
+ mojo::edk::CreateParentMessagePipe(mojo_channel_token_);
// Do NOT expand ifdef or run time condition checks here! Synchronous
// IPCs from browser process are banned. It is only narrowly allowed
@@ -1390,6 +1378,8 @@ void RenderProcessHostImpl::AppendRendererCommandLine(
command_line->AppendSwitchASCII(switches::kMojoChannelToken,
mojo_channel_token_);
}
+ command_line->AppendSwitchASCII(switches::kMojoApplicationChannelToken,
+ mojo_application_host_->GetToken());
}
void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer(
@@ -2631,11 +2621,6 @@ void RenderProcessHostImpl::OnProcessLaunched() {
Source<RenderProcessHost>(this),
NotificationService::NoDetails());
- // Allow Mojo to be setup before the renderer sees any Chrome IPC messages.
- // This way, Mojo can be safely used from the renderer in response to any
- // Chrome IPC message.
- mojo_application_host_->Activate(this, GetHandle());
-
while (!queued_messages_.empty()) {
Send(queued_messages_.front());
queued_messages_.pop();
« no previous file with comments | « content/browser/mojo/mojo_application_host.cc ('k') | content/browser/utility_process_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698