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

Unified Diff: base/files/file_win.cc

Issue 109273002: Convert base::MemoryMappedFile to use File instead of PlatformFile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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_win.cc
diff --git a/base/files/file_win.cc b/base/files/file_win.cc
index 94f4d7f59c9431b073619ec71b37a1de780799fe..fab7a393ab01eb411b8d6720e65df8d64b582e93 100644
--- a/base/files/file_win.cc
+++ b/base/files/file_win.cc
@@ -13,7 +13,7 @@
namespace base {
-void File::CreateBaseFileUnsafe(const FilePath& name, uint32 flags) {
+void File::InitializeUnsafe(const FilePath& name, uint32 flags) {
base::ThreadRestrictions::AssertIOAllowed();
DCHECK(!IsValid());
@@ -197,7 +197,17 @@ int File::WriteAtCurrentPosNoBestEffort(const char* data, int size) {
return WriteAtCurrentPos(data, size);
}
-bool File::Truncate(int64 length) {
+int64 File::GetLength() {
+ base::ThreadRestrictions::AssertIOAllowed();
+ DCHECK(IsValid());
+ LARGE_INTEGER size;
+ if (!::GetFileSizeEx(file_.Get(), &size))
+ return -1;
+
+ return static_cast<int64>(size.QuadPart);
+}
+
+bool File::SetLength(int64 length) {
base::ThreadRestrictions::AssertIOAllowed();
DCHECK(IsValid());

Powered by Google App Engine
This is Rietveld 408576698