Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2552)

Unified Diff: base/files/file_posix.cc

Issue 1023103002: Let ImportantFileWriter Use fdatasync (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: base/files/file_posix.cc
diff --git a/base/files/file_posix.cc b/base/files/file_posix.cc
index 517390f8eacf71135f9e62aff00de4a2d2b7f337..0a3076177569a1a699a9650fa683fb3553ab24a7 100644
--- a/base/files/file_posix.cc
+++ b/base/files/file_posix.cc
@@ -433,6 +433,16 @@ bool File::Flush() {
return !CallFsync(file_.get());
}
+bool File::FlushData() {
+#if defined(OS_LINUX) || defined(OS_ANDROID)
+ base::ThreadRestrictions::AssertIOAllowed();
+ DCHECK(IsValid());
+ return !HANDLE_EINTR(fdatasync(file_.get()));
rvargas (doing something else) 2015/03/20 18:56:05 is fdatasync a Linux-only thing? What's the behavi
hashimoto 2015/03/20 19:38:57 fdatasync is a part of POSIX, but it's not mandato
+#else
+ return Flush();
+#endif
+}
+
bool File::SetTimes(Time last_access_time, Time last_modified_time) {
base::ThreadRestrictions::AssertIOAllowed();
DCHECK(IsValid());

Powered by Google App Engine
This is Rietveld 408576698