Chromium Code Reviews| Index: Source/core/xml/XPathPath.cpp |
| diff --git a/Source/core/xml/XPathPath.cpp b/Source/core/xml/XPathPath.cpp |
| index 73b446f487c9cf6eeb563f33931259ef52d127d2..50ca71218057c831f950a2cfee1acbfe690bd522 100644 |
| --- a/Source/core/xml/XPathPath.cpp |
| +++ b/Source/core/xml/XPathPath.cpp |
| @@ -36,9 +36,13 @@ |
| namespace WebCore { |
| namespace XPath { |
| -Filter::Filter(Expression* expr, const Vector<Predicate*>& predicates) |
| - : m_expr(expr), m_predicates(predicates) |
| +Filter::Filter(PassOwnPtr<Expression> expr, const Vector<Predicate*>& predicates) |
| + : m_expr(expr) |
| { |
| + m_predicates.reserveInitialCapacity(predicates.size()); |
| + for (size_t i = 0; i < predicates.size(); i++) |
| + m_predicates.append(adoptPtr(predicates[i])); |
| + |
|
dshwang
2013/10/14 15:56:04
As I mentioned above, Vector<OwnPtr<>> copy constr
abarth-chromium
2013/10/15 17:51:36
Great!
|
| setIsContextNodeSensitive(m_expr->isContextNodeSensitive()); |
| setIsContextPositionSensitive(m_expr->isContextPositionSensitive()); |
| setIsContextSizeSensitive(m_expr->isContextSizeSensitive()); |
| @@ -46,8 +50,6 @@ Filter::Filter(Expression* expr, const Vector<Predicate*>& predicates) |
| Filter::~Filter() |
| { |
| - delete m_expr; |
| - deleteAllValues(m_predicates); |
| } |
| Value Filter::evaluate() const |