Changeset 263572 in webkit


Ignore:
Timestamp:
Jun 26, 2020 12:20:06 PM (4 years ago)
Author:
Andres Gonzalez
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.

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r263571 r263572  
     12020-06-26  Andres Gonzalez  <andresg_22@apple.com>
     2
     3        Access to AXIsolatedTree:m_readerThreadNodeMap should happen only on the secondary AX thread.
     4        https://bugs.webkit.org/show_bug.cgi?id=213575
     5
     6        Reviewed by Chris Fleizach.
     7
     8        After calling AXObjectCache::initializeSecondaryAXThread, there may
     9        still be some client requests coming in on the main thread. Thus
     10        AXIsolatedTree::applyPendingchanges and nodeForID can be called on the
     11        main thread. Since these two methods access the member variable
     12        m_readerThreadNodeMap which should be accessed only on the secondary AX
     13        thread, we now check for this condition and bail out if needed.
     14
     15        * accessibility/isolatedtree/AXIsolatedTree.cpp:
     16        (WebCore::AXIsolatedTree::nodeForID const):
     17        (WebCore::AXIsolatedTree::applyPendingChanges):
     18        * accessibility/isolatedtree/AXIsolatedTree.h: Reordered private methods
     19        above member variables to comply with WebKit coding conventions,
     20        pointed out by Darin Adler in review for https://bugs.webkit.org/show_bug.cgi?id=213435.
     21
    1222020-06-26  Andres Gonzalez  <andresg_22@apple.com>
    223
  • trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp

    r263571 r263572  
    141141RefPtr<AXIsolatedObject> AXIsolatedTree::nodeForID(AXID axID) const
    142142{
    143     // FIXME: The following ASSERT should be met but it is commented out at the
    144     // moment because of <rdar://problem/63985646> After calling _AXUIElementUseSecondaryAXThread(true),
    145     // still receives client request on main thread.
    146     // ASSERT(axObjectCache()->canUseSecondaryAXThread() ? !isMainThread() : isMainThread());
     143    // In isolated tree mode 2, only access m_readerThreadNodeMap on the AX thread.
     144    if (axObjectCache()->canUseSecondaryAXThread() && isMainThread())
     145        return nullptr;
     146
    147147    return axID != InvalidAXID ? m_readerThreadNodeMap.get(axID) : nullptr;
    148148}
     
    394394{
    395395    AXTRACE("AXIsolatedTree::applyPendingChanges");
     396
     397    // In isolated tree mode 2, only apply pending changes on the AX thread.
     398    if (axObjectCache()->canUseSecondaryAXThread() && isMainThread())
     399        return;
     400
    396401    LockHolder locker { m_changeLogLock };
    397402
  • trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.h

    r263378 r263572  
    9999    void clear();
    100100
    101     AXIsolatedTreeID m_treeID;
    102101    static HashMap<AXIsolatedTreeID, Ref<AXIsolatedTree>>& treeIDCache();
    103102    static HashMap<PageIdentifier, Ref<AXIsolatedTree>>& treePageCache();
     
    107106    // Queues all pending additions to the tree as the result of a subtree generation.
    108107    void appendNodeChanges(Vector<NodeChange>&&);
     108    // Called on main thread to update both m_nodeMap and m_pendingChildrenUpdates.
     109    void updateChildrenIDs(AXID axID, Vector<AXID>&& childrenIDs);
    109110
     111    AXIsolatedTreeID m_treeID;
    110112    AXObjectCache* m_axObjectCache { nullptr };
    111113
     
    124126    AXID m_focusedNodeID { InvalidAXID };
    125127    Lock m_changeLogLock;
    126 
    127     // Called on main thread to updates both m_nodeMap and m_pendingChildrenUpdates.
    128     void updateChildrenIDs(AXID axID, Vector<AXID>&& childrenIDs);
    129128};
    130129
Note: See TracChangeset for help on using the changeset viewer.