Ignore:
Timestamp:
Oct 13, 2008, 2:41:40 PM (17 years ago)
Author:
[email protected]
Message:

JavaScriptCore:

2008-10-13 Sam Weinig <[email protected]>

Reviewed by Dan Bernstein.

Fix for https://bugs.webkit.org/show_bug.cgi?id=21577
5 false positive StructureID leaks

  • Add leak ignore set to StructureID to selectively ignore leaking some StructureIDs.
  • Add create method to JSGlolalData to be used when the data will be intentionally leaked and ignore all leaks caused the StructureIDs stored in it.
  • JavaScriptCore.exp:
  • kjs/JSGlobalData.cpp: (JSC::JSGlobalData::createLeaked):
  • kjs/JSGlobalData.h:
  • kjs/StructureID.cpp: (JSC::StructureID::StructureID): (JSC::StructureID::~StructureID): (JSC::StructureID::startIgnoringLeaks): (JSC::StructureID::stopIgnoringLeaks):
  • kjs/StructureID.h:

WebCore:

2008-10-13 Sam Weinig <[email protected]>

Reviewed by Dan Bernstein.

Fix for https://bugs.webkit.org/show_bug.cgi?id=21577
5 false positive StructureID leaks

In WebCore, we intentionally leak the common JSGlobalData which in turn
leaks 5 StructureIDs. Use the new JSGlobalData::createLeaked in order to
ignore the StructureIDs leaked within.

  • bindings/js/JSDOMWindowBase.cpp: (WebCore::JSDOMWindowBase::commonJSGlobalData):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/StructureID.cpp

    r37508 r37563  
    4040#ifndef NDEBUG   
    4141static WTF::RefCountedLeakCounter structureIDCounter("StructureID");
     42
     43static bool shouldIgnoreLeaks;
     44static HashSet<StructureID*> ignoreSet;
    4245#endif
    4346
     
    5861
    5962#ifndef NDEBUG
    60     structureIDCounter.increment();
     63    if (shouldIgnoreLeaks)
     64        ignoreSet.add(this);
     65    else
     66        structureIDCounter.increment();
    6167#endif
    6268}
     
    7379
    7480#ifndef NDEBUG
    75     structureIDCounter.decrement();
     81    HashSet<StructureID*>::iterator it = ignoreSet.find(this);
     82    if (it != ignoreSet.end())
     83        ignoreSet.remove(it);
     84    else
     85        structureIDCounter.decrement();
     86#endif
     87}
     88
     89void StructureID::startIgnoringLeaks()
     90{
     91#ifndef NDEBUG
     92    shouldIgnoreLeaks = true;
     93#endif
     94}
     95
     96void StructureID::stopIgnoringLeaks()
     97{
     98#ifndef NDEBUG
     99    shouldIgnoreLeaks = false;
    76100#endif
    77101}
Note: See TracChangeset for help on using the changeset viewer.