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

Unified Diff: chrome/app/main_dll_loader_win.cc

Issue 1595633002: Use valid /prefetch arguments for process launches on Windows. - do not submit (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move
Patch Set: address simple comments from gab 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
« no previous file with comments | « chrome/app/chrome_watcher_command_line_win.cc ('k') | chrome/browser/browser_process_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/app/main_dll_loader_win.cc
diff --git a/chrome/app/main_dll_loader_win.cc b/chrome/app/main_dll_loader_win.cc
index a70a6787d1504d0f2ce48b52ae09ce9325ac2f9b..5c47926161aa5b9e302e06a9a941172d1ff614c1 100644
--- a/chrome/app/main_dll_loader_win.cc
+++ b/chrome/app/main_dll_loader_win.cc
@@ -64,35 +64,30 @@ HMODULE LoadModuleWithDirectory(const base::FilePath& module) {
::SetCurrentDirectoryW(module.DirName().value().c_str());
// Get pre-read options from the PreRead field trial.
- bool trial_no_pre_read = false;
- bool trial_high_priority = false;
- bool trial_only_if_cold = false;
- bool trial_prefetch_virtual_memory = false;
- startup_metric_utils::GetPreReadOptions(
- BrowserDistribution::GetDistribution()->GetRegistryPath(),
- &trial_no_pre_read, &trial_high_priority, &trial_only_if_cold,
- &trial_prefetch_virtual_memory);
+ int pre_read_options = startup_metric_utils::GetPreReadOptions(
+ BrowserDistribution::GetDistribution()->GetRegistryPath());
// Pre-read the binary to warm the memory caches (avoids a lot of random IO).
- if (!trial_no_pre_read) {
+ if (!(pre_read_options & startup_metric_utils::NO_PRE_READ)) {
base::ThreadPriority previous_priority = base::ThreadPriority::NORMAL;
- if (trial_high_priority) {
+ if (pre_read_options & startup_metric_utils::HIGH_PRIORITY) {
previous_priority = base::PlatformThread::GetCurrentThreadPriority();
base::PlatformThread::SetCurrentThreadPriority(
base::ThreadPriority::DISPLAY);
}
- if (trial_only_if_cold) {
+ if (pre_read_options & startup_metric_utils::ONLY_IF_COLD) {
base::MemoryMappedFile module_memory_map;
const bool map_initialize_success = module_memory_map.Initialize(module);
DCHECK(map_initialize_success);
if (!IsMemoryMappedFileWarm(module_memory_map)) {
- if (trial_prefetch_virtual_memory)
+ if (pre_read_options & startup_metric_utils::PREFETCH_VIRTUAL_MEMORY)
PreReadMemoryMappedFile(module_memory_map, module);
else
PreReadFile(module);
}
- } else if (trial_prefetch_virtual_memory) {
+ } else if (pre_read_options &
+ startup_metric_utils::PREFETCH_VIRTUAL_MEMORY) {
base::MemoryMappedFile module_memory_map;
const bool map_initialize_success = module_memory_map.Initialize(module);
DCHECK(map_initialize_success);
@@ -101,7 +96,7 @@ HMODULE LoadModuleWithDirectory(const base::FilePath& module) {
PreReadFile(module);
}
- if (trial_high_priority)
+ if (pre_read_options & startup_metric_utils::HIGH_PRIORITY)
base::PlatformThread::SetCurrentThreadPriority(previous_priority);
}
« no previous file with comments | « chrome/app/chrome_watcher_command_line_win.cc ('k') | chrome/browser/browser_process_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698