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

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

Issue 2809183003: [wrapper-tracing] Fix node list leak (Closed)
Patch Set: Addressed comments. 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/dom/NodeListsNodeData.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/dom/Document.cpp
diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp
index 2f287b36a75b8f9d58f0cfc4f61b89788eb359e6..313a4e1a74adebafae14a525ee8a9fbea779f56d 100644
--- a/third_party/WebKit/Source/core/dom/Document.cpp
+++ b/third_party/WebKit/Source/core/dom/Document.cpp
@@ -6630,21 +6630,13 @@ void Document::RecordDeferredLoadReason(WouldLoadReason reason) {
}
DEFINE_TRACE_WRAPPERS(Document) {
+ // node_lists_ are traced in their corresponding NodeListsNodeData, keeping
+ // them only alive for live nodes. Otherwise we would keep lists of dead
+ // nodes alive that have not yet been invalidated.
visitor->TraceWrappers(imports_controller_);
visitor->TraceWrappers(implementation_);
visitor->TraceWrappers(style_sheet_list_);
visitor->TraceWrappers(style_engine_);
- for (int i = 0; i < kNumNodeListInvalidationTypes; ++i) {
- for (auto list : node_lists_[i]) {
- if (IsHTMLCollectionType(list->GetType())) {
- visitor->TraceWrappersWithManualWriteBarrier(
- static_cast<const HTMLCollection*>(list.Get()));
- } else {
- visitor->TraceWrappersWithManualWriteBarrier(
- static_cast<const LiveNodeList*>(list.Get()));
- }
- }
- }
// Cannot trace in Supplementable<Document> as it is part of platform/ and
// thus cannot refer to ScriptWrappableVisitor.
visitor->TraceWrappers(
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/dom/NodeListsNodeData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698