Changeset 19013 in webkit


Ignore:
Timestamp:
Jan 21, 2007, 12:51:34 PM (18 years ago)
Author:
weinig
Message:

LayoutTests:

Reviewed by Darin.

Test for: <rdar://problem/4928583> Memory usage grows when reloading google.com/ig

  • fast/dom/gc-10-expected.txt: Added.
  • fast/dom/gc-10.html: Added.
  • fast/dom/resources/gc-10-frame.html: Added.

WebCore:

Reviewed by Darin.

Fix for: <rdar://problem/4928583> Memory usage grows when reloading google.com/ig

JSDocuments are now responsible for marking the DOM wrappers associated with them, when they get marked.
This fixes a JS object leak when a DOM wrapper has a reference to a JSDocument that is otherwise not reachable.

Test: fast/dom/gc-10.html

  • WebCore.vcproj/WebCore/WebCore.vcproj:
  • WebCore.xcodeproj/project.pbxproj:
  • bindings/js/JSDocumentCustom.cpp: Added. (WebCore::JSDocument::mark):
  • bindings/js/kjs_binding.cpp: (KJS::ScriptInterpreter::markDOMNodesForDocument): (KJS::ScriptInterpreter::mark):
  • bindings/js/kjs_binding.h:
  • dom/Document.idl:

WebKitTools:

Reviewed by Darin.

Test support for: <rdar://problem/4928583> Memory usage grows when reloading google.com/ig

This adds a getJSObjectCount test-accessible function to allow test scripts to track JSObject usage.

  • DumpRenderTree/GCController.h:
  • DumpRenderTree/GCController.mm: (+[GCController isSelectorExcludedFromWebScript:]): (-[GCController getJSObjectCount]):
Location:
trunk
Files:
4 added
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r19012 r19013  
     12007-01-21  Sanjay Madhav  <sanjay12@gmail.com>
     2
     3        Reviewed by Darin.
     4
     5        Test for: <rdar://problem/4928583> Memory usage grows when reloading google.com/ig
     6
     7        * fast/dom/gc-10-expected.txt: Added.
     8        * fast/dom/gc-10.html: Added.
     9        * fast/dom/resources/gc-10-frame.html: Added.
     10
    1112007-01-21  Mitz Pettel  <mitz@webkit.org>
    212
  • trunk/WebCore/ChangeLog

    r19012 r19013  
     12007-01-21  Sanjay Madhav  <sanjay12@gmail.com>
     2
     3        Reviewed by Darin.
     4
     5        Fix for: <rdar://problem/4928583> Memory usage grows when reloading google.com/ig
     6
     7        JSDocuments are now responsible for marking the DOM wrappers associated with them, when they get marked.
     8        This fixes a JS object leak when a DOM wrapper has a reference to a JSDocument that is otherwise not reachable.
     9
     10        Test: fast/dom/gc-10.html
     11
     12        * WebCore.vcproj/WebCore/WebCore.vcproj:
     13        * WebCore.xcodeproj/project.pbxproj:
     14        * bindings/js/JSDocumentCustom.cpp: Added.
     15        (WebCore::JSDocument::mark):
     16        * bindings/js/kjs_binding.cpp:
     17        (KJS::ScriptInterpreter::markDOMNodesForDocument):
     18        (KJS::ScriptInterpreter::mark):
     19        * bindings/js/kjs_binding.h:
     20        * dom/Document.idl:
     21
    1222007-01-21  Mitz Pettel  <mitz@webkit.org>
    223
  • trunk/WebCore/WebCore.vcproj/WebCore/WebCore.vcproj

    r18966 r19013  
    54235423                                </File>
    54245424                                <File
     5425                                        RelativePath="..\..\bindings\js\JSDocumentCustom.cpp"
     5426                                        >
     5427                                </File>
     5428                                <File
    54255429                                        RelativePath="..\..\bindings\js\JSHTMLElementWrapperFactory.cpp"
    54265430                                        >
  • trunk/WebCore/WebCore.xcodeproj/project.pbxproj

    r18994 r19013  
    13471347                85FF315A0AAFBFCB00374F38 /* DOMKeyboardEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 85FF31580AAFBFCB00374F38 /* DOMKeyboardEvent.h */; };
    13481348                85FF315B0AAFBFCB00374F38 /* DOMKeyboardEvent.mm in Sources */ = {isa = PBXBuildFile; fileRef = 85FF31590AAFBFCB00374F38 /* DOMKeyboardEvent.mm */; };
     1349                929264770B61FC7200B41D34 /* JSDocumentCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 929264760B61FC7200B41D34 /* JSDocumentCustom.cpp */; };
    13491350                9305B24D098F1B6B00C28855 /* Timer.h in Headers */ = {isa = PBXBuildFile; fileRef = 9305B24C098F1B6B00C28855 /* Timer.h */; settings = {ATTRIBUTES = (Private, ); }; };
    13501351                9307056C09E0AF8F00B17FE4 /* csshelper.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEA4786097CAAC80094C9E4 /* csshelper.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    43704371                85FF31580AAFBFCB00374F38 /* DOMKeyboardEvent.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DOMKeyboardEvent.h; sourceTree = "<group>"; };
    43714372                85FF31590AAFBFCB00374F38 /* DOMKeyboardEvent.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMKeyboardEvent.mm; sourceTree = "<group>"; };
     4373                929264760B61FC7200B41D34 /* JSDocumentCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSDocumentCustom.cpp; sourceTree = "<group>"; };
    43724374                9305B24C098F1B6B00C28855 /* Timer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Timer.h; sourceTree = "<group>"; };
    43734375                9307059009E0C75800B17FE4 /* CSSPrimitiveValue.idl */ = {isa = PBXFileReference; explicitFileType = sourcecode; fileEncoding = 4; path = CSSPrimitiveValue.idl; sourceTree = "<group>"; };
     
    87818783                                93F8B3060A300FEA00F61AB8 /* CodeGeneratorJS.pm */,
    87828784                                1A9EF4560A1B957D00332B63 /* JSCanvasRenderingContext2DCustom.cpp */,
     8785                                929264760B61FC7200B41D34 /* JSDocumentCustom.cpp */,
    87838786                                938E65F609F0985D008A48EC /* JSHTMLElementWrapperFactory.cpp */,
    87848787                                938E65F009F09840008A48EC /* JSHTMLElementWrapperFactory.h */,
     
    1234412347                                1A2A68230B5BEDE70002A480 /* ProgressTracker.cpp in Sources */,
    1234512348                                A80CEBAD0B60FC49007637C1 /* SVGMPathElement.cpp in Sources */,
     12349                                929264770B61FC7200B41D34 /* JSDocumentCustom.cpp in Sources */,
    1234612350                        );
    1234712351                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/WebCore/bindings/js/kjs_binding.cpp

    r18863 r19013  
    198198}
    199199
    200 void ScriptInterpreter::mark(bool currentThreadIsMainThread)
    201 {
    202     NodePerDocMap::iterator dictEnd = domNodesPerDocument().end();
    203     for (NodePerDocMap::iterator dictIt = domNodesPerDocument().begin(); dictIt != dictEnd; ++dictIt) {
     200void ScriptInterpreter::markDOMNodesForDocument(Document* doc)
     201{
     202    NodePerDocMap::iterator dictIt = domNodesPerDocument().find(doc);
     203    if (dictIt != domNodesPerDocument().end()) {
    204204        NodeMap* nodeDict = dictIt->second;
    205205        NodeMap::iterator nodeEnd = nodeDict->end();
     
    213213        }
    214214    }
    215 
     215}
     216
     217void ScriptInterpreter::mark(bool currentThreadIsMainThread)
     218{
    216219    if (!currentThreadIsMainThread) {
    217220        // On alternate threads, DOMObjects remain in the cache because they're not collected.
  • trunk/WebCore/bindings/js/kjs_binding.h

    r18874 r19013  
    7777        static void forgetAllDOMNodesForDocument(WebCore::Document*);
    7878        static void updateDOMNodeDocument(WebCore::Node*, WebCore::Document* oldDoc, WebCore::Document* newDoc);
     79        static void markDOMNodesForDocument(WebCore::Document*);
    7980
    8081        WebCore::Frame* frame() const { return m_frame; }
  • trunk/WebCore/dom/Document.idl

    r17859 r19013  
    2121module core {
    2222
    23     interface [LegacyParent=KJS::DOMEventTargetNode, GenerateConstructor] Document : EventTargetNode {
     23    interface [LegacyParent=KJS::DOMEventTargetNode, GenerateConstructor, CustomMarkFunction] Document : EventTargetNode {
    2424
    2525        // DOM Level 1 Core
  • trunk/WebKitTools/ChangeLog

    r19000 r19013  
     12007-01-21  Sanjay Madhav  <sanjay12@gmail.com>
     2
     3        Reviewed by Darin.
     4
     5        Test support for: <rdar://problem/4928583> Memory usage grows when reloading google.com/ig
     6
     7        This adds a getJSObjectCount test-accessible function to allow test scripts to track JSObject usage.
     8
     9        * DumpRenderTree/GCController.h:
     10        * DumpRenderTree/GCController.mm:
     11        (+[GCController isSelectorExcludedFromWebScript:]):
     12        (-[GCController getJSObjectCount]):
     13
    1142007-01-20  Mark Rowe  <mrowe@apple.com>
    215
  • trunk/WebKitTools/DumpRenderTree/GCController.h

    r14569 r19013  
    3535- (void)collect;
    3636- (void)collectOnAlternateThread:(BOOL)waitUntilDone;
     37- (size_t)getJSObjectCount;
    3738@end
  • trunk/WebKitTools/DumpRenderTree/GCController.mm

    r14569 r19013  
    3838    if (aSelector == @selector(collectOnAlternateThread:))
    3939        return NO;
     40    if (aSelector == @selector(getJSObjectCount))
     41        return NO;
     42   
    4043    return YES;
    4144}
     
    5861    [WebCoreStatistics garbageCollectJavaScriptObjectsOnAlternateThread:waitUntilDone];
    5962}
     63
     64- (size_t)getJSObjectCount
     65{
     66    return [WebCoreStatistics javaScriptObjectsCount];
     67}
    6068@end
Note: See TracChangeset for help on using the changeset viewer.