Index: third_party/WebKit/Source/core/dom/DocumentOrderedMap.h |
diff --git a/third_party/WebKit/Source/core/dom/DocumentOrderedMap.h b/third_party/WebKit/Source/core/dom/DocumentOrderedMap.h |
index 0877b713598c760ce52f3e8cc0a5a2d1a707a437..5b25d3f0461a6548045de89045e0ab42d7a40aeb 100644 |
--- a/third_party/WebKit/Source/core/dom/DocumentOrderedMap.h |
+++ b/third_party/WebKit/Source/core/dom/DocumentOrderedMap.h |
@@ -44,11 +44,11 @@ namespace blink { |
class Element; |
class TreeScope; |
-class DocumentOrderedMap : public NoBaseWillBeGarbageCollectedFinalized<DocumentOrderedMap> { |
+class DocumentOrderedMap : public NoBaseWillBeGarbageCollected<DocumentOrderedMap> { |
USING_FAST_MALLOC_WILL_BE_REMOVED(DocumentOrderedMap); |
+ DECLARE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(DocumentOrderedMap); |
public: |
static PassOwnPtrWillBeRawPtr<DocumentOrderedMap> create(); |
- ~DocumentOrderedMap(); |
void add(const AtomicString&, Element*); |
void remove(const AtomicString&, Element*); |
@@ -65,7 +65,24 @@ public: |
DECLARE_TRACE(); |
#if ENABLE(ASSERT) |
- void willRemoveId(const AtomicString&); |
+ // While removing a ContainerNode, ID lookups won't be precise should the tree |
+ // have elements with duplicate IDs contained in the element being removed. |
+ // Rare trees, but ID lookups may legitimately fail across such removals; |
+ // this scope object informs DocumentOrderedMaps about the transitory |
+ // state of the underlying tree. |
+ class RemoveScope { |
+ STACK_ALLOCATED(); |
+ public: |
+ RemoveScope(); |
+ ~RemoveScope(); |
+ }; |
+#else |
+ class RemoveScope { |
+ STACK_ALLOCATED(); |
+ public: |
+ RemoveScope() { } |
+ ~RemoveScope() { } |
+ }; |
#endif |
private: |
@@ -92,9 +109,6 @@ private: |
using Map = WillBeHeapHashMap<AtomicString, OwnPtrWillBeMember<MapEntry>>; |
mutable Map m_map; |
-#if ENABLE(ASSERT) |
- AtomicString m_removingId; |
-#endif |
}; |
inline bool DocumentOrderedMap::contains(const AtomicString& id) const |