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

Unified Diff: base/files/file_posix.cc

Issue 189393002: net: Update FileStream to use base::File instead of PlatformFile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 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 a62ad98bd75974ad6f3f4548cf6648c7e8bf0702..a7debdefc187614c46608b6b7a2c4e00b0a28a3f 100644
--- a/base/files/file_posix.cc
+++ b/base/files/file_posix.cc
@@ -125,7 +125,6 @@ static File::Error CallFctnlFlock(PlatformFile file, bool do_lock) {
void File::InitializeUnsafe(const FilePath& name, uint32 flags) {
base::ThreadRestrictions::AssertIOAllowed();
DCHECK(!IsValid());
- DCHECK(!(flags & FLAG_ASYNC));
int open_flags = 0;
if (flags & FLAG_CREATE)
@@ -191,17 +190,19 @@ void File::InitializeUnsafe(const FilePath& name, uint32 flags) {
}
}
- if (descriptor >= 0 && (flags & (FLAG_CREATE_ALWAYS | FLAG_CREATE)))
+ if (descriptor < 0) {
+ error_details_ = File::OSErrorToFileError(errno);
+ return;
+ }
+
+ if (flags & (FLAG_CREATE_ALWAYS | FLAG_CREATE))
created_ = true;
- if ((descriptor >= 0) && (flags & FLAG_DELETE_ON_CLOSE))
+ if (flags & FLAG_DELETE_ON_CLOSE)
unlink(name.value().c_str());
- if (descriptor >= 0)
- error_details_ = FILE_OK;
- else
- error_details_ = File::OSErrorToFileError(errno);
-
+ async_ = ((flags & FLAG_ASYNC) == FLAG_ASYNC);
+ error_details_ = FILE_OK;
file_ = descriptor;
}
#endif // !defined(OS_NACL)
« no previous file with comments | « base/files/file.h ('k') | base/files/file_unittest.cc » ('j') | net/base/file_stream.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698