Reviewed by Darin.
authormjs <mjs@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 31 May 2005 01:20:46 +0000 (01:20 +0000)
committermjs <mjs@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 31 May 2005 01:20:46 +0000 (01:20 +0000)
commitd515e38a58770e98fab9eb33bb14e3c0a2242c7a
treea3272d873e82a03488268d24ac1e45e5bd7b8a55
parent5b1f75046836667a1a862878a1810c3878bcdd01
    Reviewed by Darin.

- fixed <rdar://problem/4125222> Dashboard heap size grows over time (leak caused by JavaScript DOM node wrappers?)

- changed per-document DOMObject caching to work with DOMNodes, since that is all it was used for anyway.

        Test cases added: (these tests actually ensure that DOM wrappers
are sufficiently protected from GC to match other browsers, they
do not verify that the leak is fixed since there's no way to test
that with layout tests).

        * layout-tests/fast/dom/gc-1-expected.txt: Added.
        * layout-tests/fast/dom/gc-1.html: Added.
        * layout-tests/fast/dom/gc-2-expected.txt: Added.
        * layout-tests/fast/dom/gc-2.html: Added.
        * layout-tests/fast/dom/gc-3-expected.txt: Added.
        * layout-tests/fast/dom/gc-3.html: Added.

        * khtml/ecma/kjs_binding.cpp:
        (KJS::ScriptInterpreter::forgetDOMObjectForDocument): New function - allows nodes
that get removed from the document to go away from the cache if not referenced.
        (KJS::ScriptInterpreter::mark): Don't mark nodes that aren't in the document,
they can stay in the cache but only if they have another source of life.
        (KJS::ScriptInterpreter::domNodesPerDocument): Renamed and changed parameter types.
        (KJS::ScriptInterpreter::getDOMNodeForDocument): Renamed and changed parameter types.
        (KJS::ScriptInterpreter::forgetDOMNodeForDocument): Renamed and changed parameter types.
        (KJS::ScriptInterpreter::putDOMNodeForDocument): Renamed and changed parameter types.
        (KJS::ScriptInterpreter::forgetAllDOMNodesForDocument): Renamed and changed parameter types.
        (KJS::ScriptInterpreter::updateDOMNodeDocument): Renamed and changed parameter types.
        * khtml/ecma/kjs_binding.h:
        * khtml/ecma/kjs_dom.cpp:
        (KJS::DOMNode::~DOMNode): call forgetDOMObjectForDocument.
        (KJS::DOMNode::mark): If the node is not in the document, make sure to mark
all wrappers in its detached piece of the tree.
        (KJS::getDOMNode): Updated for renames
        * khtml/ecma/kjs_dom.h:
        * khtml/xml/dom_docimpl.cpp:
        (DocumentImpl::~DocumentImpl): Updated for renames.
        * khtml/xml/dom_nodeimpl.cpp:
        (NodeImpl::checkAddChild): Updated for renames.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@9230 268f45cc-cd09-0410-ab3c-d52691b4dbfc
13 files changed:
LayoutTests/fast/dom/gc-1-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/gc-1.html [new file with mode: 0644]
LayoutTests/fast/dom/gc-2-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/gc-2.html [new file with mode: 0644]
LayoutTests/fast/dom/gc-3-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/gc-3.html [new file with mode: 0644]
WebCore/ChangeLog-2005-08-23
WebCore/khtml/ecma/kjs_binding.cpp
WebCore/khtml/ecma/kjs_binding.h
WebCore/khtml/ecma/kjs_dom.cpp
WebCore/khtml/ecma/kjs_dom.h
WebCore/khtml/xml/dom_docimpl.cpp
WebCore/khtml/xml/dom_nodeimpl.cpp