Index: base/file_util.cc |
=================================================================== |
--- base/file_util.cc (revision 6940) |
+++ base/file_util.cc (working copy) |
@@ -275,6 +275,29 @@ |
return fclose(file) == 0; |
} |
+/////////////////////////////////////////////// |
+// MemoryMappedFile |
+ |
+MemoryMappedFile::~MemoryMappedFile() { |
+ CloseHandles(); |
+} |
+ |
+bool MemoryMappedFile::Initialize(const FilePath& file_name) { |
+ if (IsValid()) |
+ return false; |
+ |
+ if (!MapFileToMemory(file_name)) { |
+ CloseHandles(); |
+ return false; |
+ } |
+ |
+ return true; |
+} |
+ |
+bool MemoryMappedFile::IsValid() { |
+ return data_ != NULL; |
+} |
+ |
// Deprecated functions ---------------------------------------------------- |
bool AbsolutePath(std::wstring* path_str) { |