Title: [252832] trunk
Revision
252832
Author
[email protected]
Date
2019-11-23 08:16:33 -0800 (Sat, 23 Nov 2019)

Log Message

Run LayoutTests/accessibility/mac/primary-screen-height.html on secondary accessibility thread.
https://bugs.webkit.org/show_bug.cgi?id=204391

Reviewed by Chris Fleizach.

Source/WebCore:

LayoutTests/accessibility/mac/primary-screen-height.html tests this
change when isolated tree is enabled.

Use ASSERT(!isMainThread()) instead of HIServices call to detect
whether not running in the secondary thread during LayoutTests.

* accessibility/isolatedtree/AXIsolatedTreeNode.cpp:
(WebCore::AXIsolatedObject::children):
(WebCore::AXIsolatedObject::updateBackingStore):

Tools:

Added AccessibilityController::execute to execute any
AccessibilityUIElement call into AccessibilityObjectWrapper on the
secondary accessibility thread.

* WebKitTestRunner/InjectedBundle/AccessibilityController.cpp:
(WTR::AccessibilityController::rootElement): leftover from previous review.
(WTR::AccessibilityController::execute): added this to execute any AccessibilityUIElement method on the appropriate thread.
* WebKitTestRunner/InjectedBundle/AccessibilityController.h:
* WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:
(WTR::AccessibilityUIElement::getChildrenWithRange): Runs on secondary thread.
(WTR::AccessibilityUIElement::numberAttributeValue): Runs on secondary thread.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (252831 => 252832)


--- trunk/Source/WebCore/ChangeLog	2019-11-23 16:05:09 UTC (rev 252831)
+++ trunk/Source/WebCore/ChangeLog	2019-11-23 16:16:33 UTC (rev 252832)
@@ -1,3 +1,20 @@
+2019-11-23  Andres Gonzalez  <[email protected]>
+
+        Run LayoutTests/accessibility/mac/primary-screen-height.html on secondary accessibility thread.
+        https://bugs.webkit.org/show_bug.cgi?id=204391
+
+        Reviewed by Chris Fleizach.
+
+        LayoutTests/accessibility/mac/primary-screen-height.html tests this
+        change when isolated tree is enabled.
+
+        Use ASSERT(!isMainThread()) instead of HIServices call to detect
+        whether not running in the secondary thread during LayoutTests.
+
+        * accessibility/isolatedtree/AXIsolatedTreeNode.cpp:
+        (WebCore::AXIsolatedObject::children):
+        (WebCore::AXIsolatedObject::updateBackingStore):
+
 2019-11-23  Zalan Bujtas  <[email protected]>
 
         [LFC][IFC] Remove unnecessary Line::hasContent() calls in LineLayout::placeInlineItem

Modified: trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedTreeNode.cpp (252831 => 252832)


--- trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedTreeNode.cpp	2019-11-23 16:05:09 UTC (rev 252831)
+++ trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedTreeNode.cpp	2019-11-23 16:16:33 UTC (rev 252832)
@@ -30,8 +30,6 @@
 
 #include "AccessibilityObject.h"
 
-extern "C" bool _AXUIElementRequestServicedBySecondaryAXThread(void);
-
 namespace WebCore {
 
 AXIsolatedObject::AXIsolatedObject(AXCoreObject& object)
@@ -171,7 +169,8 @@
 
 const AXCoreObject::AccessibilityChildrenVector& AXIsolatedObject::children(bool)
 {
-    if (_AXUIElementRequestServicedBySecondaryAXThread()) {
+    ASSERT(!isMainThread());
+    if (!isMainThread()) {
         m_children.clear();
         m_children.reserveInitialCapacity(m_childrenIDs.size());
         auto tree = this->tree();
@@ -279,8 +278,8 @@
 
 void AXIsolatedObject::updateBackingStore()
 {
-    if (_AXUIElementRequestServicedBySecondaryAXThread()) {
-        RELEASE_ASSERT(!isMainThread());
+    ASSERT(!isMainThread());
+    if (!isMainThread()) {
         if (auto tree = this->tree())
             tree->applyPendingChanges();
     }

Modified: trunk/Tools/ChangeLog (252831 => 252832)


--- trunk/Tools/ChangeLog	2019-11-23 16:05:09 UTC (rev 252831)
+++ trunk/Tools/ChangeLog	2019-11-23 16:16:33 UTC (rev 252832)
@@ -1,3 +1,22 @@
+2019-11-23  Andres Gonzalez  <[email protected]>
+
+        Run LayoutTests/accessibility/mac/primary-screen-height.html on secondary accessibility thread.
+        https://bugs.webkit.org/show_bug.cgi?id=204391
+
+        Reviewed by Chris Fleizach.
+
+        Added AccessibilityController::execute to execute any
+        AccessibilityUIElement call into AccessibilityObjectWrapper on the
+        secondary accessibility thread.
+
+        * WebKitTestRunner/InjectedBundle/AccessibilityController.cpp:
+        (WTR::AccessibilityController::rootElement): leftover from previous review.
+        (WTR::AccessibilityController::execute): added this to execute any AccessibilityUIElement method on the appropriate thread.
+        * WebKitTestRunner/InjectedBundle/AccessibilityController.h:
+        * WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:
+        (WTR::AccessibilityUIElement::getChildrenWithRange): Runs on secondary thread.
+        (WTR::AccessibilityUIElement::numberAttributeValue): Runs on secondary thread.
+
 2019-11-22  Per Arne Vollan  <[email protected]>
 
         Set 64-bit as default architecture on Windows

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityController.cpp (252831 => 252832)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityController.cpp	2019-11-23 16:05:09 UTC (rev 252831)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityController.cpp	2019-11-23 16:16:33 UTC (rev 252832)
@@ -88,10 +88,9 @@
     } else {
         root = static_cast<PlatformUIElement>(WKAccessibilityRootObject(page));
 
-        if (WKAccessibilityCanUseSecondaryAXThread(page)) {
-            // Set m_useAXThread to true for next request.
+        // Set m_useAXThread to true for next request.
+        if (WKAccessibilityCanUseSecondaryAXThread(page))
             m_useAXThread = true;
-        }
     }
 
     return AccessibilityUIElement::create(root);
@@ -104,6 +103,19 @@
     
     return AccessibilityUIElement::create(static_cast<PlatformUIElement>(root));    
 }
+
+void AccessibilityController::execute(Function<void()>&& function)
+{
+    if (m_useAXThread) {
+        AXThread::dispatch([&function, this] {
+            function();
+            m_semaphore.signal();
+        });
+
+        m_semaphore.wait();
+    } else
+        function();
+}
 #endif
 
 RefPtr<AccessibilityUIElement> AccessibilityController::elementAtPoint(int x, int y)

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityController.h (252831 => 252832)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityController.h	2019-11-23 16:05:09 UTC (rev 252831)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityController.h	2019-11-23 16:16:33 UTC (rev 252832)
@@ -62,6 +62,10 @@
     RefPtr<AccessibilityUIElement> elementAtPoint(int x, int y);
     RefPtr<AccessibilityUIElement> accessibleElementById(JSStringRef idAttribute);
 
+#if PLATFORM(COCOA)
+    void execute(Function<void()>&&);
+#endif
+
     bool addNotificationListener(JSValueRef functionCallback);
     bool removeNotificationListener();
 

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm (252831 => 252832)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm	2019-11-23 16:05:09 UTC (rev 252831)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm	2019-11-23 16:16:33 UTC (rev 252832)
@@ -370,8 +370,11 @@
 void AccessibilityUIElement::getChildrenWithRange(Vector<RefPtr<AccessibilityUIElement> >& elementVector, unsigned location, unsigned length)
 {
     BEGIN_AX_OBJC_EXCEPTIONS
-    NSArray* children = [m_element accessibilityArrayAttributeValues:NSAccessibilityChildrenAttribute index:location maxCount:length];
-    elementVector = convertNSArrayToVector<RefPtr<AccessibilityUIElement>>(children);
+    auto accessibilityController = InjectedBundle::singleton().accessibilityController();
+    accessibilityController->execute([&elementVector, location, length, this] {
+        NSArray* children = [m_element accessibilityArrayAttributeValues:NSAccessibilityChildrenAttribute index:location maxCount:length];
+        elementVector = convertNSArrayToVector<RefPtr<AccessibilityUIElement>>(children);
+    });
     END_AX_OBJC_EXCEPTIONS
 }
 
@@ -634,11 +637,17 @@
 double AccessibilityUIElement::numberAttributeValue(JSStringRef attribute)
 {
     BEGIN_AX_OBJC_EXCEPTIONS
-    id value = [m_element accessibilityAttributeValue:[NSString stringWithJSStringRef:attribute]];
+    id value;
+
+    auto accessibilityController = InjectedBundle::singleton().accessibilityController();
+    accessibilityController->execute([&attribute, &value, this] {
+        value = [m_element accessibilityAttributeValue:[NSString stringWithJSStringRef:attribute]];
+    });
+
     if ([value isKindOfClass:[NSNumber class]])
         return [value doubleValue];
     END_AX_OBJC_EXCEPTIONS
-    
+
     return 0;
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to