win: Add delayloads to libcef.dll and exe targets

Delay-load as many DLLs as possible for sandbox and startup perf
improvements.
This commit is contained in:
Marshall Greenblatt 2023-08-09 16:40:55 -04:00
parent 605c2bac86
commit 52a9794659
2 changed files with 66 additions and 0 deletions

View File

@ -1674,6 +1674,10 @@ if (is_mac) {
# ResourceBundle. See crbug.com/147663. # ResourceBundle. See crbug.com/147663.
"//ui/resources:ui_unscaled_resources_grd", "//ui/resources:ui_unscaled_resources_grd",
] ]
# Delay-load as many DLLs as possible for sandbox and startup perf
# improvements.
configs += [ "//build/config/win:delayloads" ]
} }
if (is_linux && !is_debug && !use_partition_alloc_as_malloc) { if (is_linux && !is_debug && !use_partition_alloc_as_malloc) {
@ -2176,6 +2180,10 @@ if (is_mac) {
configs -= [ "//build/config/win:console" ] configs -= [ "//build/config/win:console" ]
configs += [ "//build/config/win:windowed" ] configs += [ "//build/config/win:windowed" ]
# Delay-load as many DLLs as possible for sandbox and startup perf
# improvements.
configs += [ "//build/config/win:delayloads" ]
defines += [ defines += [
"CEF_USE_ATL", "CEF_USE_ATL",
] ]
@ -2264,6 +2272,10 @@ if (is_mac) {
configs -= [ "//build/config/win:console" ] configs -= [ "//build/config/win:console" ]
configs += [ "//build/config/win:windowed" ] configs += [ "//build/config/win:windowed" ]
# Delay-load as many DLLs as possible for sandbox and startup perf
# improvements.
configs += [ "//build/config/win:delayloads" ]
deps += [ deps += [
":cef_sandbox", ":cef_sandbox",
"//build/win:default_exe_manifest", "//build/win:default_exe_manifest",
@ -2331,6 +2343,10 @@ if (is_mac) {
sources += gypi_paths2.shared_sources_win + sources += gypi_paths2.shared_sources_win +
gypi_paths2.ceftests_sources_win gypi_paths2.ceftests_sources_win
# Delay-load as many DLLs as possible for sandbox and startup perf
# improvements.
configs += [ "//build/config/win:delayloads" ]
deps += [ deps += [
":cef_sandbox", ":cef_sandbox",
"//build/win:default_exe_manifest", "//build/win:default_exe_manifest",

View File

@ -436,6 +436,56 @@ if(OS_WINDOWS)
list(APPEND CEF_EXE_LINKER_FLAGS list(APPEND CEF_EXE_LINKER_FLAGS
/MANIFEST:NO # No default manifest (see ADD_WINDOWS_MANIFEST macro usage) /MANIFEST:NO # No default manifest (see ADD_WINDOWS_MANIFEST macro usage)
/LARGEADDRESSAWARE # Allow 32-bit processes to access 3GB of RAM /LARGEADDRESSAWARE # Allow 32-bit processes to access 3GB of RAM
# Delayload most libraries as the dlls are simply not required at startup (or
# at all, depending on the process type). Some dlls open handles when they are
# loaded, and we may not want them to be loaded in renderers or other sandboxed
# processes. Conversely, some dlls must be loaded before sandbox lockdown. In
# unsandboxed processes they will load when first needed. The linker will
# automatically ignore anything which is not linked to the binary at all (it is
# harmless to have an unmatched /delayload). This list should be kept in sync
# with Chromium's "delayloads" target from the //build/config/win/BUILD.gn file.
/DELAYLOAD:api-ms-win-core-winrt-error-l1-1-0.dll
/DELAYLOAD:api-ms-win-core-winrt-l1-1-0.dll
/DELAYLOAD:api-ms-win-core-winrt-string-l1-1-0.dll
/DELAYLOAD:advapi32.dll
/DELAYLOAD:comctl32.dll
/DELAYLOAD:comdlg32.dll
/DELAYLOAD:credui.dll
/DELAYLOAD:cryptui.dll
/DELAYLOAD:d3d11.dll
/DELAYLOAD:d3d9.dll
/DELAYLOAD:dwmapi.dll
/DELAYLOAD:dxgi.dll
/DELAYLOAD:dxva2.dll
/DELAYLOAD:esent.dll
/DELAYLOAD:gdi32.dll
/DELAYLOAD:hid.dll
/DELAYLOAD:imagehlp.dll
/DELAYLOAD:imm32.dll
/DELAYLOAD:msi.dll
/DELAYLOAD:netapi32.dll
/DELAYLOAD:ncrypt.dll
/DELAYLOAD:ole32.dll
/DELAYLOAD:oleacc.dll
/DELAYLOAD:propsys.dll
/DELAYLOAD:psapi.dll
/DELAYLOAD:rpcrt4.dll
/DELAYLOAD:rstrtmgr.dll
/DELAYLOAD:setupapi.dll
/DELAYLOAD:shell32.dll
/DELAYLOAD:shlwapi.dll
/DELAYLOAD:uiautomationcore.dll
/DELAYLOAD:urlmon.dll
/DELAYLOAD:user32.dll
/DELAYLOAD:usp10.dll
/DELAYLOAD:uxtheme.dll
/DELAYLOAD:wer.dll
/DELAYLOAD:wevtapi.dll
/DELAYLOAD:wininet.dll
/DELAYLOAD:winusb.dll
/DELAYLOAD:wsock32.dll
/DELAYLOAD:wtsapi32.dll
) )
list(APPEND CEF_COMPILER_DEFINES list(APPEND CEF_COMPILER_DEFINES
WIN32 _WIN32 _WINDOWS # Windows platform WIN32 _WIN32 _WINDOWS # Windows platform