summaryrefslogtreecommitdiffstats
path: root/WebKit/mac/Misc
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2010-02-15 12:23:52 +0000
committerSteve Block <steveblock@google.com>2010-02-16 11:48:32 +0000
commit8a0914b749bbe7da7768e07a7db5c6d4bb09472b (patch)
tree73f9065f370435d6fde32ae129d458a8c77c8dff /WebKit/mac/Misc
parentbf14be70295513b8076f3fa47a268a7e42b2c478 (diff)
downloadexternal_webkit-8a0914b749bbe7da7768e07a7db5c6d4bb09472b.zip
external_webkit-8a0914b749bbe7da7768e07a7db5c6d4bb09472b.tar.gz
external_webkit-8a0914b749bbe7da7768e07a7db5c6d4bb09472b.tar.bz2
Merge webkit.org at r54731 : Initial merge by git
Change-Id: Ia79977b6cf3b0b00c06ef39419989b28e57e4f4a
Diffstat (limited to 'WebKit/mac/Misc')
-rw-r--r--WebKit/mac/Misc/WebCoreStatistics.h2
-rw-r--r--WebKit/mac/Misc/WebCoreStatistics.mm20
-rw-r--r--WebKit/mac/Misc/WebLocalizableStrings.mm (renamed from WebKit/mac/Misc/WebLocalizableStrings.m)7
3 files changed, 29 insertions, 0 deletions
diff --git a/WebKit/mac/Misc/WebCoreStatistics.h b/WebKit/mac/Misc/WebCoreStatistics.h
index 6c45fb9..d205083 100644
--- a/WebKit/mac/Misc/WebCoreStatistics.h
+++ b/WebKit/mac/Misc/WebCoreStatistics.h
@@ -43,6 +43,7 @@
+ (size_t)javaScriptProtectedObjectsCount;
+ (size_t)javaScriptProtectedGlobalObjectsCount;
+ (NSCountedSet *)javaScriptProtectedObjectTypeCounts;
++ (NSCountedSet *)javaScriptObjectTypeCounts;
+ (void)garbageCollectJavaScriptObjects;
+ (void)garbageCollectJavaScriptObjectsOnAlternateThreadForDebugging:(BOOL)waitUntilDone;
@@ -85,4 +86,5 @@
- (NSString *)renderTreeAsExternalRepresentation;
- (NSString *)counterValueForElement:(DOMElement*)element;
- (int)pageNumberForElement:(DOMElement*)element:(float)pageWidthInPixels:(float)pageHeightInPixels;
+- (int)numberOfPages:(float)pageWidthInPixels:(float)pageHeightInPixels;
@end
diff --git a/WebKit/mac/Misc/WebCoreStatistics.mm b/WebKit/mac/Misc/WebCoreStatistics.mm
index b18ee29..9e8ae05 100644
--- a/WebKit/mac/Misc/WebCoreStatistics.mm
+++ b/WebKit/mac/Misc/WebCoreStatistics.mm
@@ -93,6 +93,21 @@ using namespace WebCore;
return result;
}
++ (NSCountedSet *)javaScriptObjectTypeCounts
+{
+ JSLock lock(SilenceAssertionsOnly);
+
+ NSCountedSet *result = [NSCountedSet set];
+
+ OwnPtr<HashCountedSet<const char*> > counts(JSDOMWindow::commonJSGlobalData()->heap.objectTypeCounts());
+ 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]];
+
+ return result;
+}
+
+ (void)garbageCollectJavaScriptObjects
{
gcController().garbageCollectNow();
@@ -256,4 +271,9 @@ using namespace WebCore;
return PrintContext::pageNumberForElement(core(element), FloatSize(pageWidthInPixels, pageHeightInPixels));
}
+- (int)numberOfPages:(float)pageWidthInPixels:(float)pageHeightInPixels
+{
+ return PrintContext::numberOfPages(_private->coreFrame, FloatSize(pageWidthInPixels, pageHeightInPixels));
+}
+
@end
diff --git a/WebKit/mac/Misc/WebLocalizableStrings.m b/WebKit/mac/Misc/WebLocalizableStrings.mm
index 0babfbc..4006bb7 100644
--- a/WebKit/mac/Misc/WebLocalizableStrings.m
+++ b/WebKit/mac/Misc/WebLocalizableStrings.mm
@@ -29,11 +29,18 @@
#import <WebKit/WebLocalizableStrings.h>
#import <wtf/Assertions.h>
+#import <wtf/Threading.h>
WebLocalizableStringsBundle WebKitLocalizableStringsBundle = { "com.apple.WebKit", 0 };
NSString *WebLocalizedString(WebLocalizableStringsBundle *stringsBundle, const char *key)
{
+ // This function is not thread-safe due at least to its unguarded use of the mainBundle static variable
+ // and its use of [NSBundle localizedStringForKey:::], which is not guaranteed to be thread-safe. If
+ // we decide we need to use this on background threads, we'll need to add locking here and make sure
+ // it doesn't affect performance.
+ ASSERT(isMainThread());
+
NSBundle *bundle;
if (stringsBundle == NULL) {
static NSBundle *mainBundle;