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

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: Created 6 years, 4 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 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,

Powered by Google App Engine
This is Rietveld 408576698