summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrockot <rockot@chromium.org>2016-03-16 10:50:25 -0700
committerCommit bot <commit-bot@chromium.org>2016-03-16 17:53:22 +0000
commitb0abbd20ecfc1b84f7570ee7f5df100f043010e8 (patch)
tree852cb1603e48bb647af136269089ee5ba5dda8c5
parent82f18cd2a7b718c4d5356222017d9855a53eb6f3 (diff)
downloadchromium_src-b0abbd20ecfc1b84f7570ee7f5df100f043010e8.zip
chromium_src-b0abbd20ecfc1b84f7570ee7f5df100f043010e8.tar.gz
chromium_src-b0abbd20ecfc1b84f7570ee7f5df100f043010e8.tar.bz2
Add support for MojoChannel field trial
This adds support for the upcoming MojoChannel field trial. It also simplifies the logic around enabling Mojo channel in general, getting rid of compile-time overrides and instead controlling the feature only at runtime via a single flag or (in the absence of said flag) the field trial. BUG=595082 R=jam@chromium.org Review URL: https://codereview.chromium.org/1805653003 Cr-Commit-Position: refs/heads/master@{#381490}
-rw-r--r--content/browser/renderer_host/render_process_host_impl.cc3
-rw-r--r--content/public/common/mojo_channel_switches.cc31
-rw-r--r--content/public/common/mojo_channel_switches.h3
-rw-r--r--ipc/mojo/ipc_channel_mojo.cc7
-rw-r--r--ipc/mojo/ipc_channel_mojo.h3
5 files changed, 19 insertions, 28 deletions
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc
index 16eb322..7d17955 100644
--- a/content/browser/renderer_host/render_process_host_impl.cc
+++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -1428,7 +1428,6 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer(
switches::kDisableLocalStorage,
switches::kDisableLogging,
switches::kDisableMediaSuspend,
- switches::kDisableMojoChannel,
switches::kDisableNotifications,
switches::kDisableOverlayScrollbar,
switches::kDisablePermissionsAPI,
@@ -1462,6 +1461,7 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer(
switches::kEnableLinkDisambiguationPopup,
switches::kEnableLowResTiling,
switches::kEnableMediaSuspend,
+ switches::kEnableMojoChannel,
switches::kEnableInbandTextTracks,
switches::kEnableLCDText,
switches::kEnableLogging,
@@ -1474,7 +1474,6 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer(
switches::kEnablePreciseMemoryInfo,
switches::kEnablePreferCompositingToLCDText,
switches::kEnableRGBA4444Textures,
- switches::kEnableRendererMojoChannel,
switches::kEnableSkiaBenchmarking,
switches::kEnableSlimmingPaintV2,
switches::kEnableSmoothScrolling,
diff --git a/content/public/common/mojo_channel_switches.cc b/content/public/common/mojo_channel_switches.cc
index a94e195..f649eb8 100644
--- a/content/public/common/mojo_channel_switches.cc
+++ b/content/public/common/mojo_channel_switches.cc
@@ -5,36 +5,39 @@
#include "content/public/common/mojo_channel_switches.h"
#include "base/command_line.h"
+#include "base/metrics/field_trial.h"
#include "ipc/mojo/ipc_channel_mojo.h"
#include "mojo/common/common_type_converters.h"
namespace switches {
-// Replaces renderer-browser IPC channel with ChnanelMojo.
-// TODO(morrita): Now ChannelMojo for the renderer is on by default.
-// Remove this once the change sticks.
-const char kEnableRendererMojoChannel[] =
- "enable-renderer-mojo-channel";
-
-// Disable ChannelMojo usage regardless of the platform or the process type.
-const char kDisableMojoChannel[] = "disable-mojo-channel";
+// Enable ChannelMojo on any supported platform.
+const char kEnableMojoChannel[] = "enable-mojo-channel";
// The token to use to construct the message pipe on which to layer ChannelMojo.
const char kMojoChannelToken[] = "mojo-channel-token";
} // namespace switches
+namespace {
+
+const char kMojoChannelExperimentName[] = "MojoChannel";
+
+} // namespace
+
namespace content {
bool ShouldUseMojoChannel() {
- const base::CommandLine& command_line =
- *base::CommandLine::ForCurrentProcess();
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableMojoChannel))
+ return true;
- if (command_line.HasSwitch(switches::kDisableMojoChannel))
- return false;
- if (command_line.HasSwitch(switches::kEnableRendererMojoChannel))
+ const std::string group =
+ base::FieldTrialList::FindFullName(kMojoChannelExperimentName);
+ if (group == "Enabled")
return true;
- return IPC::ChannelMojo::ShouldBeUsed();
+
+ return false;
}
} // namespace content
diff --git a/content/public/common/mojo_channel_switches.h b/content/public/common/mojo_channel_switches.h
index 1811843..20daf11 100644
--- a/content/public/common/mojo_channel_switches.h
+++ b/content/public/common/mojo_channel_switches.h
@@ -9,8 +9,7 @@
namespace switches {
-extern const char kEnableRendererMojoChannel[];
-extern const char kDisableMojoChannel[];
+extern const char kEnableMojoChannel[];
CONTENT_EXPORT extern const char kMojoChannelToken[];
} // namespace switches
diff --git a/ipc/mojo/ipc_channel_mojo.cc b/ipc/mojo/ipc_channel_mojo.cc
index 8832d8d..a0dabad 100644
--- a/ipc/mojo/ipc_channel_mojo.cc
+++ b/ipc/mojo/ipc_channel_mojo.cc
@@ -199,13 +199,6 @@ MojoResult UnwrapAttachment(mojom::SerializedHandlePtr handle,
//------------------------------------------------------------------------------
// static
-bool ChannelMojo::ShouldBeUsed() {
- // TODO(rockot): Investigate performance bottlenecks and hopefully reenable
- // this at some point. http://crbug.com/500019
- return false;
-}
-
-// static
scoped_ptr<ChannelMojo> ChannelMojo::Create(
mojo::ScopedMessagePipeHandle handle,
Mode mode,
diff --git a/ipc/mojo/ipc_channel_mojo.h b/ipc/mojo/ipc_channel_mojo.h
index c1b659a..8c5de24 100644
--- a/ipc/mojo/ipc_channel_mojo.h
+++ b/ipc/mojo/ipc_channel_mojo.h
@@ -38,9 +38,6 @@ class IPC_MOJO_EXPORT ChannelMojo
public MojoBootstrap::Delegate,
public NON_EXPORTED_BASE(internal::MessagePipeReader::Delegate) {
public:
- // True if ChannelMojo should be used regardless of the flag.
- static bool ShouldBeUsed();
-
// Creates a ChannelMojo.
static scoped_ptr<ChannelMojo> Create(mojo::ScopedMessagePipeHandle handle,
Mode mode,