Index: runtime/bin/file_win.cc |
diff --git a/runtime/bin/file_win.cc b/runtime/bin/file_win.cc |
index 9101ee6673b74fc53b2b0336ccbfa73fb49b1105..bdd7065167ecad362023a843031dc02b7c5f5092 100644 |
--- a/runtime/bin/file_win.cc |
+++ b/runtime/bin/file_win.cc |
@@ -75,7 +75,7 @@ bool File::IsClosed() { |
} |
-void* File::Map(File::MapType type, int64_t position, int64_t length) { |
+MappedMemory* File::Map(File::MapType type, int64_t position, int64_t length) { |
DWORD prot_alloc; |
DWORD prot_final; |
switch (type) { |
@@ -111,7 +111,15 @@ void* File::Map(File::MapType type, int64_t position, int64_t length) { |
VirtualFree(addr, 0, MEM_RELEASE); |
return NULL; |
} |
- return addr; |
+ return new MappedMemory(addr, length); |
+} |
+ |
+ |
+void MappedMemory::Unmap() { |
+ bool result = VirtualFree(address_, size_, MEM_RELEASE); |
+ ASSERT(result); |
+ address_ = 0; |
+ size_ = 0; |
} |