OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights
reserved. | 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights
reserved. |
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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 17 matching lines...) Expand all Loading... |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #ifndef DocumentOrderedMap_h | 31 #ifndef DocumentOrderedMap_h |
32 #define DocumentOrderedMap_h | 32 #define DocumentOrderedMap_h |
33 | 33 |
34 #include "platform/heap/Handle.h" | 34 #include "platform/heap/Handle.h" |
35 #include "wtf/Forward.h" | 35 #include "wtf/Forward.h" |
36 #include "wtf/HashMap.h" | 36 #include "wtf/HashMap.h" |
37 #include "wtf/text/AtomicString.h" | 37 #include "wtf/text/AtomicString.h" |
| 38 #include "wtf/text/AtomicStringHash.h" |
38 #include "wtf/text/StringImpl.h" | 39 #include "wtf/text/StringImpl.h" |
39 | 40 |
40 namespace blink { | 41 namespace blink { |
41 | 42 |
42 class Element; | 43 class Element; |
43 class TreeScope; | 44 class TreeScope; |
44 | 45 |
45 class DocumentOrderedMap : public NoBaseWillBeGarbageCollected<DocumentOrderedMa
p> { | 46 class DocumentOrderedMap : public NoBaseWillBeGarbageCollected<DocumentOrderedMa
p> { |
46 public: | 47 public: |
47 static PassOwnPtrWillBeRawPtr<DocumentOrderedMap> create(); | 48 static PassOwnPtrWillBeRawPtr<DocumentOrderedMap> create(); |
(...skipping 23 matching lines...) Expand all Loading... |
71 { | 72 { |
72 } | 73 } |
73 | 74 |
74 void trace(Visitor*); | 75 void trace(Visitor*); |
75 | 76 |
76 RawPtrWillBeMember<Element> element; | 77 RawPtrWillBeMember<Element> element; |
77 unsigned count; | 78 unsigned count; |
78 WillBeHeapVector<RawPtrWillBeMember<Element> > orderedList; | 79 WillBeHeapVector<RawPtrWillBeMember<Element> > orderedList; |
79 }; | 80 }; |
80 | 81 |
81 typedef WillBeHeapHashMap<StringImpl*, OwnPtrWillBeMember<MapEntry> > Map; | 82 typedef WillBeHeapHashMap<AtomicString, OwnPtrWillBeMember<MapEntry> > Map; |
82 | 83 |
83 mutable Map m_map; | 84 mutable Map m_map; |
84 }; | 85 }; |
85 | 86 |
86 inline bool DocumentOrderedMap::contains(const AtomicString& id) const | 87 inline bool DocumentOrderedMap::contains(const AtomicString& id) const |
87 { | 88 { |
88 return m_map.contains(id.impl()); | 89 return m_map.contains(id); |
89 } | 90 } |
90 | 91 |
91 inline bool DocumentOrderedMap::containsMultiple(const AtomicString& id) const | 92 inline bool DocumentOrderedMap::containsMultiple(const AtomicString& id) const |
92 { | 93 { |
93 Map::const_iterator it = m_map.find(id.impl()); | 94 Map::const_iterator it = m_map.find(id); |
94 return it != m_map.end() && it->value->count > 1; | 95 return it != m_map.end() && it->value->count > 1; |
95 } | 96 } |
96 | 97 |
97 } // namespace blink | 98 } // namespace blink |
98 | 99 |
99 #endif // DocumentOrderedMap_h | 100 #endif // DocumentOrderedMap_h |
OLD | NEW |