Commit cd631cd8 authored by Morten Stenshorne's avatar Morten Stenshorne Committed by Commit Bot

Don't walk the list of documents while already doing it.

There should be no need to walk all documents in an inner loop while
already doing it in the outer loop.

The O(n^2) performance complexity is probably negligible, but what I'm
actually trying to fix here is problems when compiling with -Wshadow
(the problem here being the various |document| variables).

Bug: 294205
Change-Id: Ide1ab566e3b9ddb53d4b4f44c9c03633c90348a1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2460745Reviewed-by: default avatarAndrey Kosyakov <caseq@chromium.org>
Commit-Queue: Morten Stenshorne <mstensho@chromium.org>
Cr-Commit-Position: refs/heads/master@{#816260}
parent 7012ae8a
......@@ -1144,6 +1144,7 @@ Response InspectorDOMAgent::performSearch(
break;
}
}
}
// XPath evaluation
for (Document* document : docs) {
......@@ -1151,8 +1152,7 @@ Response InspectorDOMAgent::performSearch(
DummyExceptionStateForTesting exception_state;
XPathResult* result = DocumentXPathEvaluator::evaluate(
*document, whitespace_trimmed_query, document, nullptr,
XPathResult::kOrderedNodeSnapshotType, ScriptValue(),
exception_state);
XPathResult::kOrderedNodeSnapshotType, ScriptValue(), exception_state);
if (exception_state.HadException() || !result)
continue;
......@@ -1180,7 +1180,6 @@ Response InspectorDOMAgent::performSearch(
for (unsigned i = 0; i < size; ++i)
result_collector.insert(element_list->item(i));
}
}
*search_id = IdentifiersFactory::CreateIdentifier();
HeapVector<Member<Node>>* results_it =
......
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