| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/app/main_dll_loader_win.h" | 5 #include "chrome/app/main_dll_loader_win.h" |
| 6 | 6 |
| 7 #include <windows.h> // NOLINT | 7 #include <windows.h> // NOLINT |
| 8 #include <shlwapi.h> // NOLINT | 8 #include <shlwapi.h> // NOLINT |
| 9 #include <stddef.h> | 9 #include <stddef.h> |
| 10 #include <userenv.h> // NOLINT | 10 #include <userenv.h> // NOLINT |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 | 55 |
| 56 // Loads |module| after setting the CWD to |module|'s directory. Returns a | 56 // Loads |module| after setting the CWD to |module|'s directory. Returns a |
| 57 // reference to the loaded module on success, or null on error. | 57 // reference to the loaded module on success, or null on error. |
| 58 HMODULE LoadModuleWithDirectory(const base::FilePath& module) { | 58 HMODULE LoadModuleWithDirectory(const base::FilePath& module) { |
| 59 ::SetCurrentDirectoryW(module.DirName().value().c_str()); | 59 ::SetCurrentDirectoryW(module.DirName().value().c_str()); |
| 60 | 60 |
| 61 const startup_metric_utils::PreReadOptions pre_read_options = | 61 const startup_metric_utils::PreReadOptions pre_read_options = |
| 62 startup_metric_utils::GetPreReadOptions(); | 62 startup_metric_utils::GetPreReadOptions(); |
| 63 | 63 |
| 64 // If enabled by the PreRead field trial, pre-read the binary to avoid a lot | 64 // If enabled by the PreRead field trial, pre-read the binary to avoid a lot |
| 65 // of random IO. Don't pre-read the binary if it is chrome_child.dll and the | 65 // of random IO. |
| 66 // |pre_read_chrome_child_in_browser| option is enabled; the binary should | 66 if (pre_read_options.pre_read) |
| 67 // already have been pre-read by the browser process in that case. | |
| 68 if (pre_read_options.pre_read && | |
| 69 (!pre_read_options.pre_read_chrome_child_in_browser || | |
| 70 module.BaseName().value() != installer::kChromeChildDll)) { | |
| 71 PreReadFile(module, pre_read_options); | 67 PreReadFile(module, pre_read_options); |
| 72 } | |
| 73 | 68 |
| 74 return ::LoadLibraryExW(module.value().c_str(), nullptr, | 69 return ::LoadLibraryExW(module.value().c_str(), nullptr, |
| 75 LOAD_WITH_ALTERED_SEARCH_PATH); | 70 LOAD_WITH_ALTERED_SEARCH_PATH); |
| 76 } | 71 } |
| 77 | 72 |
| 78 void RecordDidRun(const base::FilePath& dll_path) { | 73 void RecordDidRun(const base::FilePath& dll_path) { |
| 79 bool system_level = !InstallUtil::IsPerUserInstall(dll_path); | 74 bool system_level = !InstallUtil::IsPerUserInstall(dll_path); |
| 80 GoogleUpdateSettings::UpdateDidRunState(true, system_level); | 75 GoogleUpdateSettings::UpdateDidRunState(true, system_level); |
| 81 } | 76 } |
| 82 | 77 |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 } | 247 } |
| 253 }; | 248 }; |
| 254 | 249 |
| 255 MainDllLoader* MakeMainDllLoader() { | 250 MainDllLoader* MakeMainDllLoader() { |
| 256 #if defined(GOOGLE_CHROME_BUILD) | 251 #if defined(GOOGLE_CHROME_BUILD) |
| 257 return new ChromeDllLoader(); | 252 return new ChromeDllLoader(); |
| 258 #else | 253 #else |
| 259 return new ChromiumDllLoader(); | 254 return new ChromiumDllLoader(); |
| 260 #endif | 255 #endif |
| 261 } | 256 } |
| OLD | NEW |