Index: Source/WebCore/dom/Document.h |
=================================================================== |
--- Source/WebCore/dom/Document.h (revision 145445) |
+++ Source/WebCore/dom/Document.h (working copy) |
@@ -228,29 +228,6 @@ |
using ContainerNode::ref; |
using ContainerNode::deref; |
- // Nodes belonging to this document hold guard references - |
- // these are enough to keep the document from being destroyed, but |
- // not enough to keep it from removing its children. This allows a |
- // node that outlives its document to still have a valid document |
- // pointer without introducing reference cycles. |
- void guardRef() |
- { |
- ASSERT(!m_deletionHasBegun); |
- ++m_guardRefCount; |
- } |
- |
- void guardDeref() |
- { |
- ASSERT(!m_deletionHasBegun); |
- --m_guardRefCount; |
- if (!m_guardRefCount && !refCount()) { |
-#ifndef NDEBUG |
- m_deletionHasBegun = true; |
-#endif |
- delete this; |
- } |
- } |
- |
Element* getElementById(const AtomicString& id) const; |
virtual bool canContainRangeEndPoint() const { return true; } |
@@ -1217,8 +1194,8 @@ |
friend class Node; |
friend class IgnoreDestructiveWriteCountIncrementer; |
- void removedLastRef(); |
- |
+ virtual void dispose() OVERRIDE; |
+ |
void detachParser(); |
typedef void (*ArgumentsCallback)(const String& keyString, const String& valueString, Document*, void* data); |
@@ -1286,8 +1263,6 @@ |
void addListenerType(ListenerType listenerType) { m_listenerTypes |= listenerType; } |
void addMutationEventListenerTypeIfEnabled(ListenerType); |
- int m_guardRefCount; |
- |
void styleResolverThrowawayTimerFired(Timer<Document>*); |
Timer<Document> m_styleResolverThrowawayTimer; |
double m_lastStyleResolverAccessTime; |
@@ -1603,10 +1578,9 @@ |
, m_previous(0) |
, m_next(0) |
{ |
- if (document) |
- document->guardRef(); |
- else |
+ if (!m_treeScope) |
m_treeScope = TreeScope::noDocumentInstance(); |
+ m_treeScope->guardRef(); |
#if !defined(NDEBUG) || (defined(DUMP_NODE_STATISTICS) && DUMP_NODE_STATISTICS) |
trackForDebugging(); |