| Index: components/startup_metric_utils/common/pre_read_field_trial_utils_win.cc
|
| diff --git a/components/startup_metric_utils/common/pre_read_field_trial_utils_win.cc b/components/startup_metric_utils/common/pre_read_field_trial_utils_win.cc
|
| index 6aa82a19d93e59d8da9f80ca767206fe5f438be6..d24ae210c29168f4656af3841cc153bd7c2478a5 100644
|
| --- a/components/startup_metric_utils/common/pre_read_field_trial_utils_win.cc
|
| +++ b/components/startup_metric_utils/common/pre_read_field_trial_utils_win.cc
|
| @@ -31,6 +31,7 @@ const base::char16 kHighPriorityVariationName[] = L"HighPriority";
|
| const base::char16 kOnlyIfColdVariationName[] = L"OnlyIfCold";
|
| const base::char16 kPrefetchVirtualMemoryVariationName[] =
|
| L"PrefetchVirtualMemory";
|
| +const base::char16 kNoPrefetchArgumentVariationName[] = L"NoPrefetchArgument";
|
|
|
| // Registry key in which the PreRead field trial group is stored.
|
| const base::char16 kPreReadFieldTrialRegistryKey[] = L"\\PreReadFieldTrial";
|
| @@ -43,16 +44,8 @@ base::string16 GetPreReadRegistryPath(
|
|
|
| } // namespace
|
|
|
| -void GetPreReadOptions(const base::string16& product_registry_path,
|
| - bool* no_pre_read,
|
| - bool* high_priority,
|
| - bool* only_if_cold,
|
| - bool* prefetch_virtual_memory) {
|
| +int GetPreReadOptions(const base::string16& product_registry_path) {
|
| DCHECK(!product_registry_path.empty());
|
| - DCHECK(no_pre_read);
|
| - DCHECK(high_priority);
|
| - DCHECK(only_if_cold);
|
| - DCHECK(prefetch_virtual_memory);
|
|
|
| // Open the PreRead field trial's registry key.
|
| const base::string16 registry_path =
|
| @@ -63,21 +56,28 @@ void GetPreReadOptions(const base::string16& product_registry_path,
|
| // Set the PreRead field trial's options.
|
| struct VariationMapping {
|
| const base::char16* name;
|
| - bool* variable;
|
| + PreReadOptions bit;
|
| } const variations_mappings[] = {
|
| - {kNoPreReadVariationName, no_pre_read},
|
| - {kHighPriorityVariationName, high_priority},
|
| - {kOnlyIfColdVariationName, only_if_cold},
|
| - {kPrefetchVirtualMemoryVariationName, prefetch_virtual_memory},
|
| + {kNoPreReadVariationName, NO_PRE_READ},
|
| + {kHighPriorityVariationName, HIGH_PRIORITY},
|
| + {kOnlyIfColdVariationName, ONLY_IF_COLD},
|
| + {kPrefetchVirtualMemoryVariationName, PREFETCH_VIRTUAL_MEMORY},
|
| + {kNoPrefetchArgumentVariationName, NO_PREFETCH_ARGUMENT},
|
| };
|
|
|
| + int options = 0;
|
| +
|
| for (const auto& mapping : variations_mappings) {
|
| // Set the option variable to true if the corresponding value is found in
|
| // the registry. Set to false otherwise (default behavior).
|
| DWORD value = 0;
|
| - *mapping.variable = key.ReadValueDW(mapping.name, &value) == ERROR_SUCCESS;
|
| - DCHECK(!*mapping.variable || value == 1);
|
| + if (key.ReadValueDW(mapping.name, &value) == ERROR_SUCCESS) {
|
| + DCHECK(value == 1);
|
| + options &= mapping.bit;
|
| + }
|
| }
|
| +
|
| + return options;
|
| }
|
|
|
| void UpdatePreReadOptions(const base::string16& product_registry_path) {
|
|
|