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

Unified Diff: runtime/bin/file_linux.cc

Issue 2410303008: Revert "Use a single file for app snapshots." (Closed)
Patch Set: Created 4 years, 2 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 e6b27f8ace515a8b1d2a4073c01be6e9005ada64..4f61db1d306b3415c629dea7a2f3f10b6564b015 100644
--- a/runtime/bin/file_linux.cc
+++ b/runtime/bin/file_linux.cc
@@ -77,23 +77,16 @@ bool File::IsClosed() {
}
-void* File::Map(MapType type, int64_t position, int64_t length) {
+void* File::MapExecutable(intptr_t* len) {
ASSERT(handle_->fd() >= 0);
- int prot = PROT_NONE;
- switch (type) {
- case kReadOnly:
- prot = PROT_READ;
- break;
- case kReadExecute:
- prot = PROT_READ | PROT_EXEC;
- break;
- default:
- return NULL;
- }
- void* addr = mmap(NULL, length, prot, MAP_PRIVATE,
- handle_->fd(), position);
+ intptr_t length = Length();
+ void* addr = mmap(0, length,
+ PROT_READ | PROT_EXEC, MAP_PRIVATE,
+ handle_->fd(), 0);
if (addr == MAP_FAILED) {
- return NULL;
+ *len = -1;
+ } else {
+ *len = length;
}
return addr;
}
« 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