RESOLVED FIXED 190467
Use finer grained locking in FontDatabase
https://bugs.webkit.org/show_bug.cgi?id=190467
Summary Use finer grained locking in FontDatabase
Antti Koivisto
Reported 2018-10-11 06:26:35 PDT
Constructing a font can take a significant amount of time. We don't need to hold the lock during that.
Attachments
patch (4.50 KB, patch)
2018-10-11 06:32 PDT, Antti Koivisto
no flags
Antti Koivisto
Comment 1 2018-10-11 06:32:49 PDT
Alex Christensen
Comment 2 2018-10-11 09:40:02 PDT
Comment on attachment 352038 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=352038&action=review > Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp:-893 > - std::lock_guard<Lock> locker(m_descriptorMapLock); > - > auto folded = familyName.foldCase(); > - return m_familyNameToFontDescriptors.ensure(folded, [&] { Wouldn't moving the lock_guard to after the call to foldCase have the same result? we could leave the call to ensure as it is.
Antti Koivisto
Comment 3 2018-10-11 11:12:05 PDT
> Wouldn't moving the lock_guard to after the call to foldCase have the same > result? we could leave the call to ensure as it is. No, the lock needs to be free during the CTFont stuff, that's the slow part (but inherently thread safe). We lookup the cache with the lock held. If we don't find anything we free the lock and do the CTFont dance. Then we retake the lock to add it to the cache (which might not do anything because other thread might have already added this font).
WebKit Commit Bot
Comment 4 2018-10-11 11:39:12 PDT
Comment on attachment 352038 [details] patch Clearing flags on attachment: 352038 Committed r237040: <https://trac.webkit.org/changeset/237040>
WebKit Commit Bot
Comment 5 2018-10-11 11:39:14 PDT
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 6 2018-10-11 11:40:27 PDT
Note You need to log in before you can comment on or make changes to this bug.