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

Unified Diff: components/startup_metric_utils/common/pre_read_field_trial_utils_win.h

Issue 1610733002: Store PreRead options obtained from the registry in a global variable. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: self-review Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: components/startup_metric_utils/common/pre_read_field_trial_utils_win.h
diff --git a/components/startup_metric_utils/common/pre_read_field_trial_utils_win.h b/components/startup_metric_utils/common/pre_read_field_trial_utils_win.h
index 612f76b2f43d39cc88436d2e7948ca2b9e11600b..080b56a743b799dc70e89b3fc34ecd95f3801b75 100644
--- a/components/startup_metric_utils/common/pre_read_field_trial_utils_win.h
+++ b/components/startup_metric_utils/common/pre_read_field_trial_utils_win.h
@@ -19,19 +19,32 @@ namespace startup_metric_utils {
using RegisterPreReadSyntheticFieldTrialCallback =
const base::Callback<bool(const std::string&, const std::string&)>;
-// Get DLL pre-reading options. |product_registry_path| is the registry path
-// under which the registry key for this field trial resides. The |no_pre_read|
-// option is set if DLLs should not be pre-read. The |high_priority| option is
-// set if pre-reading should be done with a high thread priority. The
-// |only_if_cold| option is set if only cold DLLs should be pre-read. The
-// |prefetch_virtual_memory| option is set if the
-// ::PrefetchVirtualMemory function should be used to pre-read DLLs, if
-// available.
-void GetPreReadOptions(const base::string16& product_registry_path,
- bool* no_pre_read,
- bool* high_priority,
- bool* only_if_cold,
- bool* prefetch_virtual_memory);
+// The options controlled by the PreRead field trial.
+enum PreReadOptions {
+ // No explicit DLL pre-reading.
+ PRE_READ_OPTION_NO_PRE_READ = 1 << 0,
grt (UTC plus 2) 2016/01/21 04:24:00 use a series of "const uint32_t kFooTheBar = n;" v
fdoray 2016/01/21 16:04:16 Done (now using a struct).
+
+ // Pre-read DLLs with a high thread priority.
+ PRE_READ_OPTION_HIGH_PRIORITY = 1 << 1,
+
+ // Pre-read DLLs only when they are cold.
+ PRE_READ_OPTION_ONLY_IF_COLD = 1 << 2,
+
+ // Pre-read DLLs using the ::PrefetchVirtualMemory function, if available.
+ PRE_READ_OPTION_PREFETCH_VIRTUAL_MEMORY = 1 << 3,
+
+ // Set when the pre-read options have not been initialized yet.
+ PRE_READ_OPTION_UNINITIALIZED = 1 << 4,
+};
+
+// Initializes DLL pre-reading options from the registry.
+// |product_registry_path| is the registry path under which the registry key for
+// this field trial resides.
+void InitializePreReadOptions(const base::string16& product_registry_path);
+
+// Returns the bitfield of the DLL pre-reading options to use for the current
+// process. InitializePreReadOptions() must have been called before this.
+int GetPreReadOptions();
grt (UTC plus 2) 2016/01/21 04:24:00 use uint32_t rather than int for the bitfield. bit
fdoray 2016/01/21 16:04:16 Done (now using a struct).
// Updates DLL pre-reading options in the registry with the latest info for the
// next startup. |product_registry_path| is the registry path under which the

Powered by Google App Engine
This is Rietveld 408576698