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

Unified Diff: base/files/file.cc

Issue 109273002: Convert base::MemoryMappedFile to use File instead of PlatformFile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Posix GetSize Created 7 years 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.cc
diff --git a/base/files/file.cc b/base/files/file.cc
index 4902f15a2ff02744e44699317565797ebf0c05b3..508103ac7d4e1ebac1d376565bd25f3b86abe258 100644
--- a/base/files/file.cc
+++ b/base/files/file.cc
@@ -31,14 +31,17 @@ File::File(const FilePath& name, uint32 flags)
error_(FILE_OK),
created_(false),
async_(false) {
- if (name.ReferencesParent()) {
- error_ = FILE_ERROR_ACCESS_DENIED;
- return;
- }
- CreateBaseFileUnsafe(name, flags);
+ Initialize(name, flags);
}
#endif
+File::File(PlatformFile platform_file)
+ : file_(platform_file),
+ error_(FILE_OK),
+ created_(false),
+ async_(false) {
+}
+
File::File(RValue other)
: file_(other.object->TakePlatformFile()),
error_(other.object->error()),
@@ -61,4 +64,14 @@ File& File::operator=(RValue other) {
return *this;
}
+#if !defined(OS_NACL)
+void File::Initialize(const FilePath& name, uint32 flags) {
+ if (name.ReferencesParent()) {
+ error_ = FILE_ERROR_ACCESS_DENIED;
+ return;
+ }
+ InitializeUnsafe(name, flags);
+}
+#endif
+
} // namespace base
« no previous file with comments | « base/files/file.h ('k') | base/files/file_posix.cc » ('j') | media/base/media_file_checker.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698