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

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

Issue 2052583003: Limit live Document tracking to debug builds. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 | no next file » | 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 ebb654a679723787a0db21ad7ebb065c6e507684..b4f3645f135ab7d580657005588c50beaee12d1b 100644
--- a/third_party/WebKit/Source/core/dom/Document.cpp
+++ b/third_party/WebKit/Source/core/dom/Document.cpp
@@ -242,6 +242,11 @@
using namespace WTF;
using namespace Unicode;
+#ifndef NDEBUG
+using WeakDocumentSet = blink::PersistentHeapHashSet<blink::WeakMember<blink::Document>>;
+static WeakDocumentSet& liveDocumentSet();
+#endif
+
namespace blink {
using namespace HTMLNames;
@@ -367,14 +372,6 @@ uint64_t Document::s_globalTreeVersion = 0;
static bool s_threadedParsingEnabledForTesting = true;
-using WeakDocumentSet = PersistentHeapHashSet<WeakMember<Document>>;
-
-static WeakDocumentSet& liveDocumentSet()
-{
- DEFINE_STATIC_LOCAL(WeakDocumentSet, set, ());
- return set;
-}
-
// This class doesn't work with non-Document ExecutionContext.
class AutofocusTask final : public ExecutionContextTask {
public:
@@ -514,7 +511,9 @@ Document::Document(const DocumentInit& initializer, DocumentClassFlags documentC
// ignoring the defersLoading flag.
DCHECK(!parentDocument() || !parentDocument()->activeDOMObjectsAreSuspended());
+#ifndef NDEBUG
liveDocumentSet().add(this);
+#endif
}
Document::~Document()
@@ -5996,6 +5995,13 @@ template class CORE_TEMPLATE_EXPORT Supplement<Document>;
#ifndef NDEBUG
using namespace blink;
+
+static WeakDocumentSet& liveDocumentSet()
+{
+ DEFINE_STATIC_LOCAL(WeakDocumentSet, set, ());
+ return set;
+}
+
void showLiveDocumentInstances()
{
WeakDocumentSet& set = liveDocumentSet();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698