Title: [292611] trunk/Source/WebKit
Revision
292611
Author
simon.fra...@apple.com
Date
2022-04-08 10:48:53 -0700 (Fri, 08 Apr 2022)

Log Message

Have GPU Process call lowMemoryHandler() on each RemoteRenderingBackend
https://bugs.webkit.org/show_bug.cgi?id=238967

Reviewed by Tim Horton.

Hook up RemoteRenderingBackend::lowMemoryHandler(), which doesn't do anything yet,
but will clear the IOSurface pool.

* GPUProcess/GPUConnectionToWebProcess.cpp:
(WebKit::GPUConnectionToWebProcess::lowMemoryHandler):
* GPUProcess/GPUConnectionToWebProcess.h:
* GPUProcess/GPUProcess.cpp:
(WebKit::GPUProcess::lowMemoryHandler):
* GPUProcess/graphics/RemoteRenderingBackend.cpp:
(WebKit::RemoteRenderingBackend::lowMemoryHandler):
* GPUProcess/graphics/RemoteRenderingBackend.h:

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (292610 => 292611)


--- trunk/Source/WebKit/ChangeLog	2022-04-08 17:48:41 UTC (rev 292610)
+++ trunk/Source/WebKit/ChangeLog	2022-04-08 17:48:53 UTC (rev 292611)
@@ -1,3 +1,22 @@
+2022-04-08  Simon Fraser  <simon.fra...@apple.com>
+
+        Have GPU Process call lowMemoryHandler() on each RemoteRenderingBackend
+        https://bugs.webkit.org/show_bug.cgi?id=238967
+
+        Reviewed by Tim Horton.
+
+        Hook up RemoteRenderingBackend::lowMemoryHandler(), which doesn't do anything yet,
+        but will clear the IOSurface pool.
+
+        * GPUProcess/GPUConnectionToWebProcess.cpp:
+        (WebKit::GPUConnectionToWebProcess::lowMemoryHandler):
+        * GPUProcess/GPUConnectionToWebProcess.h:
+        * GPUProcess/GPUProcess.cpp:
+        (WebKit::GPUProcess::lowMemoryHandler):
+        * GPUProcess/graphics/RemoteRenderingBackend.cpp:
+        (WebKit::RemoteRenderingBackend::lowMemoryHandler):
+        * GPUProcess/graphics/RemoteRenderingBackend.h:
+
 2022-04-08  Carlos Garcia Campos  <cgar...@igalia.com>
 
         [GTK] RemoteInspector: update target list page contents on change instead of reloading

Modified: trunk/Source/WebKit/GPUProcess/GPUConnectionToWebProcess.cpp (292610 => 292611)


--- trunk/Source/WebKit/GPUProcess/GPUConnectionToWebProcess.cpp	2022-04-08 17:48:41 UTC (rev 292610)
+++ trunk/Source/WebKit/GPUProcess/GPUConnectionToWebProcess.cpp	2022-04-08 17:48:53 UTC (rev 292611)
@@ -453,6 +453,12 @@
     gpuProcess().parentProcessConnection()->send(Messages::GPUProcessProxy::TerminateWebProcess(m_webProcessIdentifier), 0);
 }
 
+void GPUConnectionToWebProcess::lowMemoryHandler(Critical critical, Synchronous synchronous)
+{
+    for (auto& remoteRenderingBackend : m_remoteRenderingBackendMap.values())
+        remoteRenderingBackend->lowMemoryHandler(critical, synchronous);
+}
+
 #if ENABLE(WEB_AUDIO)
 RemoteAudioDestinationManager& GPUConnectionToWebProcess::remoteAudioDestinationManager()
 {

Modified: trunk/Source/WebKit/GPUProcess/GPUConnectionToWebProcess.h (292610 => 292611)


--- trunk/Source/WebKit/GPUProcess/GPUConnectionToWebProcess.h	2022-04-08 17:48:41 UTC (rev 292610)
+++ trunk/Source/WebKit/GPUProcess/GPUConnectionToWebProcess.h	2022-04-08 17:48:53 UTC (rev 292611)
@@ -68,6 +68,11 @@
 #include "IPCTester.h"
 #endif
 
+namespace WTF {
+enum class Critical : bool;
+enum class Synchronous : bool;
+}
+
 namespace WebCore {
 class SecurityOrigin;
 struct SecurityOriginData;
@@ -188,8 +193,10 @@
     void updateSupportedRemoteCommands();
 
     bool allowsExitUnderMemoryPressure() const;
+    void terminateWebProcess();
 
-    void terminateWebProcess();
+    void lowMemoryHandler(WTF::Critical, WTF::Synchronous);
+
 #if ENABLE(WEBGL)
     void releaseGraphicsContextGLForTesting(GraphicsContextGLIdentifier);
 #endif

Modified: trunk/Source/WebKit/GPUProcess/GPUProcess.cpp (292610 => 292611)


--- trunk/Source/WebKit/GPUProcess/GPUProcess.cpp	2022-04-08 17:48:41 UTC (rev 292610)
+++ trunk/Source/WebKit/GPUProcess/GPUProcess.cpp	2022-04-08 17:48:53 UTC (rev 292611)
@@ -215,6 +215,9 @@
     RELEASE_LOG(Process, "GPUProcess::lowMemoryHandler: critical=%d, synchronous=%d", critical == Critical::Yes, synchronous == Synchronous::Yes);
     tryExitIfUnused();
 
+    for (auto& connection : m_webProcessConnections.values())
+        connection->lowMemoryHandler(critical, synchronous);
+
     WebCore::releaseGraphicsMemory(critical, synchronous);
 }
 

Modified: trunk/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.cpp (292610 => 292611)


--- trunk/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.cpp	2022-04-08 17:48:41 UTC (rev 292610)
+++ trunk/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.cpp	2022-04-08 17:48:53 UTC (rev 292611)
@@ -540,6 +540,12 @@
     });
 }
 
+void RemoteRenderingBackend::lowMemoryHandler(Critical, Synchronous)
+{
+    ASSERT(isMainRunLoop());
+    // This will clear the IOSurfacePool.
+}
+
 } // namespace WebKit
 
 #endif // ENABLE(GPU_PROCESS)

Modified: trunk/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.h (292610 => 292611)


--- trunk/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.h	2022-04-08 17:48:41 UTC (rev 292610)
+++ trunk/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.h	2022-04-08 17:48:53 UTC (rev 292611)
@@ -48,8 +48,12 @@
 #include <WebCore/ProcessIdentity.h>
 #include <wtf/WeakPtr.h>
 
+namespace WTF {
+enum class Critical : bool;
+enum class Synchronous : bool;
+}
+
 namespace WebCore {
-
 class DestinationColorSpace;
 class FloatSize;
 class MediaPlayer;
@@ -56,7 +60,6 @@
 class NativeImage;
 
 enum class RenderingMode : bool;
-
 }
 
 namespace IPC {
@@ -95,6 +98,8 @@
     IPC::StreamServerConnection& streamConnection() const { return m_streamConnection.get(); }
     void performWithMediaPlayerOnMainThread(WebCore::MediaPlayerIdentifier, Function<void(WebCore::MediaPlayer&)>&&);
 
+    void lowMemoryHandler(WTF::Critical, WTF::Synchronous);
+
 private:
     RemoteRenderingBackend(GPUConnectionToWebProcess&, RemoteRenderingBackendCreationParameters&&, IPC::StreamConnectionBuffer&&);
     void startListeningForIPC();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to