Commit 8bc42a8c authored by Aaron Leventhal's avatar Aaron Leventhal Committed by Commit Bot

Revert: Remove WalkAllDescendants as a speculative fix for IPC crashes

Reverts CL:2148035 as it seems to relate to some IPC crashes.
The reason is unknown, but this safely reverts the change for now.
See repro steps for crash in issue 1094848. The repro steps work
on Canary but not for own-built versions.

TBR: dmazzoni@chromium.org
Bug: 1131848,1094848
Change-Id: I5d13fb13f7b5e9473bdad1f8f80c11a6ca449df1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2433026
Commit-Queue: Aaron Leventhal <aleventhal@chromium.org>
Reviewed-by: default avatarAaron Leventhal <aleventhal@chromium.org>
Cr-Commit-Position: refs/heads/master@{#810935}
parent fedac800
...@@ -178,6 +178,9 @@ class AXTreeSerializer { ...@@ -178,6 +178,9 @@ class AXTreeSerializer {
AXSourceNode node, AXSourceNode node,
AXTreeUpdateBase<AXNodeData, AXTreeData>* out_update); AXTreeUpdateBase<AXNodeData, AXTreeData>* out_update);
// Visit all of the descendants of |node| once.
void WalkAllDescendants(AXSourceNode node);
// Delete the entire client subtree but don't set the did_reset_ flag // Delete the entire client subtree but don't set the did_reset_ flag
// like when Reset() is called. // like when Reset() is called.
void InternalReset(); void InternalReset();
...@@ -456,6 +459,12 @@ bool AXTreeSerializer<AXSourceNode, AXNodeData, AXTreeData>::SerializeChanges( ...@@ -456,6 +459,12 @@ bool AXTreeSerializer<AXSourceNode, AXNodeData, AXTreeData>::SerializeChanges(
if (!tree_->IsValid(lca)) if (!tree_->IsValid(lca))
lca = tree_->GetRoot(); lca = tree_->GetRoot();
// Work around flaky source trees where nodes don't figure out their
// correct parent/child relationships until you walk the whole tree once.
// Covered by this test in the content_browsertests suite:
// DumpAccessibilityTreeTest.AccessibilityAriaOwns.
WalkAllDescendants(lca);
if (!SerializeChangedNodes(lca, out_update)) if (!SerializeChangedNodes(lca, out_update))
return false; return false;
...@@ -583,17 +592,7 @@ bool AXTreeSerializer<AXSourceNode, AXNodeData, AXTreeData>:: ...@@ -583,17 +592,7 @@ bool AXTreeSerializer<AXSourceNode, AXNodeData, AXTreeData>::
#if defined(ADDRESS_SANITIZER) #if defined(ADDRESS_SANITIZER)
// Wrapping this in ADDRESS_SANITIZER will cause it to run on // Wrapping this in ADDRESS_SANITIZER will cause it to run on
// clusterfuzz, which should help us narrow down the issue. // clusterfuzz, which should help us narrow down the issue.
// TODO(accessibility) Remove all cases where this occurs and re-add NOTREACHED() << "Illegal reparenting detected";
// NOTREACHED(). This condition leads to performance problems. It will
// also reset virtual buffers, causing users to lose their place.
NOTREACHED() << "Illegal reparenting detected: "
<< "\nPassed-in parent: "
<< tree_->GetDebugString(tree_->GetFromId(client_node->id))
<< "\nChild: " << tree_->GetDebugString(child)
<< "\nChild's parent: "
<< tree_->GetDebugString(
tree_->GetFromId(client_child->parent->id))
<< "\n-----------------------------------------\n\n\n";
#endif #endif
Reset(); Reset();
return false; return false;
...@@ -673,10 +672,6 @@ bool AXTreeSerializer<AXSourceNode, AXNodeData, AXTreeData>:: ...@@ -673,10 +672,6 @@ bool AXTreeSerializer<AXSourceNode, AXNodeData, AXTreeData>::
new_child->ignored = tree_->IsIgnored(child); new_child->ignored = tree_->IsIgnored(child);
new_child->invalid = false; new_child->invalid = false;
client_node->children.push_back(new_child); client_node->children.push_back(new_child);
DCHECK(!ClientTreeNodeById(child_id))
<< "Child id " << child_id << " already exists in map."
<< "\nChild is " << tree_->GetDebugString(tree_->GetFromId(child_id))
<< " of parent " << tree_->GetDebugString(node);
client_id_map_[child_id] = new_child; client_id_map_[child_id] = new_child;
if (!SerializeChangedNodes(child, out_update)) if (!SerializeChangedNodes(child, out_update))
return false; return false;
...@@ -691,6 +686,15 @@ bool AXTreeSerializer<AXSourceNode, AXNodeData, AXTreeData>:: ...@@ -691,6 +686,15 @@ bool AXTreeSerializer<AXSourceNode, AXNodeData, AXTreeData>::
return true; return true;
} }
template <typename AXSourceNode, typename AXNodeData, typename AXTreeData>
void AXTreeSerializer<AXSourceNode, AXNodeData, AXTreeData>::WalkAllDescendants(
AXSourceNode node) {
std::vector<AXSourceNode> children;
tree_->GetChildren(node, &children);
for (size_t i = 0; i < children.size(); ++i)
WalkAllDescendants(children[i]);
}
} // namespace ui } // namespace ui
#endif // UI_ACCESSIBILITY_AX_TREE_SERIALIZER_H_ #endif // UI_ACCESSIBILITY_AX_TREE_SERIALIZER_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment