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

Unified Diff: runtime/bin/file_linux.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_fuchsia.cc ('k') | runtime/bin/file_macos.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/file_linux.cc
diff --git a/runtime/bin/file_linux.cc b/runtime/bin/file_linux.cc
index 33d809f0eadc3de74e5894f93e2b868d744fc06c..95a994a24a8834faadf4f4b72af7f9084560a766 100644
--- a/runtime/bin/file_linux.cc
+++ b/runtime/bin/file_linux.cc
@@ -79,7 +79,7 @@ bool File::IsClosed() {
}
-void* File::Map(MapType type, int64_t position, int64_t length) {
+MappedMemory* File::Map(MapType type, int64_t position, int64_t length) {
ASSERT(handle_->fd() >= 0);
int prot = PROT_NONE;
switch (type) {
@@ -96,7 +96,15 @@ void* File::Map(MapType type, int64_t position, int64_t length) {
if (addr == MAP_FAILED) {
return NULL;
}
- return addr;
+ return new MappedMemory(addr, length);
+}
+
+
+void MappedMemory::Unmap() {
+ int result = munmap(address_, size_);
+ ASSERT(result == 0);
+ address_ = 0;
+ size_ = 0;
}
« no previous file with comments | « runtime/bin/file_fuchsia.cc ('k') | runtime/bin/file_macos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698