Reland: AccessibilityEvent throttling on Android with improvements
This CL relands AccessibilityEvent throttling on Android. Original CL: http://crrev.com/c/2067443 Revert: http://crrev.com/c/2132927 This change was reverted to prevent regression before M83 was cut, but with this CL it will be relanded along with the improvements added here. This CL improves the throttling logic by separating it from the WebContentsAccessibilityImpl into it's own class, which we have called AccessibilityEventDispatcher. Whenever the WCAI wishes to send an event, it sends it to the dispatcher. The dispatcher can then act as a pass-through, throttle the event, discard the event, etc. as determined by preset rules that are opaque to the WebContentsAccessibilityImpl. This will make unit testing easier and allows us to make wholesale changes to our throttling without affecting implementations. This CL also adds an improvement by taking into account the |virtualViewId| of whatever node is trying to send an event. Until now we have relied solely on the eventType and ensured that no two events of the same type are sent in quick succession (if the eventType is one we are throttling). This creates an issue where two separate nodes with different |virtualViewId|'s can each request an event of some type to be sent, but only one will get through. We fix this problem by making our throttling check not just the eventType but also |virtualViewId|. This requires some sort of 2D structure, or a key of Pair or some wrapper object that will hold the two ints (|virtualViewId| and eventType). Here we use a long in place of a Pair, by bitshifting |virtualViewId| left 32 bits and doing a bitwise OR with eventType. This gives us a 64bit long that is essentially two int's concatenated in memory, which will be a unique id for a |virtualViewId|-eventType pairing. This CL also adds an improvement by allowing us to specify a delay time on a per eventType basis. Before this change we had a simple Set that contains a list of eventTypes to delay. We have now made this a map from eventType to delay time in ms, so that we can potentially delay different events by different amounts. Change-Id: I7431253a715cc712a81b1f6ac2b39d19e91daa8e Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2139905Reviewed-by:Mark Schillaci <mschillaci@google.com> Reviewed-by:
Bo <boliu@chromium.org> Reviewed-by:
Dominic Mazzoni <dmazzoni@chromium.org> Commit-Queue: Mark Schillaci <mschillaci@google.com> Cr-Commit-Position: refs/heads/master@{#759354}
Showing
Please register or sign in to comment