Title: [290360] trunk/Source/WebKit
Revision
290360
Author
[email protected]
Date
2022-02-23 01:32:13 -0800 (Wed, 23 Feb 2022)

Log Message

[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):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (290359 => 290360)


--- trunk/Source/WebKit/ChangeLog	2022-02-23 09:28:47 UTC (rev 290359)
+++ trunk/Source/WebKit/ChangeLog	2022-02-23 09:32:13 UTC (rev 290360)
@@ -1,3 +1,21 @@
+2022-02-23  Pablo Saavedra  <[email protected]>
+
+        [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  <[email protected]>
 
         RemoteSampleBufferDisplayLayer::enqueueSample should not change media samples owned by its object heap

Modified: trunk/Source/WebKit/Shared/AuxiliaryProcess.cpp (290359 => 290360)


--- trunk/Source/WebKit/Shared/AuxiliaryProcess.cpp	2022-02-23 09:28:47 UTC (rev 290359)
+++ trunk/Source/WebKit/Shared/AuxiliaryProcess.cpp	2022-02-23 09:32:13 UTC (rev 290360)
@@ -60,7 +60,13 @@
 
 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)

Modified: trunk/Source/WebKit/WebProcess/WebProcess.cpp (290359 => 290360)


--- trunk/Source/WebKit/WebProcess/WebProcess.cpp	2022-02-23 09:28:47 UTC (rev 290359)
+++ trunk/Source/WebKit/WebProcess/WebProcess.cpp	2022-02-23 09:32:13 UTC (rev 290360)
@@ -257,6 +257,7 @@
 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 @@
     _exit(EXIT_SUCCESS);
 #endif
 }
+#endif
 
 WebProcess& WebProcess::singleton()
 {
@@ -359,9 +361,13 @@
 {
     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);

Modified: trunk/Source/WebKit/WebProcess/WebProcess.h (290359 => 290360)


--- trunk/Source/WebKit/WebProcess/WebProcess.h	2022-02-23 09:28:47 UTC (rev 290359)
+++ trunk/Source/WebKit/WebProcess/WebProcess.h	2022-02-23 09:32:13 UTC (rev 290360)
@@ -511,7 +511,7 @@
     bool shouldTerminate() override;
     void terminate() override;
 
-#if USE(APPKIT)
+#if USE(APPKIT) || PLATFORM(GTK) || PLATFORM(WPE)
     void stopRunLoop() override;
 #endif
 

Modified: trunk/Source/WebKit/WebProcess/glib/WebProcessGLib.cpp (290359 => 290360)


--- trunk/Source/WebKit/WebProcess/glib/WebProcessGLib.cpp	2022-02-23 09:28:47 UTC (rev 290359)
+++ trunk/Source/WebKit/WebProcess/glib/WebProcessGLib.cpp	2022-02-23 09:32:13 UTC (rev 290360)
@@ -72,6 +72,20 @@
 
 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);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to