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

Unified Diff: Source/core/xml/XPathStep.cpp

Issue 1099613003: Oilpan: have xml/ objects on the heap by default. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: simplify XPathResult dtor Created 5 years, 8 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 | « Source/core/xml/XPathStep.h ('k') | Source/core/xml/XPathValue.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/xml/XPathStep.cpp
diff --git a/Source/core/xml/XPathStep.cpp b/Source/core/xml/XPathStep.cpp
index 6327886e4a2831032aaf43e376662b80de4e8a2c..386c1f466d18c7b99ce678aacc183ff21ab499e2 100644
--- a/Source/core/xml/XPathStep.cpp
+++ b/Source/core/xml/XPathStep.cpp
@@ -41,13 +41,13 @@ namespace XPath {
Step::Step(Axis axis, const NodeTest& nodeTest)
: m_axis(axis)
- , m_nodeTest(adoptPtrWillBeNoop(new NodeTest(nodeTest)))
+ , m_nodeTest(new NodeTest(nodeTest))
{
}
-Step::Step(Axis axis, const NodeTest& nodeTest, WillBeHeapVector<OwnPtrWillBeMember<Predicate>>& predicates)
+Step::Step(Axis axis, const NodeTest& nodeTest, HeapVector<Member<Predicate>>& predicates)
: m_axis(axis)
- , m_nodeTest(adoptPtrWillBeNoop(new NodeTest(nodeTest)))
+ , m_nodeTest(new NodeTest(nodeTest))
{
m_predicates.swap(predicates);
}
@@ -72,22 +72,20 @@ void Step::optimize()
// This optimization can be applied to predicates that are not context node
// list sensitive, or to first predicate that is only context position
// sensitive, e.g. foo[position() mod 2 = 0].
- WillBeHeapVector<OwnPtrWillBeMember<Predicate>> remainingPredicates;
+ HeapVector<Member<Predicate>> remainingPredicates;
for (size_t i = 0; i < m_predicates.size(); ++i) {
- OwnPtrWillBeRawPtr<Predicate> predicate(m_predicates[i].release());
+ Predicate* predicate = m_predicates[i];
if ((!predicate->isContextPositionSensitive() || nodeTest().mergedPredicates().isEmpty()) && !predicate->isContextSizeSensitive() && remainingPredicates.isEmpty()) {
- nodeTest().mergedPredicates().append(predicate.release());
+ nodeTest().mergedPredicates().append(predicate);
} else {
- remainingPredicates.append(predicate.release());
+ remainingPredicates.append(predicate);
}
}
swap(remainingPredicates, m_predicates);
}
-void optimizeStepPair(Step* first, Step* second, bool& dropSecondStep)
+bool optimizeStepPair(Step* first, Step* second)
{
- dropSecondStep = false;
-
if (first->m_axis == Step::DescendantOrSelfAxis
&& first->nodeTest().kind() == Step::NodeTest::AnyNodeTest
&& !first->m_predicates.size()
@@ -104,9 +102,10 @@ void optimizeStepPair(Step* first, Step* second, bool& dropSecondStep)
swap(second->nodeTest().mergedPredicates(), first->nodeTest().mergedPredicates());
swap(second->m_predicates, first->m_predicates);
first->optimize();
- dropSecondStep = true;
+ return true;
}
}
+ return false;
}
bool Step::predicatesAreContextListInsensitive() const
@@ -136,7 +135,7 @@ void Step::evaluate(EvaluationContext& evaluationContext, Node* context, NodeSet
for (unsigned i = 0; i < m_predicates.size(); i++) {
Predicate* predicate = m_predicates[i].get();
- OwnPtrWillBeRawPtr<NodeSet> newNodes(NodeSet::create());
+ NodeSet* newNodes = NodeSet::create();
if (!nodes.isSorted())
newNodes->markSorted(false);
@@ -239,7 +238,7 @@ static inline bool nodeMatches(EvaluationContext& evaluationContext, Node* node,
// Only the first merged predicate may depend on position.
++evaluationContext.position;
- const WillBeHeapVector<OwnPtrWillBeMember<Predicate>>& mergedPredicates = nodeTest.mergedPredicates();
+ const HeapVector<Member<Predicate>>& mergedPredicates = nodeTest.mergedPredicates();
for (unsigned i = 0; i < mergedPredicates.size(); i++) {
Predicate* predicate = mergedPredicates[i].get();
« no previous file with comments | « Source/core/xml/XPathStep.h ('k') | Source/core/xml/XPathValue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698