Changeset 164242 in webkit
- Timestamp:
- Feb 17, 2014 12:19:42 PM (10 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r164239 r164242 1 2014-02-17 Antti Koivisto <antti@apple.com> 2 3 Rename Document::m_selfOnlyRefCount to m_referencingNodeCount 4 https://bugs.webkit.org/show_bug.cgi?id=128916 5 6 Reviewed by Andreas Kling. 7 8 Make the name more informative. Also make it zero based (document is not considered to reference itself). 9 10 * dom/Document.cpp: 11 (WebCore::Document::Document): 12 (WebCore::Document::removedLastRef): 13 * dom/Document.h: 14 (WebCore::Document::increaseReferencingNodeCount): 15 (WebCore::Document::decreaseReferencingNodeCount): 16 (WebCore::Node::Node): 17 * dom/Node.cpp: 18 (WebCore::Node::~Node): 19 * dom/TreeScopeAdopter.cpp: 20 (WebCore::TreeScopeAdopter::moveTreeToNewScope): 21 (WebCore::TreeScopeAdopter::moveNodeToNewDocument): 22 1 23 2014-02-17 ChangSeok Oh <changseok.oh@collabora.com> 2 24 -
trunk/Source/WebCore/dom/Document.cpp
r164196 r164242 401 401 , m_touchEventsChangedTimer(this, &Document::touchEventsChangedTimerFired) 402 402 #endif 403 , m_ selfOnlyRefCount(1)403 , m_referencingNodeCount(0) 404 404 , m_styleResolverThrowawayTimer(this, &Document::styleResolverThrowawayTimerFired, timeBeforeThrowingAwayStyleResolverAfterLastUseInSeconds) 405 405 , m_didCalculateStyleResolver(false) … … 641 641 { 642 642 ASSERT(!m_deletionHasBegun); 643 ASSERT(m_selfOnlyRefCount); 644 if (m_selfOnlyRefCount > 1) { 645 // If removing a child removes the last self-only ref, we don't want the scope to be destroyed 646 // until after removeDetachedChildren returns, so we protect ourselves with an extra self-only ref. 647 selfOnlyRef(); 643 if (m_referencingNodeCount) { 644 // If removing a child removes the last node reference, we don't want the scope to be destroyed 645 // until after removeDetachedChildren returns, so we protect ourselves. 646 incrementReferencingNodeCount(); 648 647 649 648 // We must make sure not to be retaining any of our children through … … 680 679 m_inRemovedLastRefFunction = false; 681 680 #endif 682 selfOnlyDeref();681 decrementReferencingNodeCount(); 683 682 } else { 684 683 #ifndef NDEBUG -
trunk/Source/WebCore/dom/Document.h
r164195 r164242 264 264 virtual ~Document(); 265 265 266 // Nodes belonging to this document hold self-only references-266 // Nodes belonging to this document increase referencingNodeCount - 267 267 // these are enough to keep the document from being destroyed, but 268 268 // not enough to keep it from removing its children. This allows a 269 // node that outlives its scopeto still have a valid document269 // node that outlives its document to still have a valid document 270 270 // pointer without introducing reference cycles. 271 void selfOnlyRef()271 void incrementReferencingNodeCount() 272 272 { 273 273 ASSERT(!m_deletionHasBegun); 274 ++m_ selfOnlyRefCount;274 ++m_referencingNodeCount; 275 275 } 276 276 277 void selfOnlyDeref()277 void decrementReferencingNodeCount() 278 278 { 279 ASSERT(!m_deletionHasBegun || m_selfOnlyRefCount == 1);280 --m_ selfOnlyRefCount;281 if ( m_selfOnlyRefCount == 1&& !refCount()) {279 ASSERT(!m_deletionHasBegun || !m_referencingNodeCount); 280 --m_referencingNodeCount; 281 if (!m_referencingNodeCount && !refCount()) { 282 282 #if !ASSERT_DISABLED 283 283 m_deletionHasBegun = true; … … 1345 1345 void styleResolverThrowawayTimerFired(DeferrableOneShotTimer<Document>&); 1346 1346 1347 unsigned m_ selfOnlyRefCount;1347 unsigned m_referencingNodeCount; 1348 1348 1349 1349 DeferrableOneShotTimer<Document> m_styleResolverThrowawayTimer; … … 1716 1716 , m_next(0) 1717 1717 { 1718 document-> selfOnlyRef();1718 document->incrementReferencingNodeCount(); 1719 1719 1720 1720 #if !defined(NDEBUG) || (defined(DUMP_NODE_STATISTICS) && DUMP_NODE_STATISTICS) -
trunk/Source/WebCore/dom/Node.cpp
r164195 r164242 309 309 willBeDeletedFrom(&document()); 310 310 311 document(). selfOnlyDeref();311 document().decrementReferencingNodeCount(); 312 312 313 313 InspectorCounters::decrementCounter(InspectorCounters::NodeCounter); -
trunk/Source/WebCore/dom/TreeScopeAdopter.cpp
r164195 r164242 46 46 bool willMoveToNewDocument = &oldDocument != &newDocument; 47 47 if (willMoveToNewDocument) { 48 oldDocument. selfOnlyRef();48 oldDocument.incrementReferencingNodeCount(); 49 49 oldDocument.incDOMTreeVersion(); 50 50 } … … 78 78 79 79 if (willMoveToNewDocument) 80 oldDocument. selfOnlyDeref();80 oldDocument.decrementReferencingNodeCount(); 81 81 } 82 82 … … 113 113 ASSERT(!node->inDocument() || oldDocument != newDocument); 114 114 115 newDocument-> selfOnlyRef();116 oldDocument-> selfOnlyDeref();115 newDocument->incrementReferencingNodeCount(); 116 oldDocument->decrementReferencingNodeCount(); 117 117 118 118 if (node->hasRareData()) {
Note: See TracChangeset
for help on using the changeset viewer.