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

Unified Diff: Source/wtf/PageAllocator.cpp

Issue 1184483007: PartitionAlloc: add a discardSystemPages() hint API. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Review feedback. Created 5 years, 6 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 | « Source/wtf/PageAllocator.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/wtf/PageAllocator.cpp
diff --git a/Source/wtf/PageAllocator.cpp b/Source/wtf/PageAllocator.cpp
index b9f3eae6a5c5bee8c75891eed51485995a55fc77..5f5eb440e4bfa5c87cc5b0ea2ee1093bc78a1d31 100644
--- a/Source/wtf/PageAllocator.cpp
+++ b/Source/wtf/PageAllocator.cpp
@@ -221,5 +221,22 @@ void recommitSystemPages(void* addr, size_t len)
#endif
}
+void discardSystemPages(void* addr, size_t len)
+{
+ ASSERT(!(len & kSystemPageOffsetMask));
+#if OS(POSIX)
+ // On POSIX, the implementation detail is that discard and decommit are the
+ // same, and lead to pages that are returned to the system immediately and
+ // get replaced with zeroed pages when touched. So we just call
+ // decommitSystemPages() here to avoid code duplication.
+ decommitSystemPages(addr, len);
+#else
+ (void) addr;
+ (void) len;
+ // TODO(cevans): implement this using MEM_RESET for Windows, once we've
+ // decided that the semantics are a match.
+#endif
+}
+
} // namespace WTF
« no previous file with comments | « Source/wtf/PageAllocator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698