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 db3dea1946bbd01757d470ba70d9ba738d158aa2..309fed7456a43f3c060c02567abdcb5159b3b65a 100644 |
--- a/content/browser/renderer_host/render_process_host_impl.cc |
+++ b/content/browser/renderer_host/render_process_host_impl.cc |
@@ -138,6 +138,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" |
@@ -564,6 +565,27 @@ void RenderProcessHostImpl::EnableSendQueue() { |
is_initialized_ = false; |
} |
+bool RenderProcessHostImpl::IsMojoChannelEnabled() const { |
darin (slow to review)
2014/07/23 23:03:32
nit: these functions should be listed after MaybeA
Hajime Morrita
2014/07/24 00:38:44
Done.
|
+ 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 (IsMojoChannelEnabled()) { |
+ 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()); |
+} |
+ |
bool RenderProcessHostImpl::Init() { |
// calling Init() more than once does nothing, this makes it more convenient |
// for the view host which may not be sure in some cases |
@@ -595,11 +617,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(); |
@@ -1145,6 +1163,7 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer( |
switches::kEnablePinch, |
switches::kEnablePreciseMemoryInfo, |
switches::kEnablePreparsedJsCaching, |
+ switches::kEnableRendererMojoChannel, |
switches::kEnableSeccompFilterSandbox, |
switches::kEnableSkiaBenchmarking, |
switches::kEnableSmoothScrolling, |