Commit 0d9a8c7
committed
AX: Accessing AXIsolatedTree::{m_relations, m_selectedTextMarkerRange} requires m_changeLogLock, which can cause the AX thread to block on the main-thread or vice versa
https://bugs.webkit.org/show_bug.cgi?id=294652
rdar://153703482
Reviewed by Joshua Hoffman.
Ideally, the accessibility thread should only synchronize with the main-thread via AXIsolatedTree::m_changeLogLock
once: at the beginning of serving a request, via AXIsolatedTree::applyPendingChanges(). But prior to this commit,
we would take the lock any time we needed to access AXIsolatedTree::m_relations or AXIsolatedTree::m_selectedTextMarkerRange,
which could potentially be a lot. This can cause the AX thread to block on the main-thread at random times, and vice
versa, which can harm performance.
With this commit, we move caching the selected text marker range and relations map to a similar approach taken for other
synced data structures. We create an m_pendingFoo equivalent, guarded by a lock, and apply that in AXIsolatedTree::applyPendingChanges.
Then we can use the synced data structure safely without a lock off the main-thread.
* Source/WebCore/accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::dirtyIsolatedTreeRelations):
* Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp:
(WebCore::AXIsolatedTree::create):
(WebCore::AXIsolatedTree::updateRelations):
(WebCore::AXIsolatedTree::setSelectedTextMarkerRange):
(WebCore::AXIsolatedTree::relatedObjectIDsFor):
(WebCore::AXIsolatedTree::applyPendingChanges):
(WebCore::AXIsolatedTree::selectedTextMarkerRange): Deleted.
* Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.h:
(WebCore::AXIsolatedTree::markRelationsDirty):
(WebCore::AXIsolatedTree::selectedTextMarkerRange):
(WebCore::AXIsolatedTree::relationsNeedUpdate): Deleted.
Canonical link: https://commits.webkit.org/296378@main1 parent 10ba492 commit 0d9a8c7
3 files changed
Lines changed: 20 additions & 24 deletions
File tree
- Source/WebCore/accessibility
- isolatedtree
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3290 | 3290 | | |
3291 | 3291 | | |
3292 | 3292 | | |
3293 | | - | |
3294 | | - | |
| 3293 | + | |
| 3294 | + | |
3295 | 3295 | | |
3296 | 3296 | | |
3297 | 3297 | | |
| |||
Lines changed: 11 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
168 | 168 | | |
169 | 169 | | |
170 | 170 | | |
171 | | - | |
172 | | - | |
173 | | - | |
| 171 | + | |
174 | 172 | | |
175 | 173 | | |
176 | 174 | | |
177 | 175 | | |
178 | 176 | | |
| 177 | + | |
179 | 178 | | |
180 | 179 | | |
181 | 180 | | |
| |||
1172 | 1171 | | |
1173 | 1172 | | |
1174 | 1173 | | |
1175 | | - | |
| 1174 | + | |
1176 | 1175 | | |
1177 | 1176 | | |
1178 | 1177 | | |
1179 | 1178 | | |
1180 | | - | |
1181 | | - | |
1182 | 1179 | | |
1183 | | - | |
1184 | | - | |
1185 | | - | |
1186 | | - | |
1187 | | - | |
1188 | 1180 | | |
1189 | | - | |
| 1181 | + | |
1190 | 1182 | | |
1191 | 1183 | | |
1192 | 1184 | | |
| |||
1195 | 1187 | | |
1196 | 1188 | | |
1197 | 1189 | | |
1198 | | - | |
| 1190 | + | |
1199 | 1191 | | |
1200 | 1192 | | |
1201 | 1193 | | |
| |||
1286 | 1278 | | |
1287 | 1279 | | |
1288 | 1280 | | |
1289 | | - | |
1290 | | - | |
1291 | 1281 | | |
1292 | 1282 | | |
1293 | 1283 | | |
| |||
1413 | 1403 | | |
1414 | 1404 | | |
1415 | 1405 | | |
| 1406 | + | |
| 1407 | + | |
| 1408 | + | |
| 1409 | + | |
| 1410 | + | |
| 1411 | + | |
1416 | 1412 | | |
1417 | 1413 | | |
1418 | 1414 | | |
| |||
Lines changed: 7 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
498 | 498 | | |
499 | 499 | | |
500 | 500 | | |
501 | | - | |
502 | | - | |
| 501 | + | |
| 502 | + | |
503 | 503 | | |
504 | 504 | | |
505 | 505 | | |
| |||
517 | 517 | | |
518 | 518 | | |
519 | 519 | | |
520 | | - | |
| 520 | + | |
521 | 521 | | |
522 | 522 | | |
523 | 523 | | |
| |||
641 | 641 | | |
642 | 642 | | |
643 | 643 | | |
| 644 | + | |
| 645 | + | |
644 | 646 | | |
645 | 647 | | |
646 | 648 | | |
| |||
649 | 651 | | |
650 | 652 | | |
651 | 653 | | |
652 | | - | |
653 | | - | |
654 | | - | |
| 654 | + | |
655 | 655 | | |
656 | 656 | | |
657 | 657 | | |
658 | 658 | | |
659 | 659 | | |
660 | 660 | | |
661 | 661 | | |
662 | | - | |
| 662 | + | |
663 | 663 | | |
664 | 664 | | |
665 | 665 | | |
| |||
0 commit comments