Title: [263572] trunk/Source/WebCore
Revision
263572
Author
[email protected]
Date
2020-06-26 12:20:06 -0700 (Fri, 26 Jun 2020)

Log Message

Access to AXIsolatedTree:m_readerThreadNodeMap should happen only on the secondary AX thread.
https://bugs.webkit.org/show_bug.cgi?id=213575

Reviewed by Chris Fleizach.

After calling AXObjectCache::initializeSecondaryAXThread, there may
still be some client requests coming in on the main thread. Thus
AXIsolatedTree::applyPendingchanges and nodeForID can be called on the
main thread. Since these two methods access the member variable
m_readerThreadNodeMap which should be accessed only on the secondary AX
thread, we now check for this condition and bail out if needed.

* accessibility/isolatedtree/AXIsolatedTree.cpp:
(WebCore::AXIsolatedTree::nodeForID const):
(WebCore::AXIsolatedTree::applyPendingChanges):
* accessibility/isolatedtree/AXIsolatedTree.h: Reordered private methods
above member variables to comply with WebKit coding conventions,
pointed out by Darin Adler in review for https://bugs.webkit.org/show_bug.cgi?id=213435.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (263571 => 263572)


--- trunk/Source/WebCore/ChangeLog	2020-06-26 18:07:35 UTC (rev 263571)
+++ trunk/Source/WebCore/ChangeLog	2020-06-26 19:20:06 UTC (rev 263572)
@@ -1,5 +1,26 @@
 2020-06-26  Andres Gonzalez  <[email protected]>
 
+        Access to AXIsolatedTree:m_readerThreadNodeMap should happen only on the secondary AX thread.
+        https://bugs.webkit.org/show_bug.cgi?id=213575
+
+        Reviewed by Chris Fleizach.
+
+        After calling AXObjectCache::initializeSecondaryAXThread, there may
+        still be some client requests coming in on the main thread. Thus
+        AXIsolatedTree::applyPendingchanges and nodeForID can be called on the
+        main thread. Since these two methods access the member variable
+        m_readerThreadNodeMap which should be accessed only on the secondary AX
+        thread, we now check for this condition and bail out if needed.
+
+        * accessibility/isolatedtree/AXIsolatedTree.cpp:
+        (WebCore::AXIsolatedTree::nodeForID const):
+        (WebCore::AXIsolatedTree::applyPendingChanges):
+        * accessibility/isolatedtree/AXIsolatedTree.h: Reordered private methods
+        above member variables to comply with WebKit coding conventions,
+        pointed out by Darin Adler in review for https://bugs.webkit.org/show_bug.cgi?id=213435.
+
+2020-06-26  Andres Gonzalez  <[email protected]>
+
         Fix for crash in accessibility/roles-exposed.html in isolated tree mode.
         https://bugs.webkit.org/show_bug.cgi?id=213648
 

Modified: trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp (263571 => 263572)


--- trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp	2020-06-26 18:07:35 UTC (rev 263571)
+++ trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp	2020-06-26 19:20:06 UTC (rev 263572)
@@ -140,10 +140,10 @@
 
 RefPtr<AXIsolatedObject> AXIsolatedTree::nodeForID(AXID axID) const
 {
-    // FIXME: The following ASSERT should be met but it is commented out at the
-    // moment because of <rdar://problem/63985646> After calling _AXUIElementUseSecondaryAXThread(true),
-    // still receives client request on main thread.
-    // ASSERT(axObjectCache()->canUseSecondaryAXThread() ? !isMainThread() : isMainThread());
+    // In isolated tree mode 2, only access m_readerThreadNodeMap on the AX thread.
+    if (axObjectCache()->canUseSecondaryAXThread() && isMainThread())
+        return nullptr;
+
     return axID != InvalidAXID ? m_readerThreadNodeMap.get(axID) : nullptr;
 }
 
@@ -393,6 +393,11 @@
 void AXIsolatedTree::applyPendingChanges()
 {
     AXTRACE("AXIsolatedTree::applyPendingChanges");
+
+    // In isolated tree mode 2, only apply pending changes on the AX thread.
+    if (axObjectCache()->canUseSecondaryAXThread() && isMainThread())
+        return;
+
     LockHolder locker { m_changeLogLock };
 
     AXLOG(makeString("focusedNodeID ", m_focusedNodeID, " pendingFocusedNodeID ", m_pendingFocusedNodeID));

Modified: trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.h (263571 => 263572)


--- trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.h	2020-06-26 18:07:35 UTC (rev 263571)
+++ trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.h	2020-06-26 19:20:06 UTC (rev 263572)
@@ -98,7 +98,6 @@
     AXIsolatedTree();
     void clear();
 
-    AXIsolatedTreeID m_treeID;
     static HashMap<AXIsolatedTreeID, Ref<AXIsolatedTree>>& treeIDCache();
     static HashMap<PageIdentifier, Ref<AXIsolatedTree>>& treePageCache();
 
@@ -106,7 +105,10 @@
     Ref<AXIsolatedObject> createSubtree(AXCoreObject&, AXID parentID, bool attachWrapper, Vector<NodeChange>&);
     // Queues all pending additions to the tree as the result of a subtree generation.
     void appendNodeChanges(Vector<NodeChange>&&);
+    // Called on main thread to update both m_nodeMap and m_pendingChildrenUpdates.
+    void updateChildrenIDs(AXID axID, Vector<AXID>&& childrenIDs);
 
+    AXIsolatedTreeID m_treeID;
     AXObjectCache* m_axObjectCache { nullptr };
 
     // Only accessed on main thread.
@@ -123,9 +125,6 @@
     AXID m_pendingFocusedNodeID { InvalidAXID };
     AXID m_focusedNodeID { InvalidAXID };
     Lock m_changeLogLock;
-
-    // Called on main thread to updates both m_nodeMap and m_pendingChildrenUpdates.
-    void updateChildrenIDs(AXID axID, Vector<AXID>&& childrenIDs);
 };
 
 } // namespace WebCore
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to