Commit 6aba9c76 authored by Victor Costan's avatar Victor Costan Committed by Commit Bot

components: Specify locking mode in calls to base::File::Lock().

The distinction between kShared and kExplicit is large enough that there
are significant readability advantages to having the default be explicit
in the code.

Bug: 1125315
Change-Id: I34c479032b90124c88eadac8897c6d579dbd1554
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2394197Reviewed-by: default avatarColin Blundell <blundell@chromium.org>
Commit-Queue: Colin Blundell <blundell@chromium.org>
Auto-Submit: Victor Costan <pwnall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#804728}
parent 651ffdb7
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include <vector> #include <vector>
#include "base/check_op.h" #include "base/check_op.h"
#include "base/files/file.h"
#include "base/files/file_path.h" #include "base/files/file_path.h"
#include "base/files/scoped_file.h" #include "base/files/scoped_file.h"
#include "build/build_config.h" #include "build/build_config.h"
...@@ -66,7 +67,7 @@ bool FileImpl::IsValid() const { ...@@ -66,7 +67,7 @@ bool FileImpl::IsValid() const {
#if !defined(OS_FUCHSIA) #if !defined(OS_FUCHSIA)
base::File::Error FileImpl::RawLockFile() { base::File::Error FileImpl::RawLockFile() {
return file_.Lock(); return file_.Lock(base::File::LockMode::kExclusive);
} }
base::File::Error FileImpl::RawUnlockFile() { base::File::Error FileImpl::RawUnlockFile() {
......
...@@ -290,7 +290,7 @@ FileErrorOr<base::File> FilesystemImpl::LockFileLocal( ...@@ -290,7 +290,7 @@ FileErrorOr<base::File> FilesystemImpl::LockFileLocal(
return base::File::FILE_ERROR_IN_USE; return base::File::FILE_ERROR_IN_USE;
#if !defined(OS_FUCHSIA) #if !defined(OS_FUCHSIA)
base::File::Error error = file.Lock(); base::File::Error error = file.Lock(base::File::LockMode::kExclusive);
if (error != base::File::FILE_OK) if (error != base::File::FILE_OK)
return error; return error;
#endif #endif
......
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