[webkit-changes] [WebKit/WebKit] bd2128: AX: Remove redundant AXObjectCache::m_idsInUse Has...

Tyler Wilcock noreply at github.com
Thu Nov 21 14:43:41 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: bd2128d85acf5e768fe6bcdb677455a924592ccd
      https://github.com/WebKit/WebKit/commit/bd2128d85acf5e768fe6bcdb677455a924592ccd
  Author: Tyler Wilcock <tyler_w at apple.com>
  Date:   2024-11-21 (Thu, 21 Nov 2024)

  Changed paths:
    M Source/WebCore/accessibility/AXObjectCache.cpp
    M Source/WebCore/accessibility/AXObjectCache.h

  Log Message:
  -----------
  AX: Remove redundant AXObjectCache::m_idsInUse HashSet
https://bugs.webkit.org/show_bug.cgi?id=283461
rdar://140319280

Reviewed by Chris Fleizach.

AXObjectCache::m_idsInUse is currently used in two ways:

  1. AXObjectCache::generateNewObjectID, to ensure we don't generate an
     object ID that already belongs to some existing object

  2. In AXObjectCache::visiblePositionForTextMarkerData to ensure that
     when we reconstitute a text marker given to us by an AT, that the
     object still exists (i.e. wasn't destroyed between when we handed
     off the text marker and when the AT gave it back to us).

Point 1 is completely unnecessary. ObjectIdentifier::generate() inherently does not generate duplicate IDs.

Point 2 can be handled simply by checking whether AXObjectCache::objectForID returns a non-null object, which leans on
data structure: HashMap<AXID, Ref<AccessibilityObject>> m_objects.

Removing AXObjectCache::m_idsInUse saves 17mb of memory on https://html.spec.whatwg.org and makes object creation
and deletion more efficient.

* Source/WebCore/accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::createObjectFromRenderer):
(WebCore::AXObjectCache::createFromNode):
(WebCore::AXObjectCache::getOrCreate):
(WebCore::AXObjectCache::create):
(WebCore::AXObjectCache::remove):
(WebCore::AXObjectCache::visiblePositionForTextMarkerData):
(WebCore::AXObjectCache::generateNewObjectID): Deleted.
* Source/WebCore/accessibility/AXObjectCache.h:

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



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


More information about the webkit-changes mailing list