Index: base/files/file_posix.cc |
diff --git a/base/files/file_posix.cc b/base/files/file_posix.cc |
index 9d97c336aa6b2be46c4c7c2d6b3fc724620def2d..dd7cf27a43b7959d04eba83ee2f633e2fcc616c4 100644 |
--- a/base/files/file_posix.cc |
+++ b/base/files/file_posix.cc |
@@ -122,7 +122,7 @@ static File::Error CallFctnlFlock(PlatformFile file, bool do_lock) { |
// NaCl doesn't implement system calls to open files directly. |
#if !defined(OS_NACL) |
// TODO(erikkay): does it make sense to support FLAG_EXCLUSIVE_* here? |
-void File::CreateBaseFileUnsafe(const FilePath& name, uint32 flags) { |
+void File::InitializeUnsafe(const FilePath& name, uint32 flags) { |
base::ThreadRestrictions::AssertIOAllowed(); |
DCHECK(!IsValid()); |
DCHECK(!(flags & FLAG_ASYNC)); |
@@ -341,7 +341,15 @@ int File::WriteAtCurrentPosNoBestEffort(const char* data, int size) { |
return HANDLE_EINTR(write(file_, data, size)); |
} |
-bool File::Truncate(int64 length) { |
+int64 File::GetLength() { |
+ DCHECK(IsValid()); |
+ int64 current = Seek(File::FROM_CURRENT, 0); |
+ int64 len = Seek(File::FROM_END, 0); |
+ Seek(File::FROM_BEGIN, current); |
+ return len; |
+} |
cpu_(ooo_6.6-7.5)
2013/12/21 22:59:33
ignorance: is seeking 3 times the way of the posix
rvargas (doing something else)
2013/12/27 23:54:39
definitely my bad.
|
+ |
+bool File::SetLength(int64 length) { |
base::ThreadRestrictions::AssertIOAllowed(); |
DCHECK(IsValid()); |
return !CallFtruncate(file_, length); |