Title: [261300] trunk/Source/WebCore
Revision
261300
Author
[email protected]
Date
2020-05-07 09:51:00 -0700 (Thu, 07 May 2020)

Log Message

Make debug build run in accessibility isolated tree mode = 1.
https://bugs.webkit.org/show_bug.cgi?id=211567

Reviewed by Chris Fleizach.

- Removed several unnecessary ASSERTs that prevent debug builds to run
in isolated tree mode = 1, i.e., isolated tree mode on main thread.
- AXIsolatedObject::children and updateBackingStore need to be executed
on both threads.

* accessibility/isolatedtree/AXIsolatedObject.cpp:
(WebCore::AXIsolatedObject::detachRemoteParts):
(WebCore::AXIsolatedObject::children): Need to update the children
regardless of the thread in which it is invoked. Pending, must add a
lock to prevent thread collision.

(WebCore::AXIsolatedObject::updateBackingStore): Need to update the
backing store regardless of the thread in whhich it is invoked.

* accessibility/isolatedtree/AXIsolatedTree.cpp:
(WebCore::AXIsolatedTree::generateSubtree):
(WebCore::AXIsolatedTree::setRootNodeID):
* accessibility/mac/WebAccessibilityObjectWrapperBase.mm: Enable
isolated tree mode = 1.
(-[WebAccessibilityObjectWrapperBase detach]):
(-[WebAccessibilityObjectWrapperBase axBackingObject]):
* accessibility/mac/WebAccessibilityObjectWrapperMac.mm: Use makeString
instead of String concatenation as pointed out by Darin Adler in bug 210914.
(-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
(-[WebAccessibilityObjectWrapper accessibilityAttributeValue:forParameter:]):
(-[WebAccessibilityObjectWrapper accessibilityArrayAttributeValues:index:maxCount:]):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (261299 => 261300)


--- trunk/Source/WebCore/ChangeLog	2020-05-07 16:50:59 UTC (rev 261299)
+++ trunk/Source/WebCore/ChangeLog	2020-05-07 16:51:00 UTC (rev 261300)
@@ -1,3 +1,37 @@
+2020-05-07  Andres Gonzalez  <[email protected]>
+
+        Make debug build run in accessibility isolated tree mode = 1.
+        https://bugs.webkit.org/show_bug.cgi?id=211567
+
+        Reviewed by Chris Fleizach.
+
+        - Removed several unnecessary ASSERTs that prevent debug builds to run
+        in isolated tree mode = 1, i.e., isolated tree mode on main thread.
+        - AXIsolatedObject::children and updateBackingStore need to be executed
+        on both threads.
+
+        * accessibility/isolatedtree/AXIsolatedObject.cpp:
+        (WebCore::AXIsolatedObject::detachRemoteParts):
+        (WebCore::AXIsolatedObject::children): Need to update the children
+        regardless of the thread in which it is invoked. Pending, must add a
+        lock to prevent thread collision.
+
+        (WebCore::AXIsolatedObject::updateBackingStore): Need to update the
+        backing store regardless of the thread in whhich it is invoked.
+
+        * accessibility/isolatedtree/AXIsolatedTree.cpp:
+        (WebCore::AXIsolatedTree::generateSubtree):
+        (WebCore::AXIsolatedTree::setRootNodeID):
+        * accessibility/mac/WebAccessibilityObjectWrapperBase.mm: Enable
+        isolated tree mode = 1.
+        (-[WebAccessibilityObjectWrapperBase detach]):
+        (-[WebAccessibilityObjectWrapperBase axBackingObject]):
+        * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: Use makeString
+        instead of String concatenation as pointed out by Darin Adler in bug 210914.
+        (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
+        (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:forParameter:]):
+        (-[WebAccessibilityObjectWrapper accessibilityArrayAttributeValues:index:maxCount:]):
+
 2020-05-07  Zalan Bujtas  <[email protected]>
 
         [LFC][TFC] Set section [top, left] used position.

Modified: trunk/Source/WebCore/accessibility/AXObjectCache.cpp (261299 => 261300)


--- trunk/Source/WebCore/accessibility/AXObjectCache.cpp	2020-05-07 16:50:59 UTC (rev 261299)
+++ trunk/Source/WebCore/accessibility/AXObjectCache.cpp	2020-05-07 16:51:00 UTC (rev 261300)
@@ -3094,7 +3094,6 @@
     if (axFocus)
         tree->setFocusedNodeID(axFocus->objectID());
 
-    AXLOG(*tree);
     return makeRef(*tree);
 }
 
@@ -3108,7 +3107,6 @@
     auto tree = AXIsolatedTree::treeForPageID(*m_pageID);
     if (!tree)
         return;
-    AXLOG(*tree);
 
     switch (notification) {
     case AXCheckedStateChanged:
@@ -3121,7 +3119,6 @@
     default:
         break;
     }
-    AXLOG(*tree);
 }
 
 // FIXME: should be added to WTF::Vector.
@@ -3143,7 +3140,6 @@
     auto tree = AXIsolatedTree::treeForPageID(*m_pageID);
     if (!tree)
         return;
-    AXLOG(*tree);
 
     // Filter out multiple notifications for the same object. This avoids
     // updating the isolated tree multiple times unnecessarily.
@@ -3178,7 +3174,6 @@
             break;
         }
     }
-    AXLOG(*tree);
 }
 #endif
 

Modified: trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp (261299 => 261300)


--- trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp	2020-05-07 16:50:59 UTC (rev 261299)
+++ trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp	2020-05-07 16:51:00 UTC (rev 261300)
@@ -30,6 +30,10 @@
 
 #include "AXIsolatedTree.h"
 
+#if PLATFORM(COCOA)
+#include <pal/spi/cocoa/AccessibilitySupportSoftLink.h>
+#endif
+
 namespace WebCore {
 
 AXIsolatedObject::AXIsolatedObject(AXCoreObject& object, AXIsolatedTreeID treeID, AXID parentID)
@@ -455,9 +459,8 @@
     m_parentID = parent;
 }
 
-void AXIsolatedObject::detachRemoteParts(AccessibilityDetachmentType detachmentType)
+void AXIsolatedObject::detachRemoteParts(AccessibilityDetachmentType)
 {
-    ASSERT_UNUSED(detachmentType, isMainThread() ? detachmentType == AccessibilityDetachmentType::CacheDestroyed : detachmentType != AccessibilityDetachmentType::CacheDestroyed);
     for (const auto& childID : m_childrenIDs) {
         if (auto child = tree()->nodeForID(childID))
             child->detachFromParent();
@@ -478,13 +481,13 @@
 
 const AXCoreObject::AccessibilityChildrenVector& AXIsolatedObject::children(bool)
 {
-    if (!isMainThread()) {
-        m_children.clear();
-        m_children.reserveInitialCapacity(m_childrenIDs.size());
-        for (const auto& childID : m_childrenIDs) {
-            if (auto child = tree()->nodeForID(childID))
-                m_children.uncheckedAppend(child);
-        }
+    ASSERT(_AXSIsolatedTreeModeFunctionIsAvailable() && ((_AXSIsolatedTreeMode_Soft() == AXSIsolatedTreeModeSecondaryThread && !isMainThread()) || (_AXSIsolatedTreeMode_Soft() == AXSIsolatedTreeModeMainThread && isMainThread())));
+    updateBackingStore();
+    m_children.clear();
+    m_children.reserveInitialCapacity(m_childrenIDs.size());
+    for (const auto& childID : m_childrenIDs) {
+        if (auto child = tree()->nodeForID(childID))
+            m_children.uncheckedAppend(child);
     }
     return m_children;
 }
@@ -859,12 +862,8 @@
 void AXIsolatedObject::updateBackingStore()
 {
     // This method can be called on either the main or the AX threads.
-    // It can be called in the main thread from [WebAccessibilityObjectWrapper accessibilityFocusedUIElement].
-    // Update the IsolatedTree only if it is called on the AX thread.
-    if (!isMainThread()) {
-        if (auto tree = this->tree())
-            tree->applyPendingChanges();
-    }
+    if (auto tree = this->tree())
+        tree->applyPendingChanges();
 }
 
 String AXIsolatedObject::stringForRange(RefPtr<Range> range) const

Modified: trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp (261299 => 261300)


--- trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp	2020-05-07 16:50:59 UTC (rev 261299)
+++ trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp	2020-05-07 16:51:00 UTC (rev 261300)
@@ -163,6 +163,7 @@
     ASSERT(isMainThread());
     Vector<NodeChange> nodeChanges;
     auto object = createSubtree(axObject, parentID, attachWrapper, nodeChanges);
+    LockHolder locker { m_changeLogLock };
     appendNodeChanges(nodeChanges);
 
     if (parentID == InvalidAXID)
@@ -286,7 +287,7 @@
 {
     AXTRACE("AXIsolatedTree::setRootNodeID");
     ASSERT(isMainThread());
-    LockHolder locker { m_changeLogLock };
+    ASSERT(m_changeLogLock.isLocked());
     m_rootNodeID = axID;
 }
 

Modified: trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperBase.mm (261299 => 261300)


--- trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperBase.mm	2020-05-07 16:50:59 UTC (rev 261299)
+++ trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperBase.mm	2020-05-07 16:51:00 UTC (rev 261300)
@@ -329,8 +329,7 @@
 {
     _identifier = InvalidAXID;
 #if ENABLE(ACCESSIBILITY_ISOLATED_TREE)
-    if (!isMainThread()) {
-        ASSERT(AXObjectCache::isIsolatedTreeEnabled());
+    if (AXObjectCache::isIsolatedTreeEnabled()) {
         [self detachIsolatedObject];
         return;
     }
@@ -368,10 +367,8 @@
 - (WebCore::AXCoreObject*)axBackingObject
 {
 #if ENABLE(ACCESSIBILITY_ISOLATED_TREE)
-    if (!isMainThread()) {
-        ASSERT(AXObjectCache::isIsolatedTreeEnabled());
+    if (AXObjectCache::isIsolatedTreeEnabled())
         return m_isolatedObject;
-    }
 #endif
     return m_axObject;
 }

Modified: trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm (261299 => 261300)


--- trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm	2020-05-07 16:50:59 UTC (rev 261299)
+++ trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm	2020-05-07 16:51:00 UTC (rev 261300)
@@ -2286,7 +2286,7 @@
 - (id)accessibilityAttributeValue:(NSString*)attributeName
 ALLOW_DEPRECATED_IMPLEMENTATIONS_END
 {
-    AXTRACE(String("WebAccessibilityObjectWrapper accessibilityAttributeValue:") + String(attributeName));
+    AXTRACE(makeString("WebAccessibilityObjectWrapper accessibilityAttributeValue:", String(attributeName)));
     auto* backingObject = self.updateObjectBackingStore;
     if (!backingObject) {
         AXLOG("No backingObject!!!");
@@ -3869,7 +3869,7 @@
 - (id)accessibilityAttributeValue:(NSString*)attribute forParameter:(id)parameter
 ALLOW_DEPRECATED_IMPLEMENTATIONS_END
 {
-    AXTRACE(String("WebAccessibilityObjectWrapper accessibilityAttributeValue:") + String(attribute));
+    AXTRACE(makeString("WebAccessibilityObjectWrapper accessibilityAttributeValue:", String(attribute)));
     auto* backingObject = self.updateObjectBackingStore;
     if (!backingObject)
         return nil;
@@ -4474,7 +4474,7 @@
 
 - (NSArray *)accessibilityArrayAttributeValues:(NSString *)attribute index:(NSUInteger)index maxCount:(NSUInteger)maxCount
 {
-    AXTRACE(String("WebAccessibilityObjectWrapper accessibilityArrayAttributeValue:") + String(attribute));
+    AXTRACE(makeString("WebAccessibilityObjectWrapper accessibilityArrayAttributeValue:", String(attribute)));
     auto* backingObject = self.updateObjectBackingStore;
     if (!backingObject)
         return nil;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to