• Trent Apted's avatar
    Mac RenderTextHarfBuzz: Use hb_coretext_font_create(). · db757646
    Trent Apted authored
    The HarfBuzz roll in r513541 improved Mac UI font support in the
    renderer by detecting UI fonts and invoking CTFontCreateUIFontForLanguage().
    
    However, in chrome UI, there is already a CTFont wrapped in a gfx::
    PlatformFont for UI fonts. So creating a new CTFont for every hb_shape
    call becomes unnecessary and expensive.
    
    hb_coretext_font_create() (after a hb_coretext_face_create()) allows
    the steps requiring the call to CTFontCreateUIFontForLanguage() to
    be skipped by associating the CTFont with the hb_font_t directly.
    
    Adds a new views_perftest target and LabelPerfTest.GetPreferredSize
    to track. On a Late 2013 Mac Pro perf improves from 1390 runs/second
    to 3300 runs/second.
    
    +250 runs/second of that comes from a related hotspot in gfx::internal::
    CreateSkiaTypeface() which was deriving a new CTFont unnecessarily
    before sending it to gfx::CreateHarfBuzzFont().
    
    Bug: 785522
    Change-Id: Iccf57fe3fc9a93cd4b9de1e79e81fb84d2ad88bb
    Reviewed-on: https://chromium-review.googlesource.com/823743
    Commit-Queue: Trent Apted <tapted@chromium.org>
    Reviewed-by: default avatarMichael Wasserman <msw@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#526920}
    db757646
BUILD.gn 37.4 KB