aboutsummaryrefslogtreecommitdiff
path: root/zucchini_integration.cc
diff options
context:
space:
mode:
authorGreg Thompson <grt@chromium.org>2020-07-18 01:29:39 +0000
committerCopybara-Service <copybara-worker@google.com>2021-07-25 21:07:09 -0700
commitf16a0ed58d771eb63f3fc59377d0979fb746cf04 (patch)
treef7257c903c0124bb454975f8d8dc644de1ff7019 /zucchini_integration.cc
parent928ca353efa36162979a205997e52266bb48f870 (diff)
downloadzucchini-f16a0ed58d771eb63f3fc59377d0979fb746cf04.tar.gz
Use FLAG_SHARE_DELETE when opening files in the installer.
This CL adds FLAG_SHARE_DELETE to many file operations in Chrome's installer; including in delta patch processing and archive extraction utilities. This allows processing on files that are held open to be deleted by another entity so that we can eventually hold temporary files open with FILE_FLAG_DELETE_ON_CLOSE. BUG=516207 Change-Id: I1cd03f6360dfcd61fcd2f09797f0923331076415 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2302109 Reviewed-by: Will Harris <wfh@chromium.org> Commit-Queue: Greg Thompson <grt@chromium.org> Cr-Commit-Position: refs/heads/master@{#789702} NOKEYCHECK=True GitOrigin-RevId: f176eba36c20d3f315e507eea7f306da3b58c2e4
Diffstat (limited to 'zucchini_integration.cc')
-rw-r--r--zucchini_integration.cc12
1 files changed, 8 insertions, 4 deletions
diff --git a/zucchini_integration.cc b/zucchini_integration.cc
index 97790a3..ff7e792 100644
--- a/zucchini_integration.cc
+++ b/zucchini_integration.cc
@@ -167,8 +167,10 @@ status::Code Generate(const base::FilePath& old_path,
bool is_raw,
std::string imposed_matches) {
using base::File;
- File old_file(old_path, File::FLAG_OPEN | File::FLAG_READ);
- File new_file(new_path, File::FLAG_OPEN | File::FLAG_READ);
+ File old_file(old_path, File::FLAG_OPEN | File::FLAG_READ |
+ base::File::FLAG_SHARE_DELETE);
+ File new_file(new_path, File::FLAG_OPEN | File::FLAG_READ |
+ base::File::FLAG_SHARE_DELETE);
File patch_file(patch_path, File::FLAG_CREATE_ALWAYS | File::FLAG_READ |
File::FLAG_WRITE | File::FLAG_SHARE_DELETE |
File::FLAG_CAN_DELETE_ON_CLOSE);
@@ -192,8 +194,10 @@ status::Code Apply(const base::FilePath& old_path,
const base::FilePath& new_path,
bool force_keep) {
using base::File;
- File old_file(old_path, File::FLAG_OPEN | File::FLAG_READ);
- File patch_file(patch_path, File::FLAG_OPEN | File::FLAG_READ);
+ File old_file(old_path, File::FLAG_OPEN | File::FLAG_READ |
+ base::File::FLAG_SHARE_DELETE);
+ File patch_file(patch_path, File::FLAG_OPEN | File::FLAG_READ |
+ base::File::FLAG_SHARE_DELETE);
File new_file(new_path, File::FLAG_CREATE_ALWAYS | File::FLAG_READ |
File::FLAG_WRITE | File::FLAG_SHARE_DELETE |
File::FLAG_CAN_DELETE_ON_CLOSE);