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

Side by Side 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2005 Frerich Raabe <raabe@kde.org> 2 * Copyright (C) 2005 Frerich Raabe <raabe@kde.org>
3 * Copyright (C) 2006, 2009 Apple Inc. 3 * Copyright (C) 2006, 2009 Apple Inc.
4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 9 *
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 18 matching lines...) Expand all
29 #include "core/xml/XPathPath.h" 29 #include "core/xml/XPathPath.h"
30 30
31 #include "core/dom/Document.h" 31 #include "core/dom/Document.h"
32 #include "core/xml/XPathPredicate.h" 32 #include "core/xml/XPathPredicate.h"
33 #include "core/xml/XPathStep.h" 33 #include "core/xml/XPathStep.h"
34 #include "core/xml/XPathValue.h" 34 #include "core/xml/XPathValue.h"
35 35
36 namespace WebCore { 36 namespace WebCore {
37 namespace XPath { 37 namespace XPath {
38 38
39 Filter::Filter(Expression* expr, const Vector<Predicate*>& predicates) 39 Filter::Filter(PassOwnPtr<Expression> expr, const Vector<Predicate*>& predicates )
40 : m_expr(expr), m_predicates(predicates) 40 : m_expr(expr)
41 { 41 {
42 m_predicates.reserveInitialCapacity(predicates.size());
43 for (size_t i = 0; i < predicates.size(); i++)
44 m_predicates.append(adoptPtr(predicates[i]));
45
dshwang 2013/10/14 15:56:04 As I mentioned above, Vector<OwnPtr<>> copy constr
abarth-chromium 2013/10/15 17:51:36 Great!
42 setIsContextNodeSensitive(m_expr->isContextNodeSensitive()); 46 setIsContextNodeSensitive(m_expr->isContextNodeSensitive());
43 setIsContextPositionSensitive(m_expr->isContextPositionSensitive()); 47 setIsContextPositionSensitive(m_expr->isContextPositionSensitive());
44 setIsContextSizeSensitive(m_expr->isContextSizeSensitive()); 48 setIsContextSizeSensitive(m_expr->isContextSizeSensitive());
45 } 49 }
46 50
47 Filter::~Filter() 51 Filter::~Filter()
48 { 52 {
49 delete m_expr;
50 deleteAllValues(m_predicates);
51 } 53 }
52 54
53 Value Filter::evaluate() const 55 Value Filter::evaluate() const
54 { 56 {
55 Value v = m_expr->evaluate(); 57 Value v = m_expr->evaluate();
56 58
57 NodeSet& nodes = v.modifiableNodeSet(); 59 NodeSet& nodes = v.modifiableNodeSet();
58 nodes.sort(); 60 nodes.sort();
59 61
60 EvaluationContext& evaluationContext = Expression::evaluationContext(); 62 EvaluationContext& evaluationContext = Expression::evaluationContext();
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 Value v = m_filter->evaluate(); 208 Value v = m_filter->evaluate();
207 209
208 NodeSet& nodes = v.modifiableNodeSet(); 210 NodeSet& nodes = v.modifiableNodeSet();
209 m_path->evaluate(nodes); 211 m_path->evaluate(nodes);
210 212
211 return v; 213 return v;
212 } 214 }
213 215
214 } 216 }
215 } 217 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698