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 a1592c37903d79a6db735723e2fa04bf501680ae..bbd594953831ea4bc7d087a1b0ba9f4f5eb8f4f2 100644 |
--- a/content/browser/renderer_host/render_process_host_impl.cc |
+++ b/content/browser/renderer_host/render_process_host_impl.cc |
@@ -137,6 +137,7 @@ |
#include "ipc/ipc_channel.h" |
#include "ipc/ipc_logging.h" |
#include "ipc/ipc_switches.h" |
+#include "ipc/mojo/ipc_channel_mojo.h" |
#include "media/base/media_switches.h" |
#include "net/url_request/url_request_context_getter.h" |
#include "ppapi/shared_impl/ppapi_switches.h" |
@@ -594,11 +595,7 @@ bool RenderProcessHostImpl::Init() { |
// Setup the IPC channel. |
const std::string channel_id = |
IPC::Channel::GenerateVerifiedChannelID(std::string()); |
- channel_ = IPC::ChannelProxy::Create( |
- channel_id, |
- IPC::Channel::MODE_SERVER, |
- this, |
- BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO).get()); |
+ channel_ = CreateChannelProxy(channel_id); |
// Setup the Mojo channel. |
mojo_application_host_->Init(); |
@@ -678,6 +675,27 @@ void RenderProcessHostImpl::MaybeActivateMojo() { |
mojo_application_host_->Activate(this, GetHandle()); |
} |
+bool RenderProcessHostImpl::ShouldUseMojoChannel() const { |
+ const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
+ return command_line.HasSwitch(switches::kEnableRendererMojoChannel); |
+} |
+ |
+scoped_ptr<IPC::ChannelProxy> RenderProcessHostImpl::CreateChannelProxy( |
+ const std::string& channel_id) { |
+ scoped_refptr<base::SingleThreadTaskRunner> runner = |
+ BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); |
+ if (ShouldUseMojoChannel()) { |
+ VLOG(1) << "Mojo Channel is enabled on host"; |
+ return IPC::ChannelProxy::Create( |
+ IPC::ChannelMojo::CreateFactory( |
+ channel_id, IPC::Channel::MODE_SERVER, runner), |
+ this, runner.get()); |
+ } |
+ |
+ return IPC::ChannelProxy::Create( |
+ channel_id, IPC::Channel::MODE_SERVER, this, runner.get()); |
+} |
+ |
void RenderProcessHostImpl::CreateMessageFilters() { |
DCHECK_CURRENTLY_ON(BrowserThread::UI); |
AddFilter(new ResourceSchedulerFilter(GetID())); |
@@ -1128,6 +1146,7 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer( |
switches::kEnablePinch, |
switches::kEnablePreciseMemoryInfo, |
switches::kEnablePreparsedJsCaching, |
+ switches::kEnableRendererMojoChannel, |
switches::kEnableSeccompFilterSandbox, |
switches::kEnableSkiaBenchmarking, |
switches::kEnableSmoothScrolling, |