OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef COMPONENTS_STARTUP_METRIC_UTILS_FILE_PRE_READ_FIELD_TRIAL_UTILS_WIN_H_ | |
6 #define COMPONENTS_STARTUP_METRIC_UTILS_FILE_PRE_READ_FIELD_TRIAL_UTILS_WIN_H_ | |
7 | |
8 #include <string> | |
9 | |
10 #include "base/callback_forward.h" | |
11 #include "base/strings/string16.h" | |
12 | |
13 // Utility functions to support the PreRead field trial. The PreRead field trial | |
14 // changes the way DLLs are pre-read during startup. | |
15 | |
16 namespace startup_metric_utils { | |
17 | |
18 // Callback to register a synthetic field trial. | |
19 using RegisterPreReadSyntheticFieldTrialCallback = | |
20 const base::Callback<bool(const std::string&, const std::string&)>; | |
21 | |
22 // Get DLL pre-reading options. |product_registry_path| is the registry path | |
23 // under which the registry key for this field trial resides. The |no_pre_read| | |
24 // option is set if DLLs should not be pre-read. The |high_priority| option is | |
25 // set if pre-reading should be done with a high thread priority. The | |
26 // |only_if_cold| option is set if only cold DLLs should be pre-read. The | |
27 // |prefetch_virtual_memory| option is set if the | |
28 // ::PrefetchVirtualMemory function should be used to pre-read DLLs, if | |
29 // available. | |
30 void GetPreReadOptions(const base::string16& product_registry_path, | |
31 bool* no_pre_read, | |
32 bool* high_priority, | |
33 bool* only_if_cold, | |
34 bool* prefetch_virtual_memory); | |
35 | |
36 // Updates DLL pre-reading options in the registry with the latest info for the | |
37 // next startup. |product_registry_path| is the registry path under which the | |
38 // registry key for this field trial resides. | |
39 void UpdatePreReadOptions(const base::string16& product_registry_path); | |
40 | |
41 // Registers a synthetic field trial with the PreRead group currently stored in | |
42 // the registry. This must be done before the first metric log | |
43 // (metrics::MetricsLog) is created. Otherwise, UMA metrics generated during | |
44 // startup won't be correctly annotated. |product_registry_path| is the registry | |
45 // path under which the key for this field trial resides. | |
46 void RegisterPreReadSyntheticFieldTrial( | |
47 const base::string16& product_registry_path, | |
48 const RegisterPreReadSyntheticFieldTrialCallback& | |
49 register_synthetic_field_trial); | |
50 | |
51 } // namespace startup_metric_utils | |
52 | |
53 #endif // COMPONENTS_STARTUP_METRIC_UTILS_FILE_PRE_READ_FIELD_TRIAL_UTILS_WIN_H
_ | |
OLD | NEW |