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...) 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 class NodeSet : public NoBaseWillBeGarbageCollected<NodeSet> { | 37 // FIXME: Oilpan: drop Finalized once Node is on the heap. |
38 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED; | 38 class NodeSet final : public GarbageCollectedFinalized<NodeSet> { |
39 public: | 39 public: |
40 static PassOwnPtrWillBeRawPtr<NodeSet> create() { return adoptPtrWillBeNoop(
new NodeSet); } | 40 static NodeSet* create() { return new NodeSet; } |
41 static PassOwnPtrWillBeRawPtr<NodeSet> create(const NodeSet&); | 41 static NodeSet* create(const NodeSet&); |
42 void trace(Visitor* visitor) { visitor->trace(m_nodes); } | 42 void trace(Visitor*); |
43 | 43 |
44 size_t size() const { return m_nodes.size(); } | 44 size_t size() const { return m_nodes.size(); } |
45 bool isEmpty() const { return !m_nodes.size(); } | 45 bool isEmpty() const { return !m_nodes.size(); } |
46 Node* operator[](unsigned i) const { return m_nodes.at(i).get(); } | 46 Node* operator[](unsigned i) const { return m_nodes.at(i).get(); } |
47 void reserveCapacity(size_t newCapacity) { m_nodes.reserveCapacity(newCapaci
ty); } | 47 void reserveCapacity(size_t newCapacity) { m_nodes.reserveCapacity(newCapaci
ty); } |
48 void clear() { m_nodes.clear(); } | 48 void clear() { m_nodes.clear(); } |
49 void swap(NodeSet& other) { std::swap(m_isSorted, other.m_isSorted); std::sw
ap(m_subtreesAreDisjoint, other.m_subtreesAreDisjoint); m_nodes.swap(other.m_nod
es); } | 49 void swap(NodeSet& other) { std::swap(m_isSorted, other.m_isSorted); std::sw
ap(m_subtreesAreDisjoint, other.m_subtreesAreDisjoint); m_nodes.swap(other.m_nod
es); } |
50 | 50 |
51 // NodeSet itself does not verify that nodes in it are unique. | 51 // NodeSet itself does not verify that nodes in it are unique. |
52 void append(PassRefPtrWillBeRawPtr<Node> node) { m_nodes.append(node); } | 52 void append(PassRefPtrWillBeRawPtr<Node> node) { m_nodes.append(node); } |
(...skipping 25 matching lines...) Loading... |
78 | 78 |
79 bool m_isSorted; | 79 bool m_isSorted; |
80 bool m_subtreesAreDisjoint; | 80 bool m_subtreesAreDisjoint; |
81 WillBeHeapVector<RefPtrWillBeMember<Node> > m_nodes; | 81 WillBeHeapVector<RefPtrWillBeMember<Node> > m_nodes; |
82 }; | 82 }; |
83 | 83 |
84 } | 84 } |
85 | 85 |
86 } | 86 } |
87 #endif // XPathNodeSet_h | 87 #endif // XPathNodeSet_h |
OLD | NEW |