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

Side by Side Diff: Source/core/xml/XPathStep.h

Issue 1099613003: Oilpan: have xml/ objects on the heap by default. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: simplify XPathResult dtor Created 5 years, 8 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
« no previous file with comments | « Source/core/xml/XPathResult.idl ('k') | Source/core/xml/XPathStep.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 22 matching lines...) Expand all
33 namespace blink { 33 namespace blink {
34 34
35 class Node; 35 class Node;
36 36
37 namespace XPath { 37 namespace XPath {
38 38
39 class Predicate; 39 class Predicate;
40 40
41 class Step final : public ParseNode { 41 class Step final : public ParseNode {
42 WTF_MAKE_NONCOPYABLE(Step); 42 WTF_MAKE_NONCOPYABLE(Step);
43 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(Step);
44 public: 43 public:
45 enum Axis { 44 enum Axis {
46 AncestorAxis, AncestorOrSelfAxis, AttributeAxis, 45 AncestorAxis, AncestorOrSelfAxis, AttributeAxis,
47 ChildAxis, DescendantAxis, DescendantOrSelfAxis, 46 ChildAxis, DescendantAxis, DescendantOrSelfAxis,
48 FollowingAxis, FollowingSiblingAxis, NamespaceAxis, 47 FollowingAxis, FollowingSiblingAxis, NamespaceAxis,
49 ParentAxis, PrecedingAxis, PrecedingSiblingAxis, 48 ParentAxis, PrecedingAxis, PrecedingSiblingAxis,
50 SelfAxis 49 SelfAxis
51 }; 50 };
52 51
53 class NodeTest : public NoBaseWillBeGarbageCollectedFinalized<NodeTest> { 52 class NodeTest : public GarbageCollectedFinalized<NodeTest> {
54 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(NodeTest);
55 public: 53 public:
56 enum Kind { 54 enum Kind {
57 TextNodeTest, CommentNodeTest, ProcessingInstructionNodeTest, AnyNod eTest, NameTest 55 TextNodeTest, CommentNodeTest, ProcessingInstructionNodeTest, AnyNod eTest, NameTest
58 }; 56 };
59 57
60 NodeTest(Kind kind) : m_kind(kind) { } 58 NodeTest(Kind kind) : m_kind(kind) { }
61 NodeTest(Kind kind, const String& data) : m_kind(kind), m_data(data) { } 59 NodeTest(Kind kind, const String& data) : m_kind(kind), m_data(data) { }
62 NodeTest(Kind kind, const AtomicString& data, const AtomicString& namesp aceURI) : m_kind(kind), m_data(data), m_namespaceURI(namespaceURI) { } 60 NodeTest(Kind kind, const AtomicString& data, const AtomicString& namesp aceURI) : m_kind(kind), m_data(data), m_namespaceURI(namespaceURI) { }
63 61
64 NodeTest(const NodeTest& o) 62 NodeTest(const NodeTest& o)
65 : m_kind(o.m_kind) 63 : m_kind(o.m_kind)
66 , m_data(o.m_data) 64 , m_data(o.m_data)
67 , m_namespaceURI(o.m_namespaceURI) 65 , m_namespaceURI(o.m_namespaceURI)
68 { 66 {
69 ASSERT(o.m_mergedPredicates.isEmpty()); 67 ASSERT(o.m_mergedPredicates.isEmpty());
70 } 68 }
71 NodeTest& operator=(const NodeTest& o) 69 NodeTest& operator=(const NodeTest& o)
72 { 70 {
73 m_kind = o.m_kind; 71 m_kind = o.m_kind;
74 m_data = o.m_data; 72 m_data = o.m_data;
75 m_namespaceURI = o.m_namespaceURI; 73 m_namespaceURI = o.m_namespaceURI;
76 ASSERT(o.m_mergedPredicates.isEmpty()); 74 ASSERT(o.m_mergedPredicates.isEmpty());
77 return *this; 75 return *this;
78 } 76 }
79 DEFINE_INLINE_TRACE() { visitor->trace(m_mergedPredicates); } 77 DEFINE_INLINE_TRACE() { visitor->trace(m_mergedPredicates); }
80 78
81 Kind kind() const { return m_kind; } 79 Kind kind() const { return m_kind; }
82 const AtomicString& data() const { return m_data; } 80 const AtomicString& data() const { return m_data; }
83 const AtomicString& namespaceURI() const { return m_namespaceURI; } 81 const AtomicString& namespaceURI() const { return m_namespaceURI; }
84 WillBeHeapVector<OwnPtrWillBeMember<Predicate>>& mergedPredicates() { re turn m_mergedPredicates; } 82 HeapVector<Member<Predicate>>& mergedPredicates() { return m_mergedPredi cates; }
85 const WillBeHeapVector<OwnPtrWillBeMember<Predicate>>& mergedPredicates( ) const { return m_mergedPredicates; } 83 const HeapVector<Member<Predicate>>& mergedPredicates() const { return m _mergedPredicates; }
86 84
87 private: 85 private:
88 Kind m_kind; 86 Kind m_kind;
89 AtomicString m_data; 87 AtomicString m_data;
90 AtomicString m_namespaceURI; 88 AtomicString m_namespaceURI;
91 89
92 // When possible, we merge some or all predicates with node test for bet ter performance. 90 // When possible, we merge some or all predicates with node test for bet ter performance.
93 WillBeHeapVector<OwnPtrWillBeMember<Predicate>> m_mergedPredicates; 91 HeapVector<Member<Predicate>> m_mergedPredicates;
94 }; 92 };
95 93
96 Step(Axis, const NodeTest&); 94 Step(Axis, const NodeTest&);
97 Step(Axis, const NodeTest&, WillBeHeapVector<OwnPtrWillBeMember<Predicate>>& ); 95 Step(Axis, const NodeTest&, HeapVector<Member<Predicate>>&);
98 virtual ~Step(); 96 virtual ~Step();
99 DECLARE_VIRTUAL_TRACE(); 97 DECLARE_VIRTUAL_TRACE();
100 98
101 void optimize(); 99 void optimize();
102 100
103 void evaluate(EvaluationContext&, Node* context, NodeSet&) const; 101 void evaluate(EvaluationContext&, Node* context, NodeSet&) const;
104 102
105 Axis axis() const { return m_axis; } 103 Axis axis() const { return m_axis; }
106 const NodeTest& nodeTest() const { return *m_nodeTest; } 104 const NodeTest& nodeTest() const { return *m_nodeTest; }
107 105
108 private: 106 private:
109 friend void optimizeStepPair(Step*, Step*, bool&); 107 friend bool optimizeStepPair(Step*, Step*);
110 bool predicatesAreContextListInsensitive() const; 108 bool predicatesAreContextListInsensitive() const;
111 NodeTest& nodeTest() { return *m_nodeTest; } 109 NodeTest& nodeTest() { return *m_nodeTest; }
112 110
113 void parseNodeTest(const String&); 111 void parseNodeTest(const String&);
114 void nodesInAxis(EvaluationContext&, Node* context, NodeSet&) const; 112 void nodesInAxis(EvaluationContext&, Node* context, NodeSet&) const;
115 String namespaceFromNodetest(const String& nodeTest) const; 113 String namespaceFromNodetest(const String& nodeTest) const;
116 114
117 Axis m_axis; 115 Axis m_axis;
118 OwnPtrWillBeMember<NodeTest> m_nodeTest; 116 Member<NodeTest> m_nodeTest;
119 WillBeHeapVector<OwnPtrWillBeMember<Predicate>> m_predicates; 117 HeapVector<Member<Predicate>> m_predicates;
120 }; 118 };
121 119
122 void optimizeStepPair(Step*, Step*, bool& dropSecondStep); 120 bool optimizeStepPair(Step*, Step*);
123 121
124 } // namespace XPath 122 } // namespace XPath
125 123
126 } // namespace blink 124 } // namespace blink
127 125
128 #endif // XPathStep_h 126 #endif // XPathStep_h
OLDNEW
« no previous file with comments | « Source/core/xml/XPathResult.idl ('k') | Source/core/xml/XPathStep.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698