Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1230)

Issue 2080243002: Access font tables in memory (Closed)

Created:
4 years, 6 months ago by drott
Modified:
4 years, 5 months ago
CC:
ajuma+watch_chromium.org, blink-reviews, blink-reviews-platform-graphics_chromium.org, Rik, chromium-reviews, danakj+watch_chromium.org, dshwang, drott+blinkwatch_chromium.org, krit, jbroman, Justin Novosad, pdr+graphicswatchlist_chromium.org, rwlbuis, Stephen Chennney
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Zero-copy font table access for HarfBuzz Our previous implementation relied on the copy function harfBuzzSkiaGetTable() to create a font table copy, which is held by hb_face_t and hb_font_t in turn. This allocation is additional overhead in terms of memory consumption and allocation cost. Using Skia's openStream() API we can retrieve the SkStreamAsset for the SkTypeface. On desktop Linux, on Android and on Windows my experimentation shows that this SkStreamAsset is available from memory most of the time and calling getMemoryBase() returns a valid address. The openStream() call itself duplicates and SkStream internally, but does not duplicate the underlying in-memory data. From The SkStreamAsset we can wrap the font data into an hb_blob_t for consumption by hb_face_create. openStream() transfers ownerships of the returned SkStreaAsset to the caller, so we have to specifiy a destruction function to HarfBuzz when hb_face_t releases the hb_blob_t. This CL saves all time and space for additional table allocations required for text shaping, which can range from a few kilobytes for a set of Latin fonts to hundreds of kilobytes for multiple fonts with large tables accessed by HarfBuzz. BUG=621878 Committed: https://crrev.com/264e1435dc66fbc7029d5472f334d185d70aea49 Cr-Commit-Position: refs/heads/master@{#402262}

Patch Set 1 #

Patch Set 2 : Mac compile fix #

Patch Set 3 : Fix leaking hb_blob_t #

Patch Set 4 : Simplify fallback case #

Total comments: 4

Patch Set 5 : Do not oversimplify fallback case #

Total comments: 1

Patch Set 6 : Transfer ttc index to HB #

Unified diffs Side-by-side diffs Delta from patch set Stats (+28 lines, -1 line) Patch
M third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.cpp View 1 2 3 4 5 2 chunks +28 lines, -1 line 0 comments Download

Messages

Total messages: 49 (19 generated)
drott
Mac compile fix
4 years, 6 months ago (2016-06-20 12:13:02 UTC) #2
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2080243002/20001
4 years, 6 months ago (2016-06-20 12:13:13 UTC) #3
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: linux_chromium_asan_rel_ng on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_asan_rel_ng/builds/179816)
4 years, 6 months ago (2016-06-20 13:35:57 UTC) #5
drott
Fix leaking hb_blob_t
4 years, 6 months ago (2016-06-21 07:46:18 UTC) #6
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2080243002/40001
4 years, 6 months ago (2016-06-21 08:43:38 UTC) #8
drott
This is ready for review now, although I need to work out and discuss with ...
4 years, 6 months ago (2016-06-21 11:16:45 UTC) #11
drott
Simplify fallback case
4 years, 6 months ago (2016-06-21 11:18:51 UTC) #12
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2080243002/60001
4 years, 6 months ago (2016-06-21 11:19:48 UTC) #14
eae
LGTM Awesome!
4 years, 6 months ago (2016-06-21 11:20:51 UTC) #15
drott
Thank you! I'd like to hear an opinion from the Skia team as well, thanks ...
4 years, 6 months ago (2016-06-21 11:30:44 UTC) #17
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: linux_chromium_asan_rel_ng on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_asan_rel_ng/builds/180518)
4 years, 6 months ago (2016-06-21 13:06:02 UTC) #19
Ilya Kulshin
https://codereview.chromium.org/2080243002/diff/60001/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.cpp File third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.cpp (right): https://codereview.chromium.org/2080243002/diff/60001/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.cpp#newcode334 third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.cpp:334: reinterpret_cast<const char*>(typefaceStream->getMemoryBase()), I'm not familiar with how harfbuzz handles ...
4 years, 6 months ago (2016-06-21 15:43:42 UTC) #21
drott
Do not oversimplify fallback case
4 years, 6 months ago (2016-06-22 07:14:08 UTC) #22
drott
On 2016/06/21 at 15:43:42, kulshin wrote: > https://codereview.chromium.org/2080243002/diff/60001/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.cpp > File third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.cpp (right): > > https://codereview.chromium.org/2080243002/diff/60001/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.cpp#newcode334 ...
4 years, 6 months ago (2016-06-22 07:15:25 UTC) #23
drott
Thanks for the review, Ilya. https://codereview.chromium.org/2080243002/diff/60001/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.cpp File third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.cpp (right): https://codereview.chromium.org/2080243002/diff/60001/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.cpp#newcode334 third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.cpp:334: reinterpret_cast<const char*>(typefaceStream->getMemoryBase()), On 2016/06/21 ...
4 years, 6 months ago (2016-06-22 07:19:48 UTC) #24
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2080243002/80001
4 years, 6 months ago (2016-06-22 07:37:05 UTC) #26
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: win_chromium_rel_ng on tryserver.chromium.win (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.win/builders/win_chromium_rel_ng/builds/243212)
4 years, 6 months ago (2016-06-22 09:39:59 UTC) #28
Ilya Kulshin
lgtm
4 years, 6 months ago (2016-06-22 14:39:45 UTC) #29
behdad
https://codereview.chromium.org/2080243002/diff/80001/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.cpp File third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.cpp (right): https://codereview.chromium.org/2080243002/diff/80001/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.cpp#newcode340 third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.cpp:340: face = hb_face_create(faceBlob.get(), 0); Instead of 0, you need ...
4 years, 6 months ago (2016-06-23 13:27:37 UTC) #30
drott
On 2016/06/23 at 13:27:37, behdad wrote: > https://codereview.chromium.org/2080243002/diff/80001/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.cpp > File third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.cpp (right): > > https://codereview.chromium.org/2080243002/diff/80001/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.cpp#newcode340 ...
4 years, 5 months ago (2016-06-27 08:59:28 UTC) #31
f(malita)
On 2016/06/27 08:59:28, drott wrote: > On 2016/06/23 at 13:27:37, behdad wrote: > > > ...
4 years, 5 months ago (2016-06-27 13:35:12 UTC) #34
drott
On 2016/06/27 at 13:35:12, fmalita wrote: > On 2016/06/27 08:59:28, drott wrote: > > On ...
4 years, 5 months ago (2016-06-27 17:55:23 UTC) #35
drott
Transfer ttc index to HB
4 years, 5 months ago (2016-06-27 17:59:39 UTC) #36
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2080243002/100001
4 years, 5 months ago (2016-06-27 18:00:22 UTC) #38
behdad
lgtm w ttc fix.
4 years, 5 months ago (2016-06-27 18:13:47 UTC) #39
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
4 years, 5 months ago (2016-06-27 19:22:35 UTC) #41
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2080243002/100001
4 years, 5 months ago (2016-06-27 19:55:26 UTC) #44
commit-bot: I haz the power
Committed patchset #6 (id:100001)
4 years, 5 months ago (2016-06-27 20:01:09 UTC) #46
commit-bot: I haz the power
Patchset 6 (id:??) landed as https://crrev.com/264e1435dc66fbc7029d5472f334d185d70aea49 Cr-Commit-Position: refs/heads/master@{#402262}
4 years, 5 months ago (2016-06-27 20:02:36 UTC) #48
drott
4 years, 5 months ago (2016-06-27 20:02:41 UTC) #49
Message was sent while issue was closed.
On 2016/06/27 at 20:01:09, commit-bot wrote:
> Committed patchset #6 (id:100001)

Great! Thanks for your help, fmalita@ and behdad@.

Powered by Google App Engine
This is Rietveld 408576698