Commit bd540794 authored by Greg Thompson's avatar Greg Thompson Committed by Commit Bot

LZMA: Improve odds of getting data to disk.

Call FlushViewOfFile before unmapping the output file to initiate
committing dirty pages to disk. This, combined with the existing call to
FlushFileBuffers, helps ensure that the data is available to another
process.

BUG=933975,1069116
R=brucedawson@chromium.org

Change-Id: Ied41e0f4067ea8b9e7b0d5c9fc679d2ab2974714
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2162739
Commit-Queue: Greg Thompson <grt@chromium.org>
Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
Auto-Submit: Greg Thompson <grt@chromium.org>
Reviewed-by: default avatarBruce Dawson <brucedawson@chromium.org>
Cr-Commit-Position: refs/heads/master@{#762147}
parent 72153652
......@@ -366,6 +366,12 @@ UnPackStatus LzmaUtilImpl::UnPack(const base::FilePath& location,
total_written += written;
}
} else {
// Modified pages are not written to disk until they're evicted from the
// working set. Explicitly kick off the write to disk now
// (asynchronously) to improve the odds that the file's contents are
// on-disk when another process (such as chrome.exe) would like to use
// them.
::FlushViewOfFile(mapped_file->data(), 0);
// Unmap the target file from the process's address space.
mapped_file.reset();
last_folder_index = -1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment