OLD | NEW |
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 16 matching lines...) Expand all Loading... |
27 #define XPathNodeSet_h | 27 #define XPathNodeSet_h |
28 | 28 |
29 #include "core/dom/Node.h" | 29 #include "core/dom/Node.h" |
30 #include "wtf/Forward.h" | 30 #include "wtf/Forward.h" |
31 #include "wtf/Vector.h" | 31 #include "wtf/Vector.h" |
32 | 32 |
33 namespace blink { | 33 namespace blink { |
34 | 34 |
35 namespace XPath { | 35 namespace XPath { |
36 | 36 |
37 // TODO(Oilpan): drop Finalized once Node is on the heap. | 37 class NodeSet final : public GarbageCollected<NodeSet> { |
38 class NodeSet final : public GarbageCollectedFinalized<NodeSet> { | |
39 public: | 38 public: |
40 static NodeSet* create() { return new NodeSet; } | 39 static NodeSet* create() { return new NodeSet; } |
41 static NodeSet* create(const NodeSet&); | 40 static NodeSet* create(const NodeSet&); |
42 DEFINE_INLINE_TRACE() { visitor->trace(m_nodes); } | 41 DEFINE_INLINE_TRACE() { visitor->trace(m_nodes); } |
43 | 42 |
44 size_t size() const { return m_nodes.size(); } | 43 size_t size() const { return m_nodes.size(); } |
45 bool isEmpty() const { return !m_nodes.size(); } | 44 bool isEmpty() const { return !m_nodes.size(); } |
46 Node* operator[](unsigned i) const { return m_nodes.at(i).get(); } | 45 Node* operator[](unsigned i) const { return m_nodes.at(i).get(); } |
47 void reserveCapacity(size_t newCapacity) { m_nodes.reserveCapacity(newCapaci
ty); } | 46 void reserveCapacity(size_t newCapacity) { m_nodes.reserveCapacity(newCapaci
ty); } |
48 void clear() { m_nodes.clear(); } | 47 void clear() { m_nodes.clear(); } |
(...skipping 29 matching lines...) Expand all Loading... |
78 | 77 |
79 bool m_isSorted; | 78 bool m_isSorted; |
80 bool m_subtreesAreDisjoint; | 79 bool m_subtreesAreDisjoint; |
81 HeapVector<Member<Node>> m_nodes; | 80 HeapVector<Member<Node>> m_nodes; |
82 }; | 81 }; |
83 | 82 |
84 } // namespace XPath | 83 } // namespace XPath |
85 | 84 |
86 } // namespace blink | 85 } // namespace blink |
87 #endif // XPathNodeSet_h | 86 #endif // XPathNodeSet_h |
OLD | NEW |