Title: [277151] trunk/Source/WebKit
Revision
277151
Author
[email protected]
Date
2021-05-06 18:48:53 -0700 (Thu, 06 May 2021)

Log Message

Retry asynchronously in WebProcessPool::getGPUProcessConnection() in case of failure
https://bugs.webkit.org/show_bug.cgi?id=225486

Reviewed by Alex Christensen.

Retry asynchronously in WebProcessPool::getGPUProcessConnection(), similarly to what
we do in WebsiteDataStore::getNetworkProcessConnection(). As a result, we no longer
need to ref the WebProcessPool in the lambda and we avoid retrying unnecessarily
when the WebProcessPool is getting destroyed.

* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::getGPUProcessConnection):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (277150 => 277151)


--- trunk/Source/WebKit/ChangeLog	2021-05-07 01:38:42 UTC (rev 277150)
+++ trunk/Source/WebKit/ChangeLog	2021-05-07 01:48:53 UTC (rev 277151)
@@ -1,3 +1,18 @@
+2021-05-06  Chris Dumez  <[email protected]>
+
+        Retry asynchronously in WebProcessPool::getGPUProcessConnection() in case of failure
+        https://bugs.webkit.org/show_bug.cgi?id=225486
+
+        Reviewed by Alex Christensen.
+
+        Retry asynchronously in WebProcessPool::getGPUProcessConnection(), similarly to what
+        we do in WebsiteDataStore::getNetworkProcessConnection(). As a result, we no longer
+        need to ref the WebProcessPool in the lambda and we avoid retrying unnecessarily
+        when the WebProcessPool is getting destroyed.
+
+        * UIProcess/WebProcessPool.cpp:
+        (WebKit::WebProcessPool::getGPUProcessConnection):
+
 2021-05-06  Eric Carlson  <[email protected]>
 
         [GPUP] Reduce MediaPlayer polling frequency when possible

Modified: trunk/Source/WebKit/UIProcess/WebProcessPool.cpp (277150 => 277151)


--- trunk/Source/WebKit/UIProcess/WebProcessPool.cpp	2021-05-07 01:38:42 UTC (rev 277150)
+++ trunk/Source/WebKit/UIProcess/WebProcessPool.cpp	2021-05-07 01:48:53 UTC (rev 277151)
@@ -527,10 +527,16 @@
 #if ENABLE(IPC_TESTING_API)
     parameters.ignoreInvalidMessageForTesting = webProcessProxy.ignoreInvalidMessageForTesting();
 #endif
-    ensureGPUProcess().getGPUProcessConnection(webProcessProxy, parameters, [this, protectedThis = makeRef(*this), parameters, webProcessProxy = makeWeakPtr(webProcessProxy), reply = WTFMove(reply)] (auto& connectionInfo) mutable {
-        if (UNLIKELY(!IPC::Connection::identifierIsValid(connectionInfo.identifier()) && webProcessProxy)) {
-            WEBPROCESSPOOL_RELEASE_LOG_ERROR(Process, "getGPUProcessConnection: Failed first attempt, retrying");
-            ensureGPUProcess().getGPUProcessConnection(*webProcessProxy, parameters, WTFMove(reply));
+    ensureGPUProcess().getGPUProcessConnection(webProcessProxy, parameters, [this, weakThis = makeWeakPtr(*this), parameters, webProcessProxy = makeWeakPtr(webProcessProxy), reply = WTFMove(reply)] (auto& connectionInfo) mutable {
+        if (UNLIKELY(!IPC::Connection::identifierIsValid(connectionInfo.identifier()))) {
+            // Retry on the next RunLoop iteration because we may be inside the WebProcessPool destructor.
+            RunLoop::main().dispatch([this, weakThis = WTFMove(weakThis), webProcessProxy = WTFMove(webProcessProxy), parameters = WTFMove(parameters), reply = WTFMove(reply)] () mutable {
+                if (weakThis && webProcessProxy) {
+                    WEBPROCESSPOOL_RELEASE_LOG_ERROR(Process, "getGPUProcessConnection: Failed first attempt, retrying");
+                    ensureGPUProcess().getGPUProcessConnection(*webProcessProxy, parameters, WTFMove(reply));
+                } else
+                    reply({ });
+            });
             return;
         }
         reply(connectionInfo);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to