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

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

Issue 1252683003: Oilpan: Schedule a precise GC when a page navigates (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 4 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 | « Source/core/dom/Document.h ('k') | Source/core/dom/Element.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/Document.cpp
diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp
index 5c0f88ee4a3d8a0d365b46fcd01fb9e373a48603..25ca5ba4fe48db26e6d3d903d52af060abf1bf51 100644
--- a/Source/core/dom/Document.cpp
+++ b/Source/core/dom/Document.cpp
@@ -335,14 +335,11 @@ static bool acceptsEditingFocus(const Element& element)
uint64_t Document::s_globalTreeVersion = 0;
-#ifndef NDEBUG
-using WeakDocumentSet = WillBeHeapHashSet<RawPtrWillBeWeakMember<Document>>;
-static WeakDocumentSet& liveDocumentSet()
+Document::WeakDocumentSet& Document::liveDocumentSet()
{
DEFINE_STATIC_LOCAL(OwnPtrWillBePersistent<WeakDocumentSet>, set, (adoptPtrWillBeNoop(new WeakDocumentSet())));
return *set;
}
-#endif
// This class doesn't work with non-Document ExecutionContext.
class AutofocusTask final : public ExecutionContextTask {
@@ -435,6 +432,7 @@ Document::Document(const DocumentInit& initializer, DocumentClassFlags documentC
, m_hasViewportUnits(false)
, m_styleRecalcElementCounter(0)
, m_parserSyncPolicy(AllowAsynchronousParsing)
+ , m_nodeCount(0)
{
if (m_frame) {
ASSERT(m_frame->page());
@@ -480,9 +478,7 @@ Document::Document(const DocumentInit& initializer, DocumentClassFlags documentC
// ignoring the defersLoading flag.
ASSERT(!parentDocument() || !parentDocument()->activeDOMObjectsAreSuspended());
-#ifndef NDEBUG
liveDocumentSet().add(this);
-#endif
}
Document::~Document()
@@ -543,10 +539,8 @@ Document::~Document()
for (unsigned i = 0; i < WTF_ARRAY_LENGTH(m_nodeListCounts); ++i)
ASSERT(!m_nodeListCounts[i]);
-#ifndef NDEBUG
liveDocumentSet().remove(this);
#endif
-#endif
InstanceCounters::decrementCounter(InstanceCounters::DocumentCounter);
}
@@ -597,6 +591,7 @@ void Document::dispose()
DocumentLifecycleNotifier::notifyDocumentWasDisposed();
m_canvasFontCache.clear();
+ m_nodeCount = 0;
}
#endif
@@ -5781,7 +5776,7 @@ template class CORE_TEMPLATE_EXPORT WillBeHeapSupplement<Document>;
using namespace blink;
void showLiveDocumentInstances()
{
- WeakDocumentSet& set = liveDocumentSet();
+ Document::WeakDocumentSet& set = Document::liveDocumentSet();
fprintf(stderr, "There are %u documents currently alive:\n", set.size());
for (Document* document : set)
fprintf(stderr, "- Document %p URL: %s\n", document, document->url().string().utf8().data());
« no previous file with comments | « Source/core/dom/Document.h ('k') | Source/core/dom/Element.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698