-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Defer UIA accessibility provider initialization until requested #14756
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: chrisglein <[email protected]>
/azp run |
Azure Pipelines successfully started running 2 pipeline(s). |
@copilot whenever the build results states: |
Co-authored-by: dannyvv <[email protected]>
/azp run |
Azure Pipelines successfully started running 2 pipeline(s). |
@chrisglein be careful before this change is merged. Someone should validate that Narrator still works as expected. We've had issues with accessibilityprovider initialization optimization breaking Narrator in the past. |
@copilot after running |
Co-authored-by: acoates-ms <[email protected]>
Formatting applied with clang-format to fix spacing issues in commit 74cbd54. Warning Firewall rules blocked me from connecting to one or more addressesI tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
/azp run |
Azure Pipelines successfully started running 2 pipeline(s). |
Oh definitely. This is our first try of the Copilot agent and we should treat this with high scrutiny. It obviously can't do any manual testing, so anything not covered by automation needs us to manually validate. |
Summary
This PR optimizes the initialization of UIA (UI Automation) accessibility providers by deferring their creation until they are actually requested by the UIA agent, rather than eagerly creating them in the constructor.
Problem
Previously,
CompositionDynamicAutomationProvider
was creatingm_textProvider
andm_annotationProvider
instances in its constructor regardless of whether the UIA agent would ever request these patterns. This resulted in unnecessary object creation and initialization overhead for accessibility scenarios where these specific patterns weren't used.Solution
Moved the provider initialization from the constructor to the
GetPatternProvider
method, where they are created lazily only when the UIA agent requests the specific pattern IDs:UIA_TextPatternId
andUIA_TextPattern2Id
for text providersUIA_AnnotationPatternId
for annotation providersChanges Made
GetPatternProvider
with null checks to prevent multiple creationCompositionTextProvider.h
Performance Impact
Fixes #14644.