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

Unified Diff: third_party/WebKit/Source/wtf/PageAllocator.cpp

Issue 1718123002: Added errno (or GetLastError code) to crash dump when systemAllocPages fails. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: modify handleOutOfMemory Created 4 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
« no previous file with comments | « third_party/WebKit/Source/wtf/PageAllocator.h ('k') | third_party/WebKit/Source/wtf/Partitions.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/wtf/PageAllocator.cpp
diff --git a/third_party/WebKit/Source/wtf/PageAllocator.cpp b/third_party/WebKit/Source/wtf/PageAllocator.cpp
index 121b6872ab339cb53f1ea8dba3e5c5cc4ae42951..7f7a884173af99aa6008e798f492c7f05acaf284 100644
--- a/third_party/WebKit/Source/wtf/PageAllocator.cpp
+++ b/third_party/WebKit/Source/wtf/PageAllocator.cpp
@@ -37,6 +37,7 @@
#if OS(POSIX)
+#include <errno.h>
#include <sys/mman.h>
#ifndef MADV_FREE
@@ -49,6 +50,7 @@
// On POSIX memmap uses a nearby address if the hint address is blocked.
static const bool kHintIsAdvisory = true;
+static uint32_t allocPageErrorCode = 0;
#elif OS(WIN)
@@ -56,6 +58,7 @@ static const bool kHintIsAdvisory = true;
// VirtualAlloc will fail if allocation at the hint address is blocked.
static const bool kHintIsAdvisory = false;
+static uint32_t allocPageErrorCode = ERROR_SUCCESS;
#else
#error Unknown OS
@@ -76,11 +79,16 @@ static void* systemAllocPages(void* hint, size_t len, PageAccessibilityConfigura
#if OS(WIN)
DWORD accessFlag = pageAccessibility == PageAccessible ? PAGE_READWRITE : PAGE_NOACCESS;
ret = VirtualAlloc(hint, len, MEM_RESERVE | MEM_COMMIT, accessFlag);
+ allocPageErrorCode = !ret ? GetLastError() : ERROR_SUCCESS;
#else
int accessFlag = pageAccessibility == PageAccessible ? (PROT_READ | PROT_WRITE) : PROT_NONE;
ret = mmap(hint, len, accessFlag, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
- if (ret == MAP_FAILED)
+ if (ret == MAP_FAILED) {
+ allocPageErrorCode = errno;
ret = 0;
+ } else {
+ allocPageErrorCode = 0;
+ }
#endif
return ret;
}
@@ -261,5 +269,10 @@ void discardSystemPages(void* addr, size_t len)
#endif
}
+uint32_t getAllocPageErrorCode()
+{
+ return allocPageErrorCode;
+}
+
} // namespace WTF
« no previous file with comments | « third_party/WebKit/Source/wtf/PageAllocator.h ('k') | third_party/WebKit/Source/wtf/Partitions.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698