⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 87462 in webkit


Ignore:
Timestamp:
May 26, 2011, 7:16:21 PM (15 years ago)
Author:
levin@chromium.org
Message:

2011-05-26 David Levin <levin@chromium.org>

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.
Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r87460 r87462  
     12011-05-26  David Levin  <levin@chromium.org>
     2
     3        Reviewed by Dmitry Titov.
     4
     5        WebKit's font notification has problems when the WebKit main thread != UI thread.
     6        https://bugs.webkit.org/show_bug.cgi?id=61391
     7
     8        This doesn't happen in DumpRenderTree, so it needs a unit test which is taking me
     9        some time to write correctly. In the meantime, this issues happens to be causing
     10        some crashes in Chrome so here's the fix alone for the time being.
     11
     12        * platform/graphics/mac/FontCacheMac.mm:
     13        (WebCore::invalidateFontCache): Ensure that FontCache::invalidate is only called on WebKit's main thread.
     14        (WebCore::fontCacheRegisteredFontsChangedNotificationCallback): Call common function for font cache invalidation.
     15         Note that the call to fontCache() is fine since the singleton is initialized well before calling this function. Theoretically,
     16         there could be a problem due to a lack of a memory barrier but that is highly unlikely and this is debug only code.
     17        (WebCore::fontCacheATSNotificationCallback): Ditto.
     18
    1192011-05-26  Stephanie Lewis  <slewis@apple.com>
    220
  • trunk/Source/WebCore/platform/graphics/mac/FontCacheMac.mm

    r85036 r87462  
    3737#import "WebFontCache.h"
    3838#import <AppKit/AppKit.h>
     39#import <wtf/MainThread.h>
    3940#import <wtf/StdLibExtras.h>
    4041
    4142
    4243namespace WebCore {
     44
     45// The "void*" parameter makes the function match the prototype for callbacks from callOnMainThread.
     46static void invalidateFontCache(void*)
     47{
     48    if (!isMainThread()) {
     49        callOnMainThread(&invalidateFontCache, 0);
     50        return;
     51    }
     52    fontCache()->invalidate();
     53}
    4354
    4455#if !defined(BUILDING_ON_LEOPARD)
     
    4758    ASSERT_UNUSED(observer, observer == fontCache());
    4859    ASSERT_UNUSED(name, CFEqual(name, kCTFontManagerRegisteredFontsChangedNotification));
    49     fontCache()->invalidate();
     60    invalidateFontCache(0);
    5061}
    5162#else
    5263static void fontCacheATSNotificationCallback(ATSFontNotificationInfoRef, void*)
    5364{
    54     fontCache()->invalidate();
     65    invalidateFontCache(0);
    5566}
    5667#endif
Note: See TracChangeset for help on using the changeset viewer.