windows: Configure stack size for executables (fixes issue #3250)

Change the default stack size to 8 MiB for 64-bit and 0.5 MiB for 32-bit.

CEF's main thread needs at least a 1.5 MiB stack size in order to avoid
stack overflow crashes. However, if this is set in the PE file then other
threads get this size as well, leading to address-space exhaustion in 32-bit
CEF. A new CefRunWinMainWithPreferredStackSize function uses fibers to switch
the main thread to a 4 MiB stack (roughly the same effective size as the
64-bit build's 8 MiB stack) before running any other code.

This change additionally moves the existing Windows-only functions
CefSetOSModalLoop and CefEnableHighDPISupport from cef_app.h to cef_win.h.
This commit is contained in:
Marshall Greenblatt
2022-10-20 18:23:32 -04:00
parent dfd1917d9b
commit 07bf5dbacc
20 changed files with 482 additions and 92 deletions

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=f1ec7f73b35927e943a058141d73d449dd31e43c$
// $hash=24d0396cbcb6e2af587c1126c899277d4ac0b4d2$
//
#include "include/capi/cef_app_capi.h"
@@ -138,20 +138,6 @@ NO_SANITIZE("cfi-icall") CEF_GLOBAL void CefQuitMessageLoop() {
cef_quit_message_loop();
}
NO_SANITIZE("cfi-icall") CEF_GLOBAL void CefSetOSModalLoop(bool osModalLoop) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_set_osmodal_loop(osModalLoop);
}
NO_SANITIZE("cfi-icall") CEF_GLOBAL void CefEnableHighDPISupport() {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_enable_highdpi_support();
}
NO_SANITIZE("cfi-icall") CEF_GLOBAL bool CefCrashReportingEnabled() {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING