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

Unified Diff: Source/core/xml/XPathPath.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
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

Powered by Google App Engine
This is Rietveld 408576698