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

Unified Diff: base/allocator/partition_allocator/page_allocator.cc

Issue 2971603002: macOS: Partition alloc should use memory tag 254. (Closed)
Patch Set: Created 3 years, 5 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/allocator/partition_allocator/page_allocator.cc
diff --git a/base/allocator/partition_allocator/page_allocator.cc b/base/allocator/partition_allocator/page_allocator.cc
index bb737b3341986d73739a2f5bed84d0c33052b1ce..7becd92e4ab63c82e2c7767638e2284ec44f977f 100644
--- a/base/allocator/partition_allocator/page_allocator.cc
+++ b/base/allocator/partition_allocator/page_allocator.cc
@@ -13,6 +13,10 @@
#include "base/logging.h"
#include "build/build_config.h"
+#if defined(OS_MACOSX)
+#include <mach/mach.h>
+#endif
+
#if defined(OS_POSIX)
#include <errno.h>
@@ -61,10 +65,19 @@ static void* SystemAllocPages(
if (!ret)
s_allocPageErrorCode = GetLastError();
#else
+
+#if defined(OS_MACOSX)
+ // Use a custom tag to make it easier to distinguish partition alloc regions
+ // in vmmap.
+ int fd = VM_MAKE_TAG(254);
+#else
+ int fd = -1;
+#endif
+
int access_flag = page_accessibility == PageAccessible
? (PROT_READ | PROT_WRITE)
: PROT_NONE;
- ret = mmap(hint, length, access_flag, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
+ ret = mmap(hint, length, access_flag, MAP_ANONYMOUS | MAP_PRIVATE, fd, 0);
if (ret == MAP_FAILED) {
s_allocPageErrorCode = errno;
ret = 0;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698