Split UI thread shutdown into before and after stages (see #3609)

Existing UI thread shutdown tasks need to be executed before the UI
thread RunLoop is terminated. Those tasks have now been moved to
CefMainRunner::StartShutdownOnUIThread and FinishShutdownOnUIThread is
now called after the RunLoop is terminated.

This fixes a shutdown crash in ChromeProcessSingleton::DeleteInstance.
DeleteInstance needs to be called on the UI thread near the end of the
shutdown process (after ChromeProcessSingleton::Cleanup is called via
PostMainMessageLoopRun).
This commit is contained in:
Marshall Greenblatt
2023-12-11 15:36:56 -05:00
parent 80c65f25a3
commit 262a93b2f7
7 changed files with 77 additions and 60 deletions

View File

@@ -37,6 +37,7 @@ class ChromeMainRunnerDelegate : public CefMainRunnerDelegate {
void BeforeMainMessageLoopRun(base::RunLoop* run_loop) override;
bool HandleMainMessageLoopQuit() override;
void BeforeUIThreadInitialize() override;
void BeforeUIThreadShutdown() override;
void AfterUIThreadShutdown() override;
void BeforeExecuteProcess(const CefMainArgs& args) override;
void AfterExecuteProcess() override;
@@ -50,6 +51,8 @@ class ChromeMainRunnerDelegate : public CefMainRunnerDelegate {
CefMainRunnerHandler* const runner_;
CefSettings* const settings_;
CefRefPtr<CefApp> application_;
bool multi_threaded_message_loop_ = false;
};
#endif // CEF_LIBCEF_COMMON_CHROME_CHROME_MAIN_RUNNER_DELEGATE_CEF_