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

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: Created 4 years, 4 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
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 4538ca414641193148ef0f2e344fe200a103f018..8720aa145470ef41f3053efcb3f46769130c3003 100644
--- a/content/renderer/accessibility/render_accessibility_impl.cc
+++ b/content/renderer/accessibility/render_accessibility_impl.cc
@@ -58,6 +58,7 @@ void RenderAccessibilityImpl::SnapshotAccessibilityTree(
WebScopedAXContext context(document);
BlinkAXTreeSource tree_source(render_frame);
tree_source.SetRoot(context.root());
+ ScopedFreezeBlinkAXTreeSource freeze(&tree_source);
BlinkAXTreeSerializer serializer(&tree_source);
serializer.set_max_node_count(kMaxSnapshotNodeCount);
serializer.SerializeChanges(context.root(), response);
@@ -244,6 +245,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;
@@ -315,6 +317,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.
@@ -357,6 +361,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;
@@ -441,6 +446,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(
@@ -455,6 +461,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;

Powered by Google App Engine
This is Rietveld 408576698