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

Unified Diff: third_party/android_crazy_linker/src/src/crazy_linker_memory_mapping.h

Issue 958473003: Asynchronously pre-fault the native library pages. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Whitespace. Created 5 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
Index: third_party/android_crazy_linker/src/src/crazy_linker_memory_mapping.h
diff --git a/third_party/android_crazy_linker/src/src/crazy_linker_memory_mapping.h b/third_party/android_crazy_linker/src/src/crazy_linker_memory_mapping.h
index f981d5d8097c577ae7265ef81b4af3cff4eb21d5..7e4dd3f25aa7ae7de4d698927b26b945dff710ef 100644
--- a/third_party/android_crazy_linker/src/src/crazy_linker_memory_mapping.h
+++ b/third_party/android_crazy_linker/src/src/crazy_linker_memory_mapping.h
@@ -33,8 +33,10 @@ class MemoryMapping {
// |size| is the page-aligned size, must be > 0.
// |prot| are the desired protection bit flags.
// |fd| is -1 (for anonymous mappings), or a valid file descriptor.
+ // |offset| offset into the file
// on failure, return false and sets errno.
- bool Allocate(void* address, size_t size, Protection prot, int fd) {
+ bool AllocateWithOffset(void* address, size_t size, Protection prot, int fd,
+ size_t offset) {
int flags = (fd >= 0) ? MAP_SHARED : MAP_ANONYMOUS;
if (address)
flags |= MAP_FIXED;
@@ -49,6 +51,16 @@ class MemoryMapping {
return true;
}
+ // Allocate a new mapping.
+ // |address| is either NULL or a fixed memory address.
+ // |size| is the page-aligned size, must be > 0.
+ // |prot| are the desired protection bit flags.
+ // |fd| is -1 (for anonymous mappings), or a valid file descriptor.
+ // on failure, return false and sets errno.
+ bool Allocate(void* address, size_t size, Protection prot, int fd) {
+ return AllocateWithOffset(address, size, prot, fd, 0);
+ }
+
// Change the protection flags of the mapping.
// On failure, return false and sets errno.
bool SetProtection(Protection prot) {

Powered by Google App Engine
This is Rietveld 408576698