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

Unified Diff: base/process/memory_win.cc

Issue 2173463002: Make base::TerminateBecauseOutOfMemory call RaiseException on Windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: implement in memory_stubs 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 | « base/process/memory_stubs.cc ('k') | skia/ext/SkMemory_new_handler.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/process/memory_win.cc
diff --git a/base/process/memory_win.cc b/base/process/memory_win.cc
index 9d75efecacb21af8e9afbb857a1b560fa6c3f171..d433020debb6dabe70e85a430d62bd191d4bbdd0 100644
--- a/base/process/memory_win.cc
+++ b/base/process/memory_win.cc
@@ -29,9 +29,9 @@ namespace base {
namespace {
#pragma warning(push)
-#pragma warning(disable: 4702)
+#pragma warning(disable: 4702) // Unreachable code after the _exit.
-int OnNoMemory(size_t size) {
+NOINLINE int OnNoMemory(size_t size) {
// 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
@@ -44,11 +44,12 @@ int OnNoMemory(size_t size) {
#pragma warning(pop)
-// HeapSetInformation function pointer.
-typedef BOOL (WINAPI* HeapSetFn)(HANDLE, HEAP_INFORMATION_CLASS, PVOID, SIZE_T);
-
} // namespace
+void TerminateBecauseOutOfMemory(size_t size) {
+ OnNoMemory(size);
+}
+
void EnableTerminationOnHeapCorruption() {
// Ignore the result code. Supported on XP SP3 and Vista.
HeapSetInformation(NULL, HeapEnableTerminationOnCorruption, NULL, 0);
« no previous file with comments | « base/process/memory_stubs.cc ('k') | skia/ext/SkMemory_new_handler.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698