Chromium Code Reviews| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 55 bool containsMultiple(const AtomicString&) const; | 55 bool containsMultiple(const AtomicString&) const; |
| 56 // concrete instantiations of the get<>() method template | 56 // concrete instantiations of the get<>() method template |
| 57 Element* getElementById(const AtomicString&, const TreeScope*) const; | 57 Element* getElementById(const AtomicString&, const TreeScope*) const; |
| 58 const WillBeHeapVector<RawPtrWillBeMember<Element>>& getAllElementsById(cons t AtomicString&, const TreeScope*) const; | 58 const WillBeHeapVector<RawPtrWillBeMember<Element>>& getAllElementsById(cons t AtomicString&, const TreeScope*) const; |
| 59 Element* getElementByMapName(const AtomicString&, const TreeScope*) const; | 59 Element* getElementByMapName(const AtomicString&, const TreeScope*) const; |
| 60 Element* getElementByLowercasedMapName(const AtomicString&, const TreeScope* ) const; | 60 Element* getElementByLowercasedMapName(const AtomicString&, const TreeScope* ) const; |
| 61 Element* getElementByLabelForAttribute(const AtomicString&, const TreeScope* ) const; | 61 Element* getElementByLabelForAttribute(const AtomicString&, const TreeScope* ) const; |
| 62 | 62 |
| 63 DECLARE_TRACE(); | 63 DECLARE_TRACE(); |
| 64 | 64 |
| 65 #if ENABLE(ASSERT) | |
| 66 void willBeRemovingId(const AtomicString*); | |
|
esprehn
2015/12/18 00:42:26
willRemoveId()
no "Be"
sof
2015/12/18 07:31:53
Renamed to willRemoveId().
| |
| 67 #endif | |
| 68 | |
| 65 private: | 69 private: |
| 70 DocumentOrderedMap(); | |
|
esprehn
2015/12/18 00:42:26
we should declare the destructor too
sof
2015/12/18 07:31:53
Done, but see below.
| |
| 71 | |
| 66 template<bool keyMatches(const AtomicString&, const Element&)> | 72 template<bool keyMatches(const AtomicString&, const Element&)> |
| 67 Element* get(const AtomicString&, const TreeScope*) const; | 73 Element* get(const AtomicString&, const TreeScope*) const; |
| 68 | 74 |
| 69 class MapEntry : public NoBaseWillBeGarbageCollected<MapEntry> { | 75 class MapEntry : public NoBaseWillBeGarbageCollected<MapEntry> { |
| 70 public: | 76 public: |
| 71 explicit MapEntry(Element* firstElement) | 77 explicit MapEntry(Element* firstElement) |
| 72 : element(firstElement) | 78 : element(firstElement) |
| 73 , count(1) | 79 , count(1) |
| 74 { | 80 { |
| 75 } | 81 } |
| 76 | 82 |
| 77 DECLARE_TRACE(); | 83 DECLARE_TRACE(); |
| 78 | 84 |
| 79 RawPtrWillBeMember<Element> element; | 85 RawPtrWillBeMember<Element> element; |
| 80 unsigned count; | 86 unsigned count; |
| 81 WillBeHeapVector<RawPtrWillBeMember<Element>> orderedList; | 87 WillBeHeapVector<RawPtrWillBeMember<Element>> orderedList; |
| 82 }; | 88 }; |
| 83 | 89 |
| 84 using Map = WillBeHeapHashMap<AtomicString, OwnPtrWillBeMember<MapEntry>>; | 90 using Map = WillBeHeapHashMap<AtomicString, OwnPtrWillBeMember<MapEntry>>; |
| 85 | 91 |
| 86 mutable Map m_map; | 92 mutable Map m_map; |
| 93 #if ENABLE(ASSERT) | |
| 94 const AtomicString* m_removingId; | |
|
tkent
2015/12/18 00:30:57
Can you make this |AtomicString| and check AtomicS
esprehn
2015/12/18 00:42:26
+1
sof
2015/12/18 07:31:53
Done that; slight downside with such a design is i
| |
| 95 #endif | |
| 87 }; | 96 }; |
| 88 | 97 |
| 89 inline bool DocumentOrderedMap::contains(const AtomicString& id) const | 98 inline bool DocumentOrderedMap::contains(const AtomicString& id) const |
| 90 { | 99 { |
| 91 return m_map.contains(id); | 100 return m_map.contains(id); |
| 92 } | 101 } |
| 93 | 102 |
| 94 inline bool DocumentOrderedMap::containsMultiple(const AtomicString& id) const | 103 inline bool DocumentOrderedMap::containsMultiple(const AtomicString& id) const |
| 95 { | 104 { |
| 96 Map::const_iterator it = m_map.find(id); | 105 Map::const_iterator it = m_map.find(id); |
| 97 return it != m_map.end() && it->value->count > 1; | 106 return it != m_map.end() && it->value->count > 1; |
| 98 } | 107 } |
| 99 | 108 |
| 100 } // namespace blink | 109 } // namespace blink |
| 101 | 110 |
| 102 #endif // DocumentOrderedMap_h | 111 #endif // DocumentOrderedMap_h |
| OLD | NEW |