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

Unified Diff: runtime/bin/file_linux.cc

Issue 2405393002: 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
Index: runtime/bin/file_linux.cc
diff --git a/runtime/bin/file_linux.cc b/runtime/bin/file_linux.cc
index 4f61db1d306b3415c629dea7a2f3f10b6564b015..68fce32a882117ecd46251e487470ed6436281c0 100644
--- a/runtime/bin/file_linux.cc
+++ b/runtime/bin/file_linux.cc
@@ -77,16 +77,25 @@ bool File::IsClosed() {
}
-void* File::MapExecutable(intptr_t* len) {
+void* File::MapReadOnly(int64_t position, int64_t length) {
+ ASSERT(handle_->fd() >= 0);
+ void* addr = mmap(0, length,
+ PROT_READ, MAP_PRIVATE,
+ handle_->fd(), position);
+ if (addr == MAP_FAILED) {
+ return NULL;
+ }
+ return addr;
+}
+
+
+void* File::MapReadExecute(int64_t position, int64_t length) {
ASSERT(handle_->fd() >= 0);
- intptr_t length = Length();
void* addr = mmap(0, length,
PROT_READ | PROT_EXEC, MAP_PRIVATE,
- handle_->fd(), 0);
+ handle_->fd(), position);
if (addr == MAP_FAILED) {
- *len = -1;
- } else {
- *len = length;
+ return NULL;
}
return addr;
}

Powered by Google App Engine
This is Rietveld 408576698