Title: [245767] trunk/Source/WebKit
Revision
245767
Author
[email protected]
Date
2019-05-24 18:39:19 -0700 (Fri, 24 May 2019)

Log Message

REGRESSION (r245715?) [WK2] Layout Test http/wpt/cache-storage/cache-storage-networkprocess-crash.html is a flaky failure
https://bugs.webkit.org/show_bug.cgi?id=198222
<rdar://problem/51114899>

Reviewed by Alex Christensen.

In case a connection gets closed, handle all of its async reply completion handlers.
This ensures they handlers are called in case the connection does not get destroyed until a much later stage.

* Platform/IPC/Connection.cpp:
(IPC::Connection::~Connection):
(IPC::Connection::connectionDidClose):
(IPC::addAsyncReplyHandler):
(IPC::clearAsyncReplyHandlers):
(IPC::CompletionHandler<void):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (245766 => 245767)


--- trunk/Source/WebKit/ChangeLog	2019-05-25 00:51:36 UTC (rev 245766)
+++ trunk/Source/WebKit/ChangeLog	2019-05-25 01:39:19 UTC (rev 245767)
@@ -1,3 +1,21 @@
+2019-05-24  Youenn Fablet  <[email protected]>
+
+        REGRESSION (r245715?) [WK2] Layout Test http/wpt/cache-storage/cache-storage-networkprocess-crash.html is a flaky failure
+        https://bugs.webkit.org/show_bug.cgi?id=198222
+        <rdar://problem/51114899>
+
+        Reviewed by Alex Christensen.
+
+        In case a connection gets closed, handle all of its async reply completion handlers.
+        This ensures they handlers are called in case the connection does not get destroyed until a much later stage.
+
+        * Platform/IPC/Connection.cpp:
+        (IPC::Connection::~Connection):
+        (IPC::Connection::connectionDidClose):
+        (IPC::addAsyncReplyHandler):
+        (IPC::clearAsyncReplyHandlers):
+        (IPC::CompletionHandler<void):
+
 2019-05-24  Per Arne Vollan  <[email protected]>
 
         Remove unused member in WebsiteDataRecord

Modified: trunk/Source/WebKit/Platform/IPC/Connection.cpp (245766 => 245767)


--- trunk/Source/WebKit/Platform/IPC/Connection.cpp	2019-05-25 00:51:36 UTC (rev 245766)
+++ trunk/Source/WebKit/Platform/IPC/Connection.cpp	2019-05-25 01:39:19 UTC (rev 245767)
@@ -242,7 +242,9 @@
     static NeverDestroyed<HashMap<uintptr_t, HashMap<uint64_t, CompletionHandler<void(Decoder*)>>>> map;
     return map.get();
 }
-    
+
+static void clearAsyncReplyHandlers(const Connection&);
+
 Connection::Connection(Identifier identifier, bool isServer, Client& client)
     : m_client(client)
     , m_uniqueID(UniqueID::generate())
@@ -277,12 +279,8 @@
     ASSERT(!isValid());
 
     allConnections().remove(m_uniqueID);
-    
-    auto map = asyncReplyHandlerMap().take(reinterpret_cast<uintptr_t>(this));
-    for (auto& handler : map.values()) {
-        if (handler)
-            handler(nullptr);
-    }
+
+    clearAsyncReplyHandlers(*this);
 }
 
 Connection* Connection::connection(UniqueID uniqueID)
@@ -849,6 +847,8 @@
         protectedThis->m_isValid = false;
 
         protectedThis->m_client.didClose(protectedThis.get());
+
+        clearAsyncReplyHandlers(protectedThis.get());
     });
 }
 
@@ -1139,6 +1139,15 @@
     ASSERT_UNUSED(result, result.isNewEntry);
 }
 
+void clearAsyncReplyHandlers(const Connection& connection)
+{
+    auto map = asyncReplyHandlerMap().take(reinterpret_cast<uintptr_t>(&connection));
+    for (auto& handler : map.values()) {
+        if (handler)
+            handler(nullptr);
+    }
+}
+
 CompletionHandler<void(Decoder*)> takeAsyncReplyHandler(Connection& connection, uint64_t identifier)
 {
     auto iterator = asyncReplyHandlerMap().find(reinterpret_cast<uintptr_t>(&connection));
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to