Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Unified Diff: content/renderer/accessibility/render_accessibility_impl.cc

Issue 2205083002: Optimize BlinkAXTreeSource by adding freeze/thaw for things like root, focus. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix pdf accessibility Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/accessibility/blink_ax_tree_source.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/accessibility/render_accessibility_impl.cc
diff --git a/content/renderer/accessibility/render_accessibility_impl.cc b/content/renderer/accessibility/render_accessibility_impl.cc
index 8b253ccb537b777302128382ceaf5e8161a6ebf7..52dc8e08a4b6b779f54564f5f790b2db59fd24b7 100644
--- a/content/renderer/accessibility/render_accessibility_impl.cc
+++ b/content/renderer/accessibility/render_accessibility_impl.cc
@@ -63,6 +63,7 @@ void RenderAccessibilityImpl::SnapshotAccessibilityTree(
return;
BlinkAXTreeSource tree_source(render_frame);
tree_source.SetRoot(root);
+ ScopedFreezeBlinkAXTreeSource freeze(&tree_source);
BlinkAXTreeSerializer serializer(&tree_source);
serializer.set_max_node_count(kMaxSnapshotNodeCount);
serializer.SerializeChanges(context.root(), response);
@@ -249,6 +250,7 @@ void RenderAccessibilityImpl::SetPdfTreeSource(
pdf_tree_source_ = pdf_tree_source;
pdf_serializer_.reset(new PdfAXTreeSerializer(pdf_tree_source_));
+ ScopedFreezeBlinkAXTreeSource freeze(&tree_source_);
WebAXObject root = tree_source_.GetRoot();
if (!root.updateLayoutAndCheckValidity())
return;
@@ -320,6 +322,8 @@ void RenderAccessibilityImpl::SendPendingAccessibilityEvents() {
while (!obj.isDetached() && obj.accessibilityIsIgnored())
obj = obj.parentObject();
+ ScopedFreezeBlinkAXTreeSource freeze(&tree_source_);
+
// Make sure it's a descendant of our root node - exceptions include the
// scroll area that's the parent of the main document (we ignore it), and
// possibly nodes attached to a different document.
@@ -367,6 +371,7 @@ void RenderAccessibilityImpl::SendLocationChanges() {
std::vector<AccessibilityHostMsg_LocationChangeParams> messages;
// Update layout on the root of the tree.
+ ScopedFreezeBlinkAXTreeSource freeze(&tree_source_);
WebAXObject root = tree_source_.GetRoot();
if (!root.updateLayoutAndCheckValidity())
return;
@@ -461,6 +466,7 @@ void RenderAccessibilityImpl::OnHitTest(gfx::Point point) {
// message back to the browser to do the hit test in the child frame,
// recursively.
AXContentNodeData data;
+ ScopedFreezeBlinkAXTreeSource freeze(&tree_source_);
tree_source_.SerializeNode(obj, &data);
if (data.HasContentIntAttribute(AX_CONTENT_ATTR_CHILD_ROUTING_ID) ||
data.HasContentIntAttribute(
@@ -475,6 +481,7 @@ void RenderAccessibilityImpl::OnHitTest(gfx::Point point) {
}
void RenderAccessibilityImpl::OnSetAccessibilityFocus(int acc_obj_id) {
+ ScopedFreezeBlinkAXTreeSource freeze(&tree_source_);
if (tree_source_.accessibility_focus_id() == acc_obj_id)
return;
« no previous file with comments | « content/renderer/accessibility/blink_ax_tree_source.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698