Title: [87462] trunk/Source/WebCore
- Revision
- 87462
- Author
- [email protected]
- Date
- 2011-05-26 19:16:21 -0700 (Thu, 26 May 2011)
Log Message
2011-05-26 David Levin <[email protected]>
Reviewed by Dmitry Titov.
WebKit's font notification has problems when the WebKit main thread != UI thread.
https://bugs.webkit.org/show_bug.cgi?id=61391
This doesn't happen in DumpRenderTree, so it needs a unit test which is taking me
some time to write correctly. In the meantime, this issues happens to be causing
some crashes in Chrome so here's the fix alone for the time being.
* platform/graphics/mac/FontCacheMac.mm:
(WebCore::invalidateFontCache): Ensure that FontCache::invalidate is only called on WebKit's main thread.
(WebCore::fontCacheRegisteredFontsChangedNotificationCallback): Call common function for font cache invalidation.
Note that the call to fontCache() is fine since the singleton is initialized well before calling this function. Theoretically,
there could be a problem due to a lack of a memory barrier but that is highly unlikely and this is debug only code.
(WebCore::fontCacheATSNotificationCallback): Ditto.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (87461 => 87462)
--- trunk/Source/WebCore/ChangeLog 2011-05-27 02:07:09 UTC (rev 87461)
+++ trunk/Source/WebCore/ChangeLog 2011-05-27 02:16:21 UTC (rev 87462)
@@ -1,3 +1,21 @@
+2011-05-26 David Levin <[email protected]>
+
+ Reviewed by Dmitry Titov.
+
+ WebKit's font notification has problems when the WebKit main thread != UI thread.
+ https://bugs.webkit.org/show_bug.cgi?id=61391
+
+ This doesn't happen in DumpRenderTree, so it needs a unit test which is taking me
+ some time to write correctly. In the meantime, this issues happens to be causing
+ some crashes in Chrome so here's the fix alone for the time being.
+
+ * platform/graphics/mac/FontCacheMac.mm:
+ (WebCore::invalidateFontCache): Ensure that FontCache::invalidate is only called on WebKit's main thread.
+ (WebCore::fontCacheRegisteredFontsChangedNotificationCallback): Call common function for font cache invalidation.
+ Note that the call to fontCache() is fine since the singleton is initialized well before calling this function. Theoretically,
+ there could be a problem due to a lack of a memory barrier but that is highly unlikely and this is debug only code.
+ (WebCore::fontCacheATSNotificationCallback): Ditto.
+
2011-05-26 Stephanie Lewis <[email protected]>
Reviewed by Geoff Garen.
Modified: trunk/Source/WebCore/platform/graphics/mac/FontCacheMac.mm (87461 => 87462)
--- trunk/Source/WebCore/platform/graphics/mac/FontCacheMac.mm 2011-05-27 02:07:09 UTC (rev 87461)
+++ trunk/Source/WebCore/platform/graphics/mac/FontCacheMac.mm 2011-05-27 02:16:21 UTC (rev 87462)
@@ -36,22 +36,33 @@
#import "WebCoreSystemInterface.h"
#import "WebFontCache.h"
#import <AppKit/AppKit.h>
+#import <wtf/MainThread.h>
#import <wtf/StdLibExtras.h>
namespace WebCore {
+// The "void*" parameter makes the function match the prototype for callbacks from callOnMainThread.
+static void invalidateFontCache(void*)
+{
+ if (!isMainThread()) {
+ callOnMainThread(&invalidateFontCache, 0);
+ return;
+ }
+ fontCache()->invalidate();
+}
+
#if !defined(BUILDING_ON_LEOPARD)
static void fontCacheRegisteredFontsChangedNotificationCallback(CFNotificationCenterRef, void* observer, CFStringRef name, const void *, CFDictionaryRef)
{
ASSERT_UNUSED(observer, observer == fontCache());
ASSERT_UNUSED(name, CFEqual(name, kCTFontManagerRegisteredFontsChangedNotification));
- fontCache()->invalidate();
+ invalidateFontCache(0);
}
#else
static void fontCacheATSNotificationCallback(ATSFontNotificationInfoRef, void*)
{
- fontCache()->invalidate();
+ invalidateFontCache(0);
}
#endif
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes