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

Unified Diff: runtime/bin/file_win.cc

Issue 2694103004: Cleanup app snapshots on isolate/vm exit. (Closed)
Patch Set: merge Created 3 years, 10 months 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
« no previous file with comments | « runtime/bin/file_macos.cc ('k') | runtime/bin/gen_snapshot.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « runtime/bin/file_macos.cc ('k') | runtime/bin/gen_snapshot.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698