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

Unified Diff: third_party/WebKit/Source/core/dom/DocumentOrderedMap.h

Issue 1555653002: Handle some failing DocumentOrderedMap ID lookups across tree removals. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: non-assert buildfix Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
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
« no previous file with comments | « third_party/WebKit/Source/core/dom/ContainerNode.cpp ('k') | third_party/WebKit/Source/core/dom/DocumentOrderedMap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698