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

Side by Side Diff: third_party/WebKit/Source/core/xml/XPathNodeSet.h

Issue 2560823003: Avoid WTF::Vector::at() and operator[] in core/xml. (Closed)
Patch Set: Created 4 years 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) 2007 Alexey Proskuryakov <ap@webkit.org> 2 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 25 matching lines...) Expand all
36 36
37 class NodeSet final : public GarbageCollected<NodeSet> { 37 class NodeSet final : public GarbageCollected<NodeSet> {
38 public: 38 public:
39 static NodeSet* create() { return new NodeSet; } 39 static NodeSet* create() { return new NodeSet; }
40 static NodeSet* create(const NodeSet&); 40 static NodeSet* create(const NodeSet&);
41 DEFINE_INLINE_TRACE() { visitor->trace(m_nodes); } 41 DEFINE_INLINE_TRACE() { visitor->trace(m_nodes); }
42 42
43 size_t size() const { return m_nodes.size(); } 43 size_t size() const { return m_nodes.size(); }
44 bool isEmpty() const { return !m_nodes.size(); } 44 bool isEmpty() const { return !m_nodes.size(); }
45 Node* operator[](unsigned i) const { return m_nodes.at(i).get(); } 45 Node* operator[](unsigned i) const { return m_nodes.at(i).get(); }
46 HeapVector<Member<Node>>::iterator begin() { return m_nodes.begin(); }
47 HeapVector<Member<Node>>::iterator end() { return m_nodes.end(); }
48 HeapVector<Member<Node>>::const_iterator begin() const {
49 return m_nodes.begin();
50 }
51 HeapVector<Member<Node>>::const_iterator end() const { return m_nodes.end(); }
46 void reserveCapacity(size_t newCapacity) { 52 void reserveCapacity(size_t newCapacity) {
47 m_nodes.reserveCapacity(newCapacity); 53 m_nodes.reserveCapacity(newCapacity);
48 } 54 }
49 void clear() { m_nodes.clear(); } 55 void clear() { m_nodes.clear(); }
50 void swap(NodeSet& other) { 56 void swap(NodeSet& other) {
51 std::swap(m_isSorted, other.m_isSorted); 57 std::swap(m_isSorted, other.m_isSorted);
52 std::swap(m_subtreesAreDisjoint, other.m_subtreesAreDisjoint); 58 std::swap(m_subtreesAreDisjoint, other.m_subtreesAreDisjoint);
53 m_nodes.swap(other.m_nodes); 59 m_nodes.swap(other.m_nodes);
54 } 60 }
55 61
(...skipping 29 matching lines...) Expand all
85 91
86 bool m_isSorted; 92 bool m_isSorted;
87 bool m_subtreesAreDisjoint; 93 bool m_subtreesAreDisjoint;
88 HeapVector<Member<Node>> m_nodes; 94 HeapVector<Member<Node>> m_nodes;
89 }; 95 };
90 96
91 } // namespace XPath 97 } // namespace XPath
92 98
93 } // namespace blink 99 } // namespace blink
94 #endif // XPathNodeSet_h 100 #endif // XPathNodeSet_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/xml/XPathFunctions.cpp ('k') | third_party/WebKit/Source/core/xml/XPathParser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698