Add WIN_ prefix to Windows-specific base::File flags.
This brings documentation about the flaghs being Windows-only to
the callsites, making the behavior clearer to the calling code.
This is the initial CL that only adds aliases for these flags and
updates references from base/files. The plan is to then send
individual CLs (via git cl split) to migrate call sites, so that
callers have a chance to review their usage for correctness.
Bug: 1244149
Change-Id: I61f63ad5c0a5fff989f3cdc73f67c0f942134c5a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3227343
Reviewed-by: Gabriel Charette <gab@chromium.org>
Commit-Queue: Alexei Svitkine <asvitkine@chromium.org>
Cr-Commit-Position: refs/heads/main@{#933879}
diff --git a/base/files/file_util.cc b/base/files/file_util.cc
index 7ce17b00..7058010 100644
--- a/base/files/file_util.cc
+++ b/base/files/file_util.cc
@@ -321,12 +321,12 @@
bool TouchFile(const FilePath& path,
const Time& last_accessed,
const Time& last_modified) {
- int flags = File::FLAG_OPEN | File::FLAG_WRITE_ATTRIBUTES;
+ int flags = File::FLAG_OPEN | File::FLAG_WIN_WRITE_ATTRIBUTES;
#if defined(OS_WIN)
// On Windows, FILE_FLAG_BACKUP_SEMANTICS is needed to open a directory.
if (DirectoryExists(path))
- flags |= File::FLAG_BACKUP_SEMANTICS;
+ flags |= File::FLAG_WIN_BACKUP_SEMANTICS;
#elif defined(OS_FUCHSIA)
// On Fuchsia, we need O_RDONLY for directories, or O_WRONLY for files.
// TODO(https://crbug.com/947802): Find a cleaner workaround for this.
@@ -407,8 +407,8 @@
DCHECK_GE(max_bytes, 0);
File file(file_path, File::FLAG_OPEN | File::FLAG_READ |
- File::FLAG_SEQUENTIAL_SCAN |
- File::FLAG_SHARE_DELETE);
+ File::FLAG_WIN_SEQUENTIAL_SCAN |
+ File::FLAG_WIN_SHARE_DELETE);
if (!file.IsValid())
return false;