WebCore:
authoraroben <aroben@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 19 Mar 2007 08:00:07 +0000 (08:00 +0000)
committeraroben <aroben@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 19 Mar 2007 08:00:07 +0000 (08:00 +0000)
        Reviewed by Hyatt and Maciej.

        Renamed WebCoreJavaScript to JavaScriptStatistics and made it C++ as
        part of <rdar://problem/5071653>.

        All layout tests pass.

        * WebCore.exp: Updated.
        * WebCore.xcodeproj/project.pbxproj: Updated.
        * bridge/JavaScriptStatistics.cpp: Moved from
        bridge/mac/WebCoreJavaScript.mm, and converted to C++.
        (WebCore::collect):
        (WebCore::JavaScriptStatistics::objectCount):
        (WebCore::JavaScriptStatistics::interpreterCount):
        (WebCore::JavaScriptStatistics::protectedObjectCount):
        (WebCore::JavaScriptStatistics::rootObjectTypeCounts):
        (WebCore::JavaScriptStatistics::garbageCollect):
        (WebCore::JavaScriptStatistics::garbageCollectOnAlternateThread):
        (WebCore::JavaScriptStatistics::shouldPrintExceptions):
        (WebCore::JavaScriptStatistics::setShouldPrintExceptions):
        * bridge/JavaScriptStatistics.h: Added.
        * bridge/mac/WebCoreJavaScript.h: Removed.
        * bridge/mac/WebCoreJavaScript.mm: Removed.

WebKit:

        Reviewed by Hyatt and Maciej.

        Updated WebCoreStatistics for the conversion of WebCoreJavaScript to
        C++.

        * Misc/WebCoreStatistics.mm:
        (+[WebCoreStatistics javaScriptObjectsCount]):
        (+[WebCoreStatistics javaScriptInterpretersCount]):
        (+[WebCoreStatistics javaScriptProtectedObjectsCount]):
        (+[WebCoreStatistics javaScriptRootObjectTypeCounts]): Moved
        conversion to NSCountedSet here from WebCore.
        (+[WebCoreStatistics garbageCollectJavaScriptObjects]):
        (+[WebCoreStatistics garbageCollectJavaScriptObjectsOnAlternateThread:]):
        (+[WebCoreStatistics shouldPrintExceptions]):
        (+[WebCoreStatistics setShouldPrintExceptions:]):
        (+[WebCoreStatistics javaScriptReferencedObjectsCount]):
        (+[WebCoreStatistics javaScriptRootObjectClasses]):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@20317 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/WebCore.exp
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/bridge/JavaScriptStatistics.cpp [moved from WebCore/bridge/mac/WebCoreJavaScript.mm with 65% similarity]
WebCore/bridge/JavaScriptStatistics.h [moved from WebCore/bridge/mac/WebCoreJavaScript.h with 64% similarity]
WebKit/ChangeLog
WebKit/Misc/WebCoreStatistics.mm

index e381a3f8facf82b2a89e91a74fd7dd327987ca0e..6ecb33e15baf69a218156ca9ec6cb3eb4e15e6cf 100644 (file)
@@ -1,3 +1,29 @@
+2007-03-19  Adam Roben  <aroben@apple.com>
+
+        Reviewed by Hyatt and Maciej.
+
+        Renamed WebCoreJavaScript to JavaScriptStatistics and made it C++ as
+        part of <rdar://problem/5071653>.
+
+        All layout tests pass.
+
+        * WebCore.exp: Updated.
+        * WebCore.xcodeproj/project.pbxproj: Updated.
+        * bridge/JavaScriptStatistics.cpp: Moved from
+        bridge/mac/WebCoreJavaScript.mm, and converted to C++.
+        (WebCore::collect):
+        (WebCore::JavaScriptStatistics::objectCount):
+        (WebCore::JavaScriptStatistics::interpreterCount):
+        (WebCore::JavaScriptStatistics::protectedObjectCount):
+        (WebCore::JavaScriptStatistics::rootObjectTypeCounts):
+        (WebCore::JavaScriptStatistics::garbageCollect):
+        (WebCore::JavaScriptStatistics::garbageCollectOnAlternateThread):
+        (WebCore::JavaScriptStatistics::shouldPrintExceptions):
+        (WebCore::JavaScriptStatistics::setShouldPrintExceptions):
+        * bridge/JavaScriptStatistics.h: Added.
+        * bridge/mac/WebCoreJavaScript.h: Removed.
+        * bridge/mac/WebCoreJavaScript.mm: Removed.
+
 2007-03-18  Maciej Stachowiak  <mjs@apple.com>
 
         Reviewed by Mark.
index aef41ed9b7f6c0063ed167054edaf11e0ce05419..bc2dd37e03c612f6fb481f168e5fbc4999e7a9e6 100644 (file)
 .objc_class_name_DOMWheelEvent
 .objc_class_name_WebCoreFrameBridge
 .objc_class_name_WebCoreHistory
-.objc_class_name_WebCoreJavaScript
 .objc_class_name_WebCoreKeyGenerator
 .objc_class_name_WebCoreScriptDebugger
 .objc_class_name_WebCoreViewFactory
@@ -310,6 +309,14 @@ __ZN7WebCore19TextResourceDecoder5flushEv
 __ZN7WebCore19TextResourceDecoder6decodeEPKcm
 __ZN7WebCore19TextResourceDecoderC1ERKNS_6StringERKNS_12TextEncodingE
 __ZN7WebCore19TextResourceDecoderD1Ev
+__ZN7WebCore20JavaScriptStatistics11objectCountEv
+__ZN7WebCore20JavaScriptStatistics14garbageCollectEv
+__ZN7WebCore20JavaScriptStatistics16interpreterCountEv
+__ZN7WebCore20JavaScriptStatistics20protectedObjectCountEv
+__ZN7WebCore20JavaScriptStatistics20rootObjectTypeCountsEv
+__ZN7WebCore20JavaScriptStatistics21shouldPrintExceptionsEv
+__ZN7WebCore20JavaScriptStatistics24setShouldPrintExceptionsEb
+__ZN7WebCore20JavaScriptStatistics31garbageCollectOnAlternateThreadEb
 __ZN7WebCore21ContextMenuController16clearContextMenuEv
 __ZN7WebCore21PlatformKeyboardEventC1EP7NSEventb
 __ZN7WebCore21findEventWithKeyStateEPNS_5EventE
index f4cc31d6c72051a3770193a47b23015ac589183f..4531ea394dccb9a307a86f4cec1b35e921a03272 100644 (file)
@@ -37,6 +37,8 @@
                06A6A73D0B8BA44800DF1703 /* StringTruncator.h in Headers */ = {isa = PBXBuildFile; fileRef = 06A6A73B0B8BA44800DF1703 /* StringTruncator.h */; settings = {ATTRIBUTES = (Private, ); }; };
                06E81ED70AB5D5E900C87837 /* LocalCurrentGraphicsContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 06E81ED60AB5D5E900C87837 /* LocalCurrentGraphicsContext.h */; };
                06E81EEC0AB5DA9700C87837 /* LocalCurrentGraphicsContext.mm in Sources */ = {isa = PBXBuildFile; fileRef = 06E81EEB0AB5DA9700C87837 /* LocalCurrentGraphicsContext.mm */; };
+               06FC442D0BAE5A9E0090EDE1 /* JavaScriptStatistics.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 06FC442B0BAE5A9E0090EDE1 /* JavaScriptStatistics.cpp */; };
+               06FC442E0BAE5A9E0090EDE1 /* JavaScriptStatistics.h in Headers */ = {isa = PBXBuildFile; fileRef = 06FC442C0BAE5A9E0090EDE1 /* JavaScriptStatistics.h */; settings = {ATTRIBUTES = (Private, ); }; };
                1402645E0AFDC19B005919E2 /* LoggingMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1402645D0AFDC19B005919E2 /* LoggingMac.mm */; };
                1402692D0AFE72D8005919E2 /* ScreenMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1402692C0AFE72D8005919E2 /* ScreenMac.mm */; };
                1403B99709EB13AF00797C7F /* DOMWindow.h in Headers */ = {isa = PBXBuildFile; fileRef = 1403B99509EB13AF00797C7F /* DOMWindow.h */; };
                93F1999E08245E59001E9ABC /* DeprecatedValueListImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = F587853B02DE375901EA4122 /* DeprecatedValueListImpl.h */; settings = {ATTRIBUTES = (Private, ); }; };
                93F199A808245E59001E9ABC /* WebCoreFrameView.h in Headers */ = {isa = PBXBuildFile; fileRef = F587854C02DE375901EA4122 /* WebCoreFrameView.h */; settings = {ATTRIBUTES = (Private, ); }; };
                93F199A908245E59001E9ABC /* WebCoreHistory.h in Headers */ = {isa = PBXBuildFile; fileRef = F5517DC2031AB56301A80180 /* WebCoreHistory.h */; settings = {ATTRIBUTES = (Private, ); }; };
-               93F199AC08245E59001E9ABC /* WebCoreJavaScript.h in Headers */ = {isa = PBXBuildFile; fileRef = F5B2A52B02E22573018635CB /* WebCoreJavaScript.h */; settings = {ATTRIBUTES = (Private, ); }; };
                93F199B308245E59001E9ABC /* WebCoreViewFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = F587855402DE375901EA4122 /* WebCoreViewFactory.h */; settings = {ATTRIBUTES = (Private, ); }; };
                93F199B808245E59001E9ABC /* ScrollBar.h in Headers */ = {isa = PBXBuildFile; fileRef = BC7B2AF80450824100A8000F /* ScrollBar.h */; settings = {ATTRIBUTES = (Private, ); }; };
                93F199BB08245E59001E9ABC /* WebCoreKeyboardUIMode.h in Headers */ = {isa = PBXBuildFile; fileRef = BE983D95052A2E0A00892D85 /* WebCoreKeyboardUIMode.h */; settings = {ATTRIBUTES = (Private, ); }; };
                93F19A9D08245E59001E9ABC /* TextResourceDecoder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F523D27802DE43D7018635CA /* TextResourceDecoder.cpp */; };
                93F19AB908245E59001E9ABC /* Range.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F523D30302DE4476018635CA /* Range.cpp */; };
                93F19ABC08245E59001E9ABC /* XMLTokenizer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F523D30902DE4476018635CA /* XMLTokenizer.cpp */; };
-               93F19ABF08245E59001E9ABC /* WebCoreJavaScript.mm in Sources */ = {isa = PBXBuildFile; fileRef = F5B2A52C02E22573018635CB /* WebCoreJavaScript.mm */; };
                93F19AC808245E59001E9ABC /* WebCoreHistory.m in Sources */ = {isa = PBXBuildFile; fileRef = F5517DC3031AB56301A80180 /* WebCoreHistory.m */; };
                93F19AD508245E59001E9ABC /* RenderTreeAsText.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93955A4203D72932008635CE /* RenderTreeAsText.cpp */; };
                93F19ADC08245E59001E9ABC /* PlatformScrollBarMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC7B2AF90450824100A8000F /* PlatformScrollBarMac.mm */; };
                06A6A73B0B8BA44800DF1703 /* StringTruncator.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = StringTruncator.h; sourceTree = "<group>"; };
                06E81ED60AB5D5E900C87837 /* LocalCurrentGraphicsContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LocalCurrentGraphicsContext.h; sourceTree = "<group>"; };
                06E81EEB0AB5DA9700C87837 /* LocalCurrentGraphicsContext.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = LocalCurrentGraphicsContext.mm; sourceTree = "<group>"; };
+               06FC442B0BAE5A9E0090EDE1 /* JavaScriptStatistics.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JavaScriptStatistics.cpp; sourceTree = "<group>"; };
+               06FC442C0BAE5A9E0090EDE1 /* JavaScriptStatistics.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JavaScriptStatistics.h; sourceTree = "<group>"; };
                1402645D0AFDC19B005919E2 /* LoggingMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = LoggingMac.mm; sourceTree = "<group>"; };
                1402692C0AFE72D8005919E2 /* ScreenMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = ScreenMac.mm; sourceTree = "<group>"; };
                1403B90C09EB124500797C7F /* DOMWindow.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DOMWindow.idl; sourceTree = "<group>"; };
                F58786BF02DE3B8601EA4122 /* TextStream.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = TextStream.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                F58786C202DE3B8601EA4122 /* DeprecatedValueList.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = DeprecatedValueList.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                F58EF58E02DFDFB7018635CA /* WebCore.exp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.exports; path = WebCore.exp; sourceTree = "<group>"; tabWidth = 4; usesTabs = 1; };
-               F5B2A52B02E22573018635CB /* WebCoreJavaScript.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebCoreJavaScript.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
-               F5B2A52C02E22573018635CB /* WebCoreJavaScript.mm */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCoreJavaScript.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                F5C2869302846DCD018635CA /* ApplicationServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ApplicationServices.framework; path = /System/Library/Frameworks/ApplicationServices.framework; sourceTree = "<absolute>"; };
                F5C2869402846DCD018635CA /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /System/Library/Frameworks/Carbon.framework; sourceTree = "<absolute>"; };
                F5C2869502846DCD018635CA /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
                                55998A5C052B59CC0017A6C1 /* AXObjectCache.h */,
                                4B3043B50AE0363200A82647 /* EditorClient.h */,
                                935C475C09AC4CA000A6AAB4 /* History.h */,
+                               06FC442B0BAE5A9E0090EDE1 /* JavaScriptStatistics.cpp */,
+                               06FC442C0BAE5A9E0090EDE1 /* JavaScriptStatistics.h */,
                                14FD6DFC0AE5EA1B00AD67AD /* WindowFeatures.h */,
                        );
                        path = bridge;
                                935C475E09AC4CAE00A6AAB4 /* HistoryMac.mm */,
                                55998A5A052B59CC0017A6C1 /* WebCoreAXObject.h */,
                                55998A5B052B59CC0017A6C1 /* WebCoreAXObject.mm */,
-                               F5B2A52B02E22573018635CB /* WebCoreJavaScript.h */,
-                               F5B2A52C02E22573018635CB /* WebCoreJavaScript.mm */,
                                7E6FEED60898582300C44C3F /* WebCoreScriptDebugger.h */,
                                7E6FEED70898582300C44C3F /* WebCoreScriptDebugger.mm */,
                        );
                                93F1999E08245E59001E9ABC /* DeprecatedValueListImpl.h in Headers */,
                                93F199A808245E59001E9ABC /* WebCoreFrameView.h in Headers */,
                                93F199A908245E59001E9ABC /* WebCoreHistory.h in Headers */,
-                               93F199AC08245E59001E9ABC /* WebCoreJavaScript.h in Headers */,
                                93F199B308245E59001E9ABC /* WebCoreViewFactory.h in Headers */,
                                93F199B808245E59001E9ABC /* ScrollBar.h in Headers */,
                                93F199BB08245E59001E9ABC /* WebCoreKeyboardUIMode.h in Headers */,
                                93F9B6E10BA0FB7200854064 /* JSComment.h in Headers */,
                                93F9B7750BA5FDDD00854064 /* JSEntityReference.h in Headers */,
                                93F9B7A10BA6032600854064 /* JSCDATASection.h in Headers */,
+                               06FC442E0BAE5A9E0090EDE1 /* JavaScriptStatistics.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                                93F19A9D08245E59001E9ABC /* TextResourceDecoder.cpp in Sources */,
                                93F19AB908245E59001E9ABC /* Range.cpp in Sources */,
                                93F19ABC08245E59001E9ABC /* XMLTokenizer.cpp in Sources */,
-                               93F19ABF08245E59001E9ABC /* WebCoreJavaScript.mm in Sources */,
                                93F19AC808245E59001E9ABC /* WebCoreHistory.m in Sources */,
                                93F19AD508245E59001E9ABC /* RenderTreeAsText.cpp in Sources */,
                                93F19ADC08245E59001E9ABC /* PlatformScrollBarMac.mm in Sources */,
                                93F9B6E00BA0FB7200854064 /* JSComment.cpp in Sources */,
                                93F9B7740BA5FDDC00854064 /* JSEntityReference.cpp in Sources */,
                                93F9B7A00BA6032600854064 /* JSCDATASection.cpp in Sources */,
+                               06FC442D0BAE5A9E0090EDE1 /* JavaScriptStatistics.cpp in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
similarity index 65%
rename from WebCore/bridge/mac/WebCoreJavaScript.mm
rename to WebCore/bridge/JavaScriptStatistics.cpp
index 5bbbcab396469a165d75ff9c41d2e9bd890272d8..8618a901362e9af19ff055b18b51ecd19a7bf896 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2003 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007 Apple Inc.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-#import "config.h"
-#import "WebCoreJavaScript.h"
+#include "config.h"
+#include "JavaScriptStatistics.h"
 
-#import <JavaScriptCore/HashCountedSet.h>
-#import <JavaScriptCore/JSLock.h>
-#import <JavaScriptCore/collector.h>
-#import <JavaScriptCore/interpreter.h>
+#include <JavaScriptCore/HashCountedSet.h>
+#include <JavaScriptCore/JSLock.h>
+#include <JavaScriptCore/collector.h>
+#include <JavaScriptCore/interpreter.h>
+
+namespace WebCore {
 
 using KJS::Collector;
 using KJS::Interpreter;
 using KJS::JSLock;
 
-void* collect(void*)
+static void* collect(void*)
 {
     JSLock lock;
     Collector::collect();
     return 0;
 }
 
-@implementation WebCoreJavaScript
-
-+ (size_t)objectCount
+size_t JavaScriptStatistics::objectCount()
 {
     JSLock lock;
     return Collector::size();
 }
 
-+ (size_t)interpreterCount
+size_t JavaScriptStatistics::interpreterCount()
 {
     JSLock lock;
     return Collector::numInterpreters();
 }
 
-+ (size_t)protectedObjectCount
+size_t JavaScriptStatistics::protectedObjectCount()
 {
     JSLock lock;
     return Collector::numProtectedObjects();
 }
 
-+ (NSCountedSet *)rootObjectTypeCounts
+HashCountedSet<const char*>* JavaScriptStatistics::rootObjectTypeCounts()
 {
     JSLock lock;
-    NSCountedSet* result = [NSCountedSet set];
-
-    HashCountedSet<const char*>* counts = Collector::rootObjectTypeCounts();
-    HashCountedSet<const char*>::iterator end = counts->end();
-    for (HashCountedSet<const char*>::iterator it = counts->begin(); it != end; ++it)
-        for (unsigned i = 0; i < it->second; ++i)
-            [result addObject:[NSString stringWithUTF8String:it->first]];
-
-    delete counts;
-    return result;
+    
+    return Collector::rootObjectTypeCounts();
 }
 
-+ (void)garbageCollect
+void JavaScriptStatistics::garbageCollect()
 {
-    collect(NULL);
+    collect(0);
 }
 
-+ (void)garbageCollectOnAlternateThread:(BOOL)waitUntilDone
+void JavaScriptStatistics::garbageCollectOnAlternateThread(bool waitUntilDone)
 {
     pthread_t thread;
     pthread_create(&thread, NULL, collect, NULL);
@@ -93,16 +85,16 @@ void* collect(void*)
     }
 }
 
-+ (BOOL)shouldPrintExceptions
+bool JavaScriptStatistics::shouldPrintExceptions()
 {
     JSLock lock;
     return Interpreter::shouldPrintExceptions();
 }
 
-+ (void)setShouldPrintExceptions:(BOOL)print
+void JavaScriptStatistics::setShouldPrintExceptions(bool print)
 {
     JSLock lock;
     Interpreter::setShouldPrintExceptions(print);
 }
 
-@end
+} // namespace WebCore
similarity index 64%
rename from WebCore/bridge/mac/WebCoreJavaScript.h
rename to WebCore/bridge/JavaScriptStatistics.h
index d669f9e03dd58a1407b88975cd4d3cb562762ce3..5be04095d3c5e9d2e5159bc22720fe50304bf1d9 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2003 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007 Apple Inc.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-@interface WebCoreJavaScript : NSObject
-{
-}
+#ifndef JavaScriptStatistics_h
+#define JavaScriptStatistics_h
 
-+ (size_t)interpreterCount;
-+ (size_t)objectCount;
-+ (size_t)protectedObjectCount;
-+ (NSCountedSet *)rootObjectTypeCounts;
+#include <wtf/HashCountedSet.h>
 
-+ (void)garbageCollect;
-+ (void)garbageCollectOnAlternateThread:(BOOL)waitUntilDone;
+namespace WebCore {
+    
+    class JavaScriptStatistics {
+    public:
+        static size_t interpreterCount();
+        static size_t objectCount();
+        static size_t protectedObjectCount();
+        static HashCountedSet<const char*>* rootObjectTypeCounts();
 
-+ (BOOL)shouldPrintExceptions;
-+ (void)setShouldPrintExceptions:(BOOL)print;
+        static void garbageCollect();
+        static void garbageCollectOnAlternateThread(bool waitUntilDone);
 
-@end
+        static bool shouldPrintExceptions();
+        static void setShouldPrintExceptions(bool print);
+    };
+    
+} // namespace WebCore
+
+#endif // !defined(JavaScriptStatistics_h)
index b3429450714ebc81ba6c494a448bd3f5867e382a..8820774bc1d01bb0c116f2b33649ac435293160f 100644 (file)
@@ -1,3 +1,23 @@
+2007-03-19  Adam Roben  <aroben@apple.com>
+
+        Reviewed by Hyatt and Maciej.
+
+        Updated WebCoreStatistics for the conversion of WebCoreJavaScript to
+        C++.
+
+        * Misc/WebCoreStatistics.mm:
+        (+[WebCoreStatistics javaScriptObjectsCount]):
+        (+[WebCoreStatistics javaScriptInterpretersCount]):
+        (+[WebCoreStatistics javaScriptProtectedObjectsCount]):
+        (+[WebCoreStatistics javaScriptRootObjectTypeCounts]): Moved
+        conversion to NSCountedSet here from WebCore.
+        (+[WebCoreStatistics garbageCollectJavaScriptObjects]):
+        (+[WebCoreStatistics garbageCollectJavaScriptObjectsOnAlternateThread:]):
+        (+[WebCoreStatistics shouldPrintExceptions]):
+        (+[WebCoreStatistics setShouldPrintExceptions:]):
+        (+[WebCoreStatistics javaScriptReferencedObjectsCount]):
+        (+[WebCoreStatistics javaScriptRootObjectClasses]):
+
 2007-03-18  Andrew Wellington  <proton@wiretapped.net>
 
         Reviewed by Mark Rowe
index f5d01bd7990ef0c06775bfe66df6d107a018847d..8b792b43130fc49f2bfdfb65fca71f006c2baa23 100644 (file)
@@ -29,8 +29,8 @@
 #import "WebCoreStatistics.h"
 
 #import "WebCache.h"
+#import <WebCore/JavaScriptStatistics.h>
 #import <WebCore/Node.h>
-#import <WebCore/WebCoreJavaScript.h>
 #import <WebKit/WebFrameBridge.h>
 #import <WebKit/WebFrameInternal.h>
 
@@ -45,42 +45,51 @@ using namespace WebCore;
 
 + (size_t)javaScriptObjectsCount
 {
-    return [WebCoreJavaScript objectCount];
+    return JavaScriptStatistics::objectCount();
 }
 
 + (size_t)javaScriptInterpretersCount
 {
-    return [WebCoreJavaScript interpreterCount];
+    return JavaScriptStatistics::interpreterCount();
 }
 
 + (size_t)javaScriptProtectedObjectsCount
 {
-    return [WebCoreJavaScript protectedObjectCount];
+    return JavaScriptStatistics::protectedObjectCount();
 }
 
 + (NSCountedSet *)javaScriptRootObjectTypeCounts
 {
-    return [WebCoreJavaScript rootObjectTypeCounts];
+    NSCountedSet *result = [NSCountedSet set];
+
+    HashCountedSet<const char*>* counts = JavaScriptStatistics::rootObjectTypeCounts();
+    HashCountedSet<const char*>::iterator end = counts->end();
+    for (HashCountedSet<const char*>::iterator it = counts->begin(); it != end; ++it)
+        for (unsigned i = 0; i < it->second; ++i)
+            [result addObject:[NSString stringWithUTF8String:it->first]];
+    
+    delete counts;
+    return result;
 }
 
 + (void)garbageCollectJavaScriptObjects
 {
-    [WebCoreJavaScript garbageCollect];
+    JavaScriptStatistics::garbageCollect();
 }
 
 + (void)garbageCollectJavaScriptObjectsOnAlternateThread:(BOOL)waitUntilDone;
 {
-    [WebCoreJavaScript garbageCollectOnAlternateThread:waitUntilDone];
+    JavaScriptStatistics::garbageCollectOnAlternateThread(waitUntilDone);
 }
 
 + (BOOL)shouldPrintExceptions
 {
-    return [WebCoreJavaScript shouldPrintExceptions];
+    return JavaScriptStatistics::shouldPrintExceptions();
 }
 
 + (void)setShouldPrintExceptions:(BOOL)print
 {
-    [WebCoreJavaScript setShouldPrintExceptions:print];
+    JavaScriptStatistics::setShouldPrintExceptions(print);
 }
 
 + (void)emptyCache
@@ -111,12 +120,12 @@ using namespace WebCore;
 
 + (size_t)javaScriptReferencedObjectsCount
 {
-    return [WebCoreJavaScript protectedObjectCount];
+    return JavaScriptStatistics::protectedObjectCount();
 }
 
 + (NSSet *)javaScriptRootObjectClasses
 {
-    return [WebCoreJavaScript rootObjectTypeCounts];
+    return [self javaScriptRootObjectTypeCounts];
 }
 
 @end