Changeset 59483 in webkit


Ignore:
Timestamp:
May 14, 2010 1:16:12 PM (14 years ago)
Author:
eric@webkit.org
Message:

2010-05-14 Evan Martin <evan@chromium.org>

Reviewed by David Levin.

[chromium] don't call fontconfig twice in complex text path
https://bugs.webkit.org/show_bug.cgi?id=38701

Previously getFontDataForCharacters would call fontconfig once to
resolve a font name, then pass that name to getCachedFontPlatformData
to load the font. This would be two trips through fontconfig (including
IPCs). With this change, we completely load the font in the first pass.

This patch is actually the same code as in r58341, which was reverted
because of a performance problem; a performance improvement has now
been committed, and with that change in place this change improves
the Chromium intl2 page cycler performance by another 5%.

See also https://bugs.webkit.org/show_bug.cgi?id=37904 .

Test: fast/text/international/bold-bengali.html
(Was checked in as part of the first attempt at this change, continues
to pass after this change.)

  • platform/chromium/ChromiumBridge.h:
  • platform/graphics/chromium/FontCacheLinux.cpp: (WebCore::FontCache::getFontDataForCharacters):
Location:
trunk/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r59482 r59483  
     12010-05-14  Evan Martin  <evan@chromium.org>
     2
     3        Reviewed by David Levin.
     4
     5        [chromium] don't call fontconfig twice in complex text path
     6        https://bugs.webkit.org/show_bug.cgi?id=38701
     7
     8        Previously getFontDataForCharacters would call fontconfig once to
     9        resolve a font name, then pass that name to getCachedFontPlatformData
     10        to load the font.  This would be two trips through fontconfig (including
     11        IPCs).  With this change, we completely load the font in the first pass.
     12
     13        This patch is actually the same code as in r58341, which was reverted
     14        because of a performance problem; a performance improvement has now
     15        been committed, and with that change in place this change improves
     16        the Chromium intl2 page cycler performance by another 5%.
     17
     18        See also https://bugs.webkit.org/show_bug.cgi?id=37904 .
     19
     20        Test: fast/text/international/bold-bengali.html
     21        (Was checked in as part of the first attempt at this change, continues
     22        to pass after this change.)
     23
     24        * platform/chromium/ChromiumBridge.h:
     25        * platform/graphics/chromium/FontCacheLinux.cpp:
     26        (WebCore::FontCache::getFontDataForCharacters):
     27
    1282010-05-14  Young Han Lee  <joybro@company100.net>
    229
  • trunk/WebCore/platform/chromium/ChromiumBridge.h

    r59465 r59483  
    126126#if OS(LINUX)
    127127        static void getRenderStyleForStrike(const char* family, int sizeAndStyle, FontRenderStyle* result);
     128        // This code is currently in the process of getting rejiggered, and though
     129        // it is not currently used, it will hopefully be used again soon.
    128130        static String getFontFamilyForCharacters(const UChar*, size_t numCharacters);
    129131#endif
  • trunk/WebCore/platform/graphics/chromium/FontCacheLinux.cpp

    r58447 r59483  
    5959                                                          int length)
    6060{
    61     String family = ChromiumBridge::getFontFamilyForCharacters(characters, length);
    62     if (family.isEmpty())
     61    int style = SkTypeface::kNormal;
     62    if (font.fontDescription().weight() >= FontWeightBold)
     63        style |= SkTypeface::kBold;
     64    if (font.fontDescription().italic())
     65        style |= SkTypeface::kItalic;
     66
     67    SkTypeface* tf = SkTypeface::CreateForChars(characters, length * 2,
     68                                                static_cast<SkTypeface::Style>(style));
     69    if (!tf)
    6370        return 0;
    6471
    65     AtomicString atomicFamily(family);
    66     return getCachedFontData(getCachedFontPlatformData(font.fontDescription(), atomicFamily, false));
     72    // FIXME: we don't have a family name for this font.
     73    // However, the family name within FontPlatformData is only used when picking
     74    // a render style for the font, so it's not too great of a loss.
     75    FontPlatformData result(tf,
     76                            "",
     77                            font.fontDescription().computedSize(),
     78                            (style & SkTypeface::kBold) && !tf->isBold(),
     79                            (style & SkTypeface::kItalic) && !tf->isItalic());
     80    tf->unref();
     81    return getCachedFontData(&result);
    6782}
    6883
Note: See TracChangeset for help on using the changeset viewer.