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

Side by Side Diff: components/startup_metric_utils/common/pre_read_field_trial_utils_win.cc

Issue 2075693002: Always use a /prefetch:# switch when launching a process on Windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 6 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
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 "components/startup_metric_utils/common/pre_read_field_trial_utils_win. h" 5 #include "components/startup_metric_utils/common/pre_read_field_trial_utils_win. h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/metrics/field_trial.h" 9 #include "base/metrics/field_trial.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 15 matching lines...) Expand all
26 const char kPreReadSyntheticFieldTrialName[] = "SyntheticPreRead"; 26 const char kPreReadSyntheticFieldTrialName[] = "SyntheticPreRead";
27 27
28 // Variation names for the PreRead field trial. All variations change the 28 // Variation names for the PreRead field trial. All variations change the
29 // default behavior, i.e. the default is the inverse of the variation. Thus, 29 // default behavior, i.e. the default is the inverse of the variation. Thus,
30 // variations that cancel something that is done by default have a negative 30 // variations that cancel something that is done by default have a negative
31 // name. 31 // name.
32 const base::char16 kNoPreReadVariationName[] = L"NoPreRead"; 32 const base::char16 kNoPreReadVariationName[] = L"NoPreRead";
33 const base::char16 kHighPriorityVariationName[] = L"HighPriority"; 33 const base::char16 kHighPriorityVariationName[] = L"HighPriority";
34 const base::char16 kPrefetchVirtualMemoryVariationName[] = 34 const base::char16 kPrefetchVirtualMemoryVariationName[] =
35 L"PrefetchVirtualMemory"; 35 L"PrefetchVirtualMemory";
36 const base::char16 kNoPrefetchArgumentVariationName[] = L"NoPrefetchArgument";
37 const base::char16 kPreReadChromeChildInBrowser[] = 36 const base::char16 kPreReadChromeChildInBrowser[] =
38 L"PreReadChromeChildInBrowser"; 37 L"PreReadChromeChildInBrowser";
39 38
40 // Registry key in which the PreRead field trial group is stored. 39 // Registry key in which the PreRead field trial group is stored.
41 const base::char16 kPreReadFieldTrialRegistryKey[] = L"\\PreReadFieldTrial"; 40 const base::char16 kPreReadFieldTrialRegistryKey[] = L"\\PreReadFieldTrial";
42 41
43 // Pre-read options to use for the current process. This is initialized by 42 // Pre-read options to use for the current process. This is initialized by
44 // InitializePreReadOptions(). 43 // InitializePreReadOptions().
45 PreReadOptions g_pre_read_options = {}; 44 PreReadOptions g_pre_read_options = {};
46 45
(...skipping 24 matching lines...) Expand all
71 const base::string16 registry_path = 70 const base::string16 registry_path =
72 GetPreReadRegistryPath(product_registry_path); 71 GetPreReadRegistryPath(product_registry_path);
73 const base::win::RegKey key(HKEY_CURRENT_USER, registry_path.c_str(), 72 const base::win::RegKey key(HKEY_CURRENT_USER, registry_path.c_str(),
74 KEY_QUERY_VALUE); 73 KEY_QUERY_VALUE);
75 74
76 // Set the PreRead field trial's options. 75 // Set the PreRead field trial's options.
77 g_pre_read_options.pre_read = !ReadBool(key, kNoPreReadVariationName); 76 g_pre_read_options.pre_read = !ReadBool(key, kNoPreReadVariationName);
78 g_pre_read_options.high_priority = ReadBool(key, kHighPriorityVariationName); 77 g_pre_read_options.high_priority = ReadBool(key, kHighPriorityVariationName);
79 g_pre_read_options.prefetch_virtual_memory = 78 g_pre_read_options.prefetch_virtual_memory =
80 ReadBool(key, kPrefetchVirtualMemoryVariationName); 79 ReadBool(key, kPrefetchVirtualMemoryVariationName);
81 g_pre_read_options.use_prefetch_argument =
82 !ReadBool(key, kNoPrefetchArgumentVariationName);
83 g_pre_read_options.pre_read_chrome_child_in_browser = 80 g_pre_read_options.pre_read_chrome_child_in_browser =
84 ReadBool(key, kPreReadChromeChildInBrowser); 81 ReadBool(key, kPreReadChromeChildInBrowser);
85 } 82 }
86 83
87 PreReadOptions GetPreReadOptions() { 84 PreReadOptions GetPreReadOptions() {
88 return g_pre_read_options; 85 return g_pre_read_options;
89 } 86 }
90 87
91 void UpdatePreReadOptions(const base::string16& product_registry_path) { 88 void UpdatePreReadOptions(const base::string16& product_registry_path) {
92 DCHECK(!product_registry_path.empty()); 89 DCHECK(!product_registry_path.empty());
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 base::string16 group; 142 base::string16 group;
146 key.ReadValue(L"", &group); 143 key.ReadValue(L"", &group);
147 144
148 if (!group.empty()) { 145 if (!group.empty()) {
149 register_synthetic_field_trial.Run(kPreReadSyntheticFieldTrialName, 146 register_synthetic_field_trial.Run(kPreReadSyntheticFieldTrialName,
150 base::UTF16ToUTF8(group)); 147 base::UTF16ToUTF8(group));
151 } 148 }
152 } 149 }
153 150
154 } // namespace startup_metric_utils 151 } // namespace startup_metric_utils
OLDNEW
« no previous file with comments | « components/startup_metric_utils/common/pre_read_field_trial_utils_win.h ('k') | content/browser/gpu/gpu_process_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698