Skip to content
Permalink
Browse files
[GTK][WPE] PlatformDisplay::terminateEglDisplays() is never called
https://bugs.webkit.org/show_bug.cgi?id=217655

Stop the run loop for GTK and WPE to ensure a normal exit, since we need
atexit handlers to be called to cleanup resources like EGL displays.

Reviewed by Carlos Garcia Campos.

* Shared/AuxiliaryProcess.cpp:
(WebKit::AuxiliaryProcess::didClose):
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::initializeConnection):
* WebProcess/WebProcess.h:
* WebProcess/glib/WebProcessGLib.cpp:
(WebKit::WebProcess::stopRunLoop):



Canonical link: https://commits.webkit.org/247678@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@290360 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
psaavedra committed Feb 23, 2022
1 parent b20c9ff commit 28d9d62aa2662266c2d9cb0032b036a257c6c8ab
Showing 5 changed files with 45 additions and 1 deletion.
@@ -1,3 +1,21 @@
2022-02-23 Pablo Saavedra <psaavedra@igalia.com>

[GTK][WPE] PlatformDisplay::terminateEglDisplays() is never called
https://bugs.webkit.org/show_bug.cgi?id=217655

Stop the run loop for GTK and WPE to ensure a normal exit, since we need
atexit handlers to be called to cleanup resources like EGL displays.

Reviewed by Carlos Garcia Campos.

* Shared/AuxiliaryProcess.cpp:
(WebKit::AuxiliaryProcess::didClose):
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::initializeConnection):
* WebProcess/WebProcess.h:
* WebProcess/glib/WebProcessGLib.cpp:
(WebKit::WebProcess::stopRunLoop):

2022-02-23 Youenn Fablet <youenn@apple.com>

RemoteSampleBufferDisplayLayer::enqueueSample should not change media samples owned by its object heap
@@ -60,7 +60,13 @@ AuxiliaryProcess::~AuxiliaryProcess()

void AuxiliaryProcess::didClose(IPC::Connection&)
{
// Stop the run loop for GTK and WPE to ensure a normal exit, since we need
// atexit handlers to be called to cleanup resources like EGL displays.
#if PLATFORM(GTK) || PLATFORM(WPE)
stopRunLoop();
#else
_exit(EXIT_SUCCESS);
#endif
}

void AuxiliaryProcess::initialize(const AuxiliaryProcessInitializationParameters& parameters)
@@ -257,6 +257,7 @@ namespace WebKit {
using namespace JSC;
using namespace WebCore;

#if !PLATFORM(GTK) && !PLATFORM(WPE)
NO_RETURN static void callExit(IPC::Connection*)
{
#if OS(WINDOWS)
@@ -266,6 +267,7 @@ NO_RETURN static void callExit(IPC::Connection*)
_exit(EXIT_SUCCESS);
#endif
}
#endif

WebProcess& WebProcess::singleton()
{
@@ -359,9 +361,13 @@ void WebProcess::initializeConnection(IPC::Connection* connection)
{
AuxiliaryProcess::initializeConnection(connection);

// Do not call exit in background queue for GTK and WPE because we need to ensure
// atexit handlers are called in the main thread to cleanup resources like EGL displays.
#if !PLATFORM(GTK) && !PLATFORM(WPE)
// We call _exit() directly from the background queue in case the main thread is unresponsive
// and AuxiliaryProcess::didClose() does not get called.
connection->setDidCloseOnConnectionWorkQueueCallback(callExit);
#endif

#if !PLATFORM(GTK) && !PLATFORM(WPE) && !ENABLE(IPC_TESTING_API)
connection->setShouldExitOnSyncMessageSendFailure(true);
@@ -511,7 +511,7 @@ class WebProcess : public AuxiliaryProcess
bool shouldTerminate() override;
void terminate() override;

#if USE(APPKIT)
#if USE(APPKIT) || PLATFORM(GTK) || PLATFORM(WPE)
void stopRunLoop() override;
#endif

@@ -72,6 +72,20 @@ namespace WebKit {

using namespace WebCore;

void WebProcess::stopRunLoop()
{
// Pages are normally closed after Close message is received from the UI
// process, but it can happen that the connection is closed before the
// Close message is processed because the UI process close the socket
// right after sending the Close message. Close here any pending page to
// ensure the threaded compositor is invalidated and GL resources
// released (see https://bugs.webkit.org/show_bug.cgi?id=217655).
for (auto& webPage : copyToVector(m_pageMap.values()))
webPage->close();

AuxiliaryProcess::stopRunLoop();
}

void WebProcess::platformSetCacheModel(CacheModel cacheModel)
{
WebCore::MemoryCache::singleton().setDisabled(cacheModel == CacheModel::DocumentViewer);

0 comments on commit 28d9d62

Please sign in to comment.