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

Side by Side Diff: content/public/common/mojo_channel_switches.cc

Issue 1805653003: Add support for MojoChannel field trial (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit Created 4 years, 9 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 unified diff | Download patch
« no previous file with comments | « content/public/common/mojo_channel_switches.h ('k') | ipc/mojo/ipc_channel_mojo.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/public/common/mojo_channel_switches.h" 5 #include "content/public/common/mojo_channel_switches.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/metrics/field_trial.h"
8 #include "ipc/mojo/ipc_channel_mojo.h" 9 #include "ipc/mojo/ipc_channel_mojo.h"
9 #include "mojo/common/common_type_converters.h" 10 #include "mojo/common/common_type_converters.h"
10 11
11 namespace switches { 12 namespace switches {
12 13
13 // Replaces renderer-browser IPC channel with ChnanelMojo. 14 // Enable ChannelMojo on any supported platform.
14 // TODO(morrita): Now ChannelMojo for the renderer is on by default. 15 const char kEnableMojoChannel[] = "enable-mojo-channel";
15 // Remove this once the change sticks.
16 const char kEnableRendererMojoChannel[] =
17 "enable-renderer-mojo-channel";
18
19 // Disable ChannelMojo usage regardless of the platform or the process type.
20 const char kDisableMojoChannel[] = "disable-mojo-channel";
21 16
22 // The token to use to construct the message pipe on which to layer ChannelMojo. 17 // The token to use to construct the message pipe on which to layer ChannelMojo.
23 const char kMojoChannelToken[] = "mojo-channel-token"; 18 const char kMojoChannelToken[] = "mojo-channel-token";
24 19
25 } // namespace switches 20 } // namespace switches
26 21
22 namespace {
23
24 const char kMojoChannelExperimentName[] = "MojoChannel";
25
26 } // namespace
27
27 namespace content { 28 namespace content {
28 29
29 bool ShouldUseMojoChannel() { 30 bool ShouldUseMojoChannel() {
30 const base::CommandLine& command_line = 31 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
31 *base::CommandLine::ForCurrentProcess(); 32 switches::kEnableMojoChannel))
33 return true;
32 34
33 if (command_line.HasSwitch(switches::kDisableMojoChannel)) 35 const std::string group =
34 return false; 36 base::FieldTrialList::FindFullName(kMojoChannelExperimentName);
Will Harris 2016/04/15 16:59:54 the query to FindFullName should always take place
35 if (command_line.HasSwitch(switches::kEnableRendererMojoChannel)) 37 if (group == "Enabled")
36 return true; 38 return true;
37 return IPC::ChannelMojo::ShouldBeUsed(); 39
40 return false;
38 } 41 }
39 42
40 } // namespace content 43 } // namespace content
OLDNEW
« no previous file with comments | « content/public/common/mojo_channel_switches.h ('k') | ipc/mojo/ipc_channel_mojo.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698