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

Unified Diff: skia/ext/SkMemory_new_handler.cpp

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
« no previous file with comments | « content/renderer/render_frame_impl.cc ('k') | third_party/WebKit/Source/bindings/core/v8/V8Initializer.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: skia/ext/SkMemory_new_handler.cpp
diff --git a/skia/ext/SkMemory_new_handler.cpp b/skia/ext/SkMemory_new_handler.cpp
index 91adb34118f198f625e11d60d6ed7c122a0b6a6e..b45ad1cd4eec0c58e3e765480e55b8a3f6f03dc1 100644
--- a/skia/ext/SkMemory_new_handler.cpp
+++ b/skia/ext/SkMemory_new_handler.cpp
@@ -9,6 +9,10 @@
#include "build/build_config.h"
#include "third_party/skia/include/core/SkTypes.h"
+#if defined(OS_WIN)
+#include <windows.h>
+#endif
+
// This implementation of sk_malloc_flags() and friends is similar to
// SkMemory_malloc.cpp, except it uses base::UncheckedMalloc and friends
// for non-SK_MALLOC_THROW calls.
@@ -30,6 +34,13 @@ void sk_abort_no_print() {
void sk_out_of_memory(void) {
SkASSERT(!"sk_out_of_memory");
+#if defined(OS_WIN)
+ // Kill the process. This is important for security since most of code
+ // does not check the result of memory allocation.
+ // https://msdn.microsoft.com/en-us/library/het71c37.aspx
+ ::RaiseException(base::win::kOomExceptionCode, EXCEPTION_NONCONTINUABLE, 0,
+ nullptr);
+#endif
abort();
}
« no previous file with comments | « content/renderer/render_frame_impl.cc ('k') | third_party/WebKit/Source/bindings/core/v8/V8Initializer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698