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

Unified Diff: third_party/WebKit/Source/core/dom/NodeListsNodeData.cpp

Issue 2809183003: [wrapper-tracing] Fix node list leak (Closed)
Patch Set: Created 3 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/dom/NodeListsNodeData.cpp
diff --git a/third_party/WebKit/Source/core/dom/NodeListsNodeData.cpp b/third_party/WebKit/Source/core/dom/NodeListsNodeData.cpp
index 5ccb6e9f87ea69123904c4322d14666f57d006b1..8787e7c87ba03c587d65dc6f5706bde4a056b868 100644
--- a/third_party/WebKit/Source/core/dom/NodeListsNodeData.cpp
+++ b/third_party/WebKit/Source/core/dom/NodeListsNodeData.cpp
@@ -30,6 +30,8 @@
#include "core/dom/NodeListsNodeData.h"
+#include "core/dom/LiveNodeList.h"
+
namespace blink {
void NodeListsNodeData::InvalidateCaches(const QualifiedName* attr_name) {
@@ -51,6 +53,26 @@ DEFINE_TRACE(NodeListsNodeData) {
DEFINE_TRACE_WRAPPERS(NodeListsNodeData) {
visitor->TraceWrappersWithManualWriteBarrier(child_node_list_);
+ NodeListAtomicNameCacheMap::const_iterator atomic_name_cache_end =
+ atomic_name_caches_.end();
+ for (NodeListAtomicNameCacheMap::const_iterator it =
sof 2017/04/12 06:51:50 Nit: ranged for loops possible?
Michael Lippautz 2017/04/12 08:06:33 Sure, just used a similar loop that is also presen
+ atomic_name_caches_.begin();
+ it != atomic_name_cache_end; ++it) {
+ LiveNodeListBase* list = it->value;
+ if (IsHTMLCollectionType(list->GetType())) {
+ visitor->TraceWrappersWithManualWriteBarrier(
+ static_cast<const HTMLCollection*>(list));
+ } else {
+ visitor->TraceWrappersWithManualWriteBarrier(
+ static_cast<const LiveNodeList*>(list));
+ }
+ }
+ TagCollectionCacheNS::const_iterator tag_end = tag_collection_cache_ns_.end();
+ for (TagCollectionCacheNS::const_iterator it =
+ tag_collection_cache_ns_.begin();
+ it != tag_end; ++it) {
+ visitor->TraceWrappersWithManualWriteBarrier(it->value);
+ }
}
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698