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

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

Issue 1612663002: Use a valid /prefetch argument when launching a process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bit
Patch Set: rebase + prefetch argument for crashpad Created 4 years, 10 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 #ifndef COMPONENTS_STARTUP_METRIC_UTILS_COMMON_PRE_READ_FIELD_TRIAL_UTILS_WIN_H_ 5 #ifndef COMPONENTS_STARTUP_METRIC_UTILS_COMMON_PRE_READ_FIELD_TRIAL_UTILS_WIN_H_
6 #define COMPONENTS_STARTUP_METRIC_UTILS_COMMON_PRE_READ_FIELD_TRIAL_UTILS_WIN_H_ 6 #define COMPONENTS_STARTUP_METRIC_UTILS_COMMON_PRE_READ_FIELD_TRIAL_UTILS_WIN_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/callback_forward.h" 10 #include "base/callback_forward.h"
11 #include "base/strings/string16.h" 11 #include "base/strings/string16.h"
12 12
13 // Utility functions to support the PreRead field trial. The PreRead field trial 13 // Utility functions to support the PreRead field trial. The PreRead field trial
14 // changes the way DLLs are pre-read during startup. 14 // changes the way DLLs are pre-read during startup.
15 15
16 namespace startup_metric_utils { 16 namespace startup_metric_utils {
17 17
18 // Callback to register a synthetic field trial. 18 // Callback to register a synthetic field trial.
19 using RegisterPreReadSyntheticFieldTrialCallback = 19 using RegisterPreReadSyntheticFieldTrialCallback =
20 const base::Callback<bool(const std::string&, const std::string&)>; 20 const base::Callback<bool(const std::string&, const std::string&)>;
21 21
22 // The options controlled by the PreRead field trial. 22 // The options controlled by the PreRead field trial.
23 struct PreReadOptions { 23 struct PreReadOptions {
24 // No explicit DLL pre-reading. 24 // Pre-read DLLs explicitly.
25 bool no_pre_read; 25 bool pre_read;
26 26
27 // Pre-read DLLs with a high thread priority. 27 // Pre-read DLLs with a high thread priority.
28 bool high_priority; 28 bool high_priority;
29 29
30 // Pre-read DLLs only when they are cold. 30 // Pre-read DLLs only when they are cold.
31 bool only_if_cold; 31 bool only_if_cold;
32 32
33 // Pre-read DLLs using the ::PrefetchVirtualMemory function, if available. 33 // Pre-read DLLs using the ::PrefetchVirtualMemory function, if available.
34 bool prefetch_virtual_memory; 34 bool prefetch_virtual_memory;
35
36 // Use a /prefetch argument when launching a process.
37 bool use_prefetch_argument;
35 }; 38 };
36 39
37 // Initializes DLL pre-reading options from the registry. 40 // Initializes DLL pre-reading options from the registry.
38 // |product_registry_path| is the registry path under which the registry key for 41 // |product_registry_path| is the registry path under which the registry key for
39 // this field trial resides. 42 // this field trial resides.
40 void InitializePreReadOptions(const base::string16& product_registry_path); 43 void InitializePreReadOptions(const base::string16& product_registry_path);
41 44
42 // Returns the bitfield of the DLL pre-reading options to use for the current 45 // Returns the bitfield of the DLL pre-reading options to use for the current
43 // process. InitializePreReadOptions() must have been called before this. 46 // process. InitializePreReadOptions() must have been called before this.
44 PreReadOptions GetPreReadOptions(); 47 PreReadOptions GetPreReadOptions();
45 48
46 // Updates DLL pre-reading options in the registry with the latest info for the 49 // Updates DLL pre-reading options in the registry with the latest info for the
47 // next startup. |product_registry_path| is the registry path under which the 50 // next startup. |product_registry_path| is the registry path under which the
48 // registry key for this field trial resides. 51 // registry key for this field trial resides.
49 void UpdatePreReadOptions(const base::string16& product_registry_path); 52 void UpdatePreReadOptions(const base::string16& product_registry_path);
50 53
51 // Registers a synthetic field trial with the PreRead group currently stored in 54 // Registers a synthetic field trial with the PreRead group currently stored in
52 // the registry. This must be done before the first metric log 55 // the registry. This must be done before the first metric log
53 // (metrics::MetricsLog) is created. Otherwise, UMA metrics generated during 56 // (metrics::MetricsLog) is created. Otherwise, UMA metrics generated during
54 // startup won't be correctly annotated. |product_registry_path| is the registry 57 // startup won't be correctly annotated. |product_registry_path| is the registry
55 // path under which the key for this field trial resides. 58 // path under which the key for this field trial resides.
56 void RegisterPreReadSyntheticFieldTrial( 59 void RegisterPreReadSyntheticFieldTrial(
57 const base::string16& product_registry_path, 60 const base::string16& product_registry_path,
58 const RegisterPreReadSyntheticFieldTrialCallback& 61 const RegisterPreReadSyntheticFieldTrialCallback&
59 register_synthetic_field_trial); 62 register_synthetic_field_trial);
60 63
61 } // namespace startup_metric_utils 64 } // namespace startup_metric_utils
62 65
63 #endif // COMPONENTS_STARTUP_METRIC_UTILS_COMMON_PRE_READ_FIELD_TRIAL_UTILS_WIN _H_ 66 #endif // COMPONENTS_STARTUP_METRIC_UTILS_COMMON_PRE_READ_FIELD_TRIAL_UTILS_WIN _H_
OLDNEW
« no previous file with comments | « components/nacl/browser/nacl_process_host.cc ('k') | components/startup_metric_utils/common/pre_read_field_trial_utils_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698