Title: [218676] trunk/Source/WebKit2
Revision
218676
Author
[email protected]
Date
2017-06-21 19:44:13 -0700 (Wed, 21 Jun 2017)

Log Message

Add release assertions help diagnose a hang in CallbackMap
https://bugs.webkit.org/show_bug.cgi?id=173680
<rdar://problem/32911286>

Reviewed by Chris Dumez.

Assert that these functions are only called in the main thread and the empty value is never used as a key.

* UIProcess/GenericCallback.h:
(WebKit::CallbackMap::put):
(WebKit::CallbackMap::take):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (218675 => 218676)


--- trunk/Source/WebKit2/ChangeLog	2017-06-22 02:24:09 UTC (rev 218675)
+++ trunk/Source/WebKit2/ChangeLog	2017-06-22 02:44:13 UTC (rev 218676)
@@ -1,3 +1,17 @@
+2017-06-21  Ryosuke Niwa  <[email protected]>
+
+        Add release assertions help diagnose a hang in CallbackMap
+        https://bugs.webkit.org/show_bug.cgi?id=173680
+        <rdar://problem/32911286>
+
+        Reviewed by Chris Dumez.
+
+        Assert that these functions are only called in the main thread and the empty value is never used as a key.
+
+        * UIProcess/GenericCallback.h:
+        (WebKit::CallbackMap::put):
+        (WebKit::CallbackMap::take):
+
 2017-06-21  Wenson Hsieh  <[email protected]>
 
         [iOS DnD] [WK2] Cancelling a drag interaction using the ObjC SPI causes subsequent dragging to fail

Modified: trunk/Source/WebKit2/UIProcess/GenericCallback.h (218675 => 218676)


--- trunk/Source/WebKit2/UIProcess/GenericCallback.h	2017-06-22 02:24:09 UTC (rev 218675)
+++ trunk/Source/WebKit2/UIProcess/GenericCallback.h	2017-06-22 02:44:13 UTC (rev 218676)
@@ -32,6 +32,7 @@
 #include "WKAPICast.h"
 #include <wtf/Function.h>
 #include <wtf/HashMap.h>
+#include <wtf/MainThread.h>
 #include <wtf/RefCounted.h>
 #include <wtf/RunLoop.h>
 
@@ -171,9 +172,10 @@
 public:
     uint64_t put(Ref<CallbackBase>&& callback)
     {
-        ASSERT(!m_map.contains(callback->callbackID()));
-
+        RELEASE_ASSERT(isMainThread());
         uint64_t callbackID = callback->callbackID();
+        RELEASE_ASSERT(callbackID);
+        RELEASE_ASSERT(!m_map.contains(callbackID));
         m_map.set(callbackID, WTFMove(callback));
         return callbackID;
     }
@@ -198,6 +200,8 @@
     template<class T>
     RefPtr<T> take(uint64_t callbackID)
     {
+        RELEASE_ASSERT(callbackID);
+        RELEASE_ASSERT(isMainThread());
         auto base = m_map.take(callbackID);
         if (!base)
             return nullptr;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to