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

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

Issue 26763004: Vector stores Expression object as OwnPtr instead of raw pointer in XPath. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Change XPathGrammar.y also Created 7 years, 2 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
« Source/core/xml/XPathPath.cpp ('K') | « Source/core/xml/XPathPredicate.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/xml/XPathPredicate.cpp
diff --git a/Source/core/xml/XPathPredicate.cpp b/Source/core/xml/XPathPredicate.cpp
index 963e115a626e60d7499b08aa969cfea4ecc69c8b..bbcc66aba3f0596f3b72b7a8f32bfa21439ef100 100644
--- a/Source/core/xml/XPathPredicate.cpp
+++ b/Source/core/xml/XPathPredicate.cpp
@@ -63,7 +63,7 @@ Value Negative::evaluate() const
return -p.toNumber();
}
-NumericOp::NumericOp(Opcode opcode, Expression* lhs, Expression* rhs)
+NumericOp::NumericOp(Opcode opcode, PassOwnPtr<Expression> lhs, PassOwnPtr<Expression> rhs)
: m_opcode(opcode)
{
addSubExpression(lhs);
@@ -94,7 +94,7 @@ Value NumericOp::evaluate() const
return 0.0;
}
-EqTestOp::EqTestOp(Opcode opcode, Expression* lhs, Expression* rhs)
+EqTestOp::EqTestOp(Opcode opcode, PassOwnPtr<Expression> lhs, PassOwnPtr<Expression> rhs)
: m_opcode(opcode)
{
addSubExpression(lhs);
@@ -197,7 +197,7 @@ Value EqTestOp::evaluate() const
return compare(lhs, rhs);
}
-LogicalOp::LogicalOp(Opcode opcode, Expression* lhs, Expression* rhs)
+LogicalOp::LogicalOp(Opcode opcode, PassOwnPtr<Expression> lhs, PassOwnPtr<Expression> rhs)
: m_opcode(opcode)
{
addSubExpression(lhs);
@@ -249,25 +249,24 @@ Value Union::evaluate() const
return lhsResult;
}
-Predicate::Predicate(Expression* expr)
+Predicate::Predicate(PassOwnPtr<Expression> expr)
: m_expr(expr)
{
}
Predicate::~Predicate()
{
- delete m_expr;
}
bool Predicate::evaluate() const
{
- ASSERT(m_expr != 0);
+ ASSERT(m_expr);
Value result(m_expr->evaluate());
// foo[3] means foo[position()=3]
if (result.isNumber())
- return EqTestOp(EqTestOp::OP_EQ, createFunction("position"), new Number(result.toNumber())).evaluate().toBoolean();
+ return EqTestOp(EqTestOp::OP_EQ, adoptPtr(createFunction("position")), adoptPtr(new Number(result.toNumber()))).evaluate().toBoolean();
return result.toBoolean();
}
« Source/core/xml/XPathPath.cpp ('K') | « Source/core/xml/XPathPredicate.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698