Bug 213124

Summary: In isolated tree mode 2, AXIsolatedObject::setChildrenIDs should be called only on secondary thread.
Product: WebKit Reporter: Andres Gonzalez <andresg_22>
Component: New BugsAssignee: Andres Gonzalez <andresg_22>
Status: RESOLVED FIXED    
Severity: Normal CC: aboxhall, apinheiro, cfleizach, darin, dmazzoni, ews-watchlist, jcraig, jdiggs, samuel_white, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch none

Description Andres Gonzalez 2020-06-12 07:10:23 PDT
In isolated tree mode 2, AXIsolatedObject::setChildrenIDs should be called only on secondary thread.
Comment 1 Andres Gonzalez 2020-06-12 07:25:53 PDT
Created attachment 401727 [details]
Patch
Comment 2 chris fleizach 2020-06-12 09:56:04 PDT
Comment on attachment 401727 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=401727&action=review

> Source/WebCore/ChangeLog:11
> +        - The unsigned int range for object IDs was being overrun for large number of objects like in the case of the sample page in <rdar://problem/59331146>. INcreased the size of AXID to size_t.

INcreased -> Increased

> Source/WebCore/accessibility/AccessibilityObjectInterface.h:75
> +typedef size_t AXID;

should we make this a uint64_t
Comment 3 Andres Gonzalez 2020-06-12 10:54:13 PDT
Created attachment 401750 [details]
Patch
Comment 4 Andres Gonzalez 2020-06-12 10:55:52 PDT
Created attachment 401751 [details]
Patch
Comment 5 Andres Gonzalez 2020-06-12 11:11:28 PDT
(In reply to chris fleizach from comment #2)
> Comment on attachment 401727 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=401727&action=review
> 
> > Source/WebCore/ChangeLog:11
> > +        - The unsigned int range for object IDs was being overrun for large number of objects like in the case of the sample page in <rdar://problem/59331146>. INcreased the size of AXID to size_t.
> 
> INcreased -> Increased

Fixed.
> 
> > Source/WebCore/accessibility/AccessibilityObjectInterface.h:75
> > +typedef size_t AXID;
> 
> should we make this a uint64_t

size_t is guarantied the largest unsigned integer range the system can handle. But we can make it a uint64_t if we prefer to specify the size explicitly.
Comment 6 EWS 2020-06-12 12:25:00 PDT
Committed r262966: <https://trac.webkit.org/changeset/262966>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 401751 [details].
Comment 7 Radar WebKit Bug Importer 2020-06-12 12:25:19 PDT
<rdar://problem/64307457>
Comment 8 Darin Adler 2020-06-12 12:30:19 PDT
Comment on attachment 401751 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=401751&action=review

> Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h:68
> +    void setChildrenIDs(Vector<AXID>&& childrenIDs)
> +    {
> +        // FIXME: The following ASSERT should be met but it is commented out at the
> +        // moment because of <rdar://problem/63985646> After calling _AXUIElementUseSecondaryAXThread(true),
> +        // still receives client request on main thread.
> +        // ASSERT(axObjectCache()->canUseSecondaryAXThread() ? !isMainThread() : isMainThread());
> +        m_childrenIDs = childrenIDs;
> +    }

Style thought for the future:

Generally seems like a poor pattern to move code from .cpp files to headers without a strong motivation; long term across many source files it likely makes our code slower to compile so we better be sure there is a benefit. Also, larger class definitions with function bodies can make it harder to see the design of the class.

I see, thought, that *this* is the kind of simple setter that can be super efficient so it’s tempting to make it inlined. Even if doing that, I think it’s better style to do that outside the class definition so it’s easier to refactor (move to and from the .cpp file). And I think that global optimization may be effective at inlining even when we don’t move things to headers.