Skip to content
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

[a11y] Move some of serialization pipeline from RAI to cache. #43243

Merged
merged 1 commit into from
Nov 22, 2023

Conversation

chromium-wpt-export-bot
Copy link
Collaborator

@chromium-wpt-export-bot chromium-wpt-export-bot commented Nov 18, 2023

This CL aims to start moving some of the code path starting from HandleAXEvent to ScheduleImmediateAXUpdate over to cache side. The old code is still left in RAI for legacy support.

The aim is to eventually delete the code from RAI side, and then RAI would only be called from ProcessDeferredAccessibilityEvents to AXReadyCallback.


Details (only explaining post-lifecyle mode):
Before this CL, a11y events (kind of) go like this: AXObjectCacheImpl::PostPlatformNotification -> RenderAccessibilityImpl::HandleAXEvent which also calls AXObjectCacheImpl::AddPendingEvent --> RenderAccessibilityImpl::ScheduleImmediateAXUpdate -> AXObjectCacheImpl::ScheduleAXUpdate --> AXObjectCacheImpl::ProcessDeferredAccessibilityEvents -> RenderAccessibilityImpl::AXReadyCallback

Note that -> doesn't mean direct calls. Some calls in the middle may have been skipped. The CL prevents these excessively unnecessary calls in between RAI (RenderAccessibilityImpl) and AXObjectCacheImpl. The calls now go like this (again kinda): AXObjectCacheImpl::PostPlatformNotification -> AXObjectCacheImpl::AddEventToSerializationQueue -> AXObjectCacheImpl::ScheduleImmediateSerialization -> AXObjectCacheImpl::ScheduleAXUpdate -> AXObjectCacheImpl::ProcessDeferredAccessibilityEvents -> RenderAccessibilityImpl::AXReadyCallback

Notice how RAI is only called at the very end. Of course, to make this possible many of the side logic had to be moved too like the delaying code that used to be AXReadyCallback is now at AXObjectCacheImpl::ProcessDeferredAccessibilityEvents.

This image describes the above: https://i.imgur.com/U3tODTX.png
What the CL achieves is moving the code in the blue square over to the left-hand side, thus making the code stay in AXObjectCache longer and only move to RAI at RenderAccessibilityImpl::AXReadyCallback. The serialization delay is moved to ProcessDeferredAccessibilityEvents.


Legacy scheduling mode (as opposed to post-lifecycle serialization) still uses the old code which goes back and forth between RAI and AXObjectCache. The reason they were not moved as well is that legacy mode will get removed eventually anyway. When legacy mode is removed, we can safely remove the old code from RAI.


Also, with the cleaner code, it'll be feasible to change the scheduling logic further to limit some events like scrolling. Scrolling improvements discussed here https://docs.google.com/document/d/1fBK1BBrG8souqZpyv7q_3kxCYF1IYoXNPXmoVL7X8Gk/edit#heading=h.uo8ebdp7cxl


Change-Id: I4662c29ee0185b8554b80b71db5ffb0aa6fc2319
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4994320
Reviewed-by: Peter Beverloo <peter@chromium.org>
Auto-Submit: Ahmed Elwasefi (Ahmad45123) <a.m.elwasefi@gmail.com>
Reviewed-by: Aaron Leventhal <aleventhal@chromium.org>
Reviewed-by: Jeremy Roman <jbroman@chromium.org>
Commit-Queue: Ahmed Elwasefi (Ahmad45123) <a.m.elwasefi@gmail.com>
Cr-Commit-Position: refs/heads/main@{#1227944}

Copy link
Collaborator

@wpt-pr-bot wpt-pr-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The review process for this patch is being conducted in the Chromium project.

@chromium-wpt-export-bot chromium-wpt-export-bot force-pushed the chromium-export-cl-4994320 branch 6 times, most recently from eba53ba to 404dabf Compare November 22, 2023 12:18
This CL aims to start moving some of the code path starting from HandleAXEvent to ScheduleImmediateAXUpdate over to cache side. The old code is still left in RAI for legacy support.

The aim is to eventually delete the code from RAI side, and then RAI would only be called from ProcessDeferredAccessibilityEvents to AXReadyCallback.

----------------------------
Details (only explaining post-lifecyle mode):
Before this CL, a11y events (kind of) go like this: AXObjectCacheImpl::PostPlatformNotification -> RenderAccessibilityImpl::HandleAXEvent which also calls AXObjectCacheImpl::AddPendingEvent --> RenderAccessibilityImpl::ScheduleImmediateAXUpdate -> AXObjectCacheImpl::ScheduleAXUpdate --> AXObjectCacheImpl::ProcessDeferredAccessibilityEvents -> RenderAccessibilityImpl::AXReadyCallback

Note that -> doesn't mean direct calls. Some calls in the middle may have been skipped. The CL prevents these excessively unnecessary calls in between RAI (RenderAccessibilityImpl) and AXObjectCacheImpl. The calls now go like this (again kinda): AXObjectCacheImpl::PostPlatformNotification -> AXObjectCacheImpl::AddEventToSerializationQueue -> AXObjectCacheImpl::ScheduleImmediateSerialization -> AXObjectCacheImpl::ScheduleAXUpdate -> AXObjectCacheImpl::ProcessDeferredAccessibilityEvents -> RenderAccessibilityImpl::AXReadyCallback

Notice how RAI is only called at the very end. Of course, to make this possible many of the side logic had to be moved too like the delaying code that used to be AXReadyCallback is now at AXObjectCacheImpl::ProcessDeferredAccessibilityEvents.

This image describes the above: https://i.imgur.com/U3tODTX.png
What the CL achieves is moving the code in the blue square over to the left-hand side, thus making the code stay in AXObjectCache longer and only move to RAI at RenderAccessibilityImpl::AXReadyCallback. The serialization delay is moved to ProcessDeferredAccessibilityEvents.

----------------------------
Legacy scheduling mode (as opposed to post-lifecycle serialization) still uses the old code which goes back and forth between RAI and AXObjectCache. The reason they were not moved as well is that legacy mode will get removed eventually anyway. When legacy mode is removed, we can safely remove the old code from RAI.

----------------------------
Also, with the cleaner code, it'll be feasible to change the scheduling logic further to limit some events like scrolling. Scrolling improvements discussed here https://docs.google.com/document/d/1fBK1BBrG8souqZpyv7q_3kxCYF1IYoXNPXmoVL7X8Gk/edit#heading=h.uo8ebdp7cxl

----------------------------

Change-Id: I4662c29ee0185b8554b80b71db5ffb0aa6fc2319
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4994320
Reviewed-by: Peter Beverloo <peter@chromium.org>
Auto-Submit: Ahmed Elwasefi (Ahmad45123) <a.m.elwasefi@gmail.com>
Reviewed-by: Aaron Leventhal <aleventhal@chromium.org>
Reviewed-by: Jeremy Roman <jbroman@chromium.org>
Commit-Queue: Ahmed Elwasefi (Ahmad45123) <a.m.elwasefi@gmail.com>
Cr-Commit-Position: refs/heads/main@{#1227944}
@chromium-wpt-export-bot chromium-wpt-export-bot merged commit 16c57b5 into master Nov 22, 2023
21 checks passed
@chromium-wpt-export-bot chromium-wpt-export-bot deleted the chromium-export-cl-4994320 branch November 22, 2023 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants