| Index: base/file_util_win.cc
|
| diff --git a/base/file_util_win.cc b/base/file_util_win.cc
|
| index 4723b96043bfb5806b68681b97b2d02a1a9a7f92..e5c032e5bbd6d0b3f8551a16b7359b25188b6f54 100644
|
| --- a/base/file_util_win.cc
|
| +++ b/base/file_util_win.cc
|
| @@ -1111,70 +1111,4 @@ bool NormalizeToNativeFilePath(const FilePath& path, FilePath* nt_path) {
|
| return success;
|
| }
|
|
|
| -bool PreReadImage(const wchar_t* file_path, size_t size_to_read,
|
| - size_t step_size) {
|
| - base::ThreadRestrictions::AssertIOAllowed();
|
| - if (base::win::GetVersion() > base::win::VERSION_XP) {
|
| - // Vista+ branch. On these OSes, the forced reads through the DLL actually
|
| - // slows warm starts. The solution is to sequentially read file contents
|
| - // with an optional cap on total amount to read.
|
| - base::win::ScopedHandle file(
|
| - CreateFile(file_path,
|
| - GENERIC_READ,
|
| - FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
|
| - NULL,
|
| - OPEN_EXISTING,
|
| - FILE_FLAG_SEQUENTIAL_SCAN,
|
| - NULL));
|
| -
|
| - if (!file.IsValid())
|
| - return false;
|
| -
|
| - // Default to 1MB sequential reads.
|
| - const DWORD actual_step_size = std::max(static_cast<DWORD>(step_size),
|
| - static_cast<DWORD>(1024*1024));
|
| - LPVOID buffer = ::VirtualAlloc(NULL,
|
| - actual_step_size,
|
| - MEM_COMMIT,
|
| - PAGE_READWRITE);
|
| -
|
| - if (buffer == NULL)
|
| - return false;
|
| -
|
| - DWORD len;
|
| - size_t total_read = 0;
|
| - while (::ReadFile(file, buffer, actual_step_size, &len, NULL) &&
|
| - len > 0 &&
|
| - (size_to_read ? total_read < size_to_read : true)) {
|
| - total_read += static_cast<size_t>(len);
|
| - }
|
| - ::VirtualFree(buffer, 0, MEM_RELEASE);
|
| - } else {
|
| - // WinXP branch. Here, reading the DLL from disk doesn't do
|
| - // what we want so instead we pull the pages into memory by loading
|
| - // the DLL and touching pages at a stride.
|
| - HMODULE dll_module = ::LoadLibraryExW(
|
| - file_path,
|
| - NULL,
|
| - LOAD_WITH_ALTERED_SEARCH_PATH | DONT_RESOLVE_DLL_REFERENCES);
|
| -
|
| - if (!dll_module)
|
| - return false;
|
| -
|
| - base::win::PEImage pe_image(dll_module);
|
| - PIMAGE_NT_HEADERS nt_headers = pe_image.GetNTHeaders();
|
| - size_t actual_size_to_read = size_to_read ? size_to_read :
|
| - nt_headers->OptionalHeader.SizeOfImage;
|
| - volatile uint8* touch = reinterpret_cast<uint8*>(dll_module);
|
| - size_t offset = 0;
|
| - while (offset < actual_size_to_read) {
|
| - uint8 unused = *(touch + offset);
|
| - offset += step_size;
|
| - }
|
| - FreeLibrary(dll_module);
|
| - }
|
| -
|
| - return true;
|
| -}
|
| -
|
| } // namespace file_util
|
|
|