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

Unified Diff: content/browser/renderer_host/render_process_host_impl.cc

Issue 382333002: Introduce ChannelMojo (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Renamed ChanelBuilder to ChannelFactory Created 6 years, 5 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
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,

Powered by Google App Engine
This is Rietveld 408576698