Add entry hook mechanism and use it for Chromium helper processes

At least when using wxGTK Chromium helper process can't be executed once
GTK is initialized because doing this creates background threads and
Chromium code aborts if there are any threads running.

As we don't want to initialize CEF unconditionally before initializing
GTK in all applications (even those not using CEF), the only solution is
to detect if we need to run a Chromium helper process ourselves before
GTK initialization, i.e. before wxApp creation, which means that it
can't be done via the existing wxModule mechanism because modules are
initialized after creating the global application instance.

So add a way to hijack wxWidgets initialization entirely if some special
command line option (such as Chromium "--type=xxx") is specified and use
it in wxWebViewChromium to call CefExecuteProcess() before initializing
GTK or even wxWidgets itself -- as it won't be needed in a CEF helper
process anyhow.
This commit is contained in:
Vadim Zeitlin 2023-09-02 23:05:12 +02:00
parent 89987807df
commit d3cc4678d5
4 changed files with 105 additions and 21 deletions

View file

@ -51,6 +51,11 @@
setting wxUSE_WEBVIEW_CHROMIUM equal to 1 in setup.h for Visual Studio
based builds.
When running applications using wxWebViewChromium, the command line option
`--type=xxx` is interpreted specially as it is used by CEF to launch helper
applications, so your program must not use this option for anything else.
__Microsoft Windows Platform__
Windows 7 or newer is required to run applications using wxWebViewChromium.