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

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

Issue 26709019: Vector stores Predicate object as OwnPtr instead of raw pointer in XPath. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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
« no previous file with comments | « Source/core/xml/XPathPath.cpp ('k') | Source/core/xml/XPathStep.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/xml/XPathStep.h
diff --git a/Source/core/xml/XPathStep.h b/Source/core/xml/XPathStep.h
index 4e9c14f3ff1cb91b0831bd9055fe891fda3eddd9..11bfd5f25aa9e5cfb5e9a9080098ce27a1b6aa5f 100644
--- a/Source/core/xml/XPathStep.h
+++ b/Source/core/xml/XPathStep.h
@@ -61,11 +61,27 @@ public:
NodeTest(Kind kind, const String& data) : m_kind(kind), m_data(data) { }
NodeTest(Kind kind, const String& data, const String& namespaceURI) : m_kind(kind), m_data(data), m_namespaceURI(namespaceURI) { }
+ NodeTest(const NodeTest& o)
+ : m_kind(o.m_kind)
+ , m_data(o.m_data)
+ , m_namespaceURI(o.m_namespaceURI)
+ {
+ ASSERT(o.m_mergedPredicates.isEmpty());
+ }
+ NodeTest& operator=(const NodeTest& o)
+ {
+ m_kind = o.m_kind;
+ m_data = o.m_data;
+ m_namespaceURI = o.m_namespaceURI;
+ ASSERT(o.m_mergedPredicates.isEmpty());
+ return *this;
+ }
+
Kind kind() const { return m_kind; }
const AtomicString& data() const { return m_data; }
const AtomicString& namespaceURI() const { return m_namespaceURI; }
- Vector<Predicate*>& mergedPredicates() { return m_mergedPredicates; }
- const Vector<Predicate*>& mergedPredicates() const { return m_mergedPredicates; }
+ Vector<OwnPtr<Predicate> >& mergedPredicates() { return m_mergedPredicates; }
+ const Vector<OwnPtr<Predicate> >& mergedPredicates() const { return m_mergedPredicates; }
private:
Kind m_kind;
@@ -73,10 +89,11 @@ public:
AtomicString m_namespaceURI;
// When possible, we merge some or all predicates with node test for better performance.
- Vector<Predicate*> m_mergedPredicates;
+ Vector<OwnPtr<Predicate> > m_mergedPredicates;
};
- Step(Axis, const NodeTest&, const Vector<Predicate*>& predicates = Vector<Predicate*>());
+ Step(Axis, const NodeTest&);
+ Step(Axis, const NodeTest&, Vector<OwnPtr<Predicate> >&);
~Step();
void optimize();
@@ -96,7 +113,7 @@ private:
Axis m_axis;
NodeTest m_nodeTest;
- Vector<Predicate*> m_predicates;
+ Vector<OwnPtr<Predicate> > m_predicates;
};
void optimizeStepPair(Step*, Step*, bool& dropSecondStep);
« no previous file with comments | « Source/core/xml/XPathPath.cpp ('k') | Source/core/xml/XPathStep.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698