Ignore:
Timestamp:
Aug 13, 2002, 11:38:00 PM (23 years ago)
Author:
mjs
Message:

JavaScriptCore:

Add the ability to determine the classes of live JavaScript
objects, to help with leak fixing.

  • kjs/collector.h, kjs/collector.cpp: (Collector::liveObjectClasses):

WebCore:

Add the ability to determine the classes of live JavaScript
objects, to help with leak fixing.

  • kwq/WebCoreJavaScript.h:
  • kwq/WebCoreJavaScript.mm: (+[WebCoreJavaScript liveObjectClasses]):

WebKit:

Add the ability to determine the classes of live JavaScript
objects, to help with leak fixing.

  • Misc.subproj/WebCoreStatistics.h:
  • Misc.subproj/WebCoreStatistics.m: (+[WebCoreStatistics javaScriptLiveObjectClasses]):

WebBrowser:

Add display of classes of live JavaScript objects to Caches
window, to help with leak fixing.

  • Debug/CacheController.h:
  • Debug/CacheController.m: (-[CacheController refreshJavaScriptStatisticsMatrix]):
  • Debug/CacheController.nib:
File:
1 edited

Legend:

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

    r1806 r1811  
    2121 */
    2222
     23#if APPLE_CHANGES
     24#define _COLLECTOR
     25#include <CoreFoundation/CoreFoundation.h>
     26#include <cxxabi.h>
     27#endif
     28
    2329#include "collector.h"
    2430#include "internal.h"
     
    328334}
    329335
    330 #endif
     336CFSetRef Collector::liveObjectClasses()
     337{
     338  CFMutableSetRef classes = CFSetCreateMutable(NULL, 0, &kCFTypeSetCallBacks);
     339
     340  CollectorBlock *block = root;
     341  while (block) {
     342    ValueImp **r = (ValueImp**)block->mem;
     343    assert(r);
     344    for (int i = 0; i < block->size; i++, r++)
     345   {
     346      ValueImp *imp = *r;
     347      if (imp != NULL) {
     348        const char *mangled_name = typeid(*imp).name();
     349        int status;
     350        char *demangled_name = __cxxabiv1::__cxa_demangle (mangled_name, NULL, NULL, &status);
     351
     352        CFStringRef className = CFStringCreateWithCString(NULL, demangled_name, kCFStringEncodingASCII);
     353        free(demangled_name);
     354        CFSetAddValue(classes, className);
     355        CFRelease(className);
     356      }
     357    }
     358    block = block->next;
     359  }
     360  return classes;
     361}
     362
     363#endif
Note: See TracChangeset for help on using the changeset viewer.