Index: chrome/browser/about_flags.cc |
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc |
index 50be5fed3d005394de15a99a5de40b37746c9840..e8ac44071a7ad7a36b2de873dc79f81284dea631 100644 |
--- a/chrome/browser/about_flags.cc |
+++ b/chrome/browser/about_flags.cc |
@@ -77,18 +77,18 @@ namespace about_flags { |
// Macros to simplify specifying the type. |
#define SINGLE_VALUE_TYPE_AND_VALUE(command_line_switch, switch_value) \ |
- Experiment::SINGLE_VALUE, \ |
+ Entry::SINGLE_VALUE, \ |
command_line_switch, switch_value, NULL, NULL, NULL, 0 |
#define SINGLE_VALUE_TYPE(command_line_switch) \ |
SINGLE_VALUE_TYPE_AND_VALUE(command_line_switch, "") |
#define ENABLE_DISABLE_VALUE_TYPE_AND_VALUE(enable_switch, enable_value, \ |
disable_switch, disable_value) \ |
- Experiment::ENABLE_DISABLE_VALUE, enable_switch, enable_value, \ |
+ Entry::ENABLE_DISABLE_VALUE, enable_switch, enable_value, \ |
disable_switch, disable_value, NULL, 3 |
#define ENABLE_DISABLE_VALUE_TYPE(enable_switch, disable_switch) \ |
ENABLE_DISABLE_VALUE_TYPE_AND_VALUE(enable_switch, "", disable_switch, "") |
#define MULTI_VALUE_TYPE(choices) \ |
- Experiment::MULTI_VALUE, NULL, NULL, NULL, NULL, choices, arraysize(choices) |
+ Entry::MULTI_VALUE, NULL, NULL, NULL, NULL, choices, arraysize(choices) |
namespace { |
@@ -106,7 +106,7 @@ const unsigned kOsAll = kOsMac | kOsWin | kOsLinux | kOsCrOS | kOsAndroid; |
const unsigned kOsDesktop = kOsMac | kOsWin | kOsLinux | kOsCrOS; |
// Adds a |StringValue| to |list| for each platform where |bitmask| indicates |
-// whether the experiment is available on that platform. |
+// whether the entry is available on that platform. |
void AddOsStrings(unsigned bitmask, base::ListValue* list) { |
struct { |
unsigned bit; |
@@ -158,7 +158,7 @@ std::set<base::CommandLine::StringType> ExtractFlagsFromCommandLine( |
return flags; |
} |
-const Experiment::Choice kTouchEventsChoices[] = { |
+const Entry::Choice kTouchEventsChoices[] = { |
{ IDS_GENERIC_EXPERIMENT_CHOICE_AUTOMATIC, "", "" }, |
{ IDS_GENERIC_EXPERIMENT_CHOICE_ENABLED, |
switches::kTouchEvents, |
@@ -169,7 +169,7 @@ const Experiment::Choice kTouchEventsChoices[] = { |
}; |
#if defined(USE_AURA) |
-const Experiment::Choice kOverscrollHistoryNavigationChoices[] = { |
+const Entry::Choice kOverscrollHistoryNavigationChoices[] = { |
{ IDS_GENERIC_EXPERIMENT_CHOICE_ENABLED, "", "" }, |
{ IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED, |
switches::kOverscrollHistoryNavigation, |
@@ -180,7 +180,7 @@ const Experiment::Choice kOverscrollHistoryNavigationChoices[] = { |
}; |
#endif |
-const Experiment::Choice kTouchTextSelectionStrategyChoices[] = { |
+const Entry::Choice kTouchTextSelectionStrategyChoices[] = { |
{ IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" }, |
{ IDS_TOUCH_SELECTION_STRATEGY_CHARACTER, |
switches::kTouchTextSelectionStrategy, |
@@ -191,7 +191,7 @@ const Experiment::Choice kTouchTextSelectionStrategyChoices[] = { |
}; |
#if !defined(DISABLE_NACL) |
-const Experiment::Choice kNaClDebugMaskChoices[] = { |
+const Entry::Choice kNaClDebugMaskChoices[] = { |
// Secure shell can be used on ChromeOS for forwarding the TCP port opened by |
// debug stub to a remote machine. Since secure shell uses NaCl, we usually |
// want to avoid debugging that. The PNaCl translator is also a NaCl module, |
@@ -205,7 +205,7 @@ const Experiment::Choice kNaClDebugMaskChoices[] = { |
}; |
#endif |
-const Experiment::Choice kMarkNonSecureAsChoices[] = { |
+const Entry::Choice kMarkNonSecureAsChoices[] = { |
{ IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" }, |
{ IDS_MARK_NON_SECURE_AS_NEUTRAL, |
switches::kMarkNonSecureAs, switches::kMarkNonSecureAsNeutral}, |
@@ -215,7 +215,7 @@ const Experiment::Choice kMarkNonSecureAsChoices[] = { |
switches::kMarkNonSecureAs, switches::kMarkNonSecureAsDubious} |
}; |
-const Experiment::Choice kShowSavedCopyChoices[] = { |
+const Entry::Choice kShowSavedCopyChoices[] = { |
{ IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" }, |
{ IDS_FLAGS_ENABLE_SHOW_SAVED_COPY_PRIMARY, |
switches::kShowSavedCopy, switches::kEnableShowSavedCopyPrimary }, |
@@ -225,7 +225,7 @@ const Experiment::Choice kShowSavedCopyChoices[] = { |
switches::kShowSavedCopy, switches::kDisableShowSavedCopy } |
}; |
-const Experiment::Choice kDefaultTileWidthChoices[] = { |
+const Entry::Choice kDefaultTileWidthChoices[] = { |
{ IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" }, |
{ IDS_FLAGS_DEFAULT_TILE_WIDTH_SHORT, |
switches::kDefaultTileWidth, "128"}, |
@@ -237,7 +237,7 @@ const Experiment::Choice kDefaultTileWidthChoices[] = { |
switches::kDefaultTileWidth, "1024"} |
}; |
-const Experiment::Choice kDefaultTileHeightChoices[] = { |
+const Entry::Choice kDefaultTileHeightChoices[] = { |
{ IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" }, |
{ IDS_FLAGS_DEFAULT_TILE_HEIGHT_SHORT, |
switches::kDefaultTileHeight, "128"}, |
@@ -249,7 +249,7 @@ const Experiment::Choice kDefaultTileHeightChoices[] = { |
switches::kDefaultTileHeight, "1024"} |
}; |
-const Experiment::Choice kSimpleCacheBackendChoices[] = { |
+const Entry::Choice kSimpleCacheBackendChoices[] = { |
{ IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" }, |
{ IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED, |
switches::kUseSimpleCacheBackend, "off" }, |
@@ -258,7 +258,7 @@ const Experiment::Choice kSimpleCacheBackendChoices[] = { |
}; |
#if defined(USE_AURA) |
-const Experiment::Choice kTabCaptureUpscaleQualityChoices[] = { |
+const Entry::Choice kTabCaptureUpscaleQualityChoices[] = { |
{ IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" }, |
{ IDS_FLAGS_TAB_CAPTURE_SCALE_QUALITY_FAST, |
switches::kTabCaptureUpscaleQuality, "fast" }, |
@@ -268,7 +268,7 @@ const Experiment::Choice kTabCaptureUpscaleQualityChoices[] = { |
switches::kTabCaptureUpscaleQuality, "best" }, |
}; |
-const Experiment::Choice kTabCaptureDownscaleQualityChoices[] = { |
+const Entry::Choice kTabCaptureDownscaleQualityChoices[] = { |
{ IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" }, |
{ IDS_FLAGS_TAB_CAPTURE_SCALE_QUALITY_FAST, |
switches::kTabCaptureDownscaleQuality, "fast" }, |
@@ -280,7 +280,7 @@ const Experiment::Choice kTabCaptureDownscaleQualityChoices[] = { |
#endif |
#if defined(OS_ANDROID) |
-const Experiment::Choice kZeroSuggestExperimentsChoices[] = { |
+const Entry::Choice kZeroSuggestExperimentsChoices[] = { |
{ IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" }, |
{ IDS_FLAGS_ZERO_SUGGEST_MOST_VISITED, |
switches::kEnableZeroSuggestMostVisited, ""}, |
@@ -290,7 +290,7 @@ const Experiment::Choice kZeroSuggestExperimentsChoices[] = { |
switches::kDisableZeroSuggest, ""} |
}; |
-const Experiment::Choice kReaderModeHeuristicsChoices[] = { |
+const Entry::Choice kReaderModeHeuristicsChoices[] = { |
{ IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", ""}, |
{ IDS_FLAGS_READER_MODE_HEURISTICS_MARKUP, |
switches::kReaderModeHeuristics, |
@@ -307,7 +307,7 @@ const Experiment::Choice kReaderModeHeuristicsChoices[] = { |
}; |
#endif |
-const Experiment::Choice kNumRasterThreadsChoices[] = { |
+const Entry::Choice kNumRasterThreadsChoices[] = { |
{ IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" }, |
{ IDS_FLAGS_NUM_RASTER_THREADS_ONE, switches::kNumRasterThreads, "1" }, |
{ IDS_FLAGS_NUM_RASTER_THREADS_TWO, switches::kNumRasterThreads, "2" }, |
@@ -315,7 +315,7 @@ const Experiment::Choice kNumRasterThreadsChoices[] = { |
{ IDS_FLAGS_NUM_RASTER_THREADS_FOUR, switches::kNumRasterThreads, "4" } |
}; |
-const Experiment::Choice kGpuRasterizationMSAASampleCountChoices[] = { |
+const Entry::Choice kGpuRasterizationMSAASampleCountChoices[] = { |
{ IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, |
"", |
"" }, |
@@ -331,7 +331,7 @@ const Experiment::Choice kGpuRasterizationMSAASampleCountChoices[] = { |
switches::kGpuRasterizationMSAASampleCount, "16" }, |
}; |
-const Experiment::Choice kEnableGpuRasterizationChoices[] = { |
+const Entry::Choice kEnableGpuRasterizationChoices[] = { |
{ IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" }, |
{ IDS_GENERIC_EXPERIMENT_CHOICE_ENABLED, |
switches::kEnableGpuRasterization, "" }, |
@@ -342,7 +342,7 @@ const Experiment::Choice kEnableGpuRasterizationChoices[] = { |
}; |
#if defined(OS_CHROMEOS) |
-const Experiment::Choice kMemoryPressureThresholdChoices[] = { |
+const Entry::Choice kMemoryPressureThresholdChoices[] = { |
{ IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" }, |
{ IDS_FLAGS_CONSERVATIVE_THRESHOLDS, |
chromeos::switches::kMemoryPressureThresholds, |
@@ -359,7 +359,7 @@ const Experiment::Choice kMemoryPressureThresholdChoices[] = { |
}; |
#endif |
-const Experiment::Choice kExtensionContentVerificationChoices[] = { |
+const Entry::Choice kExtensionContentVerificationChoices[] = { |
{ IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" }, |
{ IDS_FLAGS_EXTENSION_CONTENT_VERIFICATION_BOOTSTRAP, |
switches::kExtensionContentVerification, |
@@ -374,7 +374,7 @@ const Experiment::Choice kExtensionContentVerificationChoices[] = { |
// Note that the value is specified in seconds (where 0 is equivalent to |
// disabled). |
-const Experiment::Choice kRememberCertificateErrorDecisionsChoices[] = { |
+const Entry::Choice kRememberCertificateErrorDecisionsChoices[] = { |
{ IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" }, |
{ IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED, |
switches::kRememberCertErrorDecisions, |
@@ -396,7 +396,7 @@ const Experiment::Choice kRememberCertificateErrorDecisionsChoices[] = { |
"7776000" }, |
}; |
-const Experiment::Choice kAutofillSyncCredentialChoices[] = { |
+const Entry::Choice kAutofillSyncCredentialChoices[] = { |
{ IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", ""}, |
{ IDS_ALLOW_AUTOFILL_SYNC_CREDENTIAL, |
password_manager::switches::kAllowAutofillSyncCredential, ""}, |
@@ -406,7 +406,7 @@ const Experiment::Choice kAutofillSyncCredentialChoices[] = { |
password_manager::switches::kDisallowAutofillSyncCredential, ""}, |
}; |
-const Experiment::Choice kSSLVersionMinChoices[] = { |
+const Entry::Choice kSSLVersionMinChoices[] = { |
{ IDS_FLAGS_SSL_VERSION_DEFAULT, "", "" }, |
{ IDS_FLAGS_SSL_VERSION_TLSV1, switches::kSSLVersionMin, |
switches::kSSLVersionTLSv1 }, |
@@ -416,7 +416,7 @@ const Experiment::Choice kSSLVersionMinChoices[] = { |
switches::kSSLVersionTLSv12 }, |
}; |
-const Experiment::Choice kFillOnAccountSelectChoices[] = { |
+const Entry::Choice kFillOnAccountSelectChoices[] = { |
{ IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" }, |
{ IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED, |
autofill::switches::kDisableFillOnAccountSelect, "" }, |
@@ -427,7 +427,7 @@ const Experiment::Choice kFillOnAccountSelectChoices[] = { |
}; |
#if defined(USE_ASH) |
-const Experiment::Choice kAshScreenRotationAnimationChoices[] = { |
+const Entry::Choice kAshScreenRotationAnimationChoices[] = { |
{ IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" }, |
{ IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED, |
ash::switches::kAshEnableScreenRotationAnimation, |
@@ -442,7 +442,7 @@ const Experiment::Choice kAshScreenRotationAnimationChoices[] = { |
#endif |
#if defined(OS_CHROMEOS) |
-const Experiment::Choice kDataSaverPromptChoices[] = { |
+const Entry::Choice kDataSaverPromptChoices[] = { |
{ IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" }, |
{ IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED, |
chromeos::switches::kDisableDataSaverPrompt, "" }, |
@@ -453,7 +453,7 @@ const Experiment::Choice kDataSaverPromptChoices[] = { |
chromeos::switches::kDataSaverPromptDemoMode }, |
}; |
-const Experiment::Choice kFloatingVirtualKeyboardChoices[] = { |
+const Entry::Choice kFloatingVirtualKeyboardChoices[] = { |
{ IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" }, |
{ IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED, |
keyboard::switches::kFloatingVirtualKeyboard, |
@@ -463,7 +463,7 @@ const Experiment::Choice kFloatingVirtualKeyboardChoices[] = { |
keyboard::switches::kFloatingVirtualKeyboardEnabled}, |
}; |
-const Experiment::Choice kGestureTypingChoices[] = { |
+const Entry::Choice kGestureTypingChoices[] = { |
{ IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" }, |
{ IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED, |
keyboard::switches::kGestureTyping, |
@@ -473,7 +473,7 @@ const Experiment::Choice kGestureTypingChoices[] = { |
keyboard::switches::kGestureTypingEnabled}, |
}; |
-const Experiment::Choice kGestureEditingChoices[] = { |
+const Entry::Choice kGestureEditingChoices[] = { |
{ IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" }, |
{ IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED, |
keyboard::switches::kGestureEditing, |
@@ -484,7 +484,7 @@ const Experiment::Choice kGestureEditingChoices[] = { |
}; |
#endif |
-const Experiment::Choice kSupervisedUserSafeSitesChoices[] = { |
+const Entry::Choice kSupervisedUserSafeSitesChoices[] = { |
{ IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" }, |
{ IDS_GENERIC_EXPERIMENT_CHOICE_ENABLED, |
switches::kSupervisedUserSafeSites, |
@@ -502,9 +502,9 @@ const Experiment::Choice kSupervisedUserSafeSitesChoices[] = { |
// RECORDING USER METRICS FOR FLAGS: |
// ----------------------------------------------------------------------------- |
-// The first line of the experiment is the internal name. If you'd like to |
-// gather statistics about the usage of your flag, you should append a marker |
-// comment to the end of the feature name, like so: |
+// The first line of the entry is the internal name. If you'd like to gather |
+// statistics about the usage of your flag, you should append a marker comment |
+// to the end of the feature name, like so: |
// "my-special-feature", // FLAGS:RECORD_UMA |
// |
// After doing that, run |
@@ -525,22 +525,22 @@ const Experiment::Choice kSupervisedUserSafeSitesChoices[] = { |
// whereas running with the flag enabled happens until the user flips the flag |
// again. |
-// To add a new experiment add to the end of kExperiments. There are two |
-// distinct types of experiments: |
-// . SINGLE_VALUE: experiment is either on or off. Use the SINGLE_VALUE_TYPE |
+// To add a new entry, add to the end of kEntries. There are two |
+// distinct types of entries: |
+// . SINGLE_VALUE: entry is either on or off. Use the SINGLE_VALUE_TYPE |
// macro for this type supplying the command line to the macro. |
// . MULTI_VALUE: a list of choices, the first of which should correspond to a |
// deactivated state for this lab (i.e. no command line option). To specify |
-// this type of experiment use the macro MULTI_VALUE_TYPE supplying it the |
+// this type of entry use the macro MULTI_VALUE_TYPE supplying it the |
// array of choices. |
-// See the documentation of Experiment for details on the fields. |
+// See the documentation of Entry for details on the fields. |
// |
// Command-line switches must have entries in enum "LoginCustomFlags" in |
// histograms.xml. See note in histograms.xml and don't forget to run |
// AboutFlagsHistogramTest unit test to calculate and verify checksum. |
// |
// When adding a new choice, add it to the end of the list. |
-const Experiment kExperiments[] = { |
+const Entry kEntries[] = { |
{ |
"ignore-gpu-blacklist", |
IDS_FLAGS_IGNORE_GPU_BLACKLIST_NAME, |
@@ -2457,8 +2457,8 @@ const Experiment kExperiments[] = { |
// histograms.xml and don't forget to run AboutFlagsHistogramTest unit test. |
}; |
-const Experiment* experiments = kExperiments; |
-size_t num_experiments = arraysize(kExperiments); |
+const Entry* entries = kEntries; |
+size_t num_entries = arraysize(kEntries); |
// Stores and encapsulates the little state that about:flags has. |
class FlagsState { |
@@ -2468,7 +2468,7 @@ class FlagsState { |
base::CommandLine* command_line, |
SentinelsMode sentinels); |
bool IsRestartNeededToCommitChanges(); |
- void SetExperimentEnabled( |
+ void SetEntryEnabled( |
FlagsStorage* flags_storage, |
const std::string& internal_name, |
bool enable); |
@@ -2489,33 +2489,32 @@ class FlagsState { |
DISALLOW_COPY_AND_ASSIGN(FlagsState); |
}; |
-// Adds the internal names for the specified experiment to |names|. |
-void AddInternalName(const Experiment& e, std::set<std::string>* names) { |
- if (e.type == Experiment::SINGLE_VALUE) { |
+// Adds the internal names for the specified entry to |names|. |
+void AddInternalName(const Entry& e, std::set<std::string>* names) { |
+ if (e.type == Entry::SINGLE_VALUE) { |
names->insert(e.internal_name); |
} else { |
- DCHECK(e.type == Experiment::MULTI_VALUE || |
- e.type == Experiment::ENABLE_DISABLE_VALUE); |
+ DCHECK(e.type == Entry::MULTI_VALUE || |
+ e.type == Entry::ENABLE_DISABLE_VALUE); |
for (int i = 0; i < e.num_choices; ++i) |
names->insert(e.NameForChoice(i)); |
} |
} |
-// Confirms that an experiment is valid, used in a DCHECK in |
-// SanitizeList below. |
-bool ValidateExperiment(const Experiment& e) { |
+// Confirms that an entry is valid, used in a DCHECK in SanitizeList below. |
+bool ValidateEntry(const Entry& e) { |
switch (e.type) { |
- case Experiment::SINGLE_VALUE: |
+ case Entry::SINGLE_VALUE: |
DCHECK_EQ(0, e.num_choices); |
DCHECK(!e.choices); |
break; |
- case Experiment::MULTI_VALUE: |
+ case Entry::MULTI_VALUE: |
DCHECK_GT(e.num_choices, 0); |
DCHECK(e.choices); |
DCHECK(e.choices[0].command_line_switch); |
DCHECK_EQ('\0', e.choices[0].command_line_switch[0]); |
break; |
- case Experiment::ENABLE_DISABLE_VALUE: |
+ case Entry::ENABLE_DISABLE_VALUE: |
DCHECK_EQ(3, e.num_choices); |
DCHECK(!e.choices); |
DCHECK(e.command_line_switch); |
@@ -2529,53 +2528,51 @@ bool ValidateExperiment(const Experiment& e) { |
return true; |
} |
-// Removes all experiments from prefs::kEnabledLabsExperiments that are |
-// unknown, to prevent this list to become very long as experiments are added |
-// and removed. |
+// Removes all entries from prefs::kEnabledLabsExperiments that are unknown, to |
+// prevent this list to become very long as entries are added and removed. |
void SanitizeList(FlagsStorage* flags_storage) { |
- std::set<std::string> known_experiments; |
- for (size_t i = 0; i < num_experiments; ++i) { |
- DCHECK(ValidateExperiment(experiments[i])); |
- AddInternalName(experiments[i], &known_experiments); |
+ std::set<std::string> known_entries; |
+ for (size_t i = 0; i < num_entries; ++i) { |
+ DCHECK(ValidateEntry(entries[i])); |
+ AddInternalName(entries[i], &known_entries); |
} |
- std::set<std::string> enabled_experiments = flags_storage->GetFlags(); |
+ std::set<std::string> enabled_entries = flags_storage->GetFlags(); |
- std::set<std::string> new_enabled_experiments = |
+ std::set<std::string> new_enabled_entries = |
base::STLSetIntersection<std::set<std::string> >( |
- known_experiments, enabled_experiments); |
+ known_entries, enabled_entries); |
- if (new_enabled_experiments != enabled_experiments) |
- flags_storage->SetFlags(new_enabled_experiments); |
+ if (new_enabled_entries != enabled_entries) |
+ flags_storage->SetFlags(new_enabled_entries); |
} |
-void GetSanitizedEnabledFlags( |
- FlagsStorage* flags_storage, std::set<std::string>* result) { |
+void GetSanitizedEnabledFlags(FlagsStorage* flags_storage, |
+ std::set<std::string>* result) { |
SanitizeList(flags_storage); |
*result = flags_storage->GetFlags(); |
} |
-bool SkipConditionalExperiment(const Experiment& experiment, |
- FlagsStorage* flags_storage) { |
+bool SkipConditionalEntry(const Entry& entry, FlagsStorage* flags_storage) { |
#if defined(OS_ANDROID) || defined(ENABLE_DATA_REDUCTION_PROXY_DEBUGGING) |
chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); |
#endif |
#if defined(OS_ANDROID) |
// enable-data-reduction-proxy-dev is only available for the Dev/Beta channel. |
- if (!strcmp("enable-data-reduction-proxy-dev", experiment.internal_name) && |
+ if (!strcmp("enable-data-reduction-proxy-dev", entry.internal_name) && |
channel != chrome::VersionInfo::CHANNEL_BETA && |
channel != chrome::VersionInfo::CHANNEL_DEV) { |
return true; |
} |
// enable-data-reduction-proxy-alt is only available for the Dev channel. |
- if (!strcmp("enable-data-reduction-proxy-alt", experiment.internal_name) && |
+ if (!strcmp("enable-data-reduction-proxy-alt", entry.internal_name) && |
channel != chrome::VersionInfo::CHANNEL_DEV) { |
return true; |
} |
// enable-data-reduction-proxy-lo-fi is only available for Chromium builds and |
// the Canary/Dev channel. |
- if (!strcmp("enable-data-reduction-proxy-lo-fi", experiment.internal_name) && |
+ if (!strcmp("enable-data-reduction-proxy-lo-fi", entry.internal_name) && |
channel != chrome::VersionInfo::CHANNEL_DEV && |
channel != chrome::VersionInfo::CHANNEL_CANARY && |
channel != chrome::VersionInfo::CHANNEL_UNKNOWN) { |
@@ -2587,7 +2584,7 @@ bool SkipConditionalExperiment(const Experiment& experiment, |
// enable-data-reduction-proxy-bypass-warning is only available for Chromium |
// builds and Canary/Dev channel. |
if (!strcmp("enable-data-reduction-proxy-bypass-warnings", |
- experiment.internal_name) && |
+ entry.internal_name) && |
channel != chrome::VersionInfo::CHANNEL_UNKNOWN && |
channel != chrome::VersionInfo::CHANNEL_CANARY && |
channel != chrome::VersionInfo::CHANNEL_DEV) { |
@@ -2605,40 +2602,40 @@ void GetSanitizedEnabledFlagsForCurrentPlatform( |
FlagsStorage* flags_storage, std::set<std::string>* result) { |
GetSanitizedEnabledFlags(flags_storage, result); |
- // Filter out any experiments that aren't enabled on the current platform. We |
+ // Filter out any entries that aren't enabled on the current platform. We |
// don't remove these from prefs else syncing to a platform with a different |
- // set of experiments would be lossy. |
- std::set<std::string> platform_experiments; |
+ // set of entries would be lossy. |
+ std::set<std::string> platform_entries; |
int current_platform = GetCurrentPlatform(); |
- for (size_t i = 0; i < num_experiments; ++i) { |
- if (experiments[i].supported_platforms & current_platform) |
- AddInternalName(experiments[i], &platform_experiments); |
+ for (size_t i = 0; i < num_entries; ++i) { |
+ if (entries[i].supported_platforms & current_platform) |
+ AddInternalName(entries[i], &platform_entries); |
#if defined(OS_CHROMEOS) |
- if (experiments[i].supported_platforms & kOsCrOSOwnerOnly) |
- AddInternalName(experiments[i], &platform_experiments); |
+ if (entries[i].supported_platforms & kOsCrOSOwnerOnly) |
+ AddInternalName(entries[i], &platform_entries); |
#endif |
} |
- std::set<std::string> new_enabled_experiments = |
+ std::set<std::string> new_enabled_entries = |
base::STLSetIntersection<std::set<std::string> >( |
- platform_experiments, *result); |
+ platform_entries, *result); |
- result->swap(new_enabled_experiments); |
+ result->swap(new_enabled_entries); |
} |
-// Returns the Value representing the choice data in the specified experiment. |
+// Returns the Value representing the choice data in the specified entry. |
base::Value* CreateChoiceData( |
- const Experiment& experiment, |
- const std::set<std::string>& enabled_experiments) { |
- DCHECK(experiment.type == Experiment::MULTI_VALUE || |
- experiment.type == Experiment::ENABLE_DISABLE_VALUE); |
+ const Entry& entry, |
+ const std::set<std::string>& enabled_entries) { |
+ DCHECK(entry.type == Entry::MULTI_VALUE || |
+ entry.type == Entry::ENABLE_DISABLE_VALUE); |
base::ListValue* result = new base::ListValue; |
- for (int i = 0; i < experiment.num_choices; ++i) { |
+ for (int i = 0; i < entry.num_choices; ++i) { |
base::DictionaryValue* value = new base::DictionaryValue; |
- const std::string name = experiment.NameForChoice(i); |
+ const std::string name = entry.NameForChoice(i); |
value->SetString("internal_name", name); |
- value->SetString("description", experiment.DescriptionForChoice(i)); |
- value->SetBoolean("selected", enabled_experiments.count(name) > 0); |
+ value->SetString("description", entry.DescriptionForChoice(i)); |
+ value->SetBoolean("selected", enabled_entries.count(name) > 0); |
result->Append(value); |
} |
return result; |
@@ -2646,20 +2643,20 @@ base::Value* CreateChoiceData( |
} // namespace |
-std::string Experiment::NameForChoice(int index) const { |
- DCHECK(type == Experiment::MULTI_VALUE || |
- type == Experiment::ENABLE_DISABLE_VALUE); |
+std::string Entry::NameForChoice(int index) const { |
+ DCHECK(type == Entry::MULTI_VALUE || |
+ type == Entry::ENABLE_DISABLE_VALUE); |
DCHECK_LT(index, num_choices); |
return std::string(internal_name) + testing::kMultiSeparator + |
base::IntToString(index); |
} |
-base::string16 Experiment::DescriptionForChoice(int index) const { |
- DCHECK(type == Experiment::MULTI_VALUE || |
- type == Experiment::ENABLE_DISABLE_VALUE); |
+base::string16 Entry::DescriptionForChoice(int index) const { |
+ DCHECK(type == Entry::MULTI_VALUE || |
+ type == Entry::ENABLE_DISABLE_VALUE); |
DCHECK_LT(index, num_choices); |
int description_id; |
- if (type == Experiment::ENABLE_DISABLE_VALUE) { |
+ if (type == Entry::ENABLE_DISABLE_VALUE) { |
const int kEnableDisableDescriptionIds[] = { |
IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, |
IDS_GENERIC_EXPERIMENT_CHOICE_ENABLED, |
@@ -2708,57 +2705,55 @@ bool AreSwitchesIdenticalToCurrentCommandLine( |
return result; |
} |
-void GetFlagsExperimentsData(FlagsStorage* flags_storage, |
- FlagAccess access, |
- base::ListValue* supported_experiments, |
- base::ListValue* unsupported_experiments) { |
- std::set<std::string> enabled_experiments; |
- GetSanitizedEnabledFlags(flags_storage, &enabled_experiments); |
+void GetFlagsEntryData(FlagsStorage* flags_storage, |
+ FlagAccess access, |
+ base::ListValue* supported_entries, |
+ base::ListValue* unsupported_entries) { |
+ std::set<std::string> enabled_entries; |
+ GetSanitizedEnabledFlags(flags_storage, &enabled_entries); |
int current_platform = GetCurrentPlatform(); |
- for (size_t i = 0; i < num_experiments; ++i) { |
- const Experiment& experiment = experiments[i]; |
- if (SkipConditionalExperiment(experiment, flags_storage)) |
+ for (size_t i = 0; i < num_entries; ++i) { |
+ const Entry& entry = entries[i]; |
+ if (SkipConditionalEntry(entry, flags_storage)) |
continue; |
base::DictionaryValue* data = new base::DictionaryValue(); |
- data->SetString("internal_name", experiment.internal_name); |
+ data->SetString("internal_name", entry.internal_name); |
data->SetString("name", |
- l10n_util::GetStringUTF16(experiment.visible_name_id)); |
+ l10n_util::GetStringUTF16(entry.visible_name_id)); |
data->SetString("description", |
- l10n_util::GetStringUTF16( |
- experiment.visible_description_id)); |
+ l10n_util::GetStringUTF16(entry.visible_description_id)); |
base::ListValue* supported_platforms = new base::ListValue(); |
- AddOsStrings(experiment.supported_platforms, supported_platforms); |
+ AddOsStrings(entry.supported_platforms, supported_platforms); |
data->Set("supported_platforms", supported_platforms); |
- switch (experiment.type) { |
- case Experiment::SINGLE_VALUE: |
- data->SetBoolean( |
- "enabled", |
- enabled_experiments.count(experiment.internal_name) > 0); |
+ switch (entry.type) { |
+ case Entry::SINGLE_VALUE: |
+ data->SetBoolean("enabled", |
+ enabled_entries.count(entry.internal_name) > 0); |
break; |
- case Experiment::MULTI_VALUE: |
- case Experiment::ENABLE_DISABLE_VALUE: |
- data->Set("choices", CreateChoiceData(experiment, enabled_experiments)); |
+ case Entry::MULTI_VALUE: |
+ case Entry::ENABLE_DISABLE_VALUE: |
+ data->Set("choices", CreateChoiceData(entry, enabled_entries)); |
break; |
default: |
NOTREACHED(); |
} |
- bool supported = (experiment.supported_platforms & current_platform) != 0; |
+ bool supported = (entry.supported_platforms & current_platform) != 0; |
#if defined(OS_CHROMEOS) |
if (access == kOwnerAccessToFlags && |
- (experiment.supported_platforms & kOsCrOSOwnerOnly) != 0) { |
+ (entry.supported_platforms & kOsCrOSOwnerOnly) != 0) { |
supported = true; |
} |
#endif |
if (supported) |
- supported_experiments->Append(data); |
+ supported_entries->Append(data); |
else |
- unsupported_experiments->Append(data); |
+ unsupported_entries->Append(data); |
} |
} |
@@ -2766,11 +2761,11 @@ bool IsRestartNeededToCommitChanges() { |
return FlagsState::GetInstance()->IsRestartNeededToCommitChanges(); |
} |
-void SetExperimentEnabled(FlagsStorage* flags_storage, |
- const std::string& internal_name, |
- bool enable) { |
- FlagsState::GetInstance()->SetExperimentEnabled(flags_storage, |
- internal_name, enable); |
+void SetEntryEnabled(FlagsStorage* flags_storage, |
+ const std::string& internal_name, |
+ bool enable) { |
+ FlagsState::GetInstance()->SetEntryEnabled(flags_storage, internal_name, |
+ enable); |
} |
void RemoveFlagsSwitches( |
@@ -2866,18 +2861,18 @@ void FlagsState::ConvertFlagsToSwitches(FlagsStorage* flags_storage, |
if (command_line->HasSwitch(switches::kNoExperiments)) |
return; |
- std::set<std::string> enabled_experiments; |
+ std::set<std::string> enabled_entries; |
GetSanitizedEnabledFlagsForCurrentPlatform(flags_storage, |
- &enabled_experiments); |
+ &enabled_entries); |
NameToSwitchAndValueMap name_to_switch_map; |
- for (size_t i = 0; i < num_experiments; ++i) { |
- const Experiment& e = experiments[i]; |
- if (e.type == Experiment::SINGLE_VALUE) { |
+ for (size_t i = 0; i < num_entries; ++i) { |
+ const Entry& e = entries[i]; |
+ if (e.type == Entry::SINGLE_VALUE) { |
SetFlagToSwitchMapping(e.internal_name, e.command_line_switch, |
e.command_line_value, &name_to_switch_map); |
- } else if (e.type == Experiment::MULTI_VALUE) { |
+ } else if (e.type == Entry::MULTI_VALUE) { |
for (int j = 0; j < e.num_choices; ++j) { |
SetFlagToSwitchMapping(e.NameForChoice(j), |
e.choices[j].command_line_switch, |
@@ -2885,7 +2880,7 @@ void FlagsState::ConvertFlagsToSwitches(FlagsStorage* flags_storage, |
&name_to_switch_map); |
} |
} else { |
- DCHECK_EQ(e.type, Experiment::ENABLE_DISABLE_VALUE); |
+ DCHECK_EQ(e.type, Entry::ENABLE_DISABLE_VALUE); |
SetFlagToSwitchMapping(e.NameForChoice(0), std::string(), std::string(), |
&name_to_switch_map); |
SetFlagToSwitchMapping(e.NameForChoice(1), e.command_line_switch, |
@@ -2901,9 +2896,9 @@ void FlagsState::ConvertFlagsToSwitches(FlagsStorage* flags_storage, |
std::pair<std::string, std::string>(switches::kFlagSwitchesBegin, |
std::string())); |
} |
- for (const std::string& experiment_name : enabled_experiments) { |
+ for (const std::string& entry_name : enabled_entries) { |
NameToSwitchAndValueMap::const_iterator name_to_switch_it = |
- name_to_switch_map.find(experiment_name); |
+ name_to_switch_map.find(entry_name); |
if (name_to_switch_it == name_to_switch_map.end()) { |
NOTREACHED(); |
continue; |
@@ -2929,65 +2924,64 @@ bool FlagsState::IsRestartNeededToCommitChanges() { |
return needs_restart_; |
} |
-void FlagsState::SetExperimentEnabled(FlagsStorage* flags_storage, |
- const std::string& internal_name, |
- bool enable) { |
+void FlagsState::SetEntryEnabled(FlagsStorage* flags_storage, |
+ const std::string& internal_name, |
+ bool enable) { |
size_t at_index = internal_name.find(testing::kMultiSeparator); |
if (at_index != std::string::npos) { |
DCHECK(enable); |
- // We're being asked to enable a multi-choice experiment. Disable the |
- // currently selected choice. |
+ // We're being asked to enable a multi-choice entry. Disable the currently |
+ // selected choice. |
DCHECK_NE(at_index, 0u); |
- const std::string experiment_name = internal_name.substr(0, at_index); |
- SetExperimentEnabled(flags_storage, experiment_name, false); |
+ const std::string entry_name = internal_name.substr(0, at_index); |
+ SetEntryEnabled(flags_storage, entry_name, false); |
// And enable the new choice, if it is not the default first choice. |
- if (internal_name != experiment_name + "@0") { |
- std::set<std::string> enabled_experiments; |
- GetSanitizedEnabledFlags(flags_storage, &enabled_experiments); |
- needs_restart_ |= enabled_experiments.insert(internal_name).second; |
- flags_storage->SetFlags(enabled_experiments); |
+ if (internal_name != entry_name + "@0") { |
+ std::set<std::string> enabled_entries; |
+ GetSanitizedEnabledFlags(flags_storage, &enabled_entries); |
+ needs_restart_ |= enabled_entries.insert(internal_name).second; |
+ flags_storage->SetFlags(enabled_entries); |
} |
return; |
} |
- std::set<std::string> enabled_experiments; |
- GetSanitizedEnabledFlags(flags_storage, &enabled_experiments); |
+ std::set<std::string> enabled_entries; |
+ GetSanitizedEnabledFlags(flags_storage, &enabled_entries); |
- const Experiment* e = NULL; |
- for (size_t i = 0; i < num_experiments; ++i) { |
- if (experiments[i].internal_name == internal_name) { |
- e = experiments + i; |
+ const Entry* e = NULL; |
+ for (size_t i = 0; i < num_entries; ++i) { |
+ if (entries[i].internal_name == internal_name) { |
+ e = entries + i; |
break; |
} |
} |
DCHECK(e); |
- if (e->type == Experiment::SINGLE_VALUE) { |
+ if (e->type == Entry::SINGLE_VALUE) { |
if (enable) |
- needs_restart_ |= enabled_experiments.insert(internal_name).second; |
+ needs_restart_ |= enabled_entries.insert(internal_name).second; |
else |
- needs_restart_ |= (enabled_experiments.erase(internal_name) > 0); |
+ needs_restart_ |= (enabled_entries.erase(internal_name) > 0); |
} else { |
if (enable) { |
// Enable the first choice. |
- needs_restart_ |= enabled_experiments.insert(e->NameForChoice(0)).second; |
+ needs_restart_ |= enabled_entries.insert(e->NameForChoice(0)).second; |
} else { |
// Find the currently enabled choice and disable it. |
for (int i = 0; i < e->num_choices; ++i) { |
std::string choice_name = e->NameForChoice(i); |
- if (enabled_experiments.find(choice_name) != |
- enabled_experiments.end()) { |
+ if (enabled_entries.find(choice_name) != enabled_entries.end()) { |
needs_restart_ = true; |
- enabled_experiments.erase(choice_name); |
- // Continue on just in case there's a bug and more than one |
- // experiment for this choice was enabled. |
+ enabled_entries.erase(choice_name); |
+ // Continue on just in case there's a bug and more than one entry for |
+ // this choice was enabled. |
} |
} |
} |
} |
- flags_storage->SetFlags(enabled_experiments); |
+ flags_storage->SetFlags(enabled_entries); |
} |
void FlagsState::RemoveFlagsSwitches( |
@@ -2999,8 +2993,8 @@ void FlagsState::RemoveFlagsSwitches( |
void FlagsState::ResetAllFlags(FlagsStorage* flags_storage) { |
needs_restart_ = true; |
- std::set<std::string> no_experiments; |
- flags_storage->SetFlags(no_experiments); |
+ std::set<std::string> no_entries; |
+ flags_storage->SetFlags(no_entries); |
} |
void FlagsState::reset() { |
@@ -3022,19 +3016,19 @@ void ClearState() { |
FlagsState::GetInstance()->reset(); |
} |
-void SetExperiments(const Experiment* e, size_t count) { |
+void SetEntries(const Entry* e, size_t count) { |
if (!e) { |
- experiments = kExperiments; |
- num_experiments = arraysize(kExperiments); |
+ entries = kEntries; |
+ num_entries = arraysize(kEntries); |
} else { |
- experiments = e; |
- num_experiments = count; |
+ entries = e; |
+ num_entries = count; |
} |
} |
-const Experiment* GetExperiments(size_t* count) { |
- *count = num_experiments; |
- return experiments; |
+const Entry* GetEntries(size_t* count) { |
+ *count = num_entries; |
+ return entries; |
} |
} // namespace testing |