Commit 1d2b5628 authored by hashimoto's avatar hashimoto Committed by Commit bot

Let ImportantFileWriter Use fdatasync

Add a new method base::File::FlushData to use fdatasync.

BUG=469071

Review URL: https://codereview.chromium.org/1023103002

Cr-Commit-Position: refs/heads/master@{#321943}
parent 89cdf95a
......@@ -53,10 +53,6 @@ static int CallFtruncate(PlatformFile file, int64 length) {
return HANDLE_EINTR(ftruncate(file, length));
}
static int CallFsync(PlatformFile file) {
return HANDLE_EINTR(fsync(file));
}
static int CallFutimes(PlatformFile file, const struct timeval times[2]) {
#ifdef __USE_XOPEN2K8
// futimens should be available, but futimes might not be
......@@ -98,11 +94,6 @@ static int CallFtruncate(PlatformFile file, int64 length) {
return 0;
}
static int CallFsync(PlatformFile file) {
NOTIMPLEMENTED(); // NaCl doesn't implement fsync.
return 0;
}
static int CallFutimes(PlatformFile file, const struct timeval times[2]) {
NOTIMPLEMENTED(); // NaCl doesn't implement futimes.
return 0;
......@@ -430,7 +421,14 @@ bool File::SetLength(int64 length) {
bool File::Flush() {
base::ThreadRestrictions::AssertIOAllowed();
DCHECK(IsValid());
return !CallFsync(file_.get());
#if defined(OS_NACL)
NOTIMPLEMENTED(); // NaCl doesn't implement fsync.
return true;
#elif defined(OS_LINUX) || defined(OS_ANDROID)
return !HANDLE_EINTR(fdatasync(file_.get()));
#else
return !HANDLE_EINTR(fsync(file_.get()));
#endif
}
bool File::SetTimes(Time last_access_time, Time last_modified_time) {
......
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