nvda
9fccec04 - Add cache request support to the UIA remote ops framework (#20621)

Commit
113 days ago
Add cache request support to the UIA remote ops framework (#20621) Follow-up of #16214. Related to #20608 in a stacked effort to reduce UIA cross-process calls as much as possible. Summary of the issue: The UIA remote operations framework cannot use UIA caching. Elements returned from a remote operation arrive without any cache, so consumers immediately pay live cross-process calls for every property they read. The cache request opcodes exist in the framework's instruction set enum, but nothing exposes them. In addition, the result conversion in UIARemote.dll only handles Int32, String and Boolean scalars: a remote operation cannot return any floating point value. Description of user facing changes: None. This PR only adds code that is not yet used anywhere. Description of developer facing changes: A remote operation can create a cache request, add properties and patterns to it, and populate the cache of a remote element: ra.newCacheRequest, RemoteCacheRequest.addProperty, RemoteCacheRequest.addPattern and RemoteElement.populateCache. Elements returned or yielded from the operation carry the populated cache. _remoteOps.lowLevel gains a PatternId enum next to the existing PropertyId. Remote operations can now return UInt32, Int64, Single and Double values. A remote variant can be tested for the reserved "not supported" value inside the operation: RemoteVariant.isNotSupported. The framework readme documents cache request usage. Description of development approach: The five cache request opcodes get instruction dataclasses with local execution through the classic COM cache request methods, so the localMode unit test path covers them. A new RemoteCacheRequest remote type and RemoteElement.populateCache expose them in the high level API. The scalar result types are additional cases in IInspectableToVariant in nvdaHelper/UIARemote/lowLevel.cpp. Behaviour was verified against the real remote operations VM by walking the focus ancestry with per-ancestor cache population in File Explorer and in Edge with UIA web content. A comparison of 30 properties over 33 ancestors showed remotely populated caches are value identical to classic caches, with one platform difference: they store default values for unsupported properties instead of the reserved "not supported" value. This is documented in the readme. Explicit getPropertyValue fetches with ignoreDefault set do preserve the reserved value, which now also survives result marshaling.
Author
Parents
Loading