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

Unified Diff: third_party/WebKit/Source/wtf/Assertions.h

Issue 2130293003: Change OOMs to raise custom exception rather than breakpoint on Windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments Created 4 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
Index: third_party/WebKit/Source/wtf/Assertions.h
diff --git a/third_party/WebKit/Source/wtf/Assertions.h b/third_party/WebKit/Source/wtf/Assertions.h
index a6917d62b85b8b8074dd6ce5b85d61a7c405da8a..cab1dbc9709871de7d002f77f111a8cf81e46cd8 100644
--- a/third_party/WebKit/Source/wtf/Assertions.h
+++ b/third_party/WebKit/Source/wtf/Assertions.h
@@ -48,6 +48,10 @@
#include "wtf/build_config.h"
#include <stdarg.h>
+#if OS(WIN)
+#include <windows.h>
+#endif
+
// Users must test "#if ENABLE(ASSERT)", which helps ensure that code
// testing this macro has included this header.
#ifndef ENABLE_ASSERT
@@ -150,6 +154,18 @@ private:
#endif
#endif
+/* OOM_CRASH() - Specialization of IMMEDIATE_CRASH which will raise a custom exception on Windows to signal this is OOM and not a normal assert. */
+#ifndef OOM_CRASH
+#if OS(WIN)
+#define OOM_CRASH() do { \
+ ::RaiseException(0xE0000008, EXCEPTION_NONCONTINUABLE, 0, nullptr); \
+ IMMEDIATE_CRASH(); \
+} while (0)
+#else
+#define OOM_CRASH() IMMEDIATE_CRASH()
+#endif
+#endif
+
/* CRASH() - Raises a fatal error resulting in program termination and triggering either the debugger or the crash reporter.
Use CRASH() in response to known, unrecoverable errors like out-of-memory.
« no previous file with comments | « third_party/WebKit/Source/platform/heap/PageMemory.cpp ('k') | third_party/WebKit/Source/wtf/allocator/PartitionAlloc.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698