Reviewed by Maciej.
authordarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 1 Oct 2007 01:54:09 +0000 (01:54 +0000)
committerdarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 1 Oct 2007 01:54:09 +0000 (01:54 +0000)
commitd48ea65fb96698fab58c11cb74ca5692828d9058
tree39c7c33ed175b08c3fb8585ab13bf3b6a70fba19
parent86e94820230e3f427a776dbb7ed49034fb34157a
    Reviewed by Maciej.

        - tone down the assertion I asked Harrison to include in his fix for
          <rdar://problem/5511128>; it's OK to re-ref and deref the document
          as long as you do so after the children are done being destroyed

        No effect on release builds. Assertion change only.

        Besides the changes listed below, renamed m_hasDeleted flag to
        m_deletionHasBegun.

        * dom/ContainerNode.cpp: (WebCore::ContainerNode::removeAllChildren):
        Added code to set the m_deletionHasBegun flag and some assertions
        that test its state.

        * dom/Document.h: Removed m_hasDeleted -- we now use m_deletionHasBegun
        in the base class TreeShared.
        * dom/Document.cpp:
        (WebCore::Document::Document): Removed initialization of m_hasDeleted.
        (WebCore::Document::removedLastRef): Added code to clear
        m_inRemovedLastRefFunction if we end up deciding not to delete this.

        * platform/Shared.h:
        (WebCore::TreeShared::TreeShared): Added m_deletionHasBegun in addition to
        m_inRemovedLastRefFunction (formerly named m_hasRemovedLastRef).
        (WebCore::TreeShared::~TreeShared): Assert that m_deletionHasBegun is true.
        (WebCore::TreeShared::ref): Assert neither flag is true.
        (WebCore::TreeShared::deref): Ditto.
        (WebCore::TreeShared::hasOneRef): Ditto.
        (WebCore::TreeShared::removedLastRef): Made private. Added code to
        set m_hasDeleted to true. Also removed cast; since this class template
        has a virtual destructor, we don't need to cast before calling delete.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@25813 268f45cc-cd09-0410-ab3c-d52691b4dbfc
WebCore/ChangeLog
WebCore/dom/ContainerNode.cpp
WebCore/dom/Document.cpp
WebCore/dom/Document.h
WebCore/platform/Shared.h