summaryrefslogtreecommitdiffstats
path: root/chrome/app/chrome_dll_main.cc
diff options
context:
space:
mode:
authormbelshe@google.com <mbelshe@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-11 18:05:18 +0000
committermbelshe@google.com <mbelshe@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-11 18:05:18 +0000
commit197ea64be37bf1aeadde177a9e2d8bedcab8775c (patch)
tree279493dc0dd006792664d92b9225dedd76f00bf8 /chrome/app/chrome_dll_main.cc
parent58cd963413b1286ba73c94419822dd1c803ed537 (diff)
downloadchromium_src-197ea64be37bf1aeadde177a9e2d8bedcab8775c.zip
chromium_src-197ea64be37bf1aeadde177a9e2d8bedcab8775c.tar.gz
chromium_src-197ea64be37bf1aeadde177a9e2d8bedcab8775c.tar.bz2
Enable the _set_new_mode() call so that calls to malloc
behave like calls to new, and will go through the std_new_handler on crash. For chrome, this means that all out of memory conditions, be they malloc induced or new induced will cause the process to abort. BUG=11475 TEST=none Review URL: http://codereview.chromium.org/122041 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18180 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/app/chrome_dll_main.cc')
-rw-r--r--chrome/app/chrome_dll_main.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/chrome/app/chrome_dll_main.cc b/chrome/app/chrome_dll_main.cc
index ad9c77b..c41c95b 100644
--- a/chrome/app/chrome_dll_main.cc
+++ b/chrome/app/chrome_dll_main.cc
@@ -201,6 +201,10 @@ static void SetUpGLibLogHandler() {
}
#endif // defined(OS_LINUX)
+#if defined(OS_WIN)
+extern "C" int _set_new_mode(int);
+#endif
+
// Register the invalid param handler and pure call handler to be able to
// notify breakpad when it happens.
void RegisterInvalidParamHandler() {
@@ -209,6 +213,8 @@ void RegisterInvalidParamHandler() {
_set_purecall_handler(PureCall);
// Gather allocation failure.
std::set_new_handler(&OnNoMemory);
+ // Also enable the new handler for malloc() based failures.
+ _set_new_mode(1);
#endif
}