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

Side by Side Diff: third_party/WebKit/Source/core/dom/Document.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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All
7 * rights reserved. 7 * rights reserved.
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
9 * (http://www.torchmobile.com/) 9 * (http://www.torchmobile.com/)
10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
(...skipping 6615 matching lines...) Expand 10 before | Expand all | Expand 10 after
6626 for (int i = static_cast<int>(would_load_reason_) + 1; 6626 for (int i = static_cast<int>(would_load_reason_) + 1;
6627 i <= static_cast<int>(reason); ++i) 6627 i <= static_cast<int>(reason); ++i)
6628 RecordLoadReasonToHistogram(static_cast<WouldLoadReason>(i)); 6628 RecordLoadReasonToHistogram(static_cast<WouldLoadReason>(i));
6629 would_load_reason_ = reason; 6629 would_load_reason_ = reason;
6630 } 6630 }
6631 6631
6632 DEFINE_TRACE_WRAPPERS(Document) { 6632 DEFINE_TRACE_WRAPPERS(Document) {
6633 visitor->TraceWrappers(imports_controller_); 6633 visitor->TraceWrappers(imports_controller_);
6634 visitor->TraceWrappers(implementation_); 6634 visitor->TraceWrappers(implementation_);
6635 visitor->TraceWrappers(style_sheet_list_); 6635 visitor->TraceWrappers(style_sheet_list_);
6636 visitor->TraceWrappers(style_engine_); 6636 visitor->TraceWrappers(style_engine_);
sof 2017/04/12 06:51:50 Add a comment saying why/where node_lists_ are tak
Michael Lippautz 2017/04/12 08:06:33 Done.
6637 for (int i = 0; i < kNumNodeListInvalidationTypes; ++i) {
6638 for (auto list : node_lists_[i]) {
6639 if (IsHTMLCollectionType(list->GetType())) {
6640 visitor->TraceWrappersWithManualWriteBarrier(
6641 static_cast<const HTMLCollection*>(list.Get()));
6642 } else {
6643 visitor->TraceWrappersWithManualWriteBarrier(
6644 static_cast<const LiveNodeList*>(list.Get()));
6645 }
6646 }
6647 }
6648 // Cannot trace in Supplementable<Document> as it is part of platform/ and 6637 // Cannot trace in Supplementable<Document> as it is part of platform/ and
6649 // thus cannot refer to ScriptWrappableVisitor. 6638 // thus cannot refer to ScriptWrappableVisitor.
6650 visitor->TraceWrappers( 6639 visitor->TraceWrappers(
6651 static_cast<FontFaceSet*>(Supplementable<Document>::supplements_.at( 6640 static_cast<FontFaceSet*>(Supplementable<Document>::supplements_.at(
6652 FontFaceSet::SupplementName()))); 6641 FontFaceSet::SupplementName())));
6653 ContainerNode::TraceWrappers(visitor); 6642 ContainerNode::TraceWrappers(visitor);
6654 } 6643 }
6655 6644
6656 template class CORE_TEMPLATE_EXPORT Supplement<Document>; 6645 template class CORE_TEMPLATE_EXPORT Supplement<Document>;
6657 6646
6658 } // namespace blink 6647 } // namespace blink
6659 6648
6660 #ifndef NDEBUG 6649 #ifndef NDEBUG
6661 static WeakDocumentSet& liveDocumentSet() { 6650 static WeakDocumentSet& liveDocumentSet() {
6662 DEFINE_STATIC_LOCAL(WeakDocumentSet, set, ()); 6651 DEFINE_STATIC_LOCAL(WeakDocumentSet, set, ());
6663 return set; 6652 return set;
6664 } 6653 }
6665 6654
6666 void showLiveDocumentInstances() { 6655 void showLiveDocumentInstances() {
6667 WeakDocumentSet& set = liveDocumentSet(); 6656 WeakDocumentSet& set = liveDocumentSet();
6668 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6657 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6669 for (blink::Document* document : set) 6658 for (blink::Document* document : set)
6670 fprintf(stderr, "- Document %p URL: %s\n", document, 6659 fprintf(stderr, "- Document %p URL: %s\n", document,
6671 document->Url().GetString().Utf8().Data()); 6660 document->Url().GetString().Utf8().Data());
6672 } 6661 }
6673 #endif 6662 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698