Chromium Embedded Framework (CEF)  126.2.0+g5c56e98+chromium-126.0.6478.62
cef_win.h File Reference

Classes

class  CefMainArgs
 Class representing CefExecuteProcess arguments. More...
 
struct  CefWindowInfoTraits
 
class  CefWindowInfo
 Class representing window information. More...
 

Macros

#define CefCursorHandle   cef_cursor_handle_t
 
#define CefEventHandle   cef_event_handle_t
 
#define CefWindowHandle   cef_window_handle_t
 

Functions

int CefRunWinMainWithPreferredStackSize (wWinMainPtr wWinMain, HINSTANCE hInstance, LPWSTR lpCmdLine, int nCmdShow)
 Run the main thread on 32-bit Windows using a fiber with the preferred 4MiB stack size. More...
 
int CefRunMainWithPreferredStackSize (mainPtr main, int argc, char *argv[])
 
void CefSetOSModalLoop (bool osModalLoop)
 Set to true before calling Windows APIs like TrackPopupMenu that enter a modal message loop. More...
 

Macro Definition Documentation

◆ CefCursorHandle

#define CefCursorHandle   cef_cursor_handle_t

◆ CefEventHandle

#define CefEventHandle   cef_event_handle_t

◆ CefWindowHandle

#define CefWindowHandle   cef_window_handle_t

Function Documentation

◆ CefRunMainWithPreferredStackSize()

int CefRunMainWithPreferredStackSize ( mainPtr  main,
int  argc,
char *  argv[] 
)

◆ CefRunWinMainWithPreferredStackSize()

int CefRunWinMainWithPreferredStackSize ( wWinMainPtr  wWinMain,
HINSTANCE  hInstance,
LPWSTR  lpCmdLine,
int  nCmdShow 
)

Run the main thread on 32-bit Windows using a fiber with the preferred 4MiB stack size.

This function must be called at the top of the executable entry point function (main() or wWinMain()). It is used in combination with the initial stack size of 0.5MiB configured via the /STACK:0x80000 linker flag on executable targets. This saves significant memory on threads (like those in the Windows thread pool, and others) whose stack size can only be controlled via the linker flag.

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. This 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.

Choose the function variant that matches the entry point function type used by the executable. Reusing the entry point minimizes confusion when examining call stacks in crash reports.

If this function is already running on the fiber it will return -1 immediately, meaning that execution should proceed with the remainder of the entry point function. Otherwise, this function will block until the entry point function has completed execution on the fiber and then return a result >= 0, meaning that the entry point function should return the result immediately without proceeding with execution.

◆ CefSetOSModalLoop()

void CefSetOSModalLoop ( bool  osModalLoop)

Set to true before calling Windows APIs like TrackPopupMenu that enter a modal message loop.

Set to false after exiting the modal message loop.