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

Unified Diff: chrome/app/chrome_dll_main.cc

Issue 99090: Add a hook for using the std::set_new_handler().... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 8 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: chrome/app/chrome_dll_main.cc
===================================================================
--- chrome/app/chrome_dll_main.cc (revision 14603)
+++ chrome/app/chrome_dll_main.cc (working copy)
@@ -109,17 +109,12 @@
__debugbreak();
}
-int OnNoMemory(size_t memory_size) {
+void OnNoMemory() {
// Kill the process. This is important for security, since WebKit doesn't
// NULL-check many memory allocations. If a malloc fails, returns NULL, and
// the buffer is then used, it provides a handy mapping of memory starting at
// address 0 for an attacker to utilize.
__debugbreak();
-
- // Return memory_size so it is not optimized out. Make sure the return value
- // is at least 1 so malloc/new is retried, especially useful when under a
- // debugger.
- return memory_size ? static_cast<int>(memory_size) : 1;
}
// Handlers to silently dump the current process when there is an assert in
@@ -193,9 +188,7 @@
_set_invalid_parameter_handler(InvalidParameter);
_set_purecall_handler(PureCall);
// Gather allocation failure.
- _set_new_handler(&OnNoMemory);
- // Make sure malloc() calls the new handler too.
- _set_new_mode(1);
cpu_(ooo_6.6-7.5) 2009/04/28 22:38:16 why is _set_new_mode(1) gone?
+ std::set_new_handler(&OnNoMemory);
#endif
}
« 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