Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 66f8c855f7326fb1177ca2da5da226e1f2e80958
      
https://github.com/WebKit/WebKit/commit/66f8c855f7326fb1177ca2da5da226e1f2e80958
  Author: Tyler Wilcock <[email protected]>
  Date:   2026-06-02 (Tue, 02 Jun 2026)

  Changed paths:
    M Source/WTF/wtf/PlatformEnable.h
    M Source/WebCore/PAL/pal/spi/mac/HIServicesSPI.h
    M Source/WebCore/PlatformMac.cmake
    M Source/WebCore/SourcesCocoa.txt
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    M Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp
    M Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.h
    A Source/WebCore/accessibility/isolatedtree/mac/AXIsolatedTreeMac.mm

  Log Message:
  -----------
  AX: Add mechanism to dispatch to the accessibility thread, and use it to 
implement a tree-warming optimization after the main-thread queues updates
https://bugs.webkit.org/show_bug.cgi?id=311837
rdar://174428134

Reviewed by Joshua Hoffman.

Add AXIsolatedTree::callOnAXThread / platformCallOnAXThread to dispatch
work to the AX secondary thread. On macOS, this is implemented via a new
HIServices API, _AXUIElementPerformBlockOnSecondaryAXThread, which
queues a block on the AX thread's run loop.

Use this to proactively apply pending isolated tree changes immediately
after processQueuedNodeUpdates() queues them, rather than waiting for
the next client request (e.g. from VoiceOver) to trigger
applyPendingChanges() via updateBackingStore(). This reduces latency
when clients query the tree, since changes are already applied.

An atomic flag (m_appliedOrApplyingMainThreadUpdate) ensures we don't
redundantly queue multiple applies — only the first
processQueuedNodeUpdates() after the previous apply dispatches a new
one. Subsequent calls are no-ops until the AX thread finishes applying
and resets the flag.

callOnAXThread returns an AXThreadDispatchResult enum so callers can
handle dispatch failures if needed. The warming callsite ignores the
result since it's purely an optimization.

New feature gated behind ENABLE(ACCESSIBILITY_THREAD_DISPATCHING).

* Source/WTF/wtf/PlatformEnable.h:
* Source/WebCore/PAL/pal/spi/mac/HIServicesSPI.h:
* Source/WebCore/PlatformMac.cmake:
* Source/WebCore/SourcesCocoa.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp:
(WebCore::AXIsolatedTree::takePendingChangesLocked):
(WebCore::AXIsolatedTree::processQueuedNodeUpdates):
(WebCore::AXIsolatedTree::callOnAXThread):
(WebCore::AXIsolatedTree::platformCallOnAXThread):
* Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.h:
* Source/WebCore/accessibility/isolatedtree/mac/AXIsolatedTreeMac.mm: Added.
(WebCore::AXIsolatedTree::platformCallOnAXThread):

Canonical link: https://commits.webkit.org/314368@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to